fix(code-mode): honor agent scoped code mode#83473
Conversation
|
Codex review: needs maintainer review before merge. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: yes. at source level. Current main documents agent-level PR rating Rank-up moves:
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. Real behavior proof Risk before merge
Maintainer options:
Next step before merge Security Review detailsBest possible solution: Land this PR or an equivalent focused fix after maintainers accept the supplied transport-boundary proof for the code-mode security boundary. Do we have a high-confidence way to reproduce the issue? Yes, at source level. Current main documents agent-level Is this the best way to solve the issue? Yes. The PR fixes schema/types/help and carries the active-agent code-mode decision through catalog and model-payload enforcement, which is safer than the schema-only path previously proposed in #83394. Label justifications:
Acceptance criteria:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 57c952f67985. |
3a9f308 to
8e4fc04
Compare
9b9cb22 to
22c2376
Compare
22c2376 to
84d82e7
Compare
84d82e7 to
e7ab68b
Compare
|
Maintainer verification for head
Known note: while rebasing onto latest |
Fixes #83388.
Problem
agents.list[].tools.codeModewas documented as a per-agent setting, but main rejected it in the strict per-agent schema. A schema-only fix would be worse than the original rejection because it would accept security/tool-boundary config without making it effective at runtime.Change and value
agents.list[].tools.codeModein schema, exported types, labels, and help text.tools.codeModedefaults.functionDeclarations, while filtering code-mode payloads down toexec/wait.Who is affected
Operators using per-agent code-mode policy now get the documented behavior. Existing top-level
tools.codeModebehavior is preserved. Agents without code mode continue to see the normal tool surface.Real behavior proof
Behavior or issue addressed: Per-agent
agents.list[].tools.codeModechanges the active agent's runtime/model tool surface; it is not merely accepted by schema validation.Real environment tested: Local source worktree at rebased PR head
22c2376b7260.Exact steps or command run after this patch: Exercised the embedded-attempt runtime harness that captures the outgoing model request for an active
opsagent, then ran a redacted transport harness against PR-headresolveCodeModeConfigandcreateCodexNativeWebSearchWrapperforopsandchat.Evidence after fix:
Observed result after fix: The enabled
opsagent sent only the code-mode payload tools (exec,wait); the disabledchatcontrol kept the normal visible payload; and the grouped declaration case still filtered toexec,wait.What was not tested: No external provider API request and no gateway process. This proof targets the embedded runner/model-transport boundary where accepted config becomes an outgoing tool payload.
Verification
22c2376b7260:env OPENCLAW_VITEST_MAX_WORKERS=1 timeout 180s node --no-maglev node_modules/vitest/vitest.mjs run --config test/vitest/vitest.agents-pi-embedded.config.ts src/agents/pi-embedded-runner/run/attempt.spawn-workspace.context-engine.test.tspassed, 41 tests.22c2376b7260: redacted model-transport proof harness output shown above.22c2376b7260:node --import tsx scripts/generate-config-doc-baseline.ts --checkpassed.22c2376b7260:git diff --check origin/main...HEADpassed.zod-schema.agent-defaults.test.ts,code-mode.test.ts,openai-stream-wrappers.test.ts, andattempt.spawn-workspace.context-engine.test.ts, 116 tests total.oxfmt --check --threads=1 <touched files>passed.timeout 900s codex review --base origin/mainpassed with no actionable correctness issues.runEmbeddedAttemptrebuilds from the session base stream before wrapping; shallow override and test-support notes are non-blocking for the current config shape/test harness.pnpm check:changedon head9b9cb2218662passed, selectedcore, coreTests, docs, exit 0, leasecbx_b35df657aaf8.