Repository navigation
fix(server): PR watch wakes no longer split an emoji in a long comment - #29633
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — PR-watch comment excerpts now avoid splitting an emoji at the truncation boundary. The change is confined to message formatting and leaves watch behavior and stored state unchanged. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Surrogate-safe truncation and test apps/server/src/orchestration-v2/pullRequestWatch.ts, apps/server/src/orchestration-v2/pullRequestWatch.test.ts |
snippet shortens the truncated text by one character when the boundary would split a surrogate pair. The new test checks the generated message for an emoji at the boundary. |
Estimated code review effort: 1 (Trivial) | ~5 minutes
Change: Bug fix
Possibly related issues
- Issue 27842 describes a similar truncation problem with emoji surrogate pairs. This PR addresses the same type of boundary issue in PR-watch comment snippets.
Suggested reviewers: juliusmarminge
Merge Risk: 
Minimal · up to 58486
-
No actionable merge-blocking risk remains in the reviewed change.
Pre-merge checks: 
4
-
Full details: Description check
-
Explanation
The description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the failure mode, implementation, rationale for the focused scope, test results, runtime verification, and the unchecked live-turn scenario.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
|
Note Written by Verified in a real dev environmentVerified the formatter-to-provider path on Linux at
Not verifiedAutomatic wake delivery from a newly posted external PR comment was not exercised. The boundary content was controlled formatter input, not a comment fetched by the watch reactor. Watches ignore the signed-in user's own comments, and the existing external comments do not hit this boundary. This proves the changed formatter and real downstream Codex path, not full external-comment ingestion. Claude, native iOS/Android, and macOS/Windows desktop clients were not exercised on this Linux VM. |


Problem
When an agent watches a pull request, T3 Code wakes it with a message listing new comments, each shortened to 200 characters. The cut counts UTF-16 code units, so when an emoji (common in review-bot comments) straddles the cut, the message keeps only the first half of its surrogate pair.
That message is sent into the agent's thread as a turn. JSON encoding turns the half emoji into a lone
\ud83descape, which strict parsers reject: serde_json (used by the Codex app-server) fails withunexpected end of hex escape, and the Anthropic API rejects requests withno low surrogate in string. The wake meant to get the agent working on review feedback fails instead.Change
snippet()inapps/server/src/orchestration-v2/pullRequestWatch.tssteps back one code unit when the last kept unit is a high surrogate. It uses the same step-back asOrchestratorMcpService.tspaging,ContextHandoffService.tsandsanitizeThreadTitle.Scope and approval
Very small, focused fix for an obvious bug, so no prior issue: one truncation site, 5 non-test lines, one regression test. Overlap search: the local PR index and GitHub search found no PR touching
pullRequestWatch.tstruncation. Related surrogate fixes (#29158, #29163, #29168, #29563, #29572, #29600, open #24611, #28831) cover other call sites, not this one.Verification
pullRequestWatch.test.tsfails withAssertionError: expected false to be true(text.isWellFormed()).vp test run src/orchestration-v2/pullRequestWatch.test.tspasses 21/21.vp run check:changed: format, lint, knip, typecheck (3 packages), tests (22/22) all pass.turn/startJSON-RPC line and parsed withserde_json::from_str, givesserde_json error: unexpected end of hex escape at line 1 column 284.Reviewed with sol-loop: 1 round with GPT-6.1 Sol on high. Sol verdict: approved.
Created with Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code