Skip to content

Commit d8bb3a0

Browse files
philazarclaude
andcommitted
Move Codex settings with requested runtime switches
An approved agent-management request that switched a Codex agent to another runtime kept the Codex integration and configuration. The saved agent then passed validation but launched the new runtime as the Codex adapter. Apply the Harness picker's transition: leaving Codex clears its integration, configuration and model; entering Codex starts in Default mode. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Philip Azar <[email protected]>
1 parent 1fbbccb commit d8bb3a0

2 files changed

Lines changed: 99 additions & 7 deletions

File tree

‎src/bundled/agents/AgentUpdateReview.test.tsx‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,79 @@ it("resolves requested runtime IDs through installed harness options", () => {
6767
});
6868
});
6969

70+
it("moves Codex-owned settings with requested runtime switches", () => {
71+
const { agent } = controlFixture();
72+
const harnessOptions: NonNullable<ControlSnapshot["harnessOptions"]> = [
73+
{
74+
id: "goose",
75+
command: "/opt/homebrew/bin/goose",
76+
label: "Goose",
77+
defaultArgs: [],
78+
providers: [],
79+
},
80+
{
81+
id: "codex",
82+
command: "/tools/codex-acp",
83+
label: "Codex",
84+
defaultArgs: [],
85+
providers: [],
86+
},
87+
];
88+
const codexAgent = {
89+
...agent,
90+
harness: {
91+
...agent.harness,
92+
command: "/tools/codex-acp",
93+
args: [],
94+
provider: "",
95+
model: "gpt-5.5",
96+
integration: "codex" as const,
97+
configuration: {
98+
mode: "advanced" as const,
99+
effort: { kind: "value" as const, value: "high" },
100+
},
101+
},
102+
};
103+
const request = (runtime: string) =>
104+
({
105+
type: "agent_management_request",
106+
action: "update",
107+
requestId: "request-1",
108+
request: {
109+
channelId: "34aeaccc-c83b-4422-beac-a4b8661f9f59",
110+
agentName: "Fixture agent",
111+
runtime,
112+
},
113+
}) as const;
114+
115+
const toGoose = requestedDraft(codexAgent, request("goose"), harnessOptions);
116+
expect(toGoose).toMatchObject({
117+
command: "/opt/homebrew/bin/goose",
118+
model: "",
119+
});
120+
expect(toGoose.integration).toBeUndefined();
121+
expect(toGoose.configuration).toBeUndefined();
122+
123+
expect(
124+
requestedDraft(agent, request("codex-acp"), harnessOptions),
125+
).toMatchObject({
126+
command: "/tools/codex-acp",
127+
args: "[]",
128+
integration: "codex",
129+
configuration: { mode: "default" },
130+
provider: "",
131+
model: "",
132+
});
133+
134+
expect(
135+
requestedDraft(codexAgent, request("codex-acp"), harnessOptions),
136+
).toMatchObject({
137+
integration: "codex",
138+
configuration: { mode: "advanced", effort: { value: "high" } },
139+
model: "gpt-5.5",
140+
});
141+
});
142+
70143
it("requires a successful inventory snapshot before review", async () => {
71144
const refresh = vi.fn(async () => {});
72145
expect(

‎src/bundled/agents/AgentUpdateReview.tsx‎

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,32 @@ export function requestedDraft(
364364
);
365365
})
366366
: undefined;
367+
const codex = runtime?.id === "codex";
368+
// Like the Harness picker, entering or leaving Codex resets what it owns.
369+
const base: AgentDraft =
370+
!runtime || codex === (current.integration === "codex")
371+
? current
372+
: codex
373+
? {
374+
...current,
375+
integration: "codex",
376+
configuration: { mode: "default" },
377+
provider: "",
378+
model: "",
379+
}
380+
: {
381+
...current,
382+
integration: undefined,
383+
configuration: undefined,
384+
model: "",
385+
};
367386
return {
368-
...current,
369-
name: changes.displayName ?? current.name,
370-
systemPrompt: changes.systemPrompt ?? current.systemPrompt,
371-
command: runtime?.command ?? changes.runtime ?? current.command,
372-
args: runtime ? JSON.stringify(runtime.defaultArgs ?? []) : current.args,
373-
provider: changes.provider ?? current.provider,
374-
model: changes.model ?? current.model,
387+
...base,
388+
name: changes.displayName ?? base.name,
389+
systemPrompt: changes.systemPrompt ?? base.systemPrompt,
390+
command: runtime?.command ?? changes.runtime ?? base.command,
391+
args: runtime ? JSON.stringify(runtime.defaultArgs ?? []) : base.args,
392+
provider: changes.provider ?? base.provider,
393+
model: changes.model ?? base.model,
375394
};
376395
}

0 commit comments

Comments
 (0)