Skip to content

fix(tui): surface safe tool-validation abort diagnostics - #91002

Merged
steipete merged 8 commits into
openclaw:mainfrom
thegoldenflow:fix/90982-tui-abort-tool-error-summary
Jul 5, 2026
Merged

steipete merged 8 commits into
openclaw:mainfrom
thegoldenflow:fix/90982-tui-abort-tool-error-summary

Conversation

@thegoldenflow

@thegoldenflow thegoldenflow commented Jun 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

When the model repeatedly emitted invalid tool arguments and the run aborted, both TUI backends showed only run aborted. The useful validation context was lost between the tool result, terminal lifecycle event, Gateway chat projection, and TUI renderer. This closes #90982.

Why This Change Was Made

Carry a typed argument-validation discriminator from the agent loop and prepare a static, argument-free diagnostic at the tool boundary. Gateway and embedded runs retain that safe summary through explicit aborts and lifecycle self-aborts, while arbitrary tool output, validator paths, custom messages, and echoed arguments remain private. Terminal chat projection now uses the canonical agent-run outcome so cancellation cannot downgrade timeouts or failures.

The additive ChatAbortedEvent.errorMessage field is propagated through the generated Swift model with a defaulted nil initializer parameter for source compatibility.

User Impact

The TUI now reports a concise message such as run aborted: edit tool validation failed: invalid arguments in both Gateway and --local modes. Existing successful, failed, timed-out, and cancelled terminal semantics remain unchanged.

Evidence

  • focused agent-core, protocol, agent lifecycle/tool, Gateway abort/chat, and both TUI projection suites: passed
  • real Gateway PTY validation-loop abort: passed
  • real local embedded PTY validation-loop abort: passed
  • pnpm build: passed
  • generated protocol artifacts refreshed and Swift optional initializer compatibility verified
  • fresh Codex autoreview: passed with no actionable findings

No raw model arguments or validator detail text are present in the emitted tool, lifecycle, chat, or terminal output.

@clawsweeper

clawsweeper Bot commented Jun 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 5, 2026, 11:26 AM ET / 15:26 UTC.

Summary
The PR adds typed, sanitized tool argument-validation abort diagnostics through agent-core, embedded agent events, Gateway chat projection, protocol/Swift models, and TUI rendering.

PR surface: Source +662, Tests +1461, Docs +38, Config 0, Generated 0, Other +334. Total +2495 across 78 files.

Reproducibility: yes. at source/proof level: current main renders bare run aborted, while validation errors can include detailed tool errors and received arguments. I did not rerun the PTY proof in this read-only review.

Review metrics: 1 noteworthy metric.

  • Protocol event surface: 1 optional field added. ChatAbortedEvent.errorMessage is client-facing protocol surface, so maintainers should notice that schema and generated Swift changes remain additive/defaulted.

Stored data model
Persistent data-model change detected: migration/backfill/repair: CHANGELOG.md, migration/backfill/repair: docs/cli/policy.md, migration/backfill/repair: extensions/policy/src/doctor/automatic-repairs.ts, migration/backfill/repair: extensions/policy/src/doctor/register.test.ts, migration/backfill/repair: extensions/policy/src/doctor/scopes/data-auth.ts, migration/backfill/repair: extensions/policy/src/doctor/scopes/gateway.ts, and 19 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #90982
Summary: The linked issue is the canonical report for hidden TUI tool-call validation diagnostics; this PR is the active fix candidate and the older overlapping PR is closed unmerged.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] Several exact-head CI jobs were still in progress when inspected; merging should wait for required checks to finish.

Maintainer options:

  1. Decide the mitigation before merge
    Land this branch after required checks and maintainer merge gating, preserving the typed argument-free diagnostic boundary and optional protocol field.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No ClawSweeper repair lane is needed; the remaining action is maintainer review and exact-head merge gating.

Security
Cleared: No concrete security or supply-chain regression was found; the diff adds no dependencies or workflows and gates displayed diagnostics to typed validation provenance plus sanitization.

Review details

Best possible solution:

Land this branch after required checks and maintainer merge gating, preserving the typed argument-free diagnostic boundary and optional protocol field.

Do we have a high-confidence way to reproduce the issue?

Yes at source/proof level: current main renders bare run aborted, while validation errors can include detailed tool errors and received arguments. I did not rerun the PTY proof in this read-only review.

Is this the best way to solve the issue?

Yes. The patch fixes the narrow visibility bug at the typed validation-provenance and terminal-projection boundaries instead of parsing raw validator text or changing retry/model behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 33f7c17f233f.

Label changes

