Repository navigation
fix(tui): load long replies whole when reopening a session - #200437
harsha-7179 wants to merge 1 commit into
Conversation
The TUI requested chat.history without a text limit, so the Gateway applied its 8,000-character display cap and replies ended in "...(truncated)..." after a session was reopened. The TUI renders history rows as-is and has no per-message expansion. Request whole replies (maxChars 500,000, the protocol maximum) in both the Gateway and --local backends. Tool results keep the default 8,000-character preview through toolResultMaxChars. Fixes 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 real behavior proof before merge. What this changesThis PR requests larger reply previews when restoring history in Gateway and local TUI modes. Example: Reopen tidepool-test with an 11,532-character assistant reply ending in THE END.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this PR addresses a confirmed TUI bug, but raising the history cap can replace very long replies with an omission placeholder. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherBoth TUI backends obtain display-projected session history from the Gateway history owner, then render the returned rows directly. flowchart TD
A[Stored session transcript] --> B[Gateway history projection]
C[Gateway TUI request] --> B
D[Local TUI reader] --> B
B --> E[History byte limits]
E --> F[TUI session renderer]
Technical reviewBest possible solution: Preserve bounded history previews and recover complete assistant entries through the existing full-message owners in both TUI backends. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the default-cap-to-renderer failure path, corroborated by the reporter's screenshot and paired RPC measurements; no target code was executed. Is this the best way to solve the issue? The small parameter change restores ordinary long replies but misses the independent 128 KiB history-row limit, making existing full-message retrieval the safer complete solution. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against df195574149f. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +14, Tests +2, Docs +1. Total +17 across 6 files. Added test files: 0. 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: No label 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 Reviewed November 17, 2026, 1:18 AM ET / 06:18 UTC. |
|
Thank you, @harsha-7179, for tracing the 8,000-character cutoff in both TUI backends and testing reopened replies. @woodmanlegion’s original fix landed in 4fa3be0 and resolved the reported issue. Both backends now keep their history-page budgets and fetch the stored text for an individual capped reply. If that read fails or the reply exceeds its limit, the preview explains what happened. Closing this alternative because the landed fix covers the same reopen behavior. Its documentation for a 500,000-character history request was specific to the approach proposed here. |
Fixes #200408
What Problem This Solves
After
openclaw tuiis closed and reopened on a session, an assistant reply longer than 8,000 characters ends in...(truncated).... The stored reply is complete, and the TUI showed it in full before it was closed.The TUI requested
chat.historywithsessionKey,agentIdandlimitonly, so the Gateway applied its default 8,000-character display cap. The TUI renders history rows as-is and has no per-message expansion, so the capped text looked like the whole reply.openclaw tui --localapplied the same default cap.User Impact
Reopened TUI sessions show each reply in full, up to 500,000 characters. Tool results keep the Gateway's default 8,000-character preview, so history payloads grow only by the long replies themselves.
Why This Change Was Made
The issue names two documented routes: a per-request
maxCharsonchat.history, orchat.message.getper truncated entry (what the Control UI does). This PR takes the first.maxChars: 500000(the schema maximum) andtoolResultMaxChars: 8000onchat.history.--localpasses the same two limits toreadChatHistoryPage.src/tui/tui-backend.tsso the two backends cannot drift.maxCharswas chosen overchat.message.getbecause the TUI has no lazy-expansion surface: it would have to fetch every truncated row before rendering anyway, which adds a hydration step, concurrency bounds and a failure fallback for the same result. The Control UI's complete-history read already usesmaxChars: 500_000. I am happy to switch routes if maintainers preferchat.message.get; another contributor proposed that route on the issue.Accepted limits:
toolResultMaxCharswould have its history request rejected as an unknown parameter. I could not determine which release added the parameter; please say if a fallback is wanted.Evidence
Real Gateway over WebSocket (temporary test in
src/gateway/server.chat.gateway-server-chat-b.test.ts, not committed): a stored 11,532-character assistant reply ending inTHE END, read with the TUI's old and newchat.historyparameters.limitonlytruncated: true,reason: "display-cap"...(truncated)...maxChars: 500000,toolResultMaxChars: 8000THE ENDThe 8,018 matches the issue report (8,000 cap plus the 18-character marker).
Checks run on this head:
pnpm exec vitest run src/tui/gateway-chat.test.ts src/tui/embedded-backend.test.ts: 164 passed. The updated assertions cover the request parameters in Gateway mode and the page-reader parameters in--localmode.pnpm tsgo:core: passed.pnpm format:checkon the touched files: passed.Not done: the reopened reply has not been viewed in a live
openclaw tuiwith a real model. The development container had no systemd user session for the launcher's Gateway check and no configured model provider.