The best way to control Claude Code, Codex and more from any computer or phone
fix(server): Claude live command output no longer starts with � after skipping ahead (#33246)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Alex Southwell committed
Nov 12, 2026 at 10:09 UTC
d7fedc57431b30a75e18b544d3b306cd5abf83dd
2 files changed
+12
-6
apps/server/src/orchestration-v2/Adapters/ClaudeTaskOutputTail.test.ts
+4
-3
@@ -91,11 +91,12 @@ describe("tailClaudeTaskOutput", () => {
91
}).pipe(Effect.forkScoped);
92
assert.equal(yield* Queue.take(chunks), "start\n");
93
94
- yield* fileSystem.writeFileString(file, `start\n${"y\n".repeat(1_000_000)}end\n`);
94
+ // The skip lands on the second byte of a two-byte é.
95
+ yield* fileSystem.writeFileString(file, `start\n${"é\n".repeat(1_000_000)}end.\n`);
96
const flooded = yield* Queue.take(chunks);
97
assert.isAtMost(flooded.length, 256 * 1024 + 1);
97
- assert.isTrue(flooded.startsWith("\n"));
98
- assert.isTrue(flooded.endsWith("y\nend\n"));
98
+ assert.equal(flooded.slice(0, 3), "\n\né");
99
+ assert.isTrue(flooded.endsWith("é\nend.\n"));
100
}),
101
).pipe(Effect.provide(NodeServices.layer)),
102
);
apps/server/src/orchestration-v2/Adapters/ClaudeTaskOutputTail.ts
+8
-3
@@ -104,10 +104,15 @@ export const tailClaudeTaskOutput = Effect.fn("ClaudeTaskOutputTail.tail")(funct
104
if (Option.isSome(bytes)) {
105
// Skipped output must not splice two unrelated lines together.
106
const skipped = start > offset;
107
- // Reset partial UTF-8 bytes when skipping output.
108
- if (skipped) decoder = new TextDecoder("utf-8", { fatal: false });
107
+ let first = 0;
108
+ if (skipped) {
109
+ // Reset partial UTF-8 bytes, and skip the rest of a code point the cut landed inside.
110
+ decoder = new TextDecoder("utf-8", { fatal: false });
111
+ while (((bytes.value[first] ?? 0) & 0xc0) === 0x80) first += 1;
112
+ }
113
offset = start + bytes.value.byteLength;
110
- const text = (skipped ? "\n" : "") + decoder.decode(bytes.value, { stream: true });
114
+ const text =
115
+ (skipped ? "\n" : "") + decoder.decode(bytes.value.subarray(first), { stream: true });
116
if (text.length > 0) yield* input.onChunk(text);
117
}
118
}