Skip to content

fix(acpx): keep leaked non-openai model out of the Codex ACP thinking slot - #95852

Merged
steipete merged 2 commits into
openclaw:mainfrom
yetval:fix/codex-acp-model-thinking-slot
Jul 17, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
yetval:fix/codex-acp-model-thinking-slot

Conversation

@yetval

@yetval yetval commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

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 example google/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:

spawn_failed: Codex ACP thinking level "gemini-3.1-flash-lite" is not supported.
Use off, minimal, low, medium, high, or xhigh.

An explicit thinking=low does 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, so google/gemini-3.1-flash-lite became model google and effort gemini-3.1-flash-lite, which Codex's reasoning-effort set rejects. Codex keeps model (a free string forwarded to the provider) and model_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.

classifyCodexAcpModelRequest replaces 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 not openai/-qualified (a foreign provider/model, or a malformed <model>/<bad-suffix>); it carries any valid explicit thinking forward.
  • An openai/-qualified but malformed ref (for example openai/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: resolveAcpSpawnRuntimeOptions in src/agents/acp-spawn.ts receives params.model (the raw sessions_spawn override) 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. resolveAcpSpawnRuntimeOptions records whether params.model was supplied and threads a single modelExplicit flag through AcpInitializeSessionInput and the AcpRuntimeEnsureInput contract down to the acpx runtime (the flag is stripped again before the acpx delegate, so it never reaches the codex-acp wire). The Codex ACP ensureSession then applies provenance-aware policy:

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 ensureSession call, but runManagerInitializeSession still persisted the leaked id in runtimeOptions, and the first turn replayed it through applyRuntimeControls -> setConfigOption(model). Combined with the fail-closed Codex control path, an authenticated first turn then aborted with ACP_INVALID_RUNTIME_OPTION before doing any work (the ClawSweeper [P1] against src/agents/acp-spawn.ts plus the manager persistence path). ensureSession now reports the effective model it applied on the returned AcpRuntimeHandle as a closed { kind: "applied", model } | { kind: "dropped" }, and runManagerInitializeSession persists that effective model. A dropped inherited default is therefore never saved into runtimeOptions and 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 via withCodexSessionModel, so the raw id never reaches the acpx delegate where applyRequestedModelIfAdvertised would throw RequestedModelUnsupportedError.

The change stays at the Codex ACP owner boundary plus the generic provenance plumbing in core. The new AcpRuntimeHandle.appliedModel is 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 thinking level 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-OpenAI provider/model at sessions_spawn, an acp model google/... control, or a malformed <model>/<reasoning-effort>) now gets a clear ACP_INVALID_RUNTIME_OPTION failure instead of a silent fallback or a mis-routed crash. Explicit openai/* 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 that ensureSession reports 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 drives initializeSession with an inherited non-OpenAI default through the first runTurn and 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.
  • oxlint on the changed files: clean. tsgo core, core test, extensions prod, and extensions test lanes: clean.
  • End-to-end before/after against the real runtime: see Real behavior proof below.

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.initializeSession followed by the first runTurn (which runs applyRuntimeControls before the turn) for the codex agent, on the pristine main manager-initialization path @9d800b71c0 versus this revision @20c422032d. The Codex ACP backend is faithfully stood in at its one control boundary: ensureSession reports the inherited default as dropped and set_config_option(model) fails closed on the unsupported google/... 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.initializeSession for agent codex with an inherited google/gemini-3.1-flash-lite default (no caller selection), then issue the first runTurn, recording the persisted session model and whether the first turn completed or aborted.
Evidence after fix:

# BEFORE (pristine main @9d800b71c0)
persisted session model after spawn: "google/gemini-3.1-flash-lite"
backend received set_config_option model=google/gemini-3.1-flash-lite
first-turn outcome: first turn FAILED with ACP_INVALID_RUNTIME_OPTION

# AFTER (this revision @20c422032d, identical inputs)
persisted session model after spawn: null
first-turn outcome: first turn completed

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 with ACP_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.ensureSession class path for the codex agent on pristine main @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.

# BEFORE (pristine main @da15cf48bf)
inherited leaked default       model=google/gemini-3.1-flash-lite provenance=inherited-default
  -> THREW ACP_INVALID_RUNTIME_OPTION: "Codex ACP thinking level "gemini-3.1-flash-lite" is not supported. Use off, minimal, low, medium, high, or xhigh."; delegate.ensureSession calls=0
caller-selected unsupported    model=google/gemini-3.1-flash-lite provenance=caller-selected
  -> THREW ACP_INVALID_RUNTIME_OPTION: "Codex ACP thinking level "gemini-3.1-flash-lite" is not supported. Use off, minimal, low, medium, high, or xhigh."; delegate.ensureSession calls=0
caller-selected malformed      model=gpt-5.4/ultra provenance=caller-selected
  -> THREW ACP_INVALID_RUNTIME_OPTION: "Codex ACP thinking level "ultra" is not supported. Use off, minimal, low, medium, high, or xhigh."; delegate.ensureSession calls=0
caller-selected openai control model=openai/gpt-5.5 provenance=caller-selected
  -> OK; delegate.ensureSession calls=1 delegate.model="gpt-5.5" sessionOptions={"model":"gpt-5.5"}

# AFTER (da31813cf9, identical inputs)
inherited leaked default       model=google/gemini-3.1-flash-lite provenance=inherited-default
  -> OK; delegate.ensureSession calls=1 delegate.model=absent sessionOptions=absent
caller-selected unsupported    model=google/gemini-3.1-flash-lite provenance=caller-selected
  -> THREW ACP_INVALID_RUNTIME_OPTION: "Codex ACP model "google/gemini-3.1-flash-lite" is not supported. Use openai/<model> or <model>/<reasoning-effort>."; delegate.ensureSession calls=0
caller-selected malformed      model=gpt-5.4/ultra provenance=caller-selected
  -> THREW ACP_INVALID_RUNTIME_OPTION: "Codex ACP model "gpt-5.4/ultra" is not supported. Use openai/<model> or <model>/<reasoning-effort>."; delegate.ensureSession calls=0
caller-selected openai control model=openai/gpt-5.5 provenance=caller-selected
  -> OK; delegate.ensureSession calls=1 delegate.model="gpt-5.5" sessionOptions={"model":"gpt-5.5"}

Live codex-acp child-process spawn (captured at da31813cf9)

The same fix on the immediately prior revision driven through the real AcpxRuntime.ensureSession with the acpx delegate NOT stubbed, spawning the real @zed-industries/codex-acp binary as the codex agent. 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):

# LIVE (real codex-acp child process; real AcpxRuntime.ensureSession)
caller-unsupported     model=google/gemini-3.1-flash-lite provenance=caller-selected
  child spawn: (codex-acp child NOT spawned)
  outcome:     ensureSession THREW ACP_INVALID_RUNTIME_OPTION: "Codex ACP model "google/gemini-3.1-flash-lite" is not supported. Use openai/<model> or <model>/<reasoning-effort>."

inherited-default      model=google/gemini-3.1-flash-lite provenance=inherited-default
  child spawn: spawned: codex-acp
  outcome:     ensureSession THREW -32000: "Authentication required"

openai-control         model=openai/gpt-5.5 provenance=caller-selected
  child spawn: spawned: codex-acp -c model=gpt-5.5
  outcome:     ensureSession THREW -32000: "Authentication required"

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 leaked google/... was dropped and Codex falls back to its own default. An openai/* selection spawns with -c model=gpt-5.5. Both real spawns then reach codex's own session creation and stop at Authentication required because this box has no active Codex session, which is past the model-routing boundary this PR changes.

Fixes #95780

@yetval

yetval commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-run

@clawsweeper

clawsweeper Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@vincentkoc vincentkoc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the focused repro and the 50/50 targeted test result. I found two blockers against current main:

  1. normalizeCodexAcpModelOverride() returns undefined for any non-OpenAI provider-qualified model, and ensureSession() 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).

  2. The same undefined result is not handled in setConfigOption(key="model"): the control path falls through to delegate.setConfigOption(input), so persisted runtime controls can re-inject google/gemini-3.1-flash-lite before 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.

@yetval

yetval commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

@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 9baa49ae96. Addressing the three blockers:

1. Silent drop vs explicit selection. Provenance is merged away upstream (resolveConfiguredSubagentSpawnModelSelection collapses explicit override / agent / fleet default into one alias-resolved provider/model string), and AcpRuntimeEnsureInput carries no source flag, so I did not want to widen that cross-package runtime contract just to re-derive intent. Instead classifyCodexAcpModelRequest returns a closed { kind: "override" } | { kind: "unsupported"; thinkingOverride? }, and the two entry points apply opposite policies (this is the fail-closed behavior you asked for, keyed to where the value actually originates):

One intentional residual gap, called out in the PR body: an explicit non-OpenAI model passed at sessions_spawn time (not via acp model) is dropped rather than errored, because provenance is unavailable there and Codex is OpenAI-only, so there is no valid model to honor and the spawn still succeeds on Codex's default instead of crashing. Happy to thread an explicit-selection flag through the ACP runtime contract as a follow-up if you want spawn-time explicit non-OpenAI to hard-fail too.

2. setConfigOption(key="model") fall-through. Fixed. The model key now classifies and fails closed before any delegate call; it never reaches delegate.setConfigOption(input). Regression test asserts the delegate is not called. The before/after proof shows it directly: on the prior revision the delegate was re-injected with google/gemini-3.1-flash-lite; now delegate.setConfigOption calls=0.

3. Malformed gpt-5.4/ultra. A <model>/<unknown-suffix> ref classifies as unsupported, so the explicit control path fails closed against the documented <model>/<reasoning-effort> contract (an openai/-qualified malformed ref such as openai/foo/bar throws immediately). Covered by tests at both the classifier and setConfigOption levels.

Local gates: runtime.test.ts 69 passed, type-aware oxlint clean, tsgo extensions prod + test lanes clean. Full before/after (real AcpxRuntime.ensureSession + setConfigOption, only the process-spawn delegate stubbed) is in the PR body. Re-requesting review.

@yetval

yetval commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-run

@clawsweeper

clawsweeper Bot commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@yetval
yetval requested a review from vincentkoc June 23, 2026 14:56
@clawsweeper

clawsweeper Bot commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 27, 2026, 10:38 AM ET / 14:38 UTC.

Summary
The PR replaces Codex ACP model/thinking parsing with provenance-aware classification, threads explicit model provenance through ACP spawn initialization, reports effective model application on ACP handles, and updates manager persistence/tests so dropped inherited defaults are not replayed before the first turn.

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.

  • ACP runtime contract fields: 1 optional input field added, 1 optional handle field added. These fields carry model provenance and effective model state across the core/runtime boundary, so compatibility review matters before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #95780
Summary: The linked open bug is canonical and this PR is the active candidate fix; adjacent ACP thinking work is related but not the same slot-leak root cause.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] Merging changes Codex ACP model-routing compatibility: inherited unsupported defaults are dropped, while explicit unsupported Codex model selections fail closed with ACP_INVALID_RUNTIME_OPTION.
  • [P1] The PR adds optional modelExplicit and appliedModel fields to the ACP runtime boundary; this is additive, but maintainers should intentionally accept it as the cross-boundary provenance contract.

Maintainer options:

  1. Accept the provenance contract (recommended)
    Land with modelExplicit and appliedModel as the intended boundary because the patch separates inherited defaults from caller intent and prevents first-turn replay of dropped models.
  2. Document explicit fail-closed behavior
    Before merge, preserve PR-body or release-note context that unsupported explicit Codex ACP model selections now fail while inherited non-OpenAI defaults are dropped.
  3. Pause for a narrower API
    If maintainers do not want generic ACP runtime fields for model provenance, pause this branch and ask for a Codex-only contract shape.

Next step before merge

  • No automated repair job is needed; the remaining action is maintainer compatibility approval and normal merge gating for the active candidate fix.

Security
Cleared: The diff changes ACPX parsing, optional runtime type fields, and tests without adding dependencies, workflows, permissions, lockfiles, secret handling, or new supply-chain execution paths.

Review details

Best 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 changes

Label justifications:

  • P1: The linked bug blocks a real Codex ACP spawn workflow when an inherited default model is non-OpenAI.
  • merge-risk: 🚨 compatibility: The PR changes fallback versus fail-closed behavior for Codex ACP model routing and adds optional ACP runtime contract fields.
  • merge-risk: 🚨 auth-provider: The changed path controls provider/model routing for Codex ACP startup and runtime model selection.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes copied terminal output for the manager initialize-plus-first-turn path and live Codex ACP child-process spawn boundary, and the latest head source still matches the proofed behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes copied terminal output for the manager initialize-plus-first-turn path and live Codex ACP child-process spawn boundary, and the latest head source still matches the proofed behavior.
Evidence reviewed

PR surface:

Source +84, Tests +408. Total +492 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 5 171 87 +84
Tests 2 408 0 +408
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 579 87 +492

What I checked:

  • Current main source reproduces the slot leak: Current main strips only the OpenAI prefix, splits the remaining model ref on /, and passes the second segment through Codex ACP thinking validation, so google/gemini-3.1-flash-lite is treated as a thinking value. (extensions/acpx/src/runtime.ts:540, f4fa10c2c5ac)
  • PR head classifier avoids thinking-slot routing for foreign refs: At the latest PR head, classifyCodexAcpModelRequest only treats a slash suffix as reasoning when it matches a known thinking alias; otherwise foreign provider/model refs become unsupported instead of being validated as efforts. (extensions/acpx/src/runtime.ts:534, 20c422032d71)
  • PR head separates inherited defaults from explicit model selections: Codex ACP ensureSession now fails unsupported models only when modelExplicit is true, otherwise removes the unsupported inherited model and reports it as dropped on the returned handle. (extensions/acpx/src/runtime.ts:1120, 20c422032d71)
  • Manager persists the effective model: runManagerInitializeSession passes modelExplicit only for caller-selected models and normalizes persisted runtime options from handle.appliedModel, so a dropped model becomes absent before first-turn controls run. (src/acp/control-plane/manager.initialize-session.ts:61, 20c422032d71)
  • Codex dependency contract checked: Sibling Codex source keeps Settings.model and Settings.reasoning_effort as separate fields, and ReasoningEffort is its own protocol type, supporting the fix direction that provider/model refs must not be fed into the effort slot. (../codex/codex-rs/protocol/src/config_types.rs:712, c464468493e9)
  • Canonical issue link is still open: Live GitHub state shows [Bug]: ACP spawn of codex injects default model id (gemini-3.1-flash-lite) into the thinking-level slot #95780 is open and lists this PR as its closing pull request, so the PR remains the active candidate fix rather than cleanup-close material.

Likely related people:

  • vincentkoc: Recent ACPX model capability handling landed in 300b09b33ff8, and Vincent left the concrete changes-requested review on this PR that the current revision addresses. (role: recent ACPX model-runtime contributor and reviewer; confidence: high; commits: 300b09b33ff8; files: extensions/acpx/src/runtime.ts)
  • Moeed Ahmed: Commit metadata and prior issue review evidence tie the current Codex ACP normalization block to e998986889ec; the signal is useful but not definitive because that commit was broad. (role: introduced or carried current parser block; confidence: medium; commits: e998986889ec; files: extensions/acpx/src/runtime.ts)
  • InTheCloudDan: Authored merged PR [codex] Map ACP thinking to advertised effort key #79926, which changed adjacent ACP thinking/config-key mapping surfaces related to this routing area. (role: prior ACP thinking mapping contributor; confidence: medium; commits: 253b53f13a5f; files: src/acp/control-plane/manager.runtime-controls.ts, src/acp/control-plane/runtime-options.ts)
  • joshavant: Recent main commit cee2aca409 touched extensions/acpx/src/runtime.ts, though its primary purpose was agent cron scoping rather than the Codex model parser. (role: recent adjacent contributor; confidence: low; commits: cee2aca40912; files: extensions/acpx/src/runtime.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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 keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@yetval

yetval commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-run

1 similar comment
@yetval

yetval commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-run

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jun 24, 2026
@yetval
yetval force-pushed the fix/codex-acp-model-thinking-slot branch from 9baa49a to da31813 Compare June 24, 2026 02:42
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Jun 24, 2026
@yetval

yetval commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@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.

  • resolveAcpSpawnRuntimeOptions (src/agents/acp-spawn.ts) records whether params.model was caller-supplied and threads a modelExplicit flag through AcpInitializeSessionInput and the AcpRuntimeEnsureInput contract to the acpx runtime (stripped before the acpx delegate).
  • Codex ACP ensureSession now drops an inherited leaked default (the [Bug]: ACP spawn of codex injects default model id (gemini-3.1-flash-lite) into the thinking-level slot #95780 case) but fails closed with ACP_INVALID_RUNTIME_OPTION on a caller-selected unsupported or malformed model, before the delegate is reached.

Real before/after proof in the body drives the real AcpxRuntime.ensureSession on pristine main vs this head with identical inputs: the same google/... ref now resolves by provenance (dropped when inherited, rejected when caller-selected), and the openai/gpt-5.5 control is unchanged. The one remaining stub is the codex-acp child process (that package is not installed in this environment), stated in the proof.

@clawsweeper

clawsweeper Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jun 24, 2026
@yetval

yetval commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Added the [P1] live child-process proof to the body (no code change; head still da31813cf9). It drives the real AcpxRuntime.ensureSession with the acpx delegate NOT stubbed, spawning the real @zed-industries/codex-acp binary as the codex agent (a thin wrapper records the launch argv, then execs the real binary):

  • caller-selected unsupported google/... -> fails closed with ACP_INVALID_RUNTIME_OPTION, no codex-acp child spawned.
  • inherited foreign default google/... -> a real codex-acp child spawns with no -c model= (the leaked default dropped, Codex on its own default).
  • openai/gpt-5.5 -> spawns with -c model=gpt-5.5.

Both real spawns then reach codex's own session creation and stop at Authentication required (this box has no active Codex session), which is past the model-routing boundary this PR changes. The original stubbed-delegate before/after (showing the pristine-main crash) is retained above it.

@yetval
yetval force-pushed the fix/codex-acp-model-thinking-slot branch from da31813 to 685905a Compare June 24, 2026 13:27
@yetval

yetval commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Refreshed to head 685905a210 (rebased on latest main). This revision addresses the [P1] patch-quality finding: a dropped inherited Codex ACP default was still persisted into runtimeOptions and replayed as a set_config_option(model) on the first turn, which the fail-closed Codex control path then rejected.

  • ensureSession now reports the effective model it applied on the returned AcpRuntimeHandle as a closed { kind: "applied", model } | { kind: "dropped" }.
  • runManagerInitializeSession persists that effective model, so a dropped inherited default is never saved into runtimeOptions and never replayed before the first turn. A caller-selected unsupported model still fails closed at spawn and never persists, so the new optional handle field changes only the inherited-default case.

Real behavior proof updated (PR body) to cover the manager path: driving the real AcpSessionManager.initializeSession + first runTurn on pristine main @2aa9d67635 vs this revision @685905a210, with the Codex backend faithfully stood in at its one control boundary. BEFORE persists google/gemini-3.1-flash-lite and the first turn fails with ACP_INVALID_RUNTIME_OPTION; AFTER persists no model and the first turn completes. Added the matching regression in manager.runtime-config.test.ts (init -> first runTurn, asserts the dropped default is neither persisted nor replayed) plus returned-handle assertions in runtime.test.ts.

Gates: acpx 74, manager runtime-config 21, manager initialize-session 4; oxlint clean; tsgo core, core test, extensions prod, extensions test lanes clean.

@clawsweeper

clawsweeper Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 24, 2026
@yetval
yetval force-pushed the fix/codex-acp-model-thinking-slot branch from 685905a to 20c4220 Compare June 27, 2026 14:31
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Jun 27, 2026
@yetval

yetval commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@jpplaisted

Copy link
Copy Markdown

Downstream signal: we're holding a production OpenClaw deployment on 2026.6.9 partly because of #95780 — native sessions_spawn runtime=acp for codex is unusable (the default model id leaks into the thinking-level slot; thinking=low doesn't override), so we're on a codex exec bypass. This PR is on our upgrade-revisit gate.

CI looks green here; is the CHANGES_REQUESTED review the main thing outstanding? Happy to validate the fix against our repro (macOS, claude-cli main runtime) if a test build would help move it along. Thanks for the work on this.

@yetval

yetval commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

@jpplaisted yes, the CHANGES_REQUESTED review is the only thing outstanding. It was filed against an older commit and its blockers are addressed in the current head; CI is green. Validation welcome.

yetval and others added 2 commits July 17, 2026 03:08
… 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.
@steipete
steipete force-pushed the fix/codex-acp-model-thinking-slot branch from 20c4220 to 3121ffb Compare July 17, 2026 02:54
@steipete
steipete merged commit a06799a into openclaw:main Jul 17, 2026
119 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
… 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]>
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
… 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: acpx merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ACP spawn of codex injects default model id (gemini-3.1-flash-lite) into the thinking-level slot

4 participants