Repository navigation
fix(tui): prevent unsafe errors and out-of-order streamed replies - #114869
Conversation
Co-authored-by: Marnie0415 <[email protected]>
Co-authored-by: Foxy6670 <[email protected]>
Co-authored-by: Foxy6670 <[email protected]>
Co-authored-by: Foxy6670 <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed July 27, 2026, 10:43 PM ET / July 28, 2026, 02:43 UTC. ClawSweeper reviewWhat this changesThe branch routes TUI failures through the existing redacting terminal-safe formatter and splits cumulative assistant streams around tool output so rendered replies remain chronological after updates, cancellations, and revisions. Merge readinessKeep this PR open for normal maintainer review. The supplied patch is a focused repair for TUI secret-safe errors and streamed reply ordering, with substantial terminal-oriented proof, but it is protected by the Priority: P1 Review scores
Verification
How this fits togetherOpenClaw’s terminal UI receives operational failures and streamed chat/tool events from its backend, then renders them into the interactive chat log and stderr. This patch normalizes unsafe error inputs before display and changes how assistant stream state is segmented around tool rows. flowchart LR
A[Gateway and backend events] --> B[TUI event handlers]
C[Operational errors] --> D[Shared error formatter]
B --> E[Chat log state]
D --> F[System notices and stderr]
E --> G[Assistant and tool segments]
G --> H[Terminal UI output]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +128, Tests +271. Total +399 across 13 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Rebase this focused repair onto current Do we have a high-confidence way to reproduce the issue? No high-confidence independent reproduction was run in this read-only review. The supplied focused tests and PTY fixture describe concrete current-main failure paths for nested error display and cumulative assistant snapshots around tool events. Is this the best way to solve the issue? Yes, provisionally: using the existing shared error formatter and keeping stream segmentation in the ChatLog owner avoids parallel formatting policy or protocol changes. The final merge-head PTY verification remains important because the ordering fix changes live per-run display state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4273ca9dbd9b. LabelsLabel changes:
Label 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
|
|
Merged via squash.
|
…enclaw#114869) * fix(tui): redact and sanitize terminal errors Co-authored-by: Marnie0415 <[email protected]> * fix(tui): keep streamed answers and tools chronological Co-authored-by: Foxy6670 <[email protected]> * fix(tui): keep revised answers after tool calls Co-authored-by: Foxy6670 <[email protected]> * fix(tui): discard retracted streamed assistant rows Co-authored-by: Foxy6670 <[email protected]> --------- Co-authored-by: Marnie0415 <[email protected]> Co-authored-by: Foxy6670 <[email protected]>
Related: #104639
Related: #103147
What Problem This Solves
Fixes an issue where TUI users saw raw errors that could expose bearer tokens or terminal control sequences when a Gateway, session, model, shell, or startup operation failed. Fixes an issue where streamed assistant replies appeared above intervening tool calls, duplicated text across multiple tools, or left stale text after cancellations or provider snapshot revisions.
Why This Change Was Made
Routes every affected TUI error through one existing-contract, cause-aware, secret-redacting, terminal-safe formatter. Keeps chronological segmentation in the ChatLog owner without changing Gateway protocol, provider catalogs, TUI verbosity, dependencies, or user configuration. Frozen assistant segments remain owned by their run and safely reconcile revised or retracted provider snapshots.
This independently validated current-main fix is based on the concrete reports in #104639 by @Marnie0415 and #103147 by @Foxy6670. Both contributors are credited in the corresponding git commits. The broader tool-card and verbosity product changes proposed in #103147 are intentionally not bundled.
User Impact
TUI errors retain helpful nested causes without leaking secrets or ANSI/OSC controls. Assistant text appears in the correct order around tool calls; indentation, repeated calls, run cancellation, revised snapshots, empty retractions, and removal of abandoned assistant rows remain correct.
Evidence