-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
code-mode: AgentToolsSchema rejects "codeMode" key but docs say agent-level config works #83388
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Problem
docs/reference/code-mode.md(line 67) says:But the per-agent
toolszod schema (AgentToolsSchema) is.strict()and doesn't includecodeMode. Only the top-levelToolsSchemaaccepts it. Per-agent enablement isn't possible — the gateway rejects the config.Change and value
Either add
codeMode: CodeModeSchema.optional()toAgentToolsSchema, or correct the doc to say "runtime/top-level only".Per-agent enablement is the more useful option — it allows testing code mode on a single agent without forcing fleet-wide behavior change during evaluation or gradual rollout.
Who's affected
Anyone reading the documented agent-level config and trying to apply it. Affects evaluation/testing workflows where mixing code-mode and non-code-mode agents in the same fleet is desirable.
Reproduction
Tested on Openclaw
2026.5.16-beta.4.openclaw.json:{ "agents": { "list": [ { "id": "test-agent", "tools": { "codeMode": { "enabled": true } } } ] } }openclaw gateway restartExpected
Gateway starts; code mode enabled for
test-agentonly.Actual
Gateway rejects config validation:
Schema evidence
In
dist/zod-schema.agent-runtime-CMJF3lIB.js:const AgentToolsSchema = z.object({ ...CommonToolPolicyFields, elevated, exec, fs, loopDetection, message, sandbox }).strict()— nocodeModeconst ToolsSchema = z.object({ ...CommonToolPolicyFields, ..., codeMode: CodeModeSchema, ... })— codeMode present at top-level onlySuggested fix
Add
codeMode: CodeModeSchema.optional()toAgentToolsSchemaso the documented agent-level enablement works. If a per-agent override isn't intended, instead remove "agent or" from the docs.Local workaround
Set
tools.codeMode.enabled: trueat the root ofopenclaw.json. This enables code mode for every agent in the fleet.