Skip to content

Commit b886695

Browse files
committed
fix(codex): keep child settings across model reroutes
1 parent 28d6501 commit b886695

2 files changed

Lines changed: 26 additions & 8 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts‎

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7164,12 +7164,32 @@ describe("CodexAdapterV2 post-settle continuation", () => {
71647164
},
71657165
},
71667166
};
7167+
const initialSettings: CodexReplay.CodexAppServerReplayEntry = {
7168+
type: "emit_inbound",
7169+
frame: {
7170+
method: "thread/settings/updated",
7171+
params: {
7172+
threadId: RESUME_CHILD_THREAD,
7173+
threadSettings: {
7174+
model: "gpt-6-astra",
7175+
effort: "low",
7176+
serviceTier: "ultrafast",
7177+
modelProvider: "openai",
7178+
cwd: "/workspace",
7179+
approvalPolicy: "never",
7180+
approvalsReviewer: "auto_review",
7181+
collaborationMode: { mode: "default", settings: { model: "gpt-6-astra" } },
7182+
sandboxPolicy: { type: "dangerFullAccess" },
7183+
},
7184+
},
7185+
},
7186+
};
71677187
const harness = yield* makeCodexReplayHarness(
71687188
{
71697189
...resumeSubagentTranscript,
71707190
entries: resumeSubagentTranscript.entries.flatMap((entry) =>
71717191
entry.type === "emit_inbound" && entry.label === "turn/completed/root"
7172-
? [entry, notification]
7192+
? [entry, initialSettings, notification]
71737193
: [entry],
71747194
),
71757195
},
@@ -7198,12 +7218,10 @@ describe("CodexAdapterV2 post-settle continuation", () => {
71987218
yield* Deferred.succeed(releaseMetadata, undefined);
71997219
yield* TestClock.adjust("30 seconds");
72007220
assert.equal(harness.subagentUpdates().at(-1)?.subagent.model, model);
7201-
if (method === "thread/settings/updated") {
7202-
assert.deepEqual(harness.subagentUpdates().at(-1)?.subagent.modelSelection?.options, [
7203-
{ id: "reasoningEffort", value: "low" },
7204-
{ id: "serviceTier", value: "ultrafast" },
7205-
]);
7206-
}
7221+
assert.deepEqual(harness.subagentUpdates().at(-1)?.subagent.modelSelection?.options, [
7222+
{ id: "reasoningEffort", value: "low" },
7223+
{ id: "serviceTier", value: "ultrafast" },
7224+
]);
72077225
}).pipe(Effect.provide(Layer.merge(IdAllocator.layer, NodeServices.layer))),
72087226
),
72097227
);

‎apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2680,7 +2680,7 @@ export function makeCodexAdapterV2(adapterOptions: CodexAdapterV2Options): Provi
26802680
const model = value?.trim();
26812681
if (!model) return;
26822682
const previous = subagentSelections.get(nativeThreadId);
2683-
const previousOptions = previous?.model === model ? previous.options : undefined;
2683+
const previousOptions = previous?.options;
26842684
const options =
26852685
effort === undefined && tier === undefined
26862686
? previousOptions

0 commit comments

Comments
 (0)