@devries-cameron20 / t3code-1 / commits / b63adbf54e
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): PR watch wakes no longer split an emoji in a long comment (#29633)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Alex Southwell committed Nov 3, 2026 at 23:13 UTC b63adbf54e2fe969b588a829ba6be7b4171c131d
2 files changed +22 -1
apps/server/src/orchestration-v2/pullRequestWatch.test.ts
+17
@@ -8,6 +8,7 @@ import { assert, describe, it } from "@effect/vitest";
8 import {
9 PULL_REQUEST_WATCH_WAKE_LIMIT,
10 evaluatePullRequestWatch as evaluate,
11 + pullRequestWatchMessage,
12 } from "./pullRequestWatch.ts";
13
14 // These cases read the head once or at one moment, so the no-checks notice never comes due.
@@ -335,6 +336,22 @@ describe("evaluatePullRequestWatch", () => {
336 assert.deepEqual(evaluatePullRequestWatch(report.next, detail(), comments).changes, []);
337 });
338
339 + it("cuts a long remark in the wake message without splitting an emoji", () => {
340 + const body = `${"x".repeat(196)}🚀 and more`;
341 + const report = evaluatePullRequestWatch(watch(), detail(), [
342 + remark("reviewer", "2026-10-02T12:06:00Z", body),
343 + ]);
344 + const { text } = pullRequestWatchMessage({
345 + number: 1,
346 + url: "https://github.com/o/r/pull/1",
347 + baseBranch: "main",
348 + headSha: null,
349 + report,
350 + });
351 + assert.isTrue(text.isWellFormed());
352 + assert.include(text, `"${"x".repeat(196)}..."`);
353 + });
354 +
355 it("reports a conflict once, until the branch is clean again", () => {
356 const conflicting = detail({ mergeability: "conflicting" });
357 const first = evaluatePullRequestWatch(watch(), conflicting, noRemarks);
apps/server/src/orchestration-v2/pullRequestWatch.ts
+5 -1
@@ -160,7 +160,11 @@ function snippet(body: string): string {
160 .replaceAll(/<!--[\s\S]*?-->/g, " ")
161 .replaceAll(/\s+/g, " ")
162 .trim();
163 - return text.length <= SNIPPET_LENGTH ? text : `${text.slice(0, SNIPPET_LENGTH - 3)}...`;
163 + if (text.length <= SNIPPET_LENGTH) return text;
164 + // Half an emoji serializes to a lone surrogate escape, which provider JSON parsers reject.
165 + const last = text.charCodeAt(SNIPPET_LENGTH - 4);
166 + const end = last >= 0xd800 && last <= 0xdbff ? SNIPPET_LENGTH - 4 : SNIPPET_LENGTH - 3;
167 + return `${text.slice(0, end)}...`;
168 }
169
170 function listed<T>(items: ReadonlyArray<T>, line: (item: T) => string): Array<string> {