Repository navigation
fix(acpx): keep leaked non-openai model out of the Codex ACP thinking slot - #95852
Conversation
|
@clawsweeper re-run |
|
🦞🧹 I asked ClawSweeper to review this item again. |
vincentkoc
left a comment
There was a problem hiding this comment.
Thanks for the focused repro and the 50/50 targeted test result. I found two blockers against current main:
-
normalizeCodexAcpModelOverride()returnsundefinedfor any non-OpenAI provider-qualified model, andensureSession()then silently drops it. That is only safe for the leaked fleet-default case; an explicit/acp model google/...selection must fail clearly rather than silently falling back to Codex's default. The runtime input currently carries no provenance, so the patch needs an explicit design for distinguishing leaked defaults from user-selected models (or a fail-closed behavior). -
The same
undefinedresult is not handled insetConfigOption(key="model"): the control path falls through todelegate.setConfigOption(input), so persisted runtime controls can re-injectgoogle/gemini-3.1-flash-litebefore a turn and reproduce the failure. Add a regression test and handle this path consistently.
There is also a malformed-ref edge case: an unqualified value such as gpt-5.4/ultra (unknown suffix) is silently treated as a non-OpenAI ref instead of failing the documented <model>/<reasoning-effort> contract. Keep malformed inputs fail-closed.
Please rework the parser/control path and rerun the focused suite plus autoreview before requesting another review.
00d75f8 to
9baa49a
Compare
|
@vincentkoc thanks for the review. Reworked the parser into a classifier whose drop-vs-fail policy is owned by each entry point, and refreshed the head to 1. Silent drop vs explicit selection. Provenance is merged away upstream (
One intentional residual gap, called out in the PR body: an explicit non-OpenAI model passed at 2. 3. Malformed Local gates: |
|
@clawsweeper re-run |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs maintainer review before merge. Reviewed June 27, 2026, 10:38 AM ET / 14:38 UTC. Summary PR surface: Source +84, Tests +408. Total +492 across 7 files. Reproducibility: yes. Current main routes the second segment of a non-OpenAI provider/model ref through Codex ACP thinking validation; I did not execute the runtime path locally because this review is read-only, but the source path and linked issue proof are high-confidence. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the provenance-aware Codex ACP fix with the additive effective-model contract if maintainers accept the fallback-versus-fail-closed behavior; otherwise pause for a narrower runtime API design. Do we have a high-confidence way to reproduce the issue? Yes. Current main routes the second segment of a non-OpenAI provider/model ref through Codex ACP thinking validation; I did not execute the runtime path locally because this review is read-only, but the source path and linked issue proof are high-confidence. Is this the best way to solve the issue? Yes, with maintainer acceptance of the contract change. The PR keeps Codex-specific parsing in the ACPX owner boundary while core carries only the provenance/effective-model facts needed to avoid persisting a dropped default. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f4fa10c2c5ac. Label changesLabel justifications:
Evidence reviewedPR surface: Source +84, Tests +408. Total +492 across 7 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@clawsweeper re-run |
1 similar comment
|
@clawsweeper re-run |
9baa49a to
da31813
Compare
|
@clawsweeper re-run Refreshed to head da31813cf9. This revision addresses the [P1] patch-quality blocker (preserve explicit spawn-time model provenance) rather than dropping unsupported caller selections.
Real before/after proof in the body drives the real |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Added the [P1] live child-process proof to the body (no code change; head still da31813cf9). It drives the real
Both real spawns then reach codex's own session creation and stop at |
da31813 to
685905a
Compare
|
@clawsweeper re-review Refreshed to head
Real behavior proof updated (PR body) to cover the manager path: driving the real Gates: acpx 74, manager runtime-config 21, manager initialize-session 4; oxlint clean; tsgo core, core test, extensions prod, extensions test lanes clean. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
685905a to
20c4220
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Downstream signal: we're holding a production OpenClaw deployment on 2026.6.9 partly because of #95780 — native CI looks green here; is the |
|
@jpplaisted yes, the |
… slot Codex ACP spawn mis-routed an inherited non-OpenAI fleet default into the reasoning-effort slot and aborted (openclaw#95780). Replace the splitter with a closed classifier and make the spawn path provenance-aware: drop an inherited leaked default so Codex starts on its own default, but fail closed with ACP_INVALID_RUNTIME_OPTION when a caller explicitly selects an unsupported or malformed model. Thread a modelExplicit flag from resolveAcpSpawnRuntimeOptions through the ACP runtime ensure contract; strip it before the acpx delegate. Dropping the inherited default only at ensureSession was not enough: the manager still persisted the leaked model in runtimeOptions, and the first turn replayed it through applyRuntimeControls -> setConfigOption(model), which the new fail-closed Codex control path then rejected. ensureSession now reports the effective model it applied on the returned handle (applied | dropped), and the manager persists that effective model, so a dropped inherited default is never saved or replayed as a model control before the first turn. Explicit unsupported selections still fail closed at spawn and never persist.
20c4220 to
3121ffb
Compare
|
Merged via squash.
|
… slot (openclaw#95852) * fix(acpx): keep leaked non-openai model out of the Codex ACP thinking slot Codex ACP spawn mis-routed an inherited non-OpenAI fleet default into the reasoning-effort slot and aborted (openclaw#95780). Replace the splitter with a closed classifier and make the spawn path provenance-aware: drop an inherited leaked default so Codex starts on its own default, but fail closed with ACP_INVALID_RUNTIME_OPTION when a caller explicitly selects an unsupported or malformed model. Thread a modelExplicit flag from resolveAcpSpawnRuntimeOptions through the ACP runtime ensure contract; strip it before the acpx delegate. Dropping the inherited default only at ensureSession was not enough: the manager still persisted the leaked model in runtimeOptions, and the first turn replayed it through applyRuntimeControls -> setConfigOption(model), which the new fail-closed Codex control path then rejected. ensureSession now reports the effective model it applied on the returned handle (applied | dropped), and the manager persists that effective model, so a dropped inherited default is never saved or replayed as a model control before the first turn. Explicit unsupported selections still fail closed at spawn and never persist. * test(acp): split runtime config validation tests --------- Co-authored-by: Peter Steinberger <[email protected]>
… slot (openclaw#95852) * fix(acpx): keep leaked non-openai model out of the Codex ACP thinking slot Codex ACP spawn mis-routed an inherited non-OpenAI fleet default into the reasoning-effort slot and aborted (openclaw#95780). Replace the splitter with a closed classifier and make the spawn path provenance-aware: drop an inherited leaked default so Codex starts on its own default, but fail closed with ACP_INVALID_RUNTIME_OPTION when a caller explicitly selects an unsupported or malformed model. Thread a modelExplicit flag from resolveAcpSpawnRuntimeOptions through the ACP runtime ensure contract; strip it before the acpx delegate. Dropping the inherited default only at ensureSession was not enough: the manager still persisted the leaked model in runtimeOptions, and the first turn replayed it through applyRuntimeControls -> setConfigOption(model), which the new fail-closed Codex control path then rejected. ensureSession now reports the effective model it applied on the returned handle (applied | dropped), and the manager persists that effective model, so a dropped inherited default is never saved or replayed as a model control before the first turn. Explicit unsupported selections still fail closed at spawn and never persist. * test(acp): split runtime config validation tests --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Spawning the Codex ACP agent fails during setup when the fleet's default/primary model belongs to a non-OpenAI provider.
sessions_spawn(runtime="acp", agentId="codex")resolves that inherited default (for examplegoogle/gemini-3.1-flash-lite) into the Codex model slot, and the Codex ACP model parser then treats the segment after the/as a reasoning effort. The spawn aborts with:An explicit
thinking=lowdoes not help, because the model id is mis-routed before the thinking value is applied. Reported in #95780.Why This Change Was Made
The root cause is in the Codex ACP model translation in
extensions/acpx/src/runtime.ts. The original parser split the ref on/and unconditionally treated the second segment as a reasoning effort, sogoogle/gemini-3.1-flash-litebecame modelgoogleand effortgemini-3.1-flash-lite, which Codex's reasoning-effort set rejects. Codex keepsmodel(a free string forwarded to the provider) andmodel_reasoning_effort(the closed set{none, minimal, low, medium, high, xhigh}) as separate fields (codex-rs/protocol/src/openai_models.rs:40,codex-rs/protocol/src/config_types.rs:695), so a non-OpenAI model id is never valid in the effort slot.classifyCodexAcpModelRequestreplaces the old splitter with a closed result:{ kind: "override", override }for a usable request:openai/<model>(prefix stripped), a bare<model>,<model>/<reasoning-effort>, or a thinking-only override.{ kind: "unsupported", thinkingOverride? }for a ref that is not a valid Codex model and is notopenai/-qualified (a foreignprovider/model, or a malformed<model>/<bad-suffix>); it carries any valid explicit thinking forward.openai/-qualified but malformed ref (for exampleopenai/foo/bar) throws immediately, since the caller explicitly named OpenAI.The earlier revision then dropped every unsupported model at spawn. Review feedback (and the ClawSweeper re-review) correctly pointed out that the spawn planner still knows whether the model was a caller selection or an inherited default:
resolveAcpSpawnRuntimeOptionsinsrc/agents/acp-spawn.tsreceivesparams.model(the rawsessions_spawnoverride) before it is collapsed into runtime options. Dropping a caller-selected unsupported model silently hides invalid intent.This revision preserves that provenance instead of discarding it.
resolveAcpSpawnRuntimeOptionsrecords whetherparams.modelwas supplied and threads a singlemodelExplicitflag throughAcpInitializeSessionInputand theAcpRuntimeEnsureInputcontract down to the acpx runtime (the flag is stripped again before the acpx delegate, so it never reaches the codex-acp wire). The Codex ACPensureSessionthen applies provenance-aware policy:codexinjects default model id (gemini-3.1-flash-lite) into the thinking-level slot #95780 case: the value is not anything requested for this spawn.ACP_INVALID_RUNTIME_OPTIONbefore the delegate is reached, so invalid intent surfaces instead of silently falling back.A model dropped at spawn must also be kept out of the session's persisted runtime controls. The previous revision dropped the inherited default only from the initial
ensureSessioncall, butrunManagerInitializeSessionstill persisted the leaked id inruntimeOptions, and the first turn replayed it throughapplyRuntimeControls->setConfigOption(model). Combined with the fail-closed Codex control path, an authenticated first turn then aborted withACP_INVALID_RUNTIME_OPTIONbefore doing any work (the ClawSweeper [P1] againstsrc/agents/acp-spawn.tsplus the manager persistence path).ensureSessionnow reports the effective model it applied on the returnedAcpRuntimeHandleas a closed{ kind: "applied", model } | { kind: "dropped" }, andrunManagerInitializeSessionpersists that effective model. A dropped inherited default is therefore never saved intoruntimeOptionsand never replayed as a model control before the first turn. A caller-selected unsupported model still fails closed at spawn and never persists, so the new handle field changes only the inherited-default case.setConfigOption/acp model(an explicit runtime control) already fails closed for an unsupported model; that behavior is unchanged. A model dropped at spawn is also removed from the session input viawithCodexSessionModel, so the raw id never reaches the acpx delegate whereapplyRequestedModelIfAdvertisedwould throwRequestedModelUnsupportedError.The change stays at the Codex ACP owner boundary plus the generic provenance plumbing in core. The new
AcpRuntimeHandle.appliedModelis additive and optional; only the Codex ACP backend populates it and only the manager reads it. The Claude ACP sibling has no reasoning-effort slot, so it cannot misroute a model id into a thinking level; this issue (#95780) is specific to Codex.User Impact
Codex ACP spawns succeed again when the inherited fleet default is a non-OpenAI model, falling back to Codex's own default model with any explicit
thinkinglevel honored, and the first turn after such a spawn no longer aborts on a replayed model control. A caller who explicitly selects a model Codex cannot run (a non-OpenAIprovider/modelatsessions_spawn, anacp model google/...control, or a malformed<model>/<reasoning-effort>) now gets a clearACP_INVALID_RUNTIME_OPTIONfailure instead of a silent fallback or a mis-routed crash. Explicitopenai/*selections and<model>/<reasoning-effort>overrides are unchanged.Evidence
node scripts/run-vitest.mjs extensions/acpx/src/runtime.test.ts: 78 passed, including new cases that a caller-selected unsupported (google/...) and malformed (gpt-5.4/ultra) spawn model fail closed without calling the delegate, that an inherited leaked default is dropped, that an explicit supported model passes through without leaking the provenance flag, and thatensureSessionreports a dropped inherited default and a supported model as applied on the returned handle.node scripts/run-vitest.mjs src/acp/control-plane/manager.runtime-config.test.ts: 21 passed, including a regression that drivesinitializeSessionwith an inherited non-OpenAI default through the firstrunTurnand asserts the dropped default is neither persisted nor replayed as a model control, plus a supported model that is persisted and replayed.node scripts/run-vitest.mjs src/acp/control-plane/manager.initialize-session.test.ts: 4 passed;node scripts/run-vitest.mjs src/agents/acp-spawn.test.ts: spawn planner threading.oxlinton the changed files: clean.tsgocore, core test, extensions prod, and extensions test lanes: clean.Real behavior proof
Behavior addressed: after an inherited non-OpenAI fleet default is dropped at Codex ACP spawn (#95780), the leaked model was still persisted into the session runtime options and replayed as a model control on the first turn, so an authenticated first turn aborted with ACP_INVALID_RUNTIME_OPTION before doing any work.
Real environment tested: the real
AcpSessionManager.initializeSessionfollowed by the firstrunTurn(which runsapplyRuntimeControlsbefore the turn) for thecodexagent, on the pristinemainmanager-initialization path @9d800b71c0 versus this revision @20c422032d. The Codex ACP backend is faithfully stood in at its one control boundary:ensureSessionreports the inherited default as dropped andset_config_option(model)fails closed on the unsupportedgoogle/...value, matching the real Codex control path. The manager persistence and first-turn control replay run for real, with identical inputs on both trees.Exact steps or command run after this patch: drive the real
AcpSessionManager.initializeSessionfor agentcodexwith an inheritedgoogle/gemini-3.1-flash-litedefault (no caller selection), then issue the firstrunTurn, recording the persisted session model and whether the first turn completed or aborted.Evidence after fix:
Observed result after fix: on the pristine path the inherited non-OpenAI default is persisted into the session runtime options and replayed as a
set_config_option(model)before the first turn, which the Codex control path rejects, so the first turn aborts withACP_INVALID_RUNTIME_OPTION. After this patch the inherited default is reported dropped on the returned handle, the manager persists no model for that session, nothing is replayed, and the first turn proceeds. The only value that moves between the two runs is the persisted session model (the leaked id becomes none), which removes the first-turn abort.What was not tested: the Codex ACP backend was stood in at its one control boundary, reproducing the real fail-closed
set_config_option(model)and dropped-default behavior also shown live in the spawn subsection below; no live provider request was sent and the full build was not run.Spawn boundary before/after (captured at the immediately prior revision da31813cf9)
This revision changes the spawn path only by additively reporting the applied/dropped model on the returned handle; the classifier outputs and the codex-acp launch argv below are unchanged from da31813cf9, and the manager proof above is the fresh evidence for head 20c422032d. Two runs against the real
AcpxRuntime.ensureSessionclass path for thecodexagent on pristinemain@da15cf48bf versus @da31813cf9 with only the acpx process-spawn delegate stubbed, so the model classifier, the Codex command translation, the provenance gate, and the session-input handling all stay real.Live codex-acp child-process spawn (captured at da31813cf9)
The same fix on the immediately prior revision driven through the real
AcpxRuntime.ensureSessionwith the acpx delegate NOT stubbed, spawning the real@zed-industries/codex-acpbinary as thecodexagent. A thin wrapper records the exact launch argv, then execs the real binary. The launch path is unchanged in head 20c422032d (the handle now also carries the applied/dropped report):A caller-selected unsupported model fails closed before any child process starts (no spawn). An inherited foreign default spawns a real codex-acp child with no
-c model=argument, so the leakedgoogle/...was dropped and Codex falls back to its own default. Anopenai/*selection spawns with-c model=gpt-5.5. Both real spawns then reach codex's own session creation and stop atAuthentication requiredbecause this box has no active Codex session, which is past the model-routing boundary this PR changes.Fixes #95780