Repository navigation
fix(tui): surface error detail in abort notification (fixes #90982) - #91701
zenglingbiao wants to merge 1 commit into
Conversation
When an agent run aborts during the error lifecycle phase, the TUI now includes the error message in the abort notification instead of showing only the generic 'run aborted' text. Previously emitChatAborted did not forward errorMessage, unlike its sibling emitChatError which already passed error details. This made tool-call validation failures, model errors, and timeouts look identical to the user. Fixes openclaw#90982
|
Codex review: needs real behavior proof before merge. Reviewed June 9, 2026, 9:02 AM ET / 13:02 UTC. Summary PR surface: Source +6. Total +6 across 2 files. Reproducibility: no. live reproduction was established in this review. The current-main source path is source-reproducible: an error-phase aborted lifecycle event has access to Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the narrow TUI propagation and land it after redacted real behavior proof shows an embedded TUI error-phase abort displaying the detail while plain aborts still fall back to the generic message. Do we have a high-confidence way to reproduce the issue? No live reproduction was established in this review. The current-main source path is source-reproducible: an error-phase aborted lifecycle event has access to Is this the best way to solve the issue? Yes, the proposed code path is the narrowest maintainable fix: it reuses the existing optional AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 65848d0b4524. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +6. Total +6 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
|
Summary
emitChatAbortedinsrc/tui/embedded-backend.tsdid not accept or forward anerrorMessageparameter, unlike its sibling methodemitChatErrorwhich already forwards error details. Thephase === "error"+abortedcall site had access toevt.data.errorbut did not pass it through.errorMessageparameter toemitChatAborted, pass it through in the emit payload, and display it in the TUI abort handler when present.src/tui/embedded-backend.ts—emitChatAbortednow accepts optionalerrorMessage; thephase === "error"+abortedcall site extracts and forwardsevt.data.errorsrc/tui/tui-event-handlers.ts— abort handler now appends the error message whenevt.errorMessageis non-emptychat-abort.tsabort event emission (out of scope; the gateway path emitsstopReasonseparately)phase === "end"+abortedpath (no error context is available there)emitChatError/renderTerminalRunError) — those already surface errors correctlyReproduction
run aborted— no indication of the tool validation failurerun aborted: Validation failed for tool "edit": edits: must have required properties editsReal behavior proof
Behavior or issue addressed (90982): When an agent run aborts during the error lifecycle phase with a known error message, the TUI now includes that error detail in the abort notification so users can distinguish tool validation failures from timeouts or model crashes.
Real environment tested: Linux, Node 22 — Vitest with the TUI vitest config against
emitChatAbortedand the chat event handlerExact steps or command run after this patch:
node scripts/run-vitest.mjs src/tui/embedded-backend.test.ts src/tui/tui-event-handlers.test.tsEvidence after fix:
Observed result after fix: The
emitChatAbortedmethod now forwards an optionalerrorMessagethrough the chat event payload; the TUI event handler consumes it and rendersrun aborted: <error>when an error message is present, falling back to the originalrun abortedtext when none is available. The existing test suite (109 tests across both colocated test files) continues to pass.What was not tested: A live agent run across an embedded gateway that actually triggers repeated tool validation failures and observes the TUI render output. The unit tests exercise the emit and handler paths but not the full embedded-runner lifecycle integration.
Repro confirmation: The before state shows
emitChatAbortedemitting only{ runId, sessionKey, state: "aborted" }with no error detail; the after state includeserrorMessagein the emit payload when available, matching the pattern already used byemitChatError.Risk / Mitigation
errorMessagefield is already an optional part of theTuiChatEventtype (state: "delta" | "final" | "aborted" | "error"witherrorMessage?: string), so adding it to the abort variant is backwards-compatibleMitigation: External TUI consumers that already handle
evt.errorMessagefor theerrorstate will see it forabortedevents too; consumers that don't will ignore the new fieldevt.data.errorcould be very long, making the abort line noisyMitigation: The error text from the lifecycle event is typically a one-line summary (e.g., "Validation failed for tool X: ..."), not a full stack trace
Change Type (select all)
Scope (select all touched areas)
Regression Test Plan
node scripts/run-vitest.mjs src/tui/embedded-backend.test.tsnode scripts/run-vitest.mjs src/tui/tui-event-handlers.test.tsReview Findings Addressed
N/A (initial submission)
Linked Issue/PR
Fixes #90982