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(agent): register a Runtime that becomes available after the hello

jeffrey5ccd4d9202ae
diff --git a/apps/computer/local-daemon/README.md b/apps/computer/local-daemon/README.md
index b20189ae..cde67479 100644
--- a/apps/computer/local-daemon/README.md
+++ b/apps/computer/local-daemon/README.md
@@ -268,8 +268,10 @@ for a browser sign-in when signed out.
support Antigravity, so Agent Memory skips Antigravity Agents.
- The Gateway hello leaves out the Antigravity diagnostic while `agy` is not
installed, so such a Computer still connects to an Agent Service released
- before Antigravity support. Once `agy` is installed, the Agent Service must
- run this release first. The control API and `runtime check` keep reporting
+ before Antigravity support. When `agy` is installed later, the next
+ diagnostics update reports it and the Gateway adds its Runtime
+ Registration, so no restart is needed. Once `agy` is installed, the Agent
+ Service must run this release first. The control API and `runtime check` keep reporting
Antigravity as not installed.
## Frozen source
diff --git a/apps/node-services/src/agent/runner-gateway/runner-connections.ts b/apps/node-services/src/agent/runner-gateway/runner-connections.ts
index fe5bc1d3..8b0243f2 100644
--- a/apps/node-services/src/agent/runner-gateway/runner-connections.ts
+++ b/apps/node-services/src/agent/runner-gateway/runner-connections.ts
@@ -584,25 +584,54 @@ export class RunnerConnections {
runtimes: connection.hello.runtimes,
runtimeDiagnostics: envelope.runtime_diagnostics,
});
- connection.hello.runtime_registrations =
- connection.hello.runtime_registrations.map((observation) => {
- const diagnostic = envelope.runtime_diagnostics.find(
- ({ type }) => type === observation.provider_type,
- );
- if (!diagnostic) return observation;
- const available =
- diagnostic.status === "ready" ||
- diagnostic.status === "authentication_required";
- return {
- ...observation,
- status: available ? ("online" as const) : ("unavailable" as const),
- revision: envelope.revision,
- capabilities: available ? ["turn"] : [],
- runtime_diagnostics: structuredClone(
+ type Observation = RunnerHello["runtime_registrations"][number];
+ const observe = (
+ base: Pick<Observation, "tenant_id" | "owner_actor_id">,
+ diagnostic: RunnerHello["runtime_diagnostics"][number],
+ ): Observation => {
+ const available =
+ diagnostic.status === "ready" ||
+ diagnostic.status === "authentication_required";
+ return {
+ ...base,
+ provider_type: diagnostic.type,
+ status: available ? ("online" as const) : ("unavailable" as const),
+ revision: envelope.revision,
+ capabilities: available ? ["turn"] : [],
+ runtime_diagnostics: structuredClone(
+ diagnostic,
+ ) as unknown as Observation["runtime_diagnostics"],
+ };
+ };
+ const registrations = connection.hello.runtime_registrations;
+ const updated = registrations.map((observation) => {
+ const diagnostic = envelope.runtime_diagnostics.find(
+ ({ type }) => type === observation.provider_type,
+ );
+ return diagnostic
+ ? { ...observation, ...observe(observation, diagnostic) }
+ : observation;
+ });
+ // A Computer leaves a Runtime that is not installed out of its hello,
+ // so a Runtime that becomes available later gets the registration the
+ // hello would have given it.
+ const { tenantId, ownerActorId } = owner(connection);
+ for (const diagnostic of envelope.runtime_diagnostics) {
+ if (
+ (diagnostic.status === "ready" ||
+ diagnostic.status === "authentication_required") &&
+ !registrations.some(
+ ({ provider_type }) => provider_type === diagnostic.type,
+ )
+ )
+ updated.push(
+ observe(
+ { tenant_id: tenantId, owner_actor_id: ownerActorId },
diagnostic,
- ) as unknown as RunnerHello["runtime_registrations"][number]["runtime_diagnostics"],
- };
- });
+ ),
+ );
+ }
+ connection.hello.runtime_registrations = updated;
const commandId = `registration-snapshot-${this.context.createId()}`;
(connection.pendingRegistrationSnapshots ??= new Set()).add(commandId);
await this.send(connection, {
diff --git a/apps/node-services/tests/agent/runner-gateway/runner-connections-public.test.ts b/apps/node-services/tests/agent/runner-gateway/runner-connections-public.test.ts
index 119f406a..6bbce027 100644
--- a/apps/node-services/tests/agent/runner-gateway/runner-connections-public.test.ts
+++ b/apps/node-services/tests/agent/runner-gateway/runner-connections-public.test.ts
@@ -196,6 +196,65 @@ describe("RunnerGateway", () => {
connection.disconnect();
});
+ it("registers a Runtime that first appears in a diagnostics update", async () => {
+ const gateway = createTestRunnerGateway({ heartbeatIntervalMs: 60_000 });
+ const peer = new RecordingPeer();
+ const connection = await gateway.acceptConnection(
+ authenticatedPrincipal(),
+ {
+ ...hello(),
+ runtime_registrations: [
+ {
+ tenant_id: "tenant-acme",
+ owner_actor_id: "actor-alice",
+ provider_type: "codex",
+ status: "online",
+ revision: 1,
+ capabilities: ["turn"],
+ runtime_diagnostics: { status: "ready" },
+ },
+ ],
+ },
+ peer,
+ );
+ try {
+ // The Computer left Antigravity out until agy was installed.
+ await connection.receive({
+ type: "runner.runtime_diagnostics",
+ protocol_version: "2",
+ runner_id: "runner-local",
+ sent_at: "2026-07-29T00:00:15.000Z",
+ revision: 2,
+ runtime_diagnostics: runtimeDiagnostics({
+ ready: ["codex", "antigravity"],
+ }),
+ });
+ const registrations = peer.registrationSnapshots.at(-1)!.registrations;
+ expect(
+ registrations.find(
+ ({ registration_id }) =>
+ registration_id === testRegistrationId("antigravity"),
+ ),
+ ).toMatchObject({
+ observation: {
+ tenant_id: "tenant-acme",
+ owner_actor_id: "actor-alice",
+ provider_type: "antigravity",
+ status: "online",
+ revision: 2,
+ capabilities: ["turn"],
+ },
+ });
+ expect(
+ registrations.filter(
+ ({ observation }) => observation.provider_type === "codex",
+ ),
+ ).toHaveLength(1);
+ } finally {
+ connection.disconnect();
+ }
+ });
+
it("proves the Daemon Identity and names Runtime Registrations on every hello", async () => {
const verify = vi.fn();
const gateway = createTestRunnerGateway({