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

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

fix(shared): context chip labels no longer split an emoji at the 200-character cap (#29158)

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

Alex Southwell committed Nov 3, 2026 at 01:36 UTC d1e5044c67515c4bccfe9bdb60e4533f920b32bf
2 files changed +11 -3
packages/shared/src/composerContextReferences.test.ts
+4
@@ -59,6 +59,10 @@ describe("labels and reference links", () => {
59 collectComposerContextReferences(`[${"x".repeat(300)}](t3-context://v1/file/ctx_1)`)[0]
60 ?.label,
61 ).toHaveLength(200);
62 + expect(
63 + collectComposerContextReferences(`[${"x".repeat(199)}😀tail](t3-context://v1/file/ctx_1)`)[0]
64 + ?.label,
65 + ).toBe("x".repeat(199));
66 });
67
68 it("collects occurrences in document order with offsets, sharing a payload", () => {
packages/shared/src/composerContextReferences.ts
+7 -3
@@ -67,11 +67,15 @@ export function parseComposerContextHref(
67 }
68
69 export function sanitizeComposerContextLabel(label: string, kind: ComposerContextKind): string {
70 - const cleaned = label
70 + const normalized = label
71 .replace(/[[\]\\\r\n]/g, " ")
72 .replace(/\s+/g, " ")
73 - .trim()
74 - .slice(0, COMPOSER_CONTEXT_LABEL_MAX_CHARS);
73 + .trim();
74 + let end = COMPOSER_CONTEXT_LABEL_MAX_CHARS;
75 + const before = normalized.charCodeAt(end - 1);
76 + const after = normalized.charCodeAt(end);
77 + if (before >= 0xd800 && before <= 0xdbff && after >= 0xdc00 && after <= 0xdfff) end--;
78 + const cleaned = normalized.slice(0, end);
79 return cleaned.length > 0 ? cleaned : kind;
80 }
81