@@ -2020,188 +2020,6 @@ describe("orchestration v2 provider switching", () => {
20202020 ) ,
20212021 ) ;
20222022
2023- it . live ( "queues an unpicked follow-up on the newest queued pick" , ( ) =>
2024- Effect . scoped (
2025- Effect . gen ( function * ( ) {
2026- const cwd = yield * checkpointWorkspace ( "queued-unpicked-follow-up" ) ;
2027- const capturedTurns = yield * Ref . make < ReadonlyArray < CapturedTurn > > ( [ ] ) ;
2028- const started = yield * Deferred . make < void > ( ) ;
2029- const threadId = ThreadId . make ( "thread:queued-unpicked-follow-up" ) ;
2030- const layerRegistry = ProviderAdapterRegistry . layerFromAdapters ( [
2031- makeTestAdapter ( {
2032- instanceId : CODEX_MODEL_SELECTION . instanceId ,
2033- driver : CODEX_DRIVER ,
2034- capabilities : CodexProviderCapabilitiesV2 ,
2035- modelSelection : CODEX_MODEL_SELECTION ,
2036- responseByRunOrdinal : { } ,
2037- capturedTurns,
2038- holdFirstTurn : started ,
2039- } ) ,
2040- makeTestAdapter ( {
2041- instanceId : CLAUDE_MODEL_SELECTION . instanceId ,
2042- driver : CLAUDE_DRIVER ,
2043- capabilities : ClaudeProviderCapabilitiesV2 ,
2044- modelSelection : CLAUDE_MODEL_SELECTION ,
2045- responseByRunOrdinal : { } ,
2046- capturedTurns,
2047- } ) ,
2048- ] ) ;
2049- yield * Effect . gen ( function * ( ) {
2050- const orchestrator = yield * Orchestrator . OrchestratorV2 ;
2051- const worker = yield * EffectWorker . OrchestrationEffectWorkerV2 ;
2052- yield * orchestrator . dispatch ( {
2053- type : "thread.create" ,
2054- createdBy : "user" ,
2055- creationSource : "web" ,
2056- commandId : CommandId . make ( "command:queued-unpicked-follow-up:create" ) ,
2057- threadId,
2058- projectId : ProjectId . make ( "project:queued-unpicked-follow-up" ) ,
2059- title : "Queued unpicked follow-up" ,
2060- modelSelection : CODEX_MODEL_SELECTION ,
2061- runtimeMode : "full-access" ,
2062- interactionMode : "default" ,
2063- branch : null ,
2064- worktreePath : cwd ,
2065- } ) ;
2066- yield * orchestrator . dispatch ( {
2067- type : "message.dispatch" ,
2068- createdBy : "user" ,
2069- creationSource : "web" ,
2070- commandId : CommandId . make ( "command:queued-unpicked-follow-up:first" ) ,
2071- threadId,
2072- messageId : MessageId . make ( "message:queued-unpicked-follow-up:first" ) ,
2073- text : "Current Codex turn" ,
2074- attachments : [ ] ,
2075- modelSelection : CODEX_MODEL_SELECTION ,
2076- dispatchMode : { type : "start_immediately" } ,
2077- } ) ;
2078- yield * Deferred . await ( started ) ;
2079- yield * worker . drain ( ) ;
2080- yield * orchestrator . dispatch ( {
2081- type : "message.dispatch" ,
2082- createdBy : "user" ,
2083- creationSource : "mobile" ,
2084- commandId : CommandId . make ( "command:queued-unpicked-follow-up:pick" ) ,
2085- threadId,
2086- messageId : MessageId . make ( "message:queued-unpicked-follow-up:pick" ) ,
2087- text : "Picked Claude" ,
2088- attachments : [ ] ,
2089- modelSelection : CLAUDE_MODEL_SELECTION ,
2090- dispatchMode : { type : "queue_after_active" } ,
2091- } ) ;
2092- yield * orchestrator . dispatch ( {
2093- type : "message.dispatch" ,
2094- createdBy : "user" ,
2095- creationSource : "mobile" ,
2096- commandId : CommandId . make ( "command:queued-unpicked-follow-up:follow-up" ) ,
2097- threadId,
2098- messageId : MessageId . make ( "message:queued-unpicked-follow-up:follow-up" ) ,
2099- text : "Follow-up without a pick" ,
2100- attachments : [ ] ,
2101- dispatchMode : { type : "queue_after_active" } ,
2102- } ) ;
2103- const projection = yield * orchestrator . getThreadProjection ( threadId ) ;
2104- assert . deepEqual (
2105- projection . runs . map ( ( run ) => [ run . status , run . modelSelection . instanceId ] ) ,
2106- [
2107- [ "running" , CODEX_MODEL_SELECTION . instanceId ] ,
2108- [ "queued" , CLAUDE_MODEL_SELECTION . instanceId ] ,
2109- [ "queued" , CLAUDE_MODEL_SELECTION . instanceId ] ,
2110- ] ,
2111- ) ;
2112- yield * orchestrator . dispatch ( {
2113- type : "message.dispatch" ,
2114- createdBy : "agent" ,
2115- creationSource : "server" ,
2116- commandId : CommandId . make ( "command:queued-unpicked-follow-up:monitor" ) ,
2117- threadId,
2118- messageId : MessageId . make ( "message:queued-unpicked-follow-up:monitor" ) ,
2119- text : "Monitor update" ,
2120- attachments : [ ] ,
2121- dispatchMode : { type : "queue_after_active" } ,
2122- notification : { source : { kind : "monitor" } , outcome : "updated" , summary : "Update" } ,
2123- } ) ;
2124- yield * orchestrator . dispatch ( {
2125- type : "message.dispatch" ,
2126- createdBy : "user" ,
2127- creationSource : "mobile" ,
2128- commandId : CommandId . make ( "command:queued-unpicked-follow-up:after-monitor" ) ,
2129- threadId,
2130- messageId : MessageId . make ( "message:queued-unpicked-follow-up:after-monitor" ) ,
2131- text : "Follow-up after a monitor update" ,
2132- attachments : [ ] ,
2133- dispatchMode : { type : "queue_after_active" } ,
2134- } ) ;
2135- const afterMonitor = yield * orchestrator . getThreadProjection ( threadId ) ;
2136- assert . equal (
2137- afterMonitor . runs . find (
2138- ( run ) => run . userMessageId === "message:queued-unpicked-follow-up:after-monitor" ,
2139- ) ?. modelSelection . instanceId ,
2140- CLAUDE_MODEL_SELECTION . instanceId ,
2141- ) ;
2142- yield * orchestrator . dispatch ( {
2143- type : "message.dispatch" ,
2144- createdBy : "user" ,
2145- creationSource : "server" ,
2146- commandId : CommandId . make ( "command:queued-unpicked-follow-up:server" ) ,
2147- threadId,
2148- messageId : MessageId . make ( "message:queued-unpicked-follow-up:server" ) ,
2149- text : "Server-created answer" ,
2150- attachments : [ ] ,
2151- dispatchMode : { type : "queue_after_active" } ,
2152- } ) ;
2153- const withServerMessage = yield * orchestrator . getThreadProjection ( threadId ) ;
2154- assert . equal (
2155- withServerMessage . runs . find (
2156- ( run ) => run . userMessageId === "message:queued-unpicked-follow-up:server" ,
2157- ) ?. modelSelection . instanceId ,
2158- CODEX_MODEL_SELECTION . instanceId ,
2159- ) ;
2160- yield * orchestrator . dispatch ( {
2161- type : "thread.stop" ,
2162- commandId : CommandId . make ( "command:queued-unpicked-follow-up:stop" ) ,
2163- threadId,
2164- } ) ;
2165- yield * worker . drain ( ) ;
2166- yield * orchestrator . dispatch ( {
2167- type : "message.dispatch" ,
2168- createdBy : "user" ,
2169- creationSource : "mobile" ,
2170- commandId : CommandId . make ( "command:queued-unpicked-follow-up:continue" ) ,
2171- threadId,
2172- messageId : MessageId . make ( "message:queued-unpicked-follow-up:continue" ) ,
2173- text : "Continue without a pick" ,
2174- attachments : [ ] ,
2175- dispatchMode : { type : "start_immediately" } ,
2176- } ) ;
2177- const continued = yield * orchestrator . getThreadProjection ( threadId ) ;
2178- const continuation = continued . runs . find (
2179- ( run ) => run . userMessageId === "message:queued-unpicked-follow-up:continue" ,
2180- ) ;
2181- assert . equal ( continuation ?. modelSelection . instanceId , CODEX_MODEL_SELECTION . instanceId ) ;
2182- } ) . pipe (
2183- Effect . provide (
2184- ProviderReplayHarness . layerWithRegistry (
2185- {
2186- name : "queued-unpicked-follow-up" ,
2187- runtimePolicyOverride : {
2188- cwd,
2189- approvalPolicy : "never" ,
2190- sandboxPolicy : {
2191- type : "readOnly" ,
2192- access : { type : "fullAccess" } ,
2193- networkAccess : false ,
2194- } ,
2195- } ,
2196- } ,
2197- layerRegistry ,
2198- ) ,
2199- ) ,
2200- ) ;
2201- } ) ,
2202- ) ,
2203- ) ;
2204-
22052023 it . live ( "hands completed Grok steering context to earlier queued Codex and later Claude" , ( ) =>
22062024 Effect . scoped (
22072025 Effect . gen ( function * ( ) {
0 commit comments