fix(runner): preserve exact Claude model selectors during ACP admission

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Dotta 2026-09-11 17:02:30 -05:00
parent a7f734dc88
commit 201f78c2ef
2 changed files with 14 additions and 3 deletions

View File

@ -101,7 +101,10 @@ describe("Codex ACPX runtime adapter", () => {
});
});
it.each([["claude" as const, "claude-sonnet-5", "claude-sonnet-5"]])(
it.each([
["claude" as const, "claude-sonnet-5", "claude-sonnet-5"],
["claude" as const, "custom-claude-model", "custom-claude-model"],
])(
"opens the qualified %s session through the verified lease",
async (agent, model, providerModel) => {
const runtime = fakeRuntime();
@ -109,7 +112,7 @@ describe("Codex ACPX runtime adapter", () => {
const options = openOptions(command);
let runtimeOptions: AcpRuntimeOptions | undefined;
options.profile = resolveQualifiedAcpxProfile(agent, model);
options.launchEnvironment = { PATH: "/verified/bin" };
options.launchEnvironment = { PATH: "/verified/bin", ANTHROPIC_CUSTOM_MODEL_OPTION: "stale-model" };
await openCodexAcpxRuntime(options, {
createRegistry: ({ overrides }) => {
@ -128,6 +131,7 @@ describe("Codex ACPX runtime adapter", () => {
expect(runtimeOptions?.spawnEnvironment?.()).toEqual({
PATH: "/verified/bin",
PAPERCLIP_ACPX_ISOLATED_CONTEXT: "1",
ANTHROPIC_CUSTOM_MODEL_OPTION: providerModel,
});
expect(runtime.ensureSession).toHaveBeenCalledWith(
expect.objectContaining({

View File

@ -317,7 +317,14 @@ export async function openQualifiedAcpxRuntime(
spawnEnvironment: () => ({
...definedEnvironment(options.launchEnvironment),
...(options.profile.agent === "claude"
? { PAPERCLIP_ACPX_ISOLATED_CONTEXT: "1" }
? {
PAPERCLIP_ACPX_ISOLATED_CONTEXT: "1",
// Claude ACP otherwise maps concrete IDs back to rolling picker
// aliases (e.g. claude-sonnet-5 -> sonnet). Advertise the exact
// host-requested ID so model verification stays exact on resume
// and before the first billable prompt.
ANTHROPIC_CUSTOM_MODEL_OPTION: options.profile.reportedModelId,
}
: {}),
}),
spawnCwd: options.cwd,