Repository navigation
fix(tui): cap Protocol tab request/response bodies like the Network pane - #2597
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The shared cap is applied consistently across all changed Protocol rendering paths with focused regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Caps TUI Protocol payload rendering by reusing the Network pane’s bounded body renderer.
Changes:
- Routes Protocol detail and zoom bodies through
BodyLines. - Adds coverage for large requests, responses, and notifications.
- Updates shared component documentation.
| File | Description |
|---|---|
clients/tui/src/App.tsx |
Caps Protocol zoom bodies. |
clients/tui/src/components/HistoryTab.tsx |
Caps Protocol pane bodies. |
clients/tui/src/components/BodyLines.tsx |
Documents expanded usage. |
clients/tui/__tests__/App.test.tsx |
Verifies zoom routing through BodyLines. |
clients/tui/__tests__/HistoryTab.test.tsx |
Verifies truncation of large payloads. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Member
Author
|
Copilot review loop closed: round 1 came back clean (no inline comments, no headline findings, no suppressed comments), so per pr-flow 7c no further round was requested. |
The Protocol tab (HistoryTab) and its App zoom view rendered each message and response with an uncapped JSON.stringify, so a large payload (e.g. a 300-tool tools/list) rendered thousands of lines with no truncation marker. Route all five bodies through the shared BodyLines component (#2407), so both tabs apply the same 500-line / 2,000-char caps and report what was cut. Closes #2539 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
cliffhall
force-pushed
the
v2/fix/2539-protocol-tab-body-cap
branch
from
October 5, 2026 16:00
07e4e72 to
fd294e2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2539
What changed
The TUI Protocol tab rendered each message and response with an uncapped
JSON.stringify(…, null, 2)— one<Box>per line in the details pane, and one huge<Text>in the+zoom view — so a large payload (a 300-tooltools/list) rendered thousands of lines with no truncation marker.All five bodies now go through the shared
BodyLinescomponent from #2407, so the Protocol tab applies exactly the same caps as the Network pane (500 lines, 2,000 chars per line, with the… N more lines not shown (M total)marker) and the two views cannot drift apart:clients/tui/src/components/HistoryTab.tsx— request, response, and response/notification bodies in the details pane.clients/tui/src/App.tsx(renderMessageDetails) — the same three in the Protocol zoom view. Their key prefixes arezoom-*so tests can tell the modal's bodies apart from the pane's.clients/tui/src/components/BodyLines.tsx— header comment updated to name its new callers.Tests
HistoryTab.test.tsx: a 600-tool request+response, response, and notification each render the cap marker and never reachtool_599.App.test.tsx: the zoom modal is shorter than the cap, so the marker is never on screen there. Instead a passthrough spy onBodyLinesasserts that the zoom renders each body (zoom-req/zoom-resp/zoom-msg) through the capped component. Both new App tests fail with theApp.tsxchange reverted.npm run local:gateis green. In this sandbox it needed the sandbox's ownNODE_USE_ENV_PROXY/HTTP(S)_PROXYvariables unset. With them set, unrelated web/api/fetchintegration tests and cli--reloginrevocation tests send their localhost fetches through the sandbox gateway and fail. Those failures are environmental and have nothing to do with this diff.Screenshots
I couldn't capture any. This ran in a headless sandbox with no terminal to screenshot the Ink TUI in. The rendered frames are asserted in the tests above.
🤖 Generated with Claude Code