The best way to control Claude Code, Codex and more from any computer or phone
fix(server): keep the previous preview browser version on a shared home (#23771)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>
Victor Vogel committed
Oct 29, 2026 at 12:42 UTC
55e7b5f66d6bd9f3e8e1ba06d20262afcc9ea64c
2 files changed
+15
-11
apps/server/src/preview/PreviewBrowser.test.ts
+10
-9
@@ -73,6 +73,7 @@ const browserArchive = makeZip([
73
74
const makeHarness = Effect.fn("test.makePreviewBrowser")(function* (
75
options: {
76
+ readonly version?: string;
77
readonly archive?: Buffer;
78
readonly sha256?: string;
79
readonly body?: Stream.Stream<Uint8Array>;
@@ -93,7 +94,7 @@ const makeHarness = Effect.fn("test.makePreviewBrowser")(function* (
94
release: options.unsupported
95
? null
96
: {
96
- version: "1.2.3",
97
+ version: options.version ?? "1.2.3",
98
platform: "fixture",
99
url: "https://storage.googleapis.com/chrome-headless-shell-fixture.zip",
100
bytes: archive.byteLength,
@@ -121,10 +122,11 @@ const makeHarness = Effect.fn("test.makePreviewBrowser")(function* (
122
});
123
124
it.layer(NodeServices.layer)("PreviewBrowser", (it) => {
124
- it.effect("installs a verified download with its file modes and then reuses it", () =>
125
+ it.effect.each(["0.8.0", "1.2.3"])("retains another version when installing %s", (current) =>
126
Effect.gen(function* () {
126
- const { browser, fs, path, installRoot, requests } = yield* makeHarness();
127
- yield* fs.makeDirectory(path.join(installRoot, "1.0.0"), { recursive: true });
127
+ const { browser, fs, path, installRoot, requests } = yield* makeHarness({ version: current });
128
+ yield* fs.makeDirectory(path.join(installRoot, "0.9.0"), { recursive: true });
129
+ yield* fs.makeDirectory(path.join(installRoot, "0.10.0"));
130
const active = path.join(installRoot, ".install-other");
131
const abandoned = path.join(installRoot, ".install-abandoned");
132
yield* fs.makeDirectory(active);
@@ -135,7 +137,7 @@ it.layer(NodeServices.layer)("PreviewBrowser", (it) => {
137
138
const executable = yield* browser.executable;
139
138
- const version = path.join(installRoot, "1.2.3");
140
+ const version = path.join(installRoot, current);
141
expect(executable).toBe(path.join(version, executableName));
142
expect(yield* fs.readFileString(path.join(version, "locales", "en-US.pak"))).toBe("strings");
143
if (hostPlatform !== "win32") {
@@ -145,10 +147,9 @@ it.layer(NodeServices.layer)("PreviewBrowser", (it) => {
147
expect(yield* mode("libEGL.so")).toBe(0o755);
148
expect(yield* mode(path.join("locales", "en-US.pak"))).toBe(0o644);
149
}
148
- expect((yield* fs.readDirectory(installRoot)).toSorted()).toEqual([
149
- ".install-other",
150
- "1.2.3",
151
- ]);
150
+ expect((yield* fs.readDirectory(installRoot)).toSorted()).toEqual(
151
+ [".install-other", "0.10.0", current].toSorted(),
152
+ );
153
expect(yield* browser.executable).toBe(executable);
154
expect(yield* browser.installed).toEqual(Option.some(executable));
155
expect(requests).toHaveLength(1);
apps/server/src/preview/PreviewBrowser.ts
+5
-2
@@ -321,11 +321,14 @@ export const makePreviewBrowser = Effect.fn("PreviewBrowser.make")(function* (
321
yield* fs.remove(destination, { recursive: true, force: true });
322
yield* fs.rename(unpacked, destination);
323
}).pipe(Effect.scoped);
324
- // Shared homes may have another server installing; preserve staging directories touched within the last hour.
324
+ // Shared homes may still use the newest other version or staging directories touched within the last hour.
325
const entries = yield* fs.readDirectory(installRoot);
326
+ const previous = entries
327
+ .filter((name) => name !== release.version && !name.startsWith("."))
328
+ .toSorted((left, right) => right.localeCompare(left, "en", { numeric: true }))[0];
329
const now = yield* Clock.currentTimeMillis;
330
yield* Effect.forEach(
328
- entries.filter((name) => name !== release.version),
331
+ entries.filter((name) => name !== release.version && name !== previous),
332
(name) =>
333
Effect.gen(function* () {
334
const target = path.join(installRoot, name);