Skip to content

fix(server): git action toast descriptions no longer end in half an emoji - #43344

Merged
juliusmarminge merged 3 commits into
pingdotgg:mainfrom
saphid:hunter/c-400ca16360
Nov 26, 2026
Merged

juliusmarminge merged 3 commits into
pingdotgg:mainfrom
saphid:hunter/c-400ca16360

Conversation

@saphid

@saphid saphid commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Problem

Git action completion toast descriptions (truncateText, 72-character cap), generated commit subjects (sanitizeCommitMessage, 72-character cap), and commit hook progress lines (sanitizeProgressText, 500-character cap) in apps/server/src/git/GitManager.ts slice raw UTF-16 code units. When a typed commitMessage, generated commit subject, PR title, or hook output line has a supplementary-plane emoji straddling the cut boundary, the sliced string ends in a lone high surrogate (\ud83d), which encodes as UTF-8 ef bf bd (U+FFFD, replacement character).

Deterministic repro on origin/main (25525f948351757535decaaf8de43e952a7865b1):

  1. Run GitManager.runStackedAction (action: "commit") with commitMessage set to "a".repeat(68) + "😀" + "bbbb" (length 74, 😀 at UTF-16 indices 68–69 straddling 72 - 3 = 69), or with a pre-commit hook printing "a".repeat(499) + "😀" + "bbbb" (straddling index 500), or with a generated subject "a".repeat(71) + "😀" + "bb" (straddling index 72).
  2. Observed: toast.description is "a".repeat(68) + "\ud83d..." (isWellFormed() === false, trailing UTF-8 bytes ef bf bd 2e 2e 2e), the hook_output event ends in \ud83d (ef bf bd), and sanitizeCommitMessage returns "a".repeat(71) + "\ud83d" (isWellFormed() === false).
  3. Expected: toast.description is "a".repeat(68) + "...", the hook_output line is "a".repeat(499), and the generated commit subject is "a".repeat(71)—all well-formed (isWellFormed() === true) with the straddling emoji dropped rather than split.

Change

Drop any trailing lone high surrogate ([\uD800-\uDBFF]$) before .trimEnd() after slicing in truncateText, sanitizeCommitMessage, and sanitizeProgressText in apps/server/src/git/GitManager.ts. Web (apps/web/src/components/GitActionsControl.tsx), desktop (wraps web), and mobile (apps/mobile/src/state/use-selected-thread-git-actions.ts) render toast.description directly from this server payload without re-truncating, so fixing the server covers all client surfaces.

Scope

Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.

Verification

  • Base failure (origin/main): The regression test in apps/server/src/git/GitManager.test.ts failed on unmodified origin/main with actual: "a".repeat(68) + "\ud83d..." instead of "a".repeat(68) + "...", and the runtime transcript against origin/main (25525f948351757535decaaf8de43e952a7865b1) confirmed isWellFormed() === false and trailing ef bf bd (U+FFFD) bytes in all three functions.
  • Head pass (hunter/c-400ca16360): vp test run apps/server/src/git/GitManager.test.ts -t "truncates commit subjects, toast descriptions, and hook output without splitting an emoji" passed 3/3 consecutive runs, confirming split surrogates are dropped in completion toast descriptions, generated commit subjects, and hook_output progress lines while a whole emoji ending at index 69 (67×a + 😀 + bbbb) is preserved intact.
  • vp run check:changed: Exited 0 on 1a05208801ac (format, lint, knip, graphql, typecheck across 3 packages, and 172/172 affected tests passing).
  • Before/after runtime transcript: https://gist.github.com/saphid/8650c1ec4e2f8f0bfc55fb602d37ae08
  • Not shown: No UI screenshots were captured (server-only payload truncation; client rendering of well-formed toast strings is unchanged), and no real remote forge PR creation was exercised against a live host.

Authored by Gemini 4 Neon (Antigravity); reviewed by Claude Opus 5.5 (Model Hub).

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

GitManager truncation now removes trailing unmatched high surrogates. Commit subject sanitization applies its fallback after truncation. Tests check commit subjects, toast descriptions, and hook output.

Changes: Git text truncation

Layer / File(s) Summary
Unicode-safe text sanitization
apps/server/src/git/GitManager.ts, apps/server/src/git/GitManager.test.ts
Truncation removes a trailing unmatched high surrogate from commit and progress text. Commit subject sanitization uses "Update project files" if the truncated subject is empty. Tests check truncation boundaries and Unicode integrity in commit subjects, toast descriptions, and hook output.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to ea6f0

