@@ -161,7 +161,7 @@ function startThreadWithHarness(
161161 const paths = overrides ?. paths ?? createAttemptPaths ( ) ;
162162 const startSpy = overrides ?. skipStartSpy
163163 ? undefined
164- : vi . spyOn ( CodexAppServerClient , "start" ) . mockReturnValue ( harness . client ) ;
164+ : vi . spyOn ( CodexAppServerClient , "start" ) . mockResolvedValue ( harness . client ) ;
165165 const effectivePluginConfig = overrides ?. pluginConfig ?? pluginConfig ;
166166
167167 const run = startCodexAttemptThread ( {
@@ -383,8 +383,8 @@ describe("startCodexAttemptThread", () => {
383383 } ;
384384 const startSpy = vi
385385 . spyOn ( CodexAppServerClient , "start" )
386- . mockReturnValueOnce ( first . client )
387- . mockReturnValueOnce ( second . client ) ;
386+ . mockResolvedValueOnce ( first . client )
387+ . mockResolvedValueOnce ( second . client ) ;
388388 const paths = createAttemptPaths ( ) ;
389389 let persistedComputerUse = false ;
390390 const { run } = startThreadWithHarness ( 10_000 , new AbortController ( ) . signal , {
@@ -455,8 +455,8 @@ describe("startCodexAttemptThread", () => {
455455 const second = createClientHarness ( ) ;
456456 const startSpy = vi
457457 . spyOn ( CodexAppServerClient , "start" )
458- . mockReturnValueOnce ( first . client )
459- . mockReturnValueOnce ( second . client ) ;
458+ . mockResolvedValueOnce ( first . client )
459+ . mockResolvedValueOnce ( second . client ) ;
460460 desktopGeneration . current = { epoch : 1 , fingerprint : "desktop-x" } ;
461461 if ( changeStage === "Computer Use readiness" ) {
462462 computerUseReadinessFailure . next = Object . assign ( new Error ( "desktop selection changed" ) , {
@@ -511,7 +511,7 @@ describe("startCodexAttemptThread", () => {
511511
512512 it ( "retires the startup generation when context restart sees a new executable owner" , async ( ) => {
513513 const harness = createClientHarness ( ) ;
514- vi . spyOn ( CodexAppServerClient , "start" ) . mockReturnValue ( harness . client ) ;
514+ vi . spyOn ( CodexAppServerClient , "start" ) . mockResolvedValue ( harness . client ) ;
515515 const paths = createAttemptPaths ( ) ;
516516 const { run } = startThreadWithHarness ( 5_000 , new AbortController ( ) . signal , {
517517 harness,
@@ -547,8 +547,8 @@ describe("startCodexAttemptThread", () => {
547547 const replacement = createClientHarness ( ) ;
548548 const startSpy = vi
549549 . spyOn ( CodexAppServerClient , "start" )
550- . mockReturnValueOnce ( retained . client )
551- . mockReturnValueOnce ( replacement . client ) ;
550+ . mockResolvedValueOnce ( retained . client )
551+ . mockResolvedValueOnce ( replacement . client ) ;
552552 const appServer = resolveCodexAppServerRuntimeOptions ( { pluginConfig } ) ;
553553 const paths = createAttemptPaths ( ) ;
554554
@@ -610,7 +610,7 @@ describe("startCodexAttemptThread", () => {
610610
611611 it ( "closes indeterminate thread startup even when another lease shares the app-server" , async ( ) => {
612612 const retained = createClientHarness ( ) ;
613- vi . spyOn ( CodexAppServerClient , "start" ) . mockReturnValue ( retained . client ) ;
613+ vi . spyOn ( CodexAppServerClient , "start" ) . mockResolvedValue ( retained . client ) ;
614614 const appServer = resolveCodexAppServerRuntimeOptions ( { pluginConfig } ) ;
615615 const paths = createAttemptPaths ( ) ;
616616
@@ -798,7 +798,7 @@ describe("startCodexAttemptThread", () => {
798798 const clients = [ createClientHarness ( ) , createClientHarness ( ) , createClientHarness ( ) ] ;
799799 const start = vi . spyOn ( CodexAppServerClient , "start" ) ;
800800 for ( const harness of clients ) {
801- start . mockReturnValueOnce ( harness . client ) ;
801+ start . mockResolvedValueOnce ( harness . client ) ;
802802 }
803803 const environmentIds = new Set < string > ( ) ;
804804
@@ -831,7 +831,7 @@ describe("startCodexAttemptThread", () => {
831831 const runtime = createPairedAttemptRuntime ( ) ;
832832 const firstPaths = createAttemptPaths ( ) ;
833833 const secondPaths = createAttemptPaths ( ) ;
834- const start = vi . spyOn ( CodexAppServerClient , "start" ) . mockImplementation ( ( options ) => {
834+ const start = vi . spyOn ( CodexAppServerClient , "start" ) . mockImplementation ( async ( options ) => {
835835 const codexHome = options ?. env ?. CODEX_HOME ;
836836 if ( codexHome ?. startsWith ( `${ firstPaths . agentDir } ${ path . sep } ` ) ) {
837837 return first . client ;
0 commit comments