@@ -29,7 +29,6 @@ import { OrchestrationEffectWorkerV2 } from "./EffectWorker.ts";
2929import { EventSinkV2 } from "./EventSink.ts" ;
3030import { OrchestratorV2 } from "./Orchestrator.ts" ;
3131import {
32- ProviderAdapterOpenSessionError ,
3332 type ProviderAdapterV2Event ,
3433 type ProviderAdapterV2Shape ,
3534 type ProviderAdapterV2TurnInput ,
@@ -89,7 +88,6 @@ interface RestartAdapterState {
8988 readonly attemptId : string ;
9089 } > ;
9190 readonly closedSessionCount : number ;
92- readonly failedReplacementOpen : boolean ;
9391}
9492
9593function makeRestartAdapter (
@@ -109,32 +107,16 @@ function makeRestartAdapter(
109107 ) ,
110108 openSession : ( sessionInput ) =>
111109 Effect . gen ( function * ( ) {
112- const failThisOpen = yield * Ref . modify ( state , ( current ) => {
113- const shouldFail =
114- sessionInput . modelSelection . model === replacementSelection . model &&
115- ! current . failedReplacementOpen ;
116- return [
117- shouldFail ,
110+ yield * Ref . update ( state , ( current ) => ( {
111+ ...current ,
112+ opened : [
113+ ...current . opened ,
118114 {
119- ...current ,
120- failedReplacementOpen : current . failedReplacementOpen || shouldFail ,
121- opened : [
122- ...current . opened ,
123- {
124- model : sessionInput . modelSelection . model ,
125- cwd : sessionInput . runtimePolicy . cwd ,
126- } ,
127- ] ,
115+ model : sessionInput . modelSelection . model ,
116+ cwd : sessionInput . runtimePolicy . cwd ,
128117 } ,
129- ] as const ;
130- } ) ;
131- if ( failThisOpen ) {
132- return yield * new ProviderAdapterOpenSessionError ( {
133- driver,
134- providerSessionId : sessionInput . providerSessionId ,
135- cause : "simulated replacement open failure" ,
136- } ) ;
137- }
118+ ] ,
119+ } ) ) ;
138120
139121 const events = yield * Queue . unbounded < ProviderAdapterV2Event > ( ) ;
140122 const now = yield * DateTime . now ;
@@ -395,7 +377,7 @@ function makeCompletingHandoffAdapter(startCount: Ref.Ref<number>): ProviderAdap
395377 } ;
396378}
397379
398- it . live ( "restarts selection as a new attempt and retries after old-session cleanup" , ( ) =>
380+ it . live ( "restarts selection as a new attempt after old-session cleanup" , ( ) =>
399381 Effect . scoped (
400382 Effect . gen ( function * ( ) {
401383 const cwd = yield * checkpointWorkspace ( "selection-restart-lifecycle" ) ;
@@ -405,7 +387,6 @@ it.live("restarts selection as a new attempt and retries after old-session clean
405387 opened : [ ] ,
406388 started : [ ] ,
407389 closedSessionCount : 0 ,
408- failedReplacementOpen : false ,
409390 } ) ;
410391 const registry = makeSingleProviderAdapterRegistryLayer ( makeRestartAdapter ( state ) ) ;
411392
@@ -509,7 +490,6 @@ it.live("restarts selection as a new attempt and retries after old-session clean
509490 "selection restart supersede must not project hard-Stop interrupt items" ,
510491 ) ;
511492 assert . equal ( projection . runs [ 0 ] ?. modelSelection . model , replacementSelection . model ) ;
512- assert . isTrue ( captured . failedReplacementOpen ) ;
513493 // The old pooled process remains available to its other threads; this
514494 // thread moved to a freshly allocated replacement session.
515495 assert . equal ( captured . closedSessionCount , 0 ) ;
@@ -518,7 +498,6 @@ it.live("restarts selection as a new attempt and retries after old-session clean
518498 [
519499 [ initialSelection . model , cwd ] ,
520500 [ replacementSelection . model , cwd ] ,
521- [ replacementSelection . model , cwd ] ,
522501 ] ,
523502 ) ;
524503 assert . deepEqual (
@@ -555,9 +534,6 @@ for (const deadStatus of ["stopped", "error"] as const) {
555534 opened : [ ] ,
556535 started : [ ] ,
557536 closedSessionCount : 0 ,
558- // The dead record is seeded directly, so the adapter's one-shot
559- // simulated replacement-open failure is skipped.
560- failedReplacementOpen : true ,
561537 } ) ;
562538 const registry = makeSingleProviderAdapterRegistryLayer (
563539 makeRestartAdapter ( state , exclusiveCapabilities ) ,
@@ -722,7 +698,6 @@ it.live("detaches the old provider session after an active provider handoff", ()
722698 opened : [ ] ,
723699 started : [ ] ,
724700 closedSessionCount : 0 ,
725- failedReplacementOpen : false ,
726701 } ) ;
727702 const targetStartCount = yield * Ref . make ( 0 ) ;
728703 const registry = makeProviderAdapterRegistryLayer ( [
@@ -839,7 +814,6 @@ for (const mode of ["active", "idle", "selection-command", "pooled", "separate-h
839814 opened : [ ] ,
840815 started : [ ] ,
841816 closedSessionCount : 0 ,
842- failedReplacementOpen : true ,
843817 } ) ;
844818 const resumes : Array < {
845819 instanceId : ProviderInstanceId ;
0 commit comments