@@ -551,7 +551,7 @@ describe("codex manager cli commands", () => {
551551 expect ( payload . recommendedSwitchCommand ) . toBe ( "codex auth switch 2" ) ;
552552 } ) ;
553553
554- it ( "fails switch when Codex auth sync fails" , async ( ) => {
554+ it ( "keeps local switch when Codex auth sync fails" , async ( ) => {
555555 const now = Date . now ( ) ;
556556 loadAccountsMock . mockResolvedValueOnce ( {
557557 version : 3 ,
@@ -570,14 +570,18 @@ describe("codex manager cli commands", () => {
570570 ] ,
571571 } ) ;
572572 setCodexCliActiveSelectionMock . mockResolvedValueOnce ( false ) ;
573- const errorSpy = vi . spyOn ( console , "error" ) . mockImplementation ( ( ) => { } ) ;
573+ const warnSpy = vi . spyOn ( console , "warn" ) . mockImplementation ( ( ) => { } ) ;
574+ const logSpy = vi . spyOn ( console , "log" ) . mockImplementation ( ( ) => { } ) ;
574575 const { runCodexMultiAuthCli } = await import ( "../lib/codex-manager.js" ) ;
575576
576577 const exitCode = await runCodexMultiAuthCli ( [ "auth" , "switch" , "1" ] ) ;
577- expect ( exitCode ) . toBe ( 1 ) ;
578+ expect ( exitCode ) . toBe ( 0 ) ;
578579 expect ( saveAccountsMock ) . toHaveBeenCalledTimes ( 1 ) ;
579- expect ( errorSpy ) . toHaveBeenCalledWith (
580- expect . stringContaining ( "Codex auth sync failed" ) ,
580+ expect ( warnSpy ) . toHaveBeenCalledWith (
581+ expect . stringContaining ( "Codex auth sync did not complete" ) ,
582+ ) ;
583+ expect ( logSpy ) . toHaveBeenCalledWith (
584+ expect . stringContaining ( "Switched to account 1" ) ,
581585 ) ;
582586 } ) ;
583587
0 commit comments