Repository navigation
[AI] docs(tools): clarify per-action required params in gateway and process tool schemas - #114879
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 5:23 AM ET / 09:23 UTC. ClawSweeper reviewWhat this changesClarifies when optional gateway Merge readinessKeep this PR open: current main still lacks these action-specific schema descriptions, and the proposed wording matches the runtime invariants with correctly regenerated fixtures. No patch defect was found; the remaining merge gate is exact-head validation plus the unavailable upstream Codex-source audit. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherOpenClaw exposes tool schemas to models, then validates action-specific inputs before calling gateway configuration APIs or operating background processes. The Codex harness also serializes selected tool schemas into its dynamic-tool catalog for model-visible prompt review. flowchart LR
A[Agent prompt] --> B[Model tool schema]
B --> C[Tool arguments]
C --> D{Selected action}
D --> E[Gateway configuration lookup]
D --> F[Background process control]
B --> G[Codex dynamic-tool snapshot]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +4, Tests +1. Total +5 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the flat optional schemas, state their action-specific requirements in the descriptions, and retain the regenerated prompt snapshots as the canonical model-visible contract. Do we have a high-confidence way to reproduce the issue? No high-confidence reviewer reproduction proves that a particular model omits these fields solely because of the old descriptions. Current source does prove the action-specific requirement, and the PR supplies after-fix isolated runs for both paths. Is this the best way to solve the issue? Yes. A per-action union would add provider-schema churn, while the existing flat optional schema must support both actions; the descriptions follow the established conditional-requirement pattern in src/agents/tools/nodes-tool.ts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1c8fab89c38c. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (16 earlier review cycles; latest 8 shown)
|
dadda42 to
22eaaa3
Compare
|
[AI] Thanks for the review. Regarding the process-tool snapshot finding: the three Codex dynamic-tool snapshots are generated from a fixed tool whitelist ( The gateway The remaining @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
2fdf507 to
d6879c9
Compare
d6879c9 to
a792be0
Compare
a792be0 to
b49ffa9
Compare
b49ffa9 to
244885c
Compare
244885c to
8ea1caf
Compare
…rocess tool schemas Update gateway path and process sessionId schema descriptions so models know which actions require them at runtime. Includes regenerated Codex prompt snapshots (base telegram catalog + md token counts) matching the descriptions. Fixes #
8ea1caf to
6b32252
Compare
|
Merged via squash.
|
…rocess tool schemas (openclaw#114879) Update gateway path and process sessionId schema descriptions so models know which actions require them at runtime. Includes regenerated Codex prompt snapshots (base telegram catalog + md token counts) matching the descriptions. Fixes #
What Problem This Solves
Relates to #114839: Gateway tool
pathand process toolsessionIdparameters are markedType.Optionalin their JSON schemas, but certain actions require them at runtime. When a model omits an optional parameter, the tool returns a "path required" or "sessionId is required for this action" error instead of forwarding the call to the backend.The schema descriptions did not clearly state which actions need these parameters, so models (especially those that treat
optionalas "omittable") had no guidance to include them.Why This Change Was Made
Two schema/runtime mismatches were identified:
GatewayToolSchema.path(src/agents/tools/gateway-tool.ts:105): schema marksType.Optional(Type.String())with no description, butconfig.schema.lookuprequirespathat runtime (readStringParam(params, "path", { required: true })at line 126).config.gettreatspathas optional.processSchema.sessionId(src/agents/bash-tools.schemas.ts:80): schema says"Session id for actions other than list", butpoll/log/write/send-keys/submit/paste/kill/clear/removeall checkif (!params.sessionId)and return"sessionId is required for this action."(src/agents/bash-tools.process.ts:331). Onlylistomits it.This is not a parameter-dropping bug —
readStringParamreads directly fromparams. The issue is that models may omit parameters the schema marks optional, then hit a runtime required-check. Clearer descriptions help models include the right parameters per action.User Impact
Models that previously omitted
pathorsessionId(treating schema-leveloptionalas "not needed") now see explicit guidance on which actions require them. This reduces "path required" / "sessionId is required" errors for agents callingconfig.schema.lookupor process actions likepoll/log/write.No runtime behavior change — descriptions are metadata consumed by model-facing tool schemas.
Evidence
Changed files
src/agents/bash-tools.schemas.ts—sessionIddescription:"Session id for actions other than list"→"Required for poll, log, write, send-keys, submit, paste, kill, clear, remove. Omit for list."src/agents/tools/gateway-tool.ts—pathadd description:"Required for config.schema.lookup. Optional for config.get to request a narrower subtree."Test results
Description-only change; no runtime logic, schema structure, or test assertions modified.
Real behavior proof (after-fix live run)
Drove an affected model (GLM-5.2-FP8-test via OpenAI-compatible ZTE MaaS endpoint) to invoke the gateway tool with the updated
pathdescription. The model correctly includedpathin the tool call arguments and the gateway returned the schema (not a "path required" error).Setup: isolated dev gateway (
openclaw gateway run --dev), isolatedOPENCLAW_STATE_DIR,OPENAI_API_KEYset, modelopenai/GLM-5.2-FP8-test.Prompt sent to the agent:
Assistant tool call (captured from session transcript SQLite
transcript_eventstable):{ "type": "toolCall", "name": "gateway", "arguments": { "action": "config.schema.lookup", "path": "agents.defaults.heartbeat" } }Gateway log line confirming the call succeeded:
2026-07-28T14:30:03.543+08:00 [ws] ⇄ res ✓ config.schema.lookup 2642ms conn=10846602…6c09 id=cbe21e15…50d6Tool result (truncated, full schema returned with
ok: true):{ "ok": true, "result": { "path": "agents.defaults.heartbeat", "schema": { "type": "object", "additionalProperties": false }, "reloadKind": "hot", "children": [ { "key": "every", "path": "agents.defaults.heartbeat.every", "type": "string", "required": false }, { "key": "activeHours", "path": "agents.defaults.heartbeat.activeHours", "type": "object", "required": false }, ... ] } }Agent run summary:
The model supplied
pathand the call resolved without thepath requiredruntime guard firing, which is the behavior the updated description aims to encourage.Gateway tool — natural-language prompt (no explicit path in prompt)
To check whether the description (not the prompt) drives
pathinclusion, ran a second gateway call with a natural-language prompt that does not namepath:(Translation: "Look up the config schema for heartbeat.")
The model still included
pathin the gateway tool call (proving the schema description, not just the prompt, signals thatpathis needed). The value was incomplete (heartbeatrather thanagents.defaults.heartbeat), which is a config-knowledge gap the description cannot fix, but the key point is the model did not omit thepathargument:{ "type": "toolCall", "name": "gateway", "arguments": { "action": "config.schema.lookup", "path": "heartbeat" } }Tool result:
{ "ok": false, "code": "schema_path_not_found", "path": "heartbeat", "message": "config schema path not found" }The model then retried with the full path and succeeded — confirming the description makes the model aware
pathis required forconfig.schema.lookup, even when the prompt does not supply it.Process tool —
sessionIdsupplied forpollactionTo cover the separate
processSchema.sessionIdchange, drove the model to start a background process and poll it. The prompt asked for a backgroundsleep 30plus aprocesspoll, without explicitly namingsessionId:Prompt sent to the agent (translated from Chinese: "Start a background command
sleep 30with exec, then use the process tool's poll action to check the background process output"):The model started the background process with
exec, receivedsession tidal-lagoonfrom the tool result, then issued twoprocesspollcalls — both correctly carryingsessionId:First poll (5s timeout, process still running):
{ "type": "toolCall", "name": "process", "arguments": { "action": "poll", "sessionId": "tidal-lagoon", "timeout": 5000 } }Tool result:
{ "text": "(no new output)\n\nProcess still running." }Second poll (30s timeout, process exited):
{ "type": "toolCall", "name": "process", "arguments": { "action": "poll", "sessionId": "tidal-lagoon", "timeout": 30000 } }Tool result:
{ "text": "(no new output)\n\nProcess exited with code 0." }Agent run summary:
The model supplied
sessionIdon bothpollcalls without being explicitly told the parameter name in the prompt, and neither call hit thesessionId is required for this actionruntime guard — confirming the updatedsessionIddescription surfaces the requirement to the model.Notes
Refs #114839rather thanCloses— the reporter noted "This may be a model-specific issue", and the root cause may be model behavior rather than a code bug. This PR improves schema clarity but may not fully resolve the issue if models still omit optional parameters despite the description.