@devries-cameron20 / t3code-1 / commits / 207faa28c6
Fork 0

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

fix(server): terminal labels keep the whole name of a command with spaces (#23140)

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

MarcoDotIO committed Oct 31, 2026 at 22:24 UTC 207faa28c645b1d1a63205e080c2ac2c98d7b31b
2 files changed +26 -3
apps/server/src/terminal/Manager.test.ts
+24
@@ -765,6 +765,30 @@ it.layer(
765 }),
766 );
767
768 + it.effect("labels a running command by its whole process name, spaces included", () =>
769 + Effect.gen(function* () {
770 + const { manager } = yield* createManager(5, {
771 + subprocessPollIntervalMs: 1_000,
772 + processKillGraceMs: 0,
773 + processTable: Effect.succeed([
774 + { pid: 9000, ppid: 1, name: "zsh" },
775 + { pid: 200, ppid: 9000, name: "Google Chrome" },
776 + ]),
777 + }).pipe(Effect.provide(layerWithHostPlatform("darwin")));
778 + const label = yield* Deferred.make<string>();
779 + const unsubscribe = yield* manager.subscribe((event) =>
780 + event.type === "activity"
781 + ? Deferred.succeed(label, event.label).pipe(Effect.asVoid)
782 + : Effect.void,
783 + );
784 + yield* Effect.addFinalizer(() => Effect.sync(unsubscribe));
785 + yield* manager.open(openInput());
786 + yield* TestClock.adjust("1 second");
787 +
788 + expect(yield* Deferred.await(label)).toBe("Google Chrome");
789 + }).pipe(Effect.provide(TestClock.layer())),
790 + );
791 +
792 // Answers process-table queries after `queryDuration`, honoring the caller's
793 // timeout the way ProcessRunner's `timedOutResult` mode does.
794 const slowProcessTable = (
apps/server/src/terminal/Manager.ts
+2 -3
@@ -365,10 +365,9 @@ function normalizeChildCommandName(raw: string, platform: NodeJS.Platform): stri
365 ) {
366 trimmed = trimmed.slice(1, -1).trim();
367 }
368 - const firstToken = (trimmed.split(/\s+/)[0] ?? trimmed).trim();
369 - if (firstToken.length === 0) return null;
368 + // Process names and macOS `comm` paths can contain spaces ("Google Chrome").
369 const separators = platform === "win32" ? /[\\/]/ : /\//;
371 - const base = firstToken.split(separators).at(-1) ?? firstToken;
370 + const base = (trimmed.split(separators).at(-1) ?? trimmed).trim();
371 const withoutExe =
372 platform === "win32" && base.toLowerCase().endsWith(".exe") ? base.slice(0, -4) : base;
373 return withoutExe.length > 0 ? withoutExe : null;