Skip to content

fix(tui): cap Protocol tab request/response bodies like the Network pane - #2597

Merged
cliffhall merged 1 commit into
v2/mainfrom
v2/fix/2539-protocol-tab-body-cap
Oct 5, 2026
Merged

cliffhall merged 1 commit into
v2/mainfrom
v2/fix/2539-protocol-tab-body-cap

Conversation

@cliffhall

Copy link
Copy Markdown
Member

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-tool tools/list) rendered thousands of lines with no truncation marker.

All five bodies now go through the shared BodyLines component 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 are zoom-* 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 reach tool_599.
  • App.test.tsx: the zoom modal is shorter than the cap, so the marker is never on screen there. Instead a passthrough spy on BodyLines asserts that the zoom renders each body (zoom-req/zoom-resp/zoom-msg) through the capped component. Both new App tests fail with the App.tsx change reverted.

npm run local:gate is green. In this sandbox it needed the sandbox's own NODE_USE_ENV_PROXY/HTTP(S)_PROXY variables unset. With them set, unrelated web /api/fetch integration tests and cli --relogin revocation 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

@cliffhall cliffhall added the v2 Issues and PRs for v2 label Oct 5, 2026
@cliffhall cliffhall linked an issue Oct 5, 2026 that may be closed by this pull request
@cliffhall
cliffhall requested a balanced review from Copilot October 5, 2026 11:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cliffhall

Copy link
Copy Markdown
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
cliffhall force-pushed the v2/fix/2539-protocol-tab-body-cap branch from 07e4e72 to fd294e2 Compare October 5, 2026 16:00
@cliffhall
cliffhall merged commit 4215228 into v2/main Oct 5, 2026
5 checks passed
@cliffhall
cliffhall deleted the v2/fix/2539-protocol-tab-body-cap branch October 5, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Issues and PRs for v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI Protocol tab renders request/response JSON with no size cap

2 participants