GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(desktop): show the unavailable T3 home error above the main window on Linux by juliusmarminge · Pull Request #31193 · pingdotgg/t3code

fix(desktop): show the unavailable T3 home error above the main window on Linux #31193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
juliusmarminge wants to merge 4 commits into main
base: main
Loading
Loading
from fix/issue-31179
+234 −32
Open

fix(desktop): show the unavailable T3 home error above the main window on Linux #31193

Changes from 1 commit
Commits
Show all changes
4 commits
Select commit Hold shift + click to select a range
47649b0
test(desktop): reproduce #31179 unavailable T3 home error shown witho…
juliusmarminge Nov 4, 2026
df977d4
fix(desktop): attach the unavailable T3 home error to the main window
juliusmarminge Nov 4, 2026
a82379d
fix(desktop): keep the unavailable T3 home error from blocking backen…
juliusmarminge Nov 4, 2026
1d45a5c
Merge remote-tracking branch 'origin/main' into fix/issue-31179
juliusmarminge Nov 10, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Next Next commit
test(desktop): reproduce #31179 unavailable T3 home error shown witho…
…ut an owner

When the primary backend exits because another server owns the T3 home, the
"This T3 home is unavailable" error must be attached to the open main window
so it cannot fall behind it, and the app must still quit after it closes.
This test reproduces #31179 and fails on main, where the error box has no owner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge @claude
juliusmarminge and claude committed Nov 4, 2026
commit 47649b0b82b6bc1402c1a120b3f6727ba81a88a4

There are no files selected for viewing

175 changes: 149 additions & 26 deletions 175 apps/desktop/src/backend/DesktopBackendPool.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { SERVER_EXIT_CODE_STATE_DIR_OWNED } from "@t3tools/contracts";
import { assert, describe, it } from "@effect/vitest";
import * as Deferred from "effect/Deferred";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
import * as Ref from "effect/Ref";
import * as Sink from "effect/Sink";
import * as Stream from "effect/Stream";
import { HttpClient } from "effect/http";
import { ChildProcessSpawner } from "effect/process";
import type * as Electron from "electron";

import * as DesktopObservability from "../app/DesktopObservability.ts";
import * as DesktopState from "../app/DesktopState.ts";
Expand All @@ -15,24 +19,80 @@ import * as DesktopTelemetryPublisher from "../telemetry/DesktopTelemetryPublish
import * as DesktopBrowserHost from "../preview/DesktopBrowserHost.ts";
import * as ElectronDialog from "../electron/ElectronDialog.ts";
import * as ElectronApp from "../electron/ElectronApp.ts";
import * as ElectronWindow from "../electron/ElectronWindow.ts";
import * as DesktopWindow from "../window/DesktopWindow.ts";
import * as DesktopWslEnvironment from "../wsl/DesktopWslEnvironment.ts";
import * as DesktopBackendConfiguration from "./DesktopBackendConfiguration.ts";
import * as DesktopBackendPool from "./DesktopBackendPool.ts";
import type { DesktopBackendStartConfig } from "./DesktopBackendManager.ts";

