authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-14 20:30:29-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-14 20:30:29-07:00
log5623089aea68ca62811f51321686c259fa4c810f
treecf7dfeb66aab2cf0b19c4ea935d3bbb7254bf56a
parenta62e7d670c67bf221a5699b5a988367781fead74
signature Signed by PGP key B5690EEEBB952194

fix(server): disable color probes in worktree setup (#11843)


3 files changed, 15 insertions(+), 3 deletions(-)

apps/server/src/project/ProjectSetupScriptRunner.test.ts+8-1
...@@ -112,7 +112,12 @@ describe("ProjectSetupScriptRunner", () => {...@@ -112,7 +112,12 @@ describe("ProjectSetupScriptRunner", () => {
112 terminalId: "setup-default-setup",112 terminalId: "setup-default-setup",
113 cwd: "/repo/worktrees/a",113 cwd: "/repo/worktrees/a",
114 worktreePath: "/repo/worktrees/a",114 worktreePath: "/repo/worktrees/a",
115 env: { T3CODE_PROJECT_ROOT: "/repo/project", T3CODE_WORKTREE_PATH: "/repo/worktrees/a" },115 env: {
116 T3CODE_PROJECT_ROOT: "/repo/project",
117 T3CODE_WORKTREE_PATH: "/repo/worktrees/a",
118 NO_COLOR: "1",
119 FORCE_COLOR: "0",
120 },
116 });121 });
117 expect(write).toHaveBeenCalledWith({122 expect(write).toHaveBeenCalledWith({
118 threadId: "thread-1",123 threadId: "thread-1",
...@@ -211,6 +216,8 @@ describe("ProjectSetupScriptRunner", () => {...@@ -211,6 +216,8 @@ describe("ProjectSetupScriptRunner", () => {
211 cwd: "/repo/worktrees/a",216 cwd: "/repo/worktrees/a",
212 worktreePath: "/repo/worktrees/a",217 worktreePath: "/repo/worktrees/a",
213 env: {218 env: {
219 NO_COLOR: "1",
220 FORCE_COLOR: "0",
214 T3CODE_PROJECT_ROOT: "/repo/project",221 T3CODE_PROJECT_ROOT: "/repo/project",
215 T3CODE_WORKTREE_PATH: "/repo/worktrees/a",222 T3CODE_WORKTREE_PATH: "/repo/worktrees/a",
216 },223 },
apps/server/src/project/ProjectSetupScriptRunner.ts+2-1
...@@ -361,7 +361,8 @@ export const make = Effect.gen(function* () {...@@ -361,7 +361,8 @@ export const make = Effect.gen(function* () {
361 terminalId,361 terminalId,
362 cwd,362 cwd,
363 worktreePath: input.worktreePath,363 worktreePath: input.worktreePath,
364 env,364 // Setup may run before a terminal client attaches to answer color probes.
365 env: { ...env, NO_COLOR: "1", FORCE_COLOR: "0" },
365 })366 })
366 .pipe(367 .pipe(
367 Effect.mapError(368 Effect.mapError(
apps/server/src/terminal/Manager.test.ts+5-1
...@@ -1934,13 +1934,15 @@ it.layer(...@@ -1934,13 +1934,15 @@ it.layer(
19341934
1935 it.effect("injects runtime env overrides into spawned terminals", () =>1935 it.effect("injects runtime env overrides into spawned terminals", () =>
1936 Effect.gen(function* () {1936 Effect.gen(function* () {
1937 const { manager, ptyAdapter } = yield* createManager();1937 const { manager, ptyAdapter } = yield* createManager(5, { env: { FORCE_COLOR: "3" } });
1938 yield* manager.open(1938 yield* manager.open(
1939 openInput({1939 openInput({
1940 env: {1940 env: {
1941 T3CODE_PROJECT_ROOT: "/repo",1941 T3CODE_PROJECT_ROOT: "/repo",
1942 T3CODE_WORKTREE_PATH: "/repo/worktree-a",1942 T3CODE_WORKTREE_PATH: "/repo/worktree-a",
1943 CUSTOM_FLAG: "1",1943 CUSTOM_FLAG: "1",
1944 NO_COLOR: "1",
1945 FORCE_COLOR: "0",
1944 },1946 },
1945 }),1947 }),
1946 );1948 );
...@@ -1951,6 +1953,8 @@ it.layer(...@@ -1951,6 +1953,8 @@ it.layer(
1951 assert.equal(spawnInput.env.T3CODE_PROJECT_ROOT, "/repo");1953 assert.equal(spawnInput.env.T3CODE_PROJECT_ROOT, "/repo");
1952 assert.equal(spawnInput.env.T3CODE_WORKTREE_PATH, "/repo/worktree-a");1954 assert.equal(spawnInput.env.T3CODE_WORKTREE_PATH, "/repo/worktree-a");
1953 assert.equal(spawnInput.env.CUSTOM_FLAG, "1");1955 assert.equal(spawnInput.env.CUSTOM_FLAG, "1");
1956 assert.equal(spawnInput.env.NO_COLOR, "1");
1957 assert.equal(spawnInput.env.FORCE_COLOR, "0");
1954 }),1958 }),
1955 );1959 );
19561960