@@ -183,6 +183,8 @@ describe("CodexAdapterV2 runtime policy", () => {
183183 } ,
184184 } ) ;
185185 assert . equal ( params . effort , reasoningEffort ) ;
186+ // Some Responses providers reject `detailed`; `auto` is the most detailed a model supports.
187+ assert . equal ( params . summary , "auto" ) ;
186188 assert . equal ( params . additionalContext !== undefined , hasT3Mcp === true ) ;
187189 }
188190 }
@@ -683,7 +685,7 @@ function codexReplayPreamble(input: {
683685 approvalPolicy : "never" ,
684686 approvalsReviewer : "user" ,
685687 sandboxPolicy : { type : "dangerFullAccess" } ,
686- summary : "detailed " ,
688+ summary : "auto " ,
687689 ...( input . effort === undefined ? { } : { effort : input . effort } ) ,
688690 collaborationMode : {
689691 mode : "default" ,
@@ -717,6 +719,61 @@ function codexReplayPreamble(input: {
717719 ] ;
718720}
719721
722+ /** Every turn/start follows a config/read; inserts that exchange and shifts later client ids. */
723+ function withConfigReadBeforeTurnStart (
724+ entries : ReadonlyArray < CodexReplay . CodexAppServerReplayEntry > ,
725+ ) : Array < CodexReplay . CodexAppServerReplayEntry > {
726+ const result : Array < CodexReplay . CodexAppServerReplayEntry > = [ ] ;
727+ let offset = 0 ;
728+ let clientIds = new Map < number , number > ( ) ;
729+ for ( const entry of entries ) {
730+ const frame = entry . type === "runtime_exit" ? undefined : entry . frame ;
731+ if ( ! Predicate . isObject ( frame ) || typeof frame . id !== "number" ) {
732+ result . push ( entry ) ;
733+ continue ;
734+ }
735+ if ( entry . type === "expect_outbound" && typeof frame . method === "string" ) {
736+ if ( frame . method === "initialize" ) {
737+ offset = 0 ;
738+ clientIds = new Map ( ) ;
739+ }
740+ if ( frame . method === "turn/start" ) {
741+ const id = frame . id + offset ;
742+ const params = Predicate . isObject ( frame . params ) ? frame . params : { } ;
743+ result . push (
744+ {
745+ type : "expect_outbound" ,
746+ label : "config/read" ,
747+ frame : { id, method : "config/read" , params : { cwd : params . cwd , includeLayers : false } } ,
748+ } ,
749+ {
750+ type : "emit_inbound" ,
751+ label : "config/read" ,
752+ frame : { id, result : { config : { } , origins : { } } } ,
753+ } ,
754+ ) ;
755+ offset += 1 ;
756+ }
757+ clientIds . set ( frame . id , frame . id + offset ) ;
758+ result . push ( withReplayRequestId ( entry , frame . id + offset ) ) ;
759+ continue ;
760+ }
761+ const mapped = clientIds . get ( frame . id ) ;
762+ result . push (
763+ entry . type === "emit_inbound" && frame . method === undefined && mapped !== undefined
764+ ? withReplayRequestId ( entry , mapped )
765+ : entry ,
766+ ) ;
767+ }
768+ return result ;
769+ }
770+
771+ function withConfigReads (
772+ transcript : CodexReplay . CodexAppServerReplayTranscript ,
773+ ) : CodexReplay . CodexAppServerReplayTranscript {
774+ return { ...transcript , entries : withConfigReadBeforeTurnStart ( transcript . entries ) } ;
775+ }
776+
720777function makeCodexReplayTranscript ( input : {
721778 readonly scenario : string ;
722779 readonly entries : ReadonlyArray < CodexReplay . CodexAppServerReplayEntry > ;
@@ -757,7 +814,9 @@ describe("CodexAdapterV2 process exit", () => {
757814 const turnStarted = yield * Deferred . make < void > ( ) ;
758815 const turnCompleted = yield * Deferred . make < void > ( ) ;
759816 const events : Array < ProviderAdapter . ProviderAdapterV2Event > = [ ] ;
760- const preamble = codexReplayPreamble ( { nativeThreadId, nativeTurnId, prompt : "work" } ) ;
817+ const preamble = withConfigReadBeforeTurnStart (
818+ codexReplayPreamble ( { nativeThreadId, nativeTurnId, prompt : "work" } ) ,
819+ ) ;
761820 const terminationError =
762821 exit === "numeric"
763822 ? new CodexError . CodexAppServerProcessExitedError ( { code : 17 , pid : 52 } )
@@ -962,7 +1021,7 @@ describe("CodexAdapterV2 session initialize", () => {
9621021 ) =>
9631022 Effect . gen ( function * ( ) {
9641023 const driver = yield * CodexReplay . makeReplayDriver (
965- transcript ,
1024+ withConfigReads ( transcript ) ,
9661025 beforeEmitInbound === undefined ? { } : { beforeEmitInbound } ,
9671026 ) ;
9681027 let initializeRequests = 0 ;
@@ -1254,7 +1313,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
12541313 const continuationRequests : Array < ProviderContinuationRequests . ProviderContinuationRequest > =
12551314 [ ] ;
12561315 const driver = yield * CodexReplay . makeReplayDriver (
1257- transcript ,
1316+ withConfigReads ( transcript ) ,
12581317 beforeEmitInbound === undefined ? { } : { beforeEmitInbound } ,
12591318 ) ;
12601319 const clientFactory : CodexAdapterV2 . CodexAppServerClientFactoryShape = {
@@ -2465,7 +2524,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
24652524 cwd : "/workspace" ,
24662525 model : "gpt-5.4" ,
24672526 ...turnPolicies [ turnModes [ index ] ! ] ,
2468- summary : "detailed " ,
2527+ summary : "auto " ,
24692528 collaborationMode : { mode : "default" , settings : { model : "gpt-5.4" } } ,
24702529 } ,
24712530 } ,
@@ -3553,7 +3612,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
35533612 approvalPolicy : "never" ,
35543613 approvalsReviewer : "user" ,
35553614 sandboxPolicy : { type : "dangerFullAccess" } ,
3556- summary : "detailed " ,
3615+ summary : "auto " ,
35573616 collaborationMode : { mode : "default" , settings : { model : "gpt-5.4" } } ,
35583617 } ,
35593618 } ,
@@ -3807,7 +3866,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
38073866 makeCodexReplayTranscript ( { scenario, entries } ) ,
38083867 ) ) . replaceAll ( yield * encodeStringJson ( "/workspace" ) , yield * encodeStringJson ( cwd ) ) ,
38093868 ) ;
3810- const driver = yield * CodexReplay . makeReplayDriver ( localTranscript ) ;
3869+ const driver = yield * CodexReplay . makeReplayDriver ( withConfigReads ( localTranscript ) ) ;
38113870 yield * Effect . gen ( function * ( ) {
38123871 const orchestrator = yield * Orchestrator . OrchestratorV2 ;
38133872 const worker = yield * EffectWorker . OrchestrationEffectWorkerV2 ;
@@ -5443,7 +5502,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
54435502 yield * encodeStringJson ( cwd ) ,
54445503 ) ,
54455504 ) ;
5446- const replayDriver = yield * CodexReplay . makeReplayDriver ( localTranscript ) ;
5505+ const replayDriver = yield * CodexReplay . makeReplayDriver ( withConfigReads ( localTranscript ) ) ;
54475506 const spawner = yield * ChildProcessSpawner . ChildProcessSpawner ;
54485507 assert . equal (
54495508 Number ( yield * spawner . exitCode ( ChildProcess . make ( "git" , [ "init" , "--quiet" ] , { cwd } ) ) ) ,
@@ -5666,7 +5725,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
56665725 Effect . provide (
56675726 ProviderReplayHarness . layerWithRegistry (
56685727 { name : "codex-background-stop-untracked" , runtimePolicyOverride : { cwd } } ,
5669- CodexAdapterV2Testkit . layer ( { transcript : localTranscript } ) ,
5728+ CodexAdapterV2Testkit . layer ( { transcript : withConfigReads ( localTranscript ) } ) ,
56705729 { runEffectWorker : false } ,
56715730 ) ,
56725731 ) ,
@@ -7932,7 +7991,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
79327991 approvalPolicy : "never" ,
79337992 approvalsReviewer : "user" ,
79347993 sandboxPolicy : { type : "dangerFullAccess" } ,
7935- summary : "detailed " ,
7994+ summary : "auto " ,
79367995 collaborationMode : { mode : "default" , settings : { model : "gpt-5.4" } } ,
79377996 } ,
79387997 } ,
@@ -8080,7 +8139,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
80808139 approvalPolicy : "never" ,
80818140 approvalsReviewer : "user" ,
80828141 sandboxPolicy : { type : "dangerFullAccess" } ,
8083- summary : "detailed " ,
8142+ summary : "auto " ,
80848143 collaborationMode : { mode : "default" , settings : { model : "gpt-5.4" } } ,
80858144 } ,
80868145 } ,
0 commit comments