Skip to content

fix(native-chat): wrap long background task summaries instead of widening the chat - #47359

Merged
nwparker merged 1 commit into
stablyai:mainfrom
A0150315:fix/native-chat-background-task-wrap
Nov 23, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
A0150315:fix/native-chat-background-task-wrap

Conversation

@A0150315

@A0150315 A0150315 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Sometimes a background task finishes with a summary that is one very long "word" with no spaces, such as a long id or a line of JSON. The chat tried to fit that whole word on one line, so the conversation got wider than the window and a sideways scrollbar appeared. Now the long word wraps onto several lines and the chat stays the width of the window.

What Changed

  • Before: the result sentence under a background task row (summary, or error when there is no summary) never broke inside a long token. A 1,600-character token stretched the transcript to about 11,000px and put a horizontal scrollbar across the whole chat.
  • After: the sentence wraps inside the message column and the transcript has no horizontal overflow. Text with normal spaces still wraps at the spaces, as before.
  • Mechanism: the result <p> in NativeChatBackgroundTaskRun used the default overflow-wrap: normal, so an unbroken token set the paragraph's min-content width. That width passed up through the transcript's flex/grid ancestors, and the row's own min-w-0 did not stop it. Adding [overflow-wrap:anywhere] lowers the min-content width. break-words would not have worked, because it does not change min-content. The same utility is already used elsewhere in native chat (notice rows, event rows, wrapped code blocks, markdown). Both places that render this component get the fix: the transcript tool run and WorkerDockProviderDetailsDialog.

Why

This fixes the element that causes the overflow, and nothing else. Two alternatives were rejected. overflow-x: hidden on the scroller would hide the scrollbar but clip the text. Adding min-w-0 up the ancestor chain would touch many components to fix one leaf.

Linked Issue

Fixes #47358

Visual Proof

Headless component fixture (NativeChatMessageList, dark theme, run with pnpm fixtures:shot). The yellow bar reports the transcript scroller's overflow.

1,600-character unbroken summary at 720px

Before After
before long token after long token

Before, maxScrollerOverflow is 16028. After, it is 0.

Long URL in a narrow 360px pane

Before After
before narrow url after narrow url

Normal spaced sentence (no regression)

Before After
before spaced after spaced

This text wraps at the same word boundaries in both, and the row is 32px tall in both.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

  • Reproduced with a scratch fixture on origin/main, then compared with this branch. The fixture was not committed. Worst scroller overflow, main vs this PR:

    • long token at 720px: 16,028px vs 0
    • blocked row with only an error: 16,028px vs 0
    • spaced sentence containing one 900-character token: 5,640px vs 0
    • long URL in a 360px pane: 1,836px vs 0
    • dialog-sized box: 16,669px vs 0
    • normal spaced text: 0 on both
  • Blocked rows still render in red. The sibling output row already uses truncate; a 1,600-character outputFile gets an ellipsis and does not overflow.

  • The existing tests in native-chat/tools/tasks/ pass (5 files, 14 tests). oxlint, oxfmt, anti-slop, ast-grep and the changed-code quality gate are all clean.

  • No unit test added: this is a one-class styling change, and the repo's test guidance says not to unit-test UI styling. The fixture comparison above is the evidence.

  • Tested on macOS (headless fixture renderer). The change is renderer CSS only, so the platform, SSH and remote setup do not affect it.

Performance

This adds one CSS property to a per-task row in the renderer. It adds no JS, I/O, polling or subprocess work. Forced layout in the headless fixture, median of 15 runs, 600px box:

  • Typical case, 500 rows of spaced text: 4.10 ms vs 4.10 ms. No change.
  • Adversarial case, 200 rows that each hold a 1,600-character unbroken token: 14.1 ms vs 19.4 ms. That is about 0.1 ms per row, because each row now lays out about 20 wrapped lines instead of one 11,000px line. The transcript is virtualized, so only rows on screen are laid out. A real chat has at most a few such rows, which keeps it far below 16 ms.

Risk

The only behavior change: when a single token is wider than the column, a background task's result sentence now breaks mid-token. Text with normal spaces wraps exactly as before. This affects the desktop renderer only; on mobile, React Native Text already wraps this sentence. To back it out, revert this commit.

Level: Low

Review