Label justifications:

  • P2: This PR fixes a normal-priority user-visible TUI diagnostics bug with limited blast radius.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body and maintainer proof comment provide after-fix real PTY validation-loop proof for both Gateway and local TUI, plus build and protocol checks.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body and maintainer proof comment provide after-fix real PTY validation-loop proof for both Gateway and local TUI, plus build and protocol checks.
Evidence reviewed

PR surface:

Source +662, Tests +1461, Docs +38, Config 0, Generated 0, Other +334. Total +2495 across 78 files.

View PR surface stats
Area Files Added Removed Net
Source 35 806 144 +662
Tests 22 1475 14 +1461
Docs 5 43 5 +38
Config 1 1 1 0
Generated 1 2 2 0
Other 14 518 184 +334
Total 78 2845 350 +2495

What I checked:

  • Repository policy read: Root AGENTS.md and scoped TUI, agents, Gateway, docs, scripts, iOS, plugin SDK, and extension guides were read; the review applied the protocol, TUI proof, and compatibility guidance. (AGENTS.md:1, 33f7c17f233f)
  • Current main still has the reported bare abort line: The current main TUI abort handler renders run aborted without using an abort diagnostic, so the PR is not obsolete on main. (src/tui/tui-event-handlers.ts:720, 33f7c17f233f)
  • Raw validation errors can contain model arguments: Tool validation errors include schema detail plus Received arguments, supporting the PR's choice to avoid forwarding raw validator text. (packages/llm-core/src/validation.ts:378, 33f7c17f233f)
  • Typed validation provenance added before tool execution: The merge result marks only validateToolArguments failures with errorKind: "argument-validation" before tool execution starts. (packages/agent-core/src/agent-loop.ts:922, 7d24317c9c68)
  • Sanitized summary boundary: The new helper only accepts a compact single-line validation summary and rejects empty, oversized, or control-character-bearing values. (src/agents/tool-error-summary.ts:41, 7d24317c9c68)
  • Gateway terminal projection preserves abort diagnostics: Gateway terminal projection uses the canonical terminal outcome helper and attaches the sanitized validation summary only to aborted chat payloads. (src/gateway/server-chat.ts:637, 7d24317c9c68)

