Skip to content

fix(agents): show readable purposes for Code Mode execution - #157150

Merged
steipete merged 5 commits into
mainfrom
codex/require-code-mode-titles
Sep 24, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/require-code-mode-titles

Conversation

@steipete

@steipete steipete commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

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 exec calls, retaining the 120-character limit. Nested tools retain their existing summaries, and wait resumes 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

  • The registered-tool validation regression failed before the fix; missing, empty, and whitespace-only titles now fail, and a meaningful title passes.
  • 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.
  • Existing Code Mode agent-loop, embedded continuation, and SQLite transcript suites passed with their provider fixtures updated to include titles. No new process, timer, or Gateway fixture was added; the existing transcript suite exercises database close/reopen and source-redaction contracts.
  • node scripts/check-changed.mjs: all selected core, test typechecking, docs, lint, and repository guards passed.
  • CI first run found two additional mock-provider fixtures missing titles. Those fixtures now pass their original denial/approval assertions: 11 tests, 188.42 s wall including worker compilation (existing real-Gateway clock case 59.099 s; existing denial suite 59.94 s total lane duration). Focused lint and independent fixture review passed.
  • The same CI run timed out in unchanged 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.
  • A later CI run exposed a portal-fixture pairing race. A controlled valid interleaving reproduced the exact PAIRING_CHANGED failure: 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.
  • CI also exposed a restart-notice fixture that polled for hook entry with a one-second default and abandoned pending work on assertion failure. A controlled delay reproduced it; the fixture now awaits hook entry or enqueue completion and releases/joins started work in 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.
  • Independent final-candidate review: no actionable findings through P2.
  • Live OpenAI Responses proof on a53c4ac7599 used the actual Code Mode schema and Agent execution with gpt-5.6-luna: exactly two requests, no title supplied in either prompt. Fresh execution generated Calculate multiplication / return 19 * 23; and completed with 437; continued execution generated the same purpose / return 41 * 17; and completed with 697. 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.
  • Synthetic browser proof uses the unchanged Control UI and mock Gateway: four identical code cells gain readable purposes when their titles are supplied, with no chat.toolTitles request. This is fixture proof, not a live deployment.

Before:

Before: repeated run JavaScript rows

After:

After: short execution purposes

@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: S labels Sep 24, 2026
@steipete
steipete marked this pull request as ready for review September 24, 2026 08:30
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 7:29 AM ET / 11:29 UTC (Revision 5).

ClawSweeper review

What this changes

Requires 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
Reviewed head: a87f4971b5df6897b9687bea410a7a06b686c223

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused registered-tool coverage and relevant live execution proof support a sound repair with an accepted compatibility cost.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Two real provider requests exercised the changed registered Code Mode schema and Node executor: fresh and continued cells gained readable purposes and returned the expected results, while continued context preserved an older untitled call. The inspected Control UI images use a mock Gateway to illustrate the existing renderer; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Two real provider requests exercised the changed registered Code Mode schema and Node executor: fresh and continued cells gained readable purposes and returned the expected results, while continued context preserved an older untitled call. The inspected Control UI images use a mock Gateway to illustrate the existing renderer; no stored-data contract changes.
Evidence reviewed 12 items Introduced tool contract: The PR makes title required only in the registered outer Code Mode exec schema and adds short-purpose guidance.
Current main remains unfixed: Current main still registers the title with the optional schema and lacks the new purpose guidance.
Latest release check: The latest supplied release, v2026.9.6, also registers an optional title; the PR behavior has not shipped there.
Findings None None.
Security None None.

How this fits together

OpenClaw'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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +2, Tests +62, Docs +4. Total +68 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 2 14 12 +2
Tests 8 98 36 +62
Docs 2 10 6 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 122 54 +68

Review metrics

Metric Value Why it matters
Model tool contract 1 title field changed from optional to required This is the deliberate compatibility cost behind the improved activity labels.

Technical review

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Generic activity rows create user-facing confusion, with limited blast radius and a focused repair.
  • merge-risk: 🚨 compatibility: New untitled Code Mode calls will receive validation errors; the verified repository admin explicitly accepted that tradeoff for this change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Two real provider requests exercised the changed registered Code Mode schema and Node executor: fresh and continued cells gained readable purposes and returned the expected results, while continued context preserved an older untitled call. The inspected Control UI images use a mock Gateway to illustrate the existing renderer; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. Two real provider requests exercised the changed registered Code Mode schema and Node executor: fresh and continued cells gained readable purposes and returned the expected results, while continued context preserved an older untitled call. The inspected Control UI images use a mock Gateway to illustrate the existing renderer; no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RoboClaw: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

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

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-24T08:53:35.377Z sha febd72a :: blocked before merge. :: none
  • reviewed 2026-09-24T09:12:15.013Z sha a53c4ac :: blocked before merge. :: [P1] Preserve execution for previously valid untitled calls
  • reviewed 2026-09-24T09:30:29.653Z sha a53c4ac :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T10:07:22.427Z sha 6bef299 :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Sep 24, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Sep 24, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

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 a53c4ac7599: two real OpenAI Responses requests using gpt-5.6-luna, the actual registered Code Mode schema, normal Agent validation, and the Node executor. With no title supplied in either user prompt, the model generated Calculate multiplication for return 19 * 23; (result 437) and, in continued context containing an old untitled call, for return 41 * 17; (result 697). The old untitled arguments reached the provider unchanged, and prior history stayed unchanged. These checks stop after successful tool outcomes; they do not claim a live Gateway deployment. The PR body includes this evidence and the synthetic UI rendering proof.

@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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 24, 2026
@steipete
steipete enabled auto-merge (squash) September 24, 2026 11:34
@steipete
steipete merged commit 94ad9f0 into main Sep 24, 2026
191 checks passed
@steipete
steipete deleted the codex/require-code-mode-titles branch September 24, 2026 12:22
roboclaw-bot added a commit that referenced this pull request Sep 24, 2026
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]>
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
…#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

1 participant