The best way to control Claude Code, Codex and more from any computer or phone
fix(web): reply labels no longer cut an emoji in half (#35701)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Koi committed
Nov 14, 2026 at 02:01 UTC
8656cdb3a93883e06fd2786f1cb921571a04da11
2 files changed
+31
-1
apps/web/src/lib/composerContextRecords.test.ts
+22
@@ -4,6 +4,7 @@ import {
4
MessageId,
5
OrchestrationMessageContext,
6
ThreadId,
7
+ TurnItemId,
8
type PreviewAnnotationPayload,
9
} from "@t3tools/contracts";
10
import * as Schema from "effect/Schema";
@@ -24,6 +25,7 @@ import {
25
previewAnnotationFromRecord,
26
pullRequestContextKindLabel,
27
resolveUserMessageContext,
28
+ responseContextRecord,
29
reviewCommentContextLabel,
30
selectedMessageContextFragment,
31
reviewCommentContextRecord,
@@ -227,6 +229,26 @@ describe("composerContextRecords", () => {
229
expect(record.label).toBe(`${"a".repeat(46)}…`);
230
});
231
232
+ it("shortens a long reply label without splitting an emoji", () => {
233
+ const text = `${"a".repeat(63)}😀 trailing`;
234
+ const record = responseContextRecord({
235
+ citation: {
236
+ version: 1,
237
+ environmentId: EnvironmentId.make("environment-1"),
238
+ threadId: ThreadId.make("thread-1"),
239
+ messageId: MessageId.make("message-1"),
240
+ text,
241
+ start: 0,
242
+ end: text.length,
243
+ prefix: "",
244
+ suffix: "",
245
+ },
246
+ itemId: TurnItemId.make("item-1"),
247
+ subagents: [],
248
+ });
249
+ expect(record.label).toBe("a".repeat(63));
250
+ });
251
+
252
it("restores multiple edits on one target without parsing display strings", () => {
253
const styleChanges = [
254
...annotation.styleChanges,
apps/web/src/lib/composerContextRecords.ts
+9
-1
@@ -48,6 +48,7 @@ import {
48
import type { ReviewCommentContext } from "~/reviewCommentContext";
49
50
const PREVIEW_LABEL_MAX_CHARS = 48;
51
+const RESPONSE_LABEL_MAX_CHARS = 64;
52
53
// Truncate selections to wire bounds before persistence to avoid send-time encoding failures.
54
const TRUNCATION_MARKER = "\n… truncated …";
@@ -178,6 +179,13 @@ export function responseContextReference(record: ResponseContextRecord): Compose
179
return { kind: "response", contextId: record.contextId, label: record.label };
180
}
181
182
+function responseContextLabel(text: string): string {
183
+ const last = text.charCodeAt(RESPONSE_LABEL_MAX_CHARS - 1);
184
+ const end =
185
+ last >= 0xd800 && last <= 0xdbff ? RESPONSE_LABEL_MAX_CHARS - 1 : RESPONSE_LABEL_MAX_CHARS;
186
+ return sanitizeComposerContextLabel(text.slice(0, end), "response");
187
+}
188
+
189
/** One record per response, so replying to it again reuses the same reference. */
190
export function responseContextRecord(
191
input: Pick<ResponseContextRecord, "citation" | "itemId"> & {
@@ -192,7 +200,7 @@ export function responseContextRecord(
200
version: 1,
201
kind: "response",
202
contextId: toKindScopedComposerContextId("response", input.citation.messageId),
195
- label: sanitizeComposerContextLabel(input.citation.text.slice(0, 64), "response"),
203
+ label: responseContextLabel(input.citation.text),
204
citation: input.citation,
205
itemId: input.itemId,
206
...(input.subagents.length > 0