Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

fix(web): say why a Runtime is unavailable in Runtime settings

Dongdong Chenc7b5893689fd
diff --git a/apps/web/src/features/local-computer/computer-readiness.ts b/apps/web/src/features/local-computer/computer-readiness.ts
index 392eeb26..c5ee82a4 100644
--- a/apps/web/src/features/local-computer/computer-readiness.ts
+++ b/apps/web/src/features/local-computer/computer-readiness.ts
@@ -27,6 +27,15 @@ export const appDescriptions = {
pi: "Open-source coding agent",
} satisfies Record<TeamHubLocalRuntimeType, string>;
+export const runtimeStatusLabels = {
+ authentication_required: "Sign-in required",
+ error: "Could not check",
+ incompatible: "Update needed",
+ not_installed: "Not installed",
+ ready: "Ready",
+ unknown: "Checking",
+} satisfies Record<RuntimeStatus, string>;
+
export type ComputerReadiness =
| { kind: "reconnecting" }
| { kind: "offline" }
diff --git a/apps/web/src/features/local-computer/local-computer-gate.tsx b/apps/web/src/features/local-computer/local-computer-gate.tsx
index 2f16e5a8..34e18511 100644
--- a/apps/web/src/features/local-computer/local-computer-gate.tsx
+++ b/apps/web/src/features/local-computer/local-computer-gate.tsx
@@ -21,7 +21,12 @@ import {
computerInstallCommand,
ComputerPlatformSelector,
} from "./computer-platform";
-import { appNames, appOrder, appStatus } from "./computer-readiness";
+import {
+ appNames,
+ appOrder,
+ appStatus,
+ runtimeStatusLabels,
+} from "./computer-readiness";
import { useDesktopComputer } from "./desktop-computer";
import { DesktopComputerSetup } from "./desktop-computer-setup";
import { localComputersQueryOptions } from "./local-computer-queries";
@@ -36,15 +41,6 @@ type RuntimeStatus = LocalComputer["runtimes"][number]["status"];
// through the inventory, so the gate polls while it is open.
const pollIntervalMs = 3_000;
-const statusLabels: Record<RuntimeStatus, string> = {
- authentication_required: "Sign-in required",
- error: "Could not check",
- incompatible: "Update needed",
- not_installed: "Not installed",
- ready: "Ready",
- unknown: "Checking",
-};
-
/**
* Every model call, Another Me's included, runs on the Human's own Computer,
* so this build has nothing to offer before one runs an AI app. TeamHub
@@ -286,7 +282,7 @@ function AppRow({
: "text-muted-foreground",
)}
>
- {statusLabels[status]}
+ {runtimeStatusLabels[status]}
</span>
</li>
);
diff --git a/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.test.tsx b/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.test.tsx
index 557561db..2dc5607d 100644
--- a/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.test.tsx
+++ b/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.test.tsx
@@ -1,8 +1,15 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { fireEvent, render, screen, waitFor } from "@testing-library/react";
+import {
+ act,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from "@testing-library/react";
import { MemoryRouter } from "react-router";
import { describe, expect, it, vi } from "vitest";
+import { localComputersQueryKey } from "@/features/local-computer/local-computer-queries";
import type {
TeamHubLocalComputerPage,
TeamHubTenantAgent,
@@ -152,6 +159,99 @@ describe("EditAgentRuntimeDialog", () => {
},
);
+ it("names a missing runtime and gives its install command", async () => {
+ const computer = localComputer("computer-old", "Old Mac", "online", {
+ platform: "darwin",
+ });
+ computer.runtimes = [
+ ...computer.runtimes,
+ {
+ error_code: "RUNTIME_NOT_INSTALLED",
+ message: "Runtime executable not found",
+ models: [],
+ status: "not_installed",
+ type: "pi",
+ },
+ ];
+ renderDialog({ computersOverride: { items: [computer] }, onSave: vi.fn() });
+ const runtime = await screen.findByRole("combobox", {
+ name: "Agent runtime",
+ });
+ fireEvent.click(runtime);
+ fireEvent.click(
+ await screen.findByRole("option", { name: "Pi · Not installed" }),
+ );
+ expect(
+ screen.getByText("npm install -g @earendil-works/pi-coding-agent"),
+ ).toBeVisible();
+ expect(
+ screen.queryByText("Runtime executable not found"),
+ ).not.toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "Save Runtime" })).toBeDisabled();
+ });
+
+ it("picks a model once the chosen runtime turns ready while open", async () => {
+ const onSave = vi.fn<(input: AgentRuntimeUpdateInput) => void>();
+ const computer = localComputer("computer-old", "Old Mac", "online");
+ // A signed-out runtime reports no models until it is ready.
+ const claudeModels = computer.runtimes[0]!.models;
+ computer.runtimes[0] = { ...computer.runtimes[0]!, models: [] };
+ const queryClient = new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+ });
+ renderDialog({
+ computersOverride: { items: [computer] },
+ onSave,
+ queryClient,
+ });
+ const runtime = await screen.findByRole("combobox", {
+ name: "Agent runtime",
+ });
+ fireEvent.click(runtime);
+ fireEvent.click(
+ await screen.findByRole("option", {
+ name: "Claude Code · Sign-in required",
+ }),
+ );
+ expect(screen.getByRole("button", { name: "Save Runtime" })).toBeDisabled();
+
+ await act(async () => {
+ queryClient.setQueryData(localComputersQueryKey("tenant-northstar"), {
+ items: [
+ {
+ ...computer,
+ runtimes: computer.runtimes.map((item) =>
+ item.type === "claude"
+ ? {
+ models: claudeModels,
+ status: "ready" as const,
+ type: item.type,
+ }
+ : item,
+ ),
+ },
+ ],
+ });
+ });
+ await waitFor(() =>
+ expect(
+ screen.getByRole("combobox", { name: "Agent model" }),
+ ).toHaveTextContent("Claude default"),
+ );
+ fireEvent.click(screen.getByRole("button", { name: "Save Runtime" }));
+ expect(onSave).toHaveBeenCalledWith({
+ runtime: {
+ model: "claude-default",
+ placement: {
+ computer_id: "computer-old",
+ runtime_type: "claude",
+ type: "local",
+ workspace_grant_id: "grant-workspace",
+ },
+ },
+ });
+ });
+
it("blocks an unauthenticated target and allows choosing a ready runtime again", async () => {
const onSave = vi.fn();
renderDialog({ onSave });
@@ -161,9 +261,12 @@ describe("EditAgentRuntimeDialog", () => {
await waitFor(() => expect(runtime).toHaveTextContent("Codex"));
fireEvent.click(runtime);
fireEvent.click(
- await screen.findByRole("option", { name: "Claude Code · Unavailable" }),
+ await screen.findByRole("option", {
+ name: "Claude Code · Sign-in required",
+ }),
);
- expect(screen.getByText("Claude authentication is required")).toBeVisible();
+ expect(screen.getByText("Claude Code sign-in required")).toBeVisible();
+ expect(screen.getByText("claude auth login")).toBeVisible();
expect(screen.getByRole("button", { name: "Save Runtime" })).toBeDisabled();
fireEvent.click(runtime);
fireEvent.click(await screen.findByRole("option", { name: "Codex" }));
@@ -486,7 +589,7 @@ describe("EditAgentRuntimeDialog", () => {
fireEvent.click(runtime);
fireEvent.click(
await screen.findByRole("option", {
- name: mode === "ready-empty" ? "Pi" : "Pi · Unavailable",
+ name: mode === "ready-empty" ? "Pi" : "Pi · Not installed",
}),
);
@@ -512,7 +615,11 @@ function renderDialog({
onSave,
registration = localCodexAgent(),
computersOverride,
+ queryClient = new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+ }),
}: {
+ queryClient?: QueryClient;
field?: AgentRuntimeField;
onClose?: () => void;
onSave: (input: AgentRuntimeUpdateInput) => void;
@@ -531,11 +638,7 @@ function renderDialog({
render(
<MemoryRouter>
- <QueryClientProvider
- client={
- new QueryClient({ defaultOptions: { queries: { retry: false } } })
- }
- >
+ <QueryClientProvider client={queryClient}>
<EditAgentRuntimeDialog
field={field}
client={client}
diff --git a/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.tsx b/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.tsx
index e105ce01..ec57ef2a 100644
--- a/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.tsx
+++ b/apps/web/src/features/rooms/members/edit-agent-runtime-dialog.tsx
@@ -5,7 +5,10 @@ import { Link } from "react-router";
import { Button } from "@/components/ui/button";
import { ModalDialog } from "@/components/ui/modal-dialog";
import { Select, SelectItem } from "@/components/ui/select";
+import { runtimeStatusLabels } from "@/features/local-computer/computer-readiness";
import { localComputersQueryKey } from "@/features/local-computer/local-computer-queries";
+import { LocalRuntimeAuthenticationGuidance } from "@/features/local-computer/local-runtime-authentication-guidance";
+import { LocalRuntimeInstallGuidance } from "@/features/local-computer/local-runtime-install-guidance";
import type { TeamHubClient } from "@/features/teamhub/teamhub-client";
import type {
TeamHubAgentReasoningEffort,
@@ -146,7 +149,9 @@ export function EditAgentRuntimeDialog({
{(computer?.runtimes ?? []).map((item) => (
<SelectItem key={item.type} value={item.type}>
{runtimeLabels[item.type]}
- {item.status === "ready" ? "" : " · Unavailable"}
+ {item.status === "ready"
+ ? ""
+ : ` · ${runtimeStatusLabels[item.status]}`}
</SelectItem>
))}
</Select>
@@ -159,6 +164,7 @@ export function EditAgentRuntimeDialog({
className="ui-field-control w-full"
disabled={field === "reasoning"}
onValueChange={selection.selectModel}
+ placeholder="No models available"
value={model}
>
{model && !modelIsAvailable ? (
@@ -231,11 +237,8 @@ export function EditAgentRuntimeDialog({
: "No models are available for this runtime."}
</p>
) : null}
- {!localReady && !loading && !unavailable && selection.runtimeType ? (
- <p className="text-sm text-app-danger" role="alert">
- {runtime?.message ??
- "Install and sign in to this runtime on the computer, then wait for it to become ready."}
- </p>
+ {!localReady && !loading && !unavailable && computer && runtime ? (
+ <RuntimeSetupGuidance computer={computer} runtime={runtime} />
) : null}
{selection.runtimeType === "pi" &&
selection.computerId &&
@@ -275,6 +278,49 @@ export function EditAgentRuntimeDialog({
);
}
+/* Desktop setup installs only the runtime the person chose, so the other
+ runtimes usually show up here not installed or signed out. Say which, and
+ give the command that fixes it on that computer. */
+function RuntimeSetupGuidance({
+ computer,
+ runtime,
+}: {
+ computer: LocalComputer;
+ runtime: LocalComputer["runtimes"][number];
+}) {
+ if (runtime.status === "not_installed")
+ return (
+ <div role="status">
+ <LocalRuntimeInstallGuidance
+ computerName={computer.display_name}
+ platform={computer.platform}
+ runtimeTypes={[runtime.type]}
+ />
+ </div>
+ );
+ if (runtime.status === "authentication_required")
+ return (
+ <div
+ className="rounded-lg border border-[var(--app-status-warning-border)] bg-[var(--app-status-warning-surface)] p-3 text-sm text-app-body"
+ role="status"
+ >
+ <LocalRuntimeAuthenticationGuidance
+ computerName={computer.display_name}
+ runtimeType={runtime.type}
+ />
+ <p className="mt-1 text-muted-foreground">
+ It turns ready here on its own shortly after you sign in.
+ </p>
+ </div>
+ );
+ return (
+ <p className="text-sm text-app-danger" role="alert">
+ {runtime.message ??
+ "Install and sign in to this runtime on the computer, then wait for it to become ready."}
+ </p>
+ );
+}
+
function computerOptionLabel(computer: LocalComputer) {
return `${computer.display_name} · ${
computer.status === "online" ? "Online" : "Offline"
diff --git a/apps/web/src/features/rooms/members/use-agent-move-target.ts b/apps/web/src/features/rooms/members/use-agent-move-target.ts
index c931421e..dc46a49c 100644
--- a/apps/web/src/features/rooms/members/use-agent-move-target.ts
+++ b/apps/web/src/features/rooms/members/use-agent-move-target.ts
@@ -28,7 +28,7 @@ export function useAgentMoveTarget(
const [runtimeType, setRuntimeType] = useState<TeamHubLocalRuntimeType | "">(
current?.runtime_type ?? "codex",
);
- const [model, setModel] = useState(registration.runtime.model);
+ const [requestedModel, setModel] = useState(registration.runtime.model);
const [requestedReasoningEffort, setRequestedReasoningEffort] = useState<
TeamHubAgentReasoningEffort | ""
>(registration.runtime.reasoning_effort ?? "");
@@ -44,6 +44,13 @@ export function useAgentMoveTarget(
);
const runtime = computer?.runtimes.find((item) => item.type === runtimeType);
const modelOptions = runtime?.status === "ready" ? runtime.models : [];
+ // A Runtime chosen before it was ready has no model yet; once the Computer
+ // reports it ready, it gets the model it would have had if chosen then.
+ const model =
+ requestedModel ||
+ (runtime?.status === "ready"
+ ? resolveModelOnRuntime(registration, runtime).model
+ : "");
const selectedModel = modelOptions.find((item) => item.id === model);
// The Runtime as the Computer last reported it; an offline Computer runs
// the Agent once it connects.