@@ -488,7 +488,9 @@ const nextTurnSelectionHarness = Effect.fn("nextTurnSelectionHarness")(function*
488488 canSteer = true ,
489489 interruptTurn : Effect . Effect < void > = Effect . void ,
490490 steeringAcceptsAttachments = true ,
491+ nativeGoals ?: boolean ,
491492) {
493+ const driver = ProviderDriverKind . make ( nativeGoals === undefined ? "codex" : "opencode" ) ;
492494 const cwd = yield * checkpointWorkspace ( name ) ;
493495 const events = yield * Queue . unbounded < ProviderAdapter . ProviderAdapterV2Event > ( ) ;
494496 const started : ProviderAdapter . ProviderAdapterV2TurnInput [ ] = [ ] ;
@@ -501,6 +503,7 @@ const nextTurnSelectionHarness = Effect.fn("nextTurnSelectionHarness")(function*
501503 supportsActiveSteering : canSteer ,
502504 supportsSteeringByInterruptRestart : canRestart ,
503505 activeSteeringAcceptsAttachments : steeringAcceptsAttachments ,
506+ ...( nativeGoals === undefined ? { } : { supportsNativeGoals : nativeGoals } ) ,
504507 } ,
505508 } ;
506509 const adapter : ProviderAdapter . ProviderAdapterV2 [ "Service" ] = {
@@ -2060,8 +2063,15 @@ it.effect("queues a plain send behind the stopped queue and releases its hold",
20602063 ) ,
20612064) ;
20622065
2063- const goalHarness = Effect . fn ( "goalHarness" ) ( function * ( name : string ) {
2064- const harness = yield * nextTurnSelectionHarness ( name ) ;
2066+ const goalHarness = Effect . fn ( "goalHarness" ) ( function * ( name : string , nativeGoals ?: boolean ) {
2067+ const harness = yield * nextTurnSelectionHarness (
2068+ name ,
2069+ false ,
2070+ true ,
2071+ Effect . void ,
2072+ true ,
2073+ nativeGoals ,
2074+ ) ;
20652075 const send = ( id : string , text : string , delivery : "queue" | "auto" , freshContext = false ) =>
20662076 Effect . gen ( function * ( ) {
20672077 const orchestrator = yield * Orchestrator . OrchestratorV2 ;
@@ -2101,26 +2111,34 @@ const goalHarness = Effect.fn("goalHarness")(function* (name: string) {
21012111 return { ...harness , send, read } ;
21022112} ) ;
21032113
2104- it . effect ( "stops the running turn and starts a goal sent into it next" , ( ) =>
2105- Effect . scoped (
2106- Effect . gen ( function * ( ) {
2107- const { steered, layer, startFirstTurn, send, read } = yield * goalHarness ( "goal-steer" ) ;
2108- yield * Effect . gen ( function * ( ) {
2109- const worker = yield * EffectWorker . OrchestrationEffectWorkerV2 ;
2110- const threadId = yield * startFirstTurn ;
2111- yield * send ( "queued" , "queued" , "queue" ) ;
2112- yield * send ( "goal" , "/goal all tests pass" , "auto" ) ;
2113- yield * worker . drain ( ) ;
2114+ it . effect . each ( [ undefined , false , true ] ) (
2115+ "goal dispatch stops the active turn only with native support: %s" ,
2116+ ( nativeGoals ) =>
2117+ Effect . scoped (
2118+ Effect . gen ( function * ( ) {
2119+ const { steered, layer, startFirstTurn, send, read } = yield * goalHarness (
2120+ "goal-steer" ,
2121+ nativeGoals ,
2122+ ) ;
2123+ yield * Effect . gen ( function * ( ) {
2124+ const worker = yield * EffectWorker . OrchestrationEffectWorkerV2 ;
2125+ const threadId = yield * startFirstTurn ;
2126+ yield * send ( "queued" , "queued" , "queue" ) ;
2127+ const sending = send ( "goal" , "/goal all tests pass" , "auto" ) ;
2128+ if ( nativeGoals === false ) {
2129+ yield * Effect . flip ( sending ) ;
2130+ } else yield * sending ;
2131+ yield * worker . drain ( ) ;
21142132
2115- assert . deepEqual ( steered , [ ] ) ;
2116- assert . deepEqual ( yield * read ( threadId ) , {
2117- queue : [ "queued" ] ,
2118- started : [ "first" , "/goal all tests pass" ] ,
2119- stopRequested : true ,
2120- } ) ;
2121- } ) . pipe ( Effect . provide ( layer ) ) ;
2122- } ) ,
2123- ) ,
2133+ assert . deepEqual ( steered , [ ] ) ;
2134+ assert . deepEqual ( yield * read ( threadId ) , {
2135+ queue : [ "queued" ] ,
2136+ started : nativeGoals === false ? [ "first" ] : [ "first" , "/goal all tests pass" ] ,
2137+ stopRequested : nativeGoals !== false ,
2138+ } ) ;
2139+ } ) . pipe ( Effect . provide ( layer ) ) ;
2140+ } ) ,
2141+ ) ,
21242142) ;
21252143
21262144it . effect ( "starts a goal that names no model on the thread's model ahead of a queued pick" , ( ) =>
0 commit comments