You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(server): long worktree setup details no longer end in half an emoji - #41629
The worktree setup card can show a stray replacement character (�) right before the … of a cut-off line. The server's WorktreeSetupTracker caps a stage's detail at 200 UTF-16 code units and the failure error at 1000 by slicing at maxLength - 1. When an emoji or another non-BMP character sits on that boundary, the cut keeps only its first half. Both texts can carry user paths: a submodule's path comes from git's output, and a failed setup's error includes the project folder and git's stderr. The client then receives a lone surrogate. The web and mobile cards show the error in full, so the broken character is visible there.
#40701 fixed the same cut in ProjectSetupScriptRunner but left this helper alone.
Change
clampText in WorktreeSetupTracker.ts now uses the same splitsSurrogatePair check as #40701 and stops one code unit earlier when the cut would split a pair. The result still fits the contract's limit. Stage details, setup output lines and the failure error all go through this one helper. One test is added to WorktreeSetupTracker.test.ts.
Verification
An AI agent ran each check on Linux with no accounts.
Setup: Linux x86_64, Node 26.13.1, git 2.53.0, a throwaway repository in a temp folder.
Steps: a small script that runs real git and passes its output through the same steps the server uses, into a real WorktreeSetupTracker, then reads the snapshot back through JSON the way the WebSocket sends it.
The submodule-path detail comes from git submodule update --init --progress, with the submodule at a 206-unit path that has 🚀 at units 198–199.
The failure error comes from a git worktree add that fails into an existing folder named 🚀 release. Its stderr is wrapped the way GitCommandError and the launch failure do, giving 1024 units with 🚀 at 998–999.
e86a9c51696d (main)
005abe037809 (this PR)
Stage detail (200)
…ee\ud83d…, well-formed: false
…eee…, well-formed: true
Failure error (1000)
…y/\ud83d…, well-formed: false
…yy/…, well-formed: true
vp test run src/project/WorktreeSetupTracker.test.ts: the new case fails on main (\ud83d before …) and passes here (6/6).
Reviewing files that changed from the base of the PR and between 005abe0 and 3a045a0.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
WorktreeSetupTracker now avoids splitting a UTF-16 surrogate pair when it truncates text. A test checks the behavior for stage details and finish errors.
Changes: Surrogate-safe text truncation
Layer / File(s)
Summary
Safe clamping and tests apps/server/src/project/WorktreeSetupTracker.ts, apps/server/src/project/WorktreeSetupTracker.test.ts
clampText moves the truncation boundary back one code unit when it would split a surrogate pair. Tests check truncated stage details and finish errors.
This change prevents truncated setup text from ending with a broken character before the ellipsis. The change is small and tested, and no merge-blocking risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the fix (a truncated worktree setup detail no longer ends in a broken surrogate character) and the component (server). It matches the main change in WorktreeSetupTracker's clampText, s…
Description check
The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section explains the lone surrogate and the replacement character, with the expected behavio…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the fix (a truncated worktree setup detail no longer ends in a broken surrogate character) and the component (server). It matches the main change in WorktreeSetupTracker's clampText, so it passes. It is conventional-commit style and specific. The phrase 'half an emoji' is informal but still accurate.
Full details: Description check
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section explains the lone surrogate and the replacement character, with the expected behavior. The Change section explains the clampText update and the shared helper, and it cites the related PR #40701. The Scope section is missing. It does not link an issue that shows the bug, and it does not say why no issue is needed. The Verification section is strong. It lists the environment, steps, before and after results, and the test run. It also names the model and harness used, as the template asks. The template asks for an agent's model and harness, and the author gives 'Gemini 4 Neon in T3 Code Nightly', so that requirement is met.
Resolution
Add a Scope section. Link the issue that shows the bug, or explain in one sentence why this small obvious fix needs no issue.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
Created the reported 204-unit submodule path, configured an automatic blocking Slow setup action, and started a Replay thread in a new worktree on both commits. Captured Init submodules while setup ran. Both captures use Chromium, 1280×800, light theme, fresh synthetic state, and identical RTL/outline/enlargement to reveal the normally clipped tail; terminal output is hidden for privacy.
Proven: the scenario fails on base and passes on head. The base renders a replacement glyph and its detail is not well-formed Unicode. The head truncates cleanly, ends with an ellipsis, and stays within 200 UTF-16 units.
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
size:XS0-9 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
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.
Problem
The worktree setup card can show a stray replacement character (
�) right before the…of a cut-off line. The server'sWorktreeSetupTrackercaps a stage's detail at 200 UTF-16 code units and the failure error at 1000 by slicing atmaxLength - 1. When an emoji or another non-BMP character sits on that boundary, the cut keeps only its first half. Both texts can carry user paths: a submodule's path comes from git's output, and a failed setup's error includes the project folder and git's stderr. The client then receives a lone surrogate. The web and mobile cards show the error in full, so the broken character is visible there.#40701 fixed the same cut in
ProjectSetupScriptRunnerbut left this helper alone.Change
clampTextinWorktreeSetupTracker.tsnow uses the samesplitsSurrogatePaircheck as #40701 and stops one code unit earlier when the cut would split a pair. The result still fits the contract's limit. Stage details, setup output lines and the failure error all go through this one helper. One test is added toWorktreeSetupTracker.test.ts.Verification
An AI agent ran each check on Linux with no accounts.
Setup: Linux x86_64, Node 26.13.1, git 2.53.0, a throwaway repository in a temp folder.
Steps: a small script that runs real git and passes its output through the same steps the server uses, into a real
WorktreeSetupTracker, then reads the snapshot back through JSON the way the WebSocket sends it.git submodule update --init --progress, with the submodule at a 206-unit path that has 🚀 at units 198–199.git worktree addthat fails into an existing folder named🚀 release. Its stderr is wrapped the wayGitCommandErrorand the launch failure do, giving 1024 units with 🚀 at 998–999.e86a9c51696d(main)005abe037809(this PR)…ee\ud83d…, well-formed: false…eee…, well-formed: true…y/\ud83d…, well-formed: false…yy/…, well-formed: truevp test run src/project/WorktreeSetupTracker.test.ts: the new case fails on main (\ud83dbefore…) and passes here (6/6).vp run check:changed: passes.Generated with Gemini 4 Neon in T3 Code Nightly