@devries-cameron20 / t3code-1 / commits / 62ee103996
Fork 0

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

fix(server): setup script output no longer shows stray bytes of escape sequences (#31882)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

spoukyii committed Nov 14, 2026 at 19:56 UTC 62ee1039960d0adb70347ffd252faf6783116aa9
2 files changed +14 -4
apps/server/src/project/ProjectSetupScriptRunner.test.ts
+12
@@ -172,6 +172,18 @@ describe("ProjectSetupScriptRunner", () => {
172 }),
173 );
174
175 + it.effect("drops whole escape sequences from output lines", () =>
176 + Effect.gen(function* () {
177 + const { outputLines, emit } = yield* setup();
178 + yield* emit({
179 + ...event,
180 + type: "output",
181 + data: "\x1b7\x1b[24;0fProgress: [ 40%]\x1b8\r\n\x1b%G\x1b#8\x1b[4:3mdone\x1bM\r\n",
182 + });
183 + expect(yield* Queue.takeAll(outputLines)).toEqual(["Progress: [ 40%]", "done"]);
184 + }),
185 + );
186 +
187 it.effect("types into a quiet shell that has no line editor", () =>
188 Effect.gen(function* () {
189 const { writes } = yield* setup();
apps/server/src/project/ProjectSetupScriptRunner.ts
+2 -4
@@ -145,12 +145,10 @@ function completionSentinelPattern(token: string): RegExp {
145 return new RegExp(`${COMPLETION_SENTINEL_PREFIX}_${token}:(-?\\d+)`);
146 }
147
148 +// ECMA-48: CSI, OSC, then any other escape as intermediates (0x20-0x2F) and one final byte.
149 function stripTerminalControl(text: string): string {
150 return text
150 - .replace(
151 - /\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[()][A-Za-z0-9]|\x1b[=>]/g,
152 - "",
153 - )
151 + .replace(/\x1b\[[0-?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[ -/]*[0-~]/g, "")
152 .replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, "");
153 }
154