Repository navigation
fix(agents): show readable purposes for Code Mode execution - #157150
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 7:29 AM ET / 11:29 UTC (Revision 5). ClawSweeper reviewWhat this changesRequires a short, nonblank purpose for new outer OpenClaw Code Mode JavaScript cells, updates the documentation and tests, and stabilizes two Gateway test fixtures. Merge readiness✅ Ready for maintainer review Keep open: current main and the latest release still permit the generic Code Mode activity rows. Review found no blocking defect in the introduced patch, and a verified repository admin explicitly accepted its compatibility tradeoff. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw's agent runtime registers and validates Code Mode tool calls before executing JavaScript. The resulting tool arguments feed the existing activity display, where the Control UI shows a supplied purpose or a generic fallback. flowchart LR
A[Agent task] --> B[Model tool call]
B --> C{Purpose supplied?}
C -->|Yes| D[Code Mode executor]
C -->|No| E[Validation retry]
D --> F[Tool activity]
F --> G[Control UI row]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +2, Tests +62, Docs +4. Total +68 across 12 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep purpose validation at the registered outer Code Mode tool while retaining legacy transcript display and the optional shell and wait contracts. Do we have a high-confidence way to reproduce the issue? Yes. Current main accepts an outer Code Mode call without a title, and its display path then uses “run JavaScript”; this review established the path from source without executing it. Is this the best way to solve the issue? Yes. The registered outer tool schema is the narrow producer-side fix, and the shared shell title remains optional. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a533ff8f836e. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
Maintainer decision: the required outer Code Mode purpose is intentional, including an ordinary validation error/retry when a model omits it. Existing history is not retroactively validated. This is the approved readability/token-cost tradeoff; nested shell titles and waits keep their existing contracts. The requested live proof now passes on |
Main now owns the equivalent explicit-entry and joined-cleanup fixture repair in 94ad9f0 (#157150). Remove this PR's duplicate fixture change so main's implementation applies without conflict, retaining the reviewed yield-acknowledgment delta unchanged. Co-authored-by: steipete <[email protected]>
|
Merged via squash auto-merge.
|
…#157150) * fix(agents): require readable Code Mode execution titles * fix(agents): preserve optional shell execution title types * test(agents): title Code Mode denial and approval fixtures * test(gateway): await portal node pairing bookkeeping * test(gateway): join restart notice preparation in fixtures
What Problem This Solves
Code Mode activity can become a wall of “run JavaScript” rows when the agent omits the execution title.
User Impact
New outer Code Mode cells must include a nonblank purpose, with guidance to use 3–7 words. Users can scan what the agent is doing with a small, bounded token cost. Existing untitled history keeps its fallback label.
Why This Change Was Made
The title was described as expected on every call but remained optional in the model-facing schema. Require it only for outer Code Mode
execcalls, retaining the 120-character limit. Nested tools retain their existing summaries, andwaitresumes activity under the original cell without another title or model request. The shared shell-tool title remains optional. Maintainer decision: rejection of missing titles and ordinary validation retries are intentional; requiring a short purpose is the approved readability/token-cost tradeoff. Old transcript entries are not retroactively validated.Evidence
pnpm test src/agents/code-mode.test.ts --maxWorkers=1: 27 passed, 41.79 s wall including worker compilation; the changed validation case took 3 ms. The unchanged prompt-size budget also passes.node scripts/check-changed.mjs: all selected core, test typechecking, docs, lint, and repository guards passed.models-connect-publication.integration.test.ts: Gateway startup/connect consumed roughly 54 of 60 seconds; catalog assertions then passed before timeout during supersession. The exact 14-file/8-worker shard passed locally (391 tests, 291.21 s wall; catalog case 16.672 s). macOS/Node 26 differs from Linux/Node 24 CI, so this is non-reproduction, not a claimed fix; no timeout or assertions changed. Original CI run.PAIRING_CHANGEDfailure: post-hello connection bookkeeping overlapped the fixture's first manual inventory request. The fixture now awaits that real write after attaching node listeners. Production pairing checks, assertions, and timeouts are unchanged. The original 13-file shard passed (64 tests, 115.63 s wall; portal case 3.544 s), as did its typecheck/lint and independent review. Affected CI run.finally. Existing assertions and timeouts stay intact. Original seven-file replay: 265 tests, 69.94 s wall; changed case 580 ms. Focused lint/format and independent review passed. Local proof uses the older preparation owner; new CI checks main's asynchronous worker owner in the actual merge context.a53c4ac7599used the actual Code Mode schema and Agent execution withgpt-5.6-luna: exactly two requests, no title supplied in either prompt. Fresh execution generatedCalculate multiplication/return 19 * 23;and completed with437; continued execution generated the same purpose /return 41 * 17;and completed with697. The continued context preserved an older untitled call at the provider boundary and in prior history. Both passed normal validation and the Node executor. Scope: in-memory tool outcomes, without a final assistant turn or live Gateway.chat.toolTitlesrequest. This is fixture proof, not a live deployment.Before:
After: