The best way to control Claude Code, Codex and more from any computer or phone
fix(server): side chat and merge-back context no longer cut an emoji in half (#29572)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Alex Southwell committed
Nov 3, 2026 at 01:39 UTC
dfbafeee6c305290b9915b927a4f7123ebb98126
2 files changed
+6
-3
apps/server/src/orchestration-v2/ContextHandoffService.test.ts
+3
-2
@@ -169,12 +169,12 @@ it.effect("caps the side chat context block without summarizing discarded parent
169
...importedItem({
170
role: index % 2 === 0 ? "user" : "assistant",
171
id: `parent-${index}`,
172
- text: `item-${index} ${"x".repeat(300)}`,
172
+ text: `item-${index} ${"x".repeat(228)}😀${"x".repeat(70)}`,
173
ordinal: index,
174
}),
175
get text() {
176
summarizedItems++;
177
- return `item-${index} ${"x".repeat(300)}`;
177
+ return `item-${index} ${"x".repeat(228)}😀${"x".repeat(70)}`;
178
},
179
}));
180
const service = yield* ContextHandoffService.ContextHandoffServiceV2;
@@ -197,6 +197,7 @@ it.effect("caps the side chat context block without summarizing discarded parent
197
assert.notInclude(context, "item-0 ");
198
assert.include(context, "- Assistant: item-59 ");
199
assert.isAtMost(context.length, 8_000);
200
+ assert.isTrue(context.isWellFormed());
201
assert.isTrue(
202
context.endsWith(
203
`Use t3_thread_read on thread ${parentThreadId} to see the main thread's live state.`,
apps/server/src/orchestration-v2/ContextHandoffService.ts
+3
-1
@@ -109,7 +109,9 @@ function compactText(text: string, maxLength = 240): string {
109
if (compacted.length <= maxLength) {
110
return compacted;
111
}
112
- return `${compacted.slice(0, maxLength - 3)}...`;
112
+ const end = maxLength - 3;
113
+ const last = compacted.charCodeAt(end - 1);
114
+ return `${compacted.slice(0, last >= 0xd800 && last <= 0xdbff ? end - 1 : end)}...`;
115
}
116
117
export function visibleDeltaRunOrdinals(