Repository navigation
fix: show the whole reply when you reopen a TUI session - #200455
Conversation
TUI history used chat.history rows as returned, so assistant replies over 8,000 characters stayed cut with "...(truncated)..." after a session was reopened. Load display-capped assistant rows in full with chat.message.get (Gateway mode) or the same single-message read in-process (--local), and mark the preview when the full text cannot be loaded. Closes openclaw#200408
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThe TUI retrieves stored text for display-capped assistant replies when reopening Gateway and local sessions. Example: Reopen a session containing an 11,532-character assistant reply.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open for landing: it fixes a current TUI history defect, addresses the earlier findings, and has passing exact-head gates with no identified blocking defects. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe TUI backends read bounded session-history pages, retrieve full stored messages for capped assistant rows, and pass the resulting messages to the terminal renderer. flowchart LR
A[Reopen TUI session] --> B[Gateway or local backend]
B --> C[Bounded history page]
C --> D[Find capped assistant rows]
D --> E[Existing stored message reader]
E --> F[Full reply or marked preview]
F --> G[Terminal renderer]
Technical reviewBest possible solution: Land the existing-reader hydration approach while preserving bounded history selection and visible retrieval-failure markers. Do we have a high-confidence way to reproduce the issue? Current-main source retains capped history without expansion, corroborated by the linked official-version report and before screenshot; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch reuses the existing full-message reader, preserves history budgets and startup retries, and handles unavailable messages without replacing readable previews. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c7824fb4d2b0. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +216, Tests +186, Other +1. Total +403 across 7 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)Reviewed November 25, 2026, 8:33 PM ET / November 26, 2026, 01:33 UTC (Revision 3). |
Local mode loaded full text before the per-message and page budgets, so a reply over 128 KiB became an omission placeholder and expanded rows could push older rows off the page. Move the local history read into embedded-history-messages.ts and load full text after the budgets pick the rows, with the same limits as chat.message.get, so local and Gateway mode show the same reply. Unavailable replies now say to reopen the session to retry.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…irement-rule * origin/main: (172 commits) test(gateway): expect a revoked person's Goal retry to be hidden as not found (#205698) fix: keep browser disabled when only hardening relay authentication (#203137) fix: recover Linux stream automations after command-anchor crashes (#203149) fix(whatsapp): identify voice-note captions as text in delivery receipts (#205381) fix(test): unblock restart-auth plugin and worker publication qualification (#205679) chore(ui): refresh control ui locales (#205691) fix: reduce memory during SQLite usage refresh (#201064) fix(plugins): readmit native captures with a dangling host link chore(i18n): refresh native locales (#205680) fix(update): hash SQLite lock bytes as zeros so Windows exclusion cannot fail verification (#205668) fix(skill-workshop): skip the skill diet for skills with Markdown outside support directories (#204881) fix(plugins): clarify dated SDK migration notices (#200932) fix: keep the resident launcher when reinstalling Gateway (#205655) fix: show the whole reply when you reopen a TUI session (#200455) test(ui): wait for restored speech player authorization (#199502) feat: let agents post approved GitHub comments (#204301) fix(agents): honor imageMaxDimensionPx at the provider and CLI image handoffs (#205663) chore(ui): refresh control ui locales (#205664) fix(google): preserve playback when Google Live splits audio into parts (#205364) fix: show named characters in exported session messages (#205362) ...
) * fix(tui): show full replies after reopening a session TUI history used chat.history rows as returned, so assistant replies over 8,000 characters stayed cut with "...(truncated)..." after a session was reopened. Load display-capped assistant rows in full with chat.message.get (Gateway mode) or the same single-message read in-process (--local), and mark the preview when the full text cannot be loaded. Closes openclaw#200408 * fix(tui): load full replies after local history budgets Local mode loaded full text before the per-message and page budgets, so a reply over 128 KiB became an omission placeholder and expanded rows could push older rows off the page. Move the local history read into embedded-history-messages.ts and load full text after the budgets pick the rows, with the same limits as chat.message.get, so local and Gateway mode show the same reply. Unavailable replies now say to reopen the session to retry. * fix(tui): reuse the history session field reader and include its dependency --------- Co-authored-by: Vincent Koc <[email protected]>
* fix(tui): show full replies after reopening a session TUI history used chat.history rows as returned, so assistant replies over 8,000 characters stayed cut with "...(truncated)..." after a session was reopened. Load display-capped assistant rows in full with chat.message.get (Gateway mode) or the same single-message read in-process (--local), and mark the preview when the full text cannot be loaded. Closes #200408 * fix(tui): load full replies after local history budgets Local mode loaded full text before the per-message and page budgets, so a reply over 128 KiB became an omission placeholder and expanded rows could push older rows off the page. Move the local history read into embedded-history-messages.ts and load full text after the budgets pick the rows, with the same limits as chat.message.get, so local and Gateway mode show the same reply. Unavailable replies now say to reopen the session to retry. * fix(tui): reuse the history session field reader and include its dependency --------- Co-authored-by: Vincent Koc <[email protected]> (cherry picked from commit 4fa3be0)
* fix(tui): show full replies after reopening a session TUI history used chat.history rows as returned, so assistant replies over 8,000 characters stayed cut with "...(truncated)..." after a session was reopened. Load display-capped assistant rows in full with chat.message.get (Gateway mode) or the same single-message read in-process (--local), and mark the preview when the full text cannot be loaded. Closes #200408 * fix(tui): load full replies after local history budgets Local mode loaded full text before the per-message and page budgets, so a reply over 128 KiB became an omission placeholder and expanded rows could push older rows off the page. Move the local history read into embedded-history-messages.ts and load full text after the budgets pick the rows, with the same limits as chat.message.get, so local and Gateway mode show the same reply. Unavailable replies now say to reopen the session to retry. * fix(tui): reuse the history session field reader and include its dependency --------- Co-authored-by: Vincent Koc <[email protected]> (cherry picked from commit 4fa3be0) Companion audit: No direct later reference follow-up; sender-independent stable chat.message.get and its in-process history reader already exist. Co-authored-by: RomneyDa <[email protected]>
Closes #200408
What Problem This Solves
In
openclaw tui, a reply longer than 8,000 characters is complete while it streams, but after you close and reopen the session it stops mid-sentence with...(truncated).... The full reply is stored, yet the TUI gives no way to see the rest, so it looks as if the model stopped early or text was lost.User Impact
User impact: reopening a TUI session (Gateway or
--local) shows long replies in full again. If the full text cannot be shown, the preview stays and says why, instead of ending silently.Why This Change Was Made
The Gateway caps text in
chat.historyto keep history pages small. The Control UI already loads capped rows in full throughchat.message.get(#122207); the TUI took the capped text as it came. The TUI now does the same as the Control UI: after loading history, each assistant row markedtruncated: true/reason: "display-cap"is replaced by the stored message, newest first, four reads at a time. History pages stay bounded, and there are no protocol or schema changes.When the full text cannot be shown, the preview is kept and its marker says why:
chat.message.get:...(truncated; couldn't load the full reply. Reopen the session to try again)...(same advice as the Control UI's "Couldn't load the full message. Try again.")chat.message.getreports the stored reply as oversized (over its ~25 MB payload limit):...(truncated; the full reply is too large to show here)...Local mode (
openclaw tui --local) had the same cap. Its history read moves fromembedded-backend.tsintosrc/tui/embedded-history-messages.ts, unchanged, and full text is loaded after the existing budgets pick the rows (the 128 KiB per-message limit and the page limit), so loading full text never drops an older row from the page. The stored message is then read in-process with the same limits as the Gateway'schat.message.gethandler, so both modes show the same reply. A reply over 128 KiB shows in full in both. As with Gateway clients, a page with loaded replies can end up over its byte budget.The first revision of this PR loaded local full text before those budgets. A reply over 128 KiB then became
[chat.history omitted: message too large]instead of its preview, and expanded rows could push older rows off the page. This revision fixes both.Known limit, left as is:
chat.message.getcaps text at 1,000,000 characters, so in both modes a longer reply loads its first million characters, ending in the plain...(truncated)...marker. Command-line runs (openclaw agent) are not affected by any of this: they print the run result, not history.Evidence
Live check, Windows 11, against a running 2026.11.5-beta.4 Gateway: the session from #200408 holds an 11,532-character reply that
chat.historyreturns as 8,018 characters ending...(truncated).......(truncated)....THE END.Before:
After (Gateway):
After (
--local): live run of this branch,openclaw tui --local --session agent:main:proof, Windows 11. The run used throwawayHOME,OPENCLAW_HOME,OPENCLAW_STATE_DIR, config andOPENCLAW_WINDOWS_TASK_NAME. The session holds two stored assistant replies, written with the repo's own transcript writer (upsertSessionEntryCore+replaceTranscriptEvents). An 8,000-character preview of either stops partway through paragraph 72.THE END: after reopening, it shows in full (paragraphs 1–103 andTHE END).HUGE_REPLY_LAST_LINE), as it does over the Gateway.The
src/tui/tui-pty-local.e2e.test.tsharness times out on this Windows machine (its own existing cases too), so this was a manual run in a terminal. The retrieval-failure case can't be triggered live without corrupting storage; the unit tests below cover it.Reopened TUI screen text (repeated middle paragraphs elided)
Focused tests:
src/tui/gateway-chat.test.ts: a capped row is replaced by thechat.message.getresult; when the read reports unavailable, reports oversized, or is rejected, the preview is kept with the matching marker.src/tui/embedded-history-messages.test.ts(new) runs the real history budgets with synthetic transcript rows: a capped reply shows its stored text; a 150,000-character stored reply shows in full; a reply the reader reports oversized, and a missing reply, keep their marked previews; loading a 30,000-character reply under a 40,000-byte page budget keeps the older 15,000-character row. The 150,000-character and page-budget cases fail when full text is loaded before the budgets (the order in the first revision) and pass here.gateway-chat.test.ts,embedded-backend.test.tsandembedded-history-messages.test.ts: 172 passed.pnpm check:changed: typecheck, lint, format, line-cap and mock-export ratchets pass. The dead-export scan reports three exports in untouched files that are already onmain(approval-shared.ts,spawn-broker/host.ts,system-agent/operation-types.ts).