authorgravatar for shubh@shubhxho.comShubh <shubh@shubhxho.com> 2026-09-05 07:04:11+05:30
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-04 18:34:11-07:00
log89ee69e4430b21ee14565abf5c34dae43f38c1d8
tree9342b5efbaa33c681b669551093e446526c1fabd
parent82f64cd8d046ab4ee8588f7bcbc1e66a4a0c80fe
signature Signed by PGP key B5690EEEBB952194

fix(server): advertise truecolor in the integrated terminal (#7680)

Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>

2 files changed, 29 insertions(+), 0 deletions(-)

apps/server/src/terminal/Manager.test.ts+25
...@@ -1687,6 +1687,31 @@ it.layer(...@@ -1687,6 +1687,31 @@ it.layer(
1687 }),1687 }),
1688 );1688 );
16891689
1690 it.effect.each(["linux", "darwin", "win32"] as const)(
1691 "advertises truecolor before the PTY backend on %s without replacing explicit values",
1692 (platform) =>
1693 Effect.gen(function* () {
1694 for (const [parentColor, runtimeColor, expected] of [
1695 [undefined, undefined, "truecolor"],
1696 ["", undefined, "truecolor"],
1697 ["24bit", undefined, "24bit"],
1698 ["24bit", "", "truecolor"],
1699 ["24bit", "custom", "custom"],
1700 ] as const) {
1701 const env = Object.freeze({ COLORTERM: parentColor });
1702 const { manager, ptyAdapter } = yield* createManager(5, {
1703 shellResolver: () => "/bin/sh",
1704 env,
1705 }).pipe(Effect.provide(withHostPlatform(platform)));
1706 yield* manager.open(
1707 openInput({ env: runtimeColor === undefined ? {} : { COLORTERM: runtimeColor } }),
1708 );
1709 expect(ptyAdapter.spawnInputs[0]?.env.COLORTERM).toBe(expected);
1710 expect(env.COLORTERM).toBe(parentColor);
1711 }
1712 }),
1713 );
1714
1690 it.effect("filters app runtime env variables from terminal sessions", () =>1715 it.effect("filters app runtime env variables from terminal sessions", () =>
1691 Effect.gen(function* () {1716 Effect.gen(function* () {
1692 const { manager, ptyAdapter } = yield* createManager(5, {1717 const { manager, ptyAdapter } = yield* createManager(5, {
apps/server/src/terminal/Manager.ts+4
...@@ -1270,6 +1270,10 @@ function createTerminalSpawnEnv(...@@ -1270,6 +1270,10 @@ function createTerminalSpawnEnv(
1270 spawnEnv[key] = value;1270 spawnEnv[key] = value;
1271 }1271 }
1272 }1272 }
1273 // Both PTY backends feed truecolor-capable terminal clients.
1274 if (spawnEnv.COLORTERM === undefined || spawnEnv.COLORTERM === "") {
1275 spawnEnv.COLORTERM = "truecolor";
1276 }
1273 return stripAppImageRuntimeEnv(spawnEnv);1277 return stripAppImageRuntimeEnv(spawnEnv);
1274}1278}
12751279