@@ -37,6 +37,7 @@ import {
3737 summarizeForecast ,
3838 type ForecastAccountResult ,
3939} from "./forecast.js" ;
40+ import { createLogger } from "./logger.js" ;
4041import { MODEL_FAMILIES , type ModelFamily } from "./prompts/codex.js" ;
4142import {
4243 fetchCodexQuotaSnapshot ,
@@ -92,6 +93,7 @@ type TokenSuccessWithAccount = TokenSuccess & {
9293 accountLabel ?: string ;
9394} ;
9495type PromptTone = "accent" | "success" | "warning" | "danger" | "muted" ;
96+ const log = createLogger ( "codex-manager" ) ;
9597
9698function stylePromptText ( text : string , tone : PromptTone ) : string {
9799 if ( ! output . isTTY ) return text ;
@@ -4359,7 +4361,10 @@ async function runAuthLogin(): Promise<number> {
43594361 if ( existingCount === 0 ) {
43604362 try {
43614363 namedBackups = await getNamedBackups ( ) ;
4362- } catch {
4364+ } catch ( error ) {
4365+ log . debug ( "getNamedBackups failed, skipping restore option" , {
4366+ error : error instanceof Error ? error . message : String ( error ) ,
4367+ } ) ;
43634368 namedBackups = [ ] ;
43644369 }
43654370 }
@@ -4413,7 +4418,7 @@ async function runAuthLogin(): Promise<number> {
44134418 storage : restoredStorage ,
44144419 targetIndex,
44154420 parsed : targetIndex + 1 ,
4416- switchReason : "rotation " ,
4421+ switchReason : "restore " ,
44174422 preserveActiveIndexByFamily : true ,
44184423 } ) ;
44194424 console . log (
@@ -4541,7 +4546,7 @@ async function persistAndSyncSelectedAccount({
45414546 storage : NonNullable < Awaited < ReturnType < typeof loadAccounts > > > ;
45424547 targetIndex : number ;
45434548 parsed : number ;
4544- switchReason : "rotation" | "best" ;
4549+ switchReason : "rotation" | "best" | "restore" ;
45454550 initialSyncIdToken ?: string ;
45464551 preserveActiveIndexByFamily ?: boolean ;
45474552} ) : Promise < { synced : boolean ; wasDisabled : boolean } > {
0 commit comments