Skip to content

fix(tui): preserve hanging prefixes in tool cards - #15679

Merged
H4vC merged 1 commit into
mainfrom
farm/215311b3/fix-tool-card-hanging-wrap
Oct 14, 2026
Merged

H4vC merged 1 commit into
mainfrom
farm/215311b3/fix-tool-card-hanging-wrap

Conversation

@roboomp

@roboomp roboomp commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

Repro

At width 60, Write preview rows with long English/CJK text resume beside the frame border rather than beneath the line number; a grouped Read URL starts after a bare ├─ on the next row. Reproduced before the fix with bun run /tmp/omp-15677-repro.ts (the issue's renderer script using repository imports); the committed regression can be run with bun test packages/tui/test/tool-hanging-wrap.test.ts.

Cause

renderOutputBlock and Text.render applied wrapTextWithAnsi to flattened rows after writeToolRenderer, ReadToolGroupComponent.#appendSummaryRow, and other renderers joined their structural prefix with content. The generic wrapper had no continuation prefix to retain.

Fix

  • Add wrapPrefixedLine and wrapTreeLine to hang ANSI-aware content beneath line gutters and tree branches.
  • Wrap Write/Read code previews, grouped Read summaries, Edit streaming diffs, Todo rows, Ask options, and LSP hover code rails at their card's content width; retain width-independent highlighted Write caches.
  • Cover streaming/finished CJK Write, long Read URLs and numbered previews, Edit rails, Todo branches, Ask descriptions, and LSP hover rails; update the TUI changelog.

Verification

bun test packages/tui/test/tool-hanging-wrap.test.ts packages/tui/test/output-block.test.ts packages/tui/test/transcript-committed-release.test.ts packages/tui/test/tools-native-search.test.ts: 45 pass; bun run check:types in packages/tui: pass; live width-60 renderer smoke: Write continuations and grouped Read URL hang under their prefixes. gh_push_branch passed bun run fix and bun check. Skipped PR pre-publish gate: bun run test fails on pre-existing origin/main failures, verified with the same test paths on a clean origin/main snapshot: outdated native addon 18.8.8 vs 18.10.4 (browser-relay-daemon.test.ts and debug-server.test.ts), two grep-internal-urls.test.ts assertions, and one usage-cli.test.ts assertion; bun run build:native cannot rebuild here because cmake is unavailable. The changed TUI package suite passed 3598 tests with only the same default-branch debug-server.test.ts native failure. The ignored HTML tool-view asset was generated before the full-suite attempt. Fixes #15677

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T19:09:34.945805Z 2b0b800 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@roboomp

roboomp commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

The review-summary comment only says the review is running; there is no finding or requested change in the PR thread yet. Which specific change should I make?

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6428084c10

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/tui/src/tools/ask.ts Outdated
const optLabel = renderInlineMarkdown(opt.label, mdTheme, t => uiTheme.fg("muted", t));
out.push(` ${uiTheme.fg("dim", optionMarker(uiTheme, multi, false))} ${optLabel}`);
const marker = ` ${uiTheme.fg("dim", optionMarker(uiTheme, multi, false))} `;
out.push(...wrapPrefixedLine(marker, " ".repeat(visibleWidth(marker)), optLabel, width));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve option prefixes after Ask completes

When an Ask option has a long label, this wraps the pending call beneath its marker, but the completed card switches to renderAnswerOptionLines, which still emits a single prefixed string for renderOutputBlock to wrap generically. Consequently, submitting the answer makes continuation rows jump back to the card's left edge; apply the same prefixed wrapping to the result path as well.

AGENTS.md reference: AGENTS.md:L241-L246

Useful? React with 👍 / 👎.

Comment thread packages/tui/src/tools/lsp.ts Outdated

const rail = ` ${theme.fg("mdCodeBlockBorder", theme.boxRound.vertical)} `;
const contentLines =
codeBlockMatch && expanded

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply rail wrapping to collapsed LSP hovers

For an LSP hover whose first code line exceeds the card width, collapsing the card bypasses this branch even though renderHover still emits the same code rail in collapsed mode. renderOutputBlock then wraps the whole row generically, so the continuation starts beside the frame rather than beneath the rail; toggling from expanded to collapsed therefore reintroduces the alignment defect.

AGENTS.md reference: AGENTS.md:L241-L246

Useful? React with 👍 / 👎.

@roboomp

roboomp commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author
  • Answered Ask option labels now hang under their markers in single and grouped result cards; the regression covers selected and unselected long labels (a055431fd9).
  • Collapsed LSP hover code rails now use the same hanging wrap as expanded hovers, with both states covered (a055431fd9).
    Verification: 16 focused tests passed; TUI typecheck passed; live width-60 renders confirmed both continuations.

- Wrapped answered Ask labels at the card content width for single and grouped questions.

- Applied hover code-rail wrapping to collapsed as well as expanded LSP cards.

Fixes #15677
@H4vC
H4vC force-pushed the farm/215311b3/fix-tool-card-hanging-wrap branch from a055431 to 2b0b800 Compare October 14, 2026 19:05
@H4vC
H4vC merged commit 9799a3c into main Oct 14, 2026
6 of 7 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

? [{ content: bodyLines.flatMap(line => wrapEditRendererLine(line, Math.max(1, width - 2))) }]

P2 Badge Recount streaming diff rows with continuation gutters

When a streaming Edit preview contains several long diff lines, sliceStreamingDiffTail budgets them using wrapTextWithAnsi(rawLine, innerWidth), but this new render step wraps each highlighted line at innerWidth - gutterWidth so every continuation can consume more rows than the selector counted. For example, lines around two card-widths can be counted as two rows and rendered as three, allowing the live card to exceed previewWindowRows() and reintroducing the stale/duplicated transcript behavior that the tail cap is meant to prevent; use the same gutter-aware row calculation during selection or re-cap the resulting wrapped rows.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tui: tool-card rows with a line-number or tree prefix wrap back to column 0 (Write/Read previews, Read group)

2 participants