Repository navigation
fix(tui): keep failed attachments visible beside replies - #132115
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 5:45 PM ET / 21:45 UTC. ClawSweeper reviewWhat this changesThe PR makes the terminal UI show privacy-safe, actionable failed-attachment receipts alongside assistant reply text during live streaming and history reload. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readinessKeep open: this is a distinct, active TUI repair with no introduced correctness finding; the protected maintainer label and incomplete exact-head checks require normal human merge review. Priority: P2 Review scores
Verification
How this fits togetherGateway chat events and session history feed assistant messages into the terminal UI formatter, which renders live chat rows and rebuilt history. The change extends that shared presentation boundary to typed attachment failures. flowchart LR
A[Assistant message] --> B[Gateway chat event]
A --> C[Session history]
B --> D[Terminal UI formatter]
C --> D
D --> E[Stream finalization]
D --> F[History rebuild]
E --> G[Terminal chat log]
F --> G
Decision needed
Why: The protected maintainer label requires an explicit human merge decision even though source review found no actionable patch defect. Before merge
Agent review detailsSecurityNone. PR surfaceSource +7, Tests +248, Docs +1, Other 0. Total +256 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one terminal-specific formatter that converts the producer-owned typed outcome into generic safe receipt text, while keeping live finalization and history reconstruction on that same formatter. Do we have a high-confidence way to reproduce the issue? Yes—at the verified base/current-main SHA, attachment_error has no terminal formatter path, while final selection only uses successful attachment summaries as a fallback; failure-only and caption-plus-failure cases are directly derivable from source. This review did not execute the supplied harness. Is this the best way to solve the issue? Yes—the shared terminal formatter is the narrow owner for rendering this terminal-specific, privacy-safe receipt across both live finalization and history reload, without changing the Gateway producer contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5b605da38946. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Maintainer review completed. The net seven production lines are accepted for the missing typed-outcome boundary: validation and privacy-safe presentation of attachment failures cannot be supplied by the successful-attachment fallback. The patch keeps one shared content formatter, reuses the canonical receipt wording, removes the local record guard and fallback-only argument, and covers final/stream/history ownership without duplicated rendering. No correctness/security finding or separate Rank-up move remains in the latest review. The exact-head CI failure is separately confirmed: all five substantive failing jobs stop at the unchanged shared Control UI startup gzip gate, while 160 jobs pass. I am repairing that startup owner boundary and will refresh/retest this PR before the native prepare/merge flow. No gate bypass or landing is claimed. |
f5773d0 to
8323b12
Compare
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where TUI users received no visible failed-attachment outcome when an assistant reply contained a typed attachment error. A failure-only reply became empty history or
(no output), while a caption hid the error entirely.Why This Change Was Made
The TUI's canonical content formatter now combines the selected reply with actionable attachment failures instead of treating all attachments as a fallback for missing text. History and final stream assembly share that owner. The existing reply-media formatter supplies the wording, while the TUI retains generic media-kind labels so private filenames, source URLs and terminal escape sequences do not leak into the display.
Final text still takes precedence over streamed text, then an actual error and successful-attachment fallback. Failure receipts are composed after that selection, so a failure-only final cannot erase an already streamed caption. The optimistic projection keeps the rendered receipt once; authoritative history can replace it without duplicating it. Failure-only aborts remain cancellation diagnostics rather than successful final output.
This removes the duplicate record-coercion helper and makes the successful-attachment helper private after migrating its sole production caller. Production LOC: +37/-30 (net +7; including the ownership comment). The small remaining growth implements validation and presentation of a typed failure variant the TUI previously could not render; failure wording and final selection are reused rather than duplicated. The assertion baseline is reduced by one, not relaxed. No configuration, protocol, SDK, dependency or persistent-store change.
Provenance: #131826 introduced the typed failure producer (8bd8958, 2026-08-28; code author, PR author and merger @vyctorbrzezowski). That made the missing TUI consumer visible. The successful-attachment-only fallback dates to #117460 (b83a966, code author @steipete); it predates the new failure variant.
User Impact
TUI replies and reloaded history now retain the actionable attachment failure beside the answer, without exposing attachment sources. The TUI documentation describes this behavior. This is the release-note context for the repair.
Evidence
The complete six-path changed-file gate passed, including production/test typechecking, core/script lint and the selected architecture guards. Independent isolated Codex review found no actionable findings. No landing is claimed before exact-head hosted CI and the native merge workflow complete.
Root reproduction on unchanged main observed empty history and
(no output)for a failure-only reply, and onlyYour recordingfor a caption plus failure. The first regression run had 12 intended failures. The repaired owner/formatter/assembler suite passes 126 tests; 94 selected event, ChatLog and Markdown sibling tests also pass (172 others intentionally filtered, not counted). Root independently reran the original formatter/assembler reproduction on Node 24 and confirmed both repaired outcomes.The real ChatLog renderer is exercised through final events, streamed captions, optimistic history and authoritative history replacement, with an exactly-once receipt assertion. All media kinds and failure codes, mixed success/failure content, error precedence, thinking visibility, aborted runs and private source metadata are covered.
Before, caption plus failed audio:
After:
Native PTY replays are on an explicit campaign hold, so this is real renderer/event-flow proof, not a launched terminal UI, authenticated Gateway, provider or live-channel test. No held test, operator Gateway, state directory or credentials were touched.
Validation recovery: the assertion ratchet required its legitimate 5-to-4 reduction after removing a cast. A missing isolated-checkout UI dependency link initially selected old transitive
pako; linking the already-installed declared UI package resolved it, and the full gate passed. No dependency installation or guard suppression was used.Shared CI follow-up: #132102 and #132105 independently encounter the current main-composition startup gzip budget overrun. This TUI patch does not alter UI source, the budget, or its baseline; that owner-level repair is being investigated separately before landing.