function layerPool(labelRef: Ref.Ref<string>): Layer.Layer<DesktopBackendPool.DesktopBackendPool> {
const backendConfig: DesktopBackendStartConfig = {
executablePath: "/electron",
args: [],
entryPath: "/server/bin.mjs",
cwd: "/server",
env: {},
bootstrap: {
mode: "desktop",
noBrowser: true,
port: 3774,
t3Home: "/tmp/t3",
host: "127.0.0.1",
desktopBootstrapToken: "token",
tailscaleServeEnabled: false,
tailscaleServePort: 443,
},
bootstrapDelivery: "fd3",
extendEnv: true,
httpBaseUrl: new URL("http://127.0.0.1:3774"),
captureOutput: false,
preflightFailure: Option.none(),
};

interface LayerPoolOverrides {
readonly primaryExitCode?: number;
readonly electronDialog?: ElectronDialog.ElectronDialog["Service"];
readonly electronApp?: Partial<ElectronApp.ElectronApp["Service"]>;
readonly mainWindow?: Electron.BrowserWindow;
}

function layerPool(
labelRef: Ref.Ref<string>,
overrides: LayerPoolOverrides = {},
): Layer.Layer<DesktopBackendPool.DesktopBackendPool> {
const { primaryExitCode, mainWindow } = overrides;
const main = Option.fromUndefinedOr(mainWindow);
return DesktopBackendPool.layer.pipe(
Layer.provideMerge(
Layer.mergeAll(
FileSystem.layerNoop({}),
FileSystem.layerNoop({ exists: () => Effect.succeed(true) }),
Layer.succeed(
ChildProcessSpawner.ChildProcessSpawner,
ChildProcessSpawner.make(() => Effect.die("unexpected child process spawn")),
ChildProcessSpawner.make(() =>
primaryExitCode === undefined
? Effect.die("unexpected child process spawn")
: Effect.succeed(
ChildProcessSpawner.makeHandle({
pid: ChildProcessSpawner.ProcessId(123),
stdout: Stream.empty,
stderr: Stream.empty,
all: Stream.empty,
exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(primaryExitCode)),
isRunning: Effect.succeed(false),
kill: () => Effect.void,
stdin: Sink.drain,
getInputFd: () => Sink.drain,
getOutputFd: () => Stream.empty,
unref: Effect.succeed(Effect.void),
}),
),
),
),
Layer.succeed(
HttpClient.HttpClient,
HttpClient.make(() => Effect.die("unexpected HTTP request")),
HttpClient.make(() =>
primaryExitCode === undefined ? Effect.die("unexpected HTTP request") : Effect.never,
),
),
Layer.succeed(DesktopObservability.DesktopBackendOutputLogFactory, {
forInstance: () =>
Expand All @@ -57,16 +117,38 @@ function layerPool(labelRef: Ref.Ref<string>): Layer.Layer<DesktopBackendPool.De
}),
DesktopBrowserHost.layer,
Layer.succeed(DesktopBackendConfiguration.DesktopBackendConfiguration, {
resolvePrimary: Effect.die("unexpected primary config resolve"),
resolvePrimary:
primaryExitCode === undefined
? Effect.die("unexpected primary config resolve")
: Effect.succeed(backendConfig),
resolvePrimaryLabel: Ref.get(labelRef),
resolveWsl: () => Effect.die("unexpected WSL config resolve"),
currentBootstrapToken: Effect.die("unexpected bootstrap token read"),
} satisfies DesktopBackendConfiguration.DesktopBackendConfiguration["Service"]),
DesktopAppSettings.layerTest(),
DesktopState.layer,
DesktopWslEnvironment.layerTest(),
ElectronDialog.layer,
ElectronApp.layer,
overrides.electronDialog === undefined
? ElectronDialog.layer
: Layer.succeed(ElectronDialog.ElectronDialog, overrides.electronDialog),
Layer.succeed(ElectronApp.ElectronApp, {
...ElectronApp.make,
...overrides.electronApp,
}),
Layer.succeed(ElectronWindow.ElectronWindow, {
create: () => Effect.die("unexpected window create"),
main: Effect.succeed(main),
currentMainOrFirst: Effect.succeed(main),
focusedMainOrFirst: Effect.succeed(main),
setMain: () => Effect.die("unexpected main window set"),
clearMain: () => Effect.die("unexpected main window clear"),
prepareReveal: () => Effect.succeed(false),
reveal: () => Effect.die("unexpected window reveal"),
sendAll: () => Effect.void,
destroyAll: Effect.void,
syncAllAppearance: (sync) =>
Option.match(main, { onNone: () => Effect.void, onSome: sync }),
} satisfies ElectronWindow.ElectronWindow["Service"]),
Layer.succeed(DesktopWindow.DesktopWindow, {
createMain: Effect.die("unexpected window create"),
ensureMain: Effect.die("unexpected window ensure"),
Expand Down Expand Up @@ -99,25 +181,7 @@ describe("DesktopBackendPool", () => {
id,
label: Effect.succeed("WSL (Ubuntu)"),
configResolve: Effect.succeed({
executablePath: "/electron",
args: [],
entryPath: "/server/bin.mjs",
cwd: "/server",
env: {},
bootstrap: {
mode: "desktop",
noBrowser: true,
port: 3774,
t3Home: "/tmp/t3",
host: "127.0.0.1",
desktopBootstrapToken: "token",
tailscaleServeEnabled: false,
tailscaleServePort: 443,
},
bootstrapDelivery: "fd3",
extendEnv: true,
httpBaseUrl: new URL("http://127.0.0.1:3774"),
captureOutput: false,
...backendConfig,
preflightFailure: Option.some({ reason: "WSL starting", fatal: false }),
} satisfies DesktopBackendStartConfig),
});
Expand All @@ -133,4 +197,63 @@ describe("DesktopBackendPool", () => {
}).pipe(Effect.provide(layerPool(Ref.makeUnsafe("Windows")))),
),
);

// Linux shows a parentless error box behind the focused main window, so the user never sees it.
it.effect("shows the unavailable T3 home error attached to the main window, then quits", () => {
const mainWindow = { id: 1, isDestroyed: () => false } as unknown as Electron.BrowserWindow;
const events: Array<
| { readonly _tag: "Dialog"; readonly text: string; readonly owner?: Electron.BrowserWindow }
| { readonly _tag: "Quit" }
> = [];
const quit = Deferred.makeUnsafe<void>();
return Effect.gen(function* () {
const primary = yield* (yield* DesktopBackendPool.DesktopBackendPool).primary;
yield* primary.start;
yield* Deferred.await(quit);

const dialog = events.find(
(event) => event._tag === "Dialog" && event.text.includes("This T3 home is unavailable"),
);
assert.isDefined(dialog, "the T3 home unavailable error was never shown");
assert.strictEqual(
dialog._tag === "Dialog" ? dialog.owner : undefined,
mainWindow,
"the T3 home unavailable error must be attached to the main window",
);
assert.deepStrictEqual(
events.map((event) => event._tag),
["Dialog", "Quit"],
);
}).pipe(
Effect.scoped,
Effect.provide(
layerPool(Ref.makeUnsafe("Windows"), {
primaryExitCode: SERVER_EXIT_CODE_STATE_DIR_OWNED,
electronDialog: {
pickFolder: () => Effect.die("unexpected folder picker"),
pickFiles: () => Effect.die("unexpected file picker"),
showMessageBox: (options, owner) =>
Effect.sync(() => {
events.push({
_tag: "Dialog",
text: [options.title, options.message, options.detail].join("\n"),
...(owner === undefined ? {} : { owner }),
});
return { response: 0, checkboxChecked: false };
}),
showErrorBox: (title, content) =>
Effect.sync(() => {
events.push({ _tag: "Dialog", text: `${title}\n${content}` });
}),
},
electronApp: {
quit: Effect.sync(() => {
events.push({ _tag: "Quit" });
}).pipe(Effect.andThen(Deferred.succeed(quit, undefined))),
},
mainWindow,
}),
),
);
});
});
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402809 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.