Likely related people:

  • steipete: Blame and history show recent current-main ownership around TUI abort rendering, Gateway terminal classification, and agent-core validation, and the secure diagnostic rewrite commits on this branch are by this author. (role: recent area contributor and branch rewrite author; confidence: high; commits: 1f484a8dbde9, cd305b3b0cb9, e99827e12dc2; files: src/tui/tui-event-handlers.ts, src/tui/embedded-backend.ts, src/gateway/server-chat.ts)
  • flashosophy: Authored the recently merged delta-only assistant stream PR that touched sibling Gateway/TUI projection behavior now adjacent to this abort-diagnostic path. (role: adjacent TUI/Gateway projection contributor; confidence: medium; commits: 754fa3c921df, 3f1dea78753b; files: src/gateway/server-chat.ts)
  • vincentkoc: Recent history on agent-core and validation-adjacent runtime files makes this a low-confidence routing signal for the tool-validation side of the change. (role: adjacent agent-core contributor; confidence: low; commits: e085fa1a3ffd; files: packages/agent-core/src/agent-loop.ts, packages/llm-core/src/validation.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (5 earlier review cycles)
  • reviewed 2026-06-21T19:39:55.548Z sha d02e179d09954f055359d5f2a619fcdde0511bed :: needs real behavior proof before merge. :: [P1] Cover the Gateway-backed abort path
  • reviewed 2026-07-05T11:00:23.236Z sha 98926d9f26f8ae5cf00d82f73997a9bc7db2445f :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T11:41:17.817Z sha 72470c3c560bcb124e5bf4a13d5934b64b48d1bf :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T13:36:14.641Z sha cbb62f257c7e3c09d28177a28782bbe966955909 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T14:43:52.742Z sha 1d96f34 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jun 6, 2026
@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 6, 2026
@thegoldenflow

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Jun 6, 2026
@thegoldenflow

Copy link
Copy Markdown
Contributor Author

The code review is green (platinum hermit, security cleared) and proof: supplied is set. The remaining gate is a live TUI recording. I'm an external contributor without the reporter's Nemotron-3-Super / gpt-oss-120b + vLLM stack, so I can't reproduce the live loop locally — the before/after in the PR body is from the shipped 2026.6.1 build vs this branch's real source, with the argument payload confirmed stripped.

Could a maintainer trigger Mantis to capture the live abort line? Happy to adjust anything on the code side.

@steipete
steipete force-pushed the fix/90982-tui-abort-tool-error-summary branch from d02e179 to 98926d9 Compare July 5, 2026 10:40
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts size: L and removed size: M labels Jul 5, 2026
@steipete steipete changed the title fix(tui): show last tool-error summary on aborted runs fix(tui): surface safe tool-validation abort diagnostics Jul 5, 2026
@steipete

steipete commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Land-ready proof for exact rebased head 216059d151119d980d148cefe14d2f559f74d744:

  • node scripts/run-vitest.mjs packages/agent-core/src/agent-loop.test.ts packages/gateway-protocol/src/index.test.ts src/agents/embedded-agent-subscribe.handlers.lifecycle.test.ts src/agents/embedded-agent-subscribe.handlers.tools.test.ts src/agents/tool-error-summary.test.ts src/gateway/chat-abort.test.ts src/gateway/server-chat.agent-events.test.ts src/tui/embedded-backend.test.ts src/tui/tui-event-handlers.test.ts src/tui/tui-pty-local.e2e.test.ts — 683 tests passed across six routed focused shards, including the real Gateway and embedded --local PTY validation-loop abort scenarios.
  • Local protocol generation — idempotent for the JSON schema and generated Swift model.
  • Native post-sync pnpm build and pnpm check passed. Blacksmith Testbox-through-Crabbox tbx_01kwsaws5dsscynpfww3h4q4nj passed pnpm build plus pnpm protocol:check; Actions run https://github.com/openclaw/openclaw/actions/runs/28744008092.
  • Blacksmith Testbox-through-Crabbox tbx_01kwsd4hqs5m8pbycbm6as7wjw passed the Codex app-server runtime shard (448/448) in 17.6s, confirming the local macOS timeout was environmental; Actions run https://github.com/openclaw/openclaw/actions/runs/28745097310.
  • Fresh final Codex autoreview — no accepted/actionable findings after fixing stale diagnostic lifetime and preserving bare-abort, RPC-cancel, and timeout classification.
  • Exact-head GitHub CI — required checks monitored to green before merge.

The maintainer rewrite accepts only typed argument-validation provenance before tool execution, emits a fixed argument-free diagnostic, and routes terminal state through the canonical outcome merger. Raw validator paths/messages, model arguments, and arbitrary tool output cannot enter the TUI summary; timeout and failure precedence remain intact.

This final batch branch also carries the required maintainer changelog entries and contributor credit for #83000, #100209, and #100241, keeping those runtime branches independent of unrelated CHANGELOG.md churn on busy main.

@steipete
steipete force-pushed the fix/90982-tui-abort-tool-error-summary branch from 5667ea4 to 72470c3 Compare July 5, 2026 11:11
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 5, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 5, 2026
thegoldenflow and others added 6 commits July 5, 2026 10:27
When a run ends while looping on tool-call validation errors the TUI showed
only "run aborted". Carry the last tool failure on the terminal lifecycle
metadata and render a sanitized one-line summary on the abort line, e.g.
"run aborted: edit tool validation failed: edits: must have required properties edits".
Argument dumps are stripped; with no summary it stays "run aborted".

Refs openclaw#90982
@steipete
steipete force-pushed the fix/90982-tui-abort-tool-error-summary branch from cbb62f2 to 1d96f34 Compare July 5, 2026 14:27
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: ios App: ios cli CLI command changes commands Command implementations extensions: device-pair extensions: policy labels Jul 5, 2026
@steipete
steipete merged commit 95ebb3d into openclaw:main Jul 5, 2026
99 checks passed
@steipete

steipete commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Landed as 95ebb3dc1e7348b6048857b38042be0d9a2a6b45.

The final implementation carries a typed, argument-free validation diagnostic through agent-core, Gateway protocol, and both TUI backends while preserving canonical timeout/cancel/abort precedence. Exact-head CI was fully green; 683 focused tests, real Gateway and embedded PTY flows, protocol generation, native build/check, and Testbox build/protocol plus the 448-test Codex runtime shard all passed. Thanks @wsyjh8 for the original contribution.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 6, 2026
)

* fix(tui): show last tool-error summary on aborted runs

When a run ends while looping on tool-call validation errors the TUI showed
only "run aborted". Carry the last tool failure on the terminal lifecycle
metadata and render a sanitized one-line summary on the abort line, e.g.
"run aborted: edit tool validation failed: edits: must have required properties edits".
Argument dumps are stripped; with no summary it stays "run aborted".

Refs openclaw#90982

* fix(tui): secure abort validation diagnostics

* docs(changelog): move TUI fix to unreleased

* docs(changelog): aggregate TUI fixes

* fix(tui): scope abort validation diagnostics

* docs(changelog): restore unreleased spacing

* fix(tui): scope abort validation diagnostics

* fix(tui): scope abort validation diagnostics

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: ios App: ios app: web-ui App: web-ui cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: device-pair extensions: policy gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: XL 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.

[Bug]: TUI hides tool-call validation errors behind "run aborted" — root cause only visible in gateway log

2 participants