This change stops git action toasts, commit subjects and hook progress lines from ending in half an emoji. It touches only text truncation helpers and has a regression test. No actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: git action toast descriptions no longer end in a split emoji. The raw summary confirms the change drops a trailing lone high surrogate in truncateText, sanitizeCommitM…
Description check Passed The description follows the template sections: Problem, Change, Scope, and Verification. It explains the UTF-16 slicing bug with a deterministic repro and expected behavior. It explains the server-sid…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: git action toast descriptions no longer end in a split emoji. The raw summary confirms the change drops a trailing lone high surrogate in truncateText, sanitizeCommitMessage, and sanitizeProgressText in GitManager.ts, which fixes that symptom. It uses the conventional commit format and plain language, and it is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description follows the template sections: Problem, Change, Scope, and Verification. It explains the UTF-16 slicing bug with a deterministic repro and expected behavior. It explains the server-side fix and why clients need no change. It links no issue but gives a reason under Scope, as the template asks. Verification lists focused test results and the check run, and it states what was not checked, such as UI screenshots and live forge PR creation. The description is mostly complete. Minor gaps: the Verification section is long and includes an external gist link, and the template asks for a model and harness line, which the author gave.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1a05208 and ea6f07a.

Files selected for processing: 1

  • apps/server/src/git/GitManager.test.ts
Files with no reviewable changes: 1

  • apps/server/src/git/GitManager.test.ts

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

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 26, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Real-app proof for #43344: the scenario failed on base and passed on head.

Environment: Linux Chromium, light theme, 1920×1080, separate checkouts and fresh databases, synthetic project/thread using Replay (dev). Generated subjects came from a deterministic local model API through the real adapter. Capture-only CSS wraps the app’s existing status paragraphs identically on both sides; it changes no text and adds no overlay.

Steps: commit a README change with a hook emitting 499 a + 😀bbbb and a message of 68 a + 😀bbbb. Capture hook output and completion. Repeat with 67 a + 😀bbbb to preserve the complete emoji. Then auto-generate subjects from 71 a + 😀bb, a 72-unit malformed response ending in a high surrogate, and a high-surrogate-only response to exercise the empty-result fallback.

Case Before 8213d1dda2 After ea6f07af2c
Hook output Before: hook ends in replacement character After: split emoji removed
Toast boundary Before: malformed character before dots After: clean truncation before dots
Complete emoji fits Before: complete emoji preserved After: complete emoji preserved
Valid generated subject control Before: upstream sanitizer already handles valid input After: valid generated subject remains safe
Generated 72-unit malformed response Before: trailing replacement character After: trailing surrogate removed
Generated empty-result fallback Before: replacement character only After: Update project files fallback

Before recording · After recording · Scenario and seed driver

Both recordings end with the final committed row still visible. The valid generated-subject control is already safe on base because the shared adapter truncates by grapheme before GitManager sees it. The malformed 72-unit response and single-surrogate response exercise the changed GitManager cleanup and fallback respectively.

Not shown:

  • The exact valid generated 71 a + 😀bb input does not reproduce a 72-unit split on base: the existing upstream grapheme-aware sanitizer already removes the emoji. It was captured as a control. The changed GitManager cleanup and fallback were demonstrated with deterministic malformed model responses instead.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 26, 2026
@juliusmarminge
juliusmarminge merged commit 2a99314 into pingdotgg:main Nov 26, 2026
59 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 26, 2026
luckyou-02 pushed a commit to luckyou-02/t3code that referenced this pull request Nov 26, 2026
包含上游提交:
- pingdotgg#43318 (8ec9f43) 含三个反引号代码块后的线程链接正常渲染
- pingdotgg#43342 (6ea8886) 截断的颜色码不再残留字符到命令输出
- pingdotgg#43337 (fc1f1ba) Web Notebook 预览显示仅含 text/markdown 的输出
- pingdotgg#43331 (3fa136a) 分块 Markdown 预览保留 ... frontmatter 后的链接定义
- pingdotgg#43360 (65fc371) 文件侧栏支持复制文件路径
- pingdotgg#43358 (7891c72) 聊天表格复制为 CSV 在换行处保留空格
- pingdotgg#43344 (2a99314) Git 操作 toast 描述截断不再出现半个 emoji
- pingdotgg#43357 (5fda4f7) agent auto 发送 steer 绕过显式队列
- pingdotgg#43380 (147028a) ACP 可选布尔和选择题允许跳过
- pingdotgg#43383 (6ac4ede) 设置页快捷键胶囊按平台渲染修饰键和键名
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
…moji (pingdotgg#43344)

Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 2a99314)
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
…moji (pingdotgg#43344)

Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 2a99314)
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
…moji (pingdotgg#43344)

Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 2a99314)
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
…moji (pingdotgg#43344)

Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 2a99314)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants