Skip to content

Commit 574ea52

Browse files
Merge remote-tracking branch 'origin/main' into fix/12276-claude-custom-title
2 parents 990cb88 + 143ab16 commit 574ea52

274 files changed

Lines changed: 15058 additions & 3324 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/scripts/ci-changes.cjs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const EXTRA_OWNERS = [
3636
// scripts/build-desktop-artifact.ts reads the GNOME extension manifest.
3737
[/^apps\/desktop\/gnome-extension\//, ["@t3tools/scripts"]],
3838
[/^native\/browser-secret\//, ["@t3tools/desktop"]],
39+
[/^native\/kde-snap-shot\//, ["@t3tools/desktop"]],
3940
[/^native\/libghostty-vt\//, ["@t3tools/web"]],
4041
];
4142
const RUST = /^native\/(resource-monitor|kde-snap-shot|hyprland-snap-shot)\//;
@@ -112,10 +113,10 @@ function ownersOf(file, packages) {
112113
// A manifest can change dependencies or versions other packages read.
113114
if (path.posix.basename(file) === "package.json") return null;
114115
if (RUNS_EVERYTHING.some((pattern) => pattern.test(file))) return null;
116+
const extra = EXTRA_OWNERS.flatMap(([pattern, names]) => (pattern.test(file) ? names : []));
115117
// scripts/build-desktop-artifact.test.ts reads the crates' sources.
116-
if (RUST.test(file)) return ["@t3tools/scripts"];
118+
if (RUST.test(file)) return ["@t3tools/scripts", ...extra];
117119

118-
const extra = EXTRA_OWNERS.flatMap(([pattern, names]) => (pattern.test(file) ? names : []));
119120
const owner = packages
120121
.filter((pkg) => file.startsWith(`${pkg.dir}/`))
121122
.sort((a, b) => b.dir.length - a.dir.length)[0];

‎.github/workflows/deploy-relay.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
RELAY_TUNNEL_ZONE_NAME: ${{ vars.RELAY_TUNNEL_ZONE_NAME }}
4242
RELAY_TUNNEL_CLEANUP_MODE: ${{ vars.RELAY_TUNNEL_CLEANUP_MODE }}
4343
RELAY_LEGACY_TUNNEL_CLEANUP_MODE: ${{ vars.RELAY_LEGACY_TUNNEL_CLEANUP_MODE }}
44+
RELAY_ALERT_NOTIFIER_ID: ${{ vars.RELAY_ALERT_NOTIFIER_ID }}
45+
RELAY_WARNING_NOTIFIER_ID: ${{ vars.RELAY_WARNING_NOTIFIER_ID }}
4446
CLERK_PUBLISHABLE_KEY: ${{ vars.CLERK_PUBLISHABLE_KEY }}
4547
CLERK_JWT_AUDIENCE: ${{ vars.CLERK_JWT_AUDIENCE }}
4648
APNS_ENVIRONMENT: ${{ vars.APNS_ENVIRONMENT }}

‎apps/desktop/src/app/DesktopAppErrors.test.ts‎

Lines changed: 0 additions & 30 deletions
This file was deleted.

‎apps/desktop/src/app/DesktopDetachedActionErrors.test.ts‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎apps/desktop/src/backend/DesktopBackendPool.test.ts‎

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { assert, describe, it } from "@effect/vitest";
2-
import * as Duration from "effect/Duration";
32
import * as Effect from "effect/Effect";
43
import * as FileSystem from "effect/FileSystem";
54
import * as Layer from "effect/Layer";
@@ -19,29 +18,7 @@ import * as DesktopWindow from "../window/DesktopWindow.ts";
1918
import * as DesktopWslEnvironment from "../wsl/DesktopWslEnvironment.ts";
2019
import * as DesktopBackendConfiguration from "./DesktopBackendConfiguration.ts";
2120
import * as DesktopBackendPool from "./DesktopBackendPool.ts";
22-
import type { DesktopBackendSnapshot, DesktopBackendStartConfig } from "./DesktopBackendManager.ts";
23-
24-
function makeStubInstance(
25-
id: DesktopBackendPool.BackendInstanceId,
26-
label: string,
27-
): DesktopBackendPool.DesktopBackendInstance {
28-
const snapshot: DesktopBackendSnapshot = {
29-
desiredRunning: false,
30-
ready: false,
31-
activePid: Option.none(),
32-
restartAttempt: 0,
33-
restartScheduled: false,
34-
};
35-
return {
36-
id,
37-
label: Effect.succeed(label),
38-
start: Effect.void,
39-
stop: () => Effect.void,
40-
currentConfig: Effect.succeed(Option.none<DesktopBackendStartConfig>()),
41-
snapshot: Effect.succeed(snapshot),
42-
waitForReady: (_timeout: Duration.Duration) => Effect.succeed(false),
43-
};
44-
}
21+
import type { DesktopBackendStartConfig } from "./DesktopBackendManager.ts";
4522

4623
function layerPool(labelRef: Ref.Ref<string>): Layer.Layer<DesktopBackendPool.DesktopBackendPool> {
4724
return DesktopBackendPool.layer.pipe(
@@ -111,36 +88,6 @@ function layerPool(labelRef: Ref.Ref<string>): Layer.Layer<DesktopBackendPool.De
11188
}
11289

11390
describe("DesktopBackendPool", () => {
114-
it.effect("layerTest exposes registered instances by id", () =>
115-
Effect.gen(function* () {
116-
const pool = yield* DesktopBackendPool.DesktopBackendPool;
117-
const fetchedPrimary = yield* pool.get(DesktopBackendPool.PRIMARY_INSTANCE_ID);
118-
const fetchedWsl = yield* pool.get(DesktopBackendPool.BackendInstanceId("wsl:ubuntu"));
119-
const fetchedMissing = yield* pool.get(DesktopBackendPool.BackendInstanceId("missing"));
120-
const all = yield* pool.list;
121-
const resolvedPrimary = yield* pool.primary;
122-
123-
assert.equal(yield* Option.getOrThrow(fetchedPrimary).label, "Windows");
124-
assert.equal(yield* Option.getOrThrow(fetchedWsl).label, "WSL (Ubuntu)");
125-
assert.isTrue(Option.isNone(fetchedMissing));
126-
assert.lengthOf(all, 2);
127-
assert.equal(resolvedPrimary.id, DesktopBackendPool.PRIMARY_INSTANCE_ID);
128-
}).pipe(
129-
Effect.provide(
130-
DesktopBackendPool.layerTest([
131-
makeStubInstance(DesktopBackendPool.PRIMARY_INSTANCE_ID, "Windows"),
132-
makeStubInstance(DesktopBackendPool.BackendInstanceId("wsl:ubuntu"), "WSL (Ubuntu)"),
133-
]),
134-
),
135-
),
136-
);
137-
138-
it.effect("layerTest dies when no instances are supplied", () =>
139-
Effect.exit(
140-
DesktopBackendPool.DesktopBackendPool.pipe(Effect.provide(DesktopBackendPool.layerTest([]))),
141-
).pipe(Effect.map((exit) => assert.equal(exit._tag, "Failure"))),
142-
);
143-
14491
it.effect("resolves the primary label lazily after pool layer construction", () =>
14592
Effect.scoped(
14693
Effect.gen(function* () {

‎apps/desktop/src/backend/tailscaleEndpointProvider.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ describe("tailscale endpoint provider", () => {
209209
return {
210210
magicDnsName: "desktop.tail.ts.net",
211211
tailnetIpv4Addresses: ["100.74.126.34"],
212+
httpsServeEnabled: null,
212213
};
213214
}),
214215
});

‎apps/desktop/src/shell/DesktopShellEnvironment.test.ts‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,49 @@ describe("DesktopShellEnvironment", () => {
530530
}),
531531
);
532532

533+
it.effect("drops earlier AppImage launches' mount dirs from the search paths on linux", () =>
534+
Effect.gen(function* () {
535+
const current = "/var/tmp/.mount_cur";
536+
const env: NodeJS.ProcessEnv = {
537+
SHELL: "/bin/zsh",
538+
APPIMAGE: "/home/me/T3-Code.AppImage",
539+
APPDIR: `${current}/`,
540+
PATH: `${current}/usr/bin:/tmp/.mount_old/usr/bin:/usr/bin`,
541+
LD_LIBRARY_PATH: `/tmp/.mount_old/usr/lib:${current}/usr/lib::/opt/lib`,
542+
XDG_DATA_DIRS: "/tmp/.mount_old/usr/share:/var/tmp/.mount_cur2/usr/share",
543+
};
544+
545+
yield* runShellEnvironment({
546+
env,
547+
platform: "linux",
548+
handler: () => envOutput({ PATH: "/tmp/.mount_older/usr/bin:/home/me/.local/bin" }),
549+
});
550+
551+
assert.equal(env.PATH, `/home/me/.local/bin:${current}/usr/bin:/usr/bin`);
552+
assert.equal(env.LD_LIBRARY_PATH, `${current}/usr/lib::/opt/lib`);
553+
assert.equal(env.XDG_DATA_DIRS, undefined);
554+
}),
555+
);
556+
557+
it.effect("keeps AppImage-looking search paths outside an AppImage launch", () =>
558+
Effect.gen(function* () {
559+
const env: NodeJS.ProcessEnv = {
560+
SHELL: "/bin/zsh",
561+
PATH: "/tmp/.mount_old/usr/bin:/usr/bin",
562+
LD_LIBRARY_PATH: "/tmp/.mount_old/usr/lib",
563+
};
564+
565+
yield* runShellEnvironment({
566+
env,
567+
platform: "linux",
568+
handler: () => envOutput({ PATH: "/usr/bin" }),
569+
});
570+
571+
assert.equal(env.PATH, "/usr/bin:/tmp/.mount_old/usr/bin");
572+
assert.equal(env.LD_LIBRARY_PATH, "/tmp/.mount_old/usr/lib");
573+
}),
574+
);
575+
533576
it.effect("prefers login-shell desktop session hints over inherited values on linux", () =>
534577
Effect.gen(function* () {
535578
const env: NodeJS.ProcessEnv = {

‎apps/desktop/src/shell/DesktopShellEnvironment.ts‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,37 @@ const readEnvPath = (env: NodeJS.ProcessEnv): Option.Option<string> =>
114114

115115
const normalizeRuntimeDir = (value: string): string => value.replace(/\/+$/u, "");
116116

117+
const APPIMAGE_SEARCH_PATH_ENV_NAMES = ["PATH", "LD_LIBRARY_PATH", "XDG_DATA_DIRS"] as const;
118+
119+
// The AppImage runtime mounts each launch at `$TMPDIR/.mount_<id>` and prepends
120+
// it to the search paths above. A launch started from a shell that inherited an
121+
// earlier launch's env carries that mount too, and once it is unmounted every
122+
// spawn that walks PATH (git first of all) fails with ENOTCONN.
123+
const APPIMAGE_MOUNT_ROOT = /^(.*?\/\.mount_[^/]+)(?:\/|$)/u;
124+
125+
const stripStaleAppImageMounts = (env: NodeJS.ProcessEnv): void => {
126+
if (env.APPIMAGE === undefined && env.APPDIR === undefined) return;
127+
const appDir = env.APPDIR === undefined ? undefined : normalizeRuntimeDir(env.APPDIR);
128+
for (const name of APPIMAGE_SEARCH_PATH_ENV_NAMES) {
129+
const value = env[name];
130+
if (value === undefined) continue;
131+
// glibc's loader also splits LD_LIBRARY_PATH on `;`.
132+
const segments = value.split(name === "LD_LIBRARY_PATH" ? /[:;]/u : ":");
133+
const kept = segments.filter((segment) => {
134+
const mountRoot = APPIMAGE_MOUNT_ROOT.exec(segment)?.[1];
135+
return mountRoot === undefined || mountRoot === appDir;
136+
});
137+
if (kept.length === segments.length) continue;
138+
if (kept.length === 0) {
139+
delete env[name];
140+
} else {
141+
// An empty segment is the current dir to the loader and to PATH lookup,
142+
// but a lone one joins to "", which reads as unset.
143+
env[name] = kept.join(":") || ":";
144+
}
145+
}
146+
};
147+
117148
const linuxRuntimeDirCandidates = (
118149
env: NodeJS.ProcessEnv,
119150
uid: number | undefined,
@@ -430,6 +461,9 @@ const installPosixEnvironment = Effect.fn("desktop.shellEnvironment.installPosix
430461
if (Option.isSome(mergedPath)) {
431462
config.env.PATH = mergedPath.value;
432463
}
464+
// The server, relaunch and updater all inherit process.env, so scrubbing
465+
// here keeps earlier AppImage launches' mounts out of every one of them.
466+
stripStaleAppImageMounts(config.env);
433467
if (!config.env.SSH_AUTH_SOCK && shellEnvironment.SSH_AUTH_SOCK) {
434468
config.env.SSH_AUTH_SOCK = shellEnvironment.SSH_AUTH_SOCK;
435469
}

0 commit comments

Comments
 (0)