Reviewed by maintainers. The root cause is confirmed, and the fix reuses an existing utility. Nothing is blocking.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Original fix by @A0150315 in #47359.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The task sentence paragraph now applies overflow-wrap:anywhere. This allows long unbroken text to wrap. Existing spacing, padding, text size, and blocked-state coloring remain unchanged.

Severity of issue fixed: Low

Merge Risk: Minimal · up to 22417

Long unbroken background task summaries now wrap within the chat column instead of widening the transcript. This is a one-class styling change in the desktop renderer with a low chance of regression and is ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed [#47358] The issue requires a background command's long unbroken result to wrap inside the message column instead of widening the transcript. The whole-PR diff (merge base cd8a94d to head 224176d) cha…
Out of Scope Changes check Passed The whole-PR diff touches one file and one JSX element. The only edit adds [overflow-wrap:anywhere] to the background task result paragraph, and the className is reformatted across lines. This directl…
Title check Passed The title names the main change: long background task summaries now wrap in the native chat instead of widening it. It uses the fix(native-chat) convention and matches the raw summary, which adds over…
Description check Passed The description follows the template closely. It covers ELI5, What Changed with before and after, the mechanism, Why with rejected alternatives, a linked issue (Fixes #47358), visual proof tables, tes…
Full details: Linked Issues check

Explanation

[#47358] The issue requires a background command's long unbroken result to wrap inside the message column instead of widening the transcript. The whole-PR diff (merge base cd8a94d to head 224176d) changes one element in src/renderer/src/components/native-chat/tools/tasks/NativeChatBackgroundTaskRun.tsx. The result <p> gains the Tailwind arbitrary utility [overflow-wrap:anywhere], which lets the browser break inside a long token, so the paragraph's min-content width no longer forces the transcript wider. The existing classes, the blocked-state text-destructive styling, and the rendered sentence are unchanged. The author reports before and after fixture measurements (horizontal overflow 9,899px before, 0px after). I did not re-run the fixture, so the measurement rests on the author's report and the code change. The issue states no automated test requirement. No coding requirement is left unmet.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff touches one file and one JSX element. The only edit adds [overflow-wrap:anywhere] to the background task result paragraph, and the className is reformatted across lines. This directly implements #47358. The PR description cites reuse of the same utility in other native-chat components, but the diff does not change those files. No unrelated, refactoring, or unexplained changes appear in the reviewed diff.

Full details: Title check

Explanation

The title names the main change: long background task summaries now wrap in the native chat instead of widening it. It uses the fix(native-chat) convention and matches the raw summary, which adds overflow-wrap:anywhere to the task result paragraph. The title is 82 characters, slightly long but still clear.

Full details: Description check

Explanation

The description follows the template closely. It covers ELI5, What Changed with before and after, the mechanism, Why with rejected alternatives, a linked issue (Fixes #47358), visual proof tables, testing, a performance line with measurements, a risk section with a Low level and a revert path, and the checklists. The Linked Issue cites #47358, which matches the objectives. The Fixes # reference is filled in. The AI Disclosure section is left blank, which the template allows for internal contributors. The description is complete, so it passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 71432ea2-ace2-41cf-ad15-72131e711e96
Commits

Reviewing files that changed from the base of the PR and between 3b89079 and 224176d.

Files selected for processing: 1

  • src/renderer/src/components/native-chat/tools/tasks/NativeChatBackgroundTaskRun.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

…ning the chat

A background task's result sentence (for example the JSON line that
`orca orchestration worker-start` prints) had no break opportunity, so one
unbroken token set the transcript's min-content width and pushed a
horizontal scrollbar across the whole chat. overflow-wrap:anywhere lets it
wrap inside the column, matching the markdown body and code blocks.

Fixes stablyai#47358
@nwparker
nwparker force-pushed the fix/native-chat-background-task-wrap branch from 224176d to 7c0bc61 Compare November 23, 2026 04:53
@nwparker nwparker changed the title fix(native-chat): wrap a background task's long summary instead of widening the chat fix(native-chat): wrap long background task summaries instead of widening the chat Nov 23, 2026
@nwparker
nwparker merged commit cabc3c6 into stablyai:main Nov 23, 2026
55 of 56 checks passed
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.

Agent chat: a background task's long unbroken result widens the chat and adds a horizontal scrollbar

2 participants