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(node-services): accept a receipt for a registration snapshot a newer one overtook
jeffrey4eb70b67a60b
diff --git a/apps/node-services/src/agent/runner-gateway/runner-connections.ts b/apps/node-services/src/agent/runner-gateway/runner-connections.tsindex a0382859..674645a0 100644--- a/apps/node-services/src/agent/runner-gateway/runner-connections.ts+++ b/apps/node-services/src/agent/runner-gateway/runner-connections.ts@@ -292,7 +292,7 @@ export class RunnerConnections {try {await this.send(connection, this.#welcome(connection, pending));const commandId = `registration-snapshot-${this.context.createId()}`;- connection.registrationSnapshotCommandId = commandId;+ (connection.pendingRegistrationSnapshots ??= new Set()).add(commandId);await this.send(connection, {type: "runtime.registration.snapshot",protocol_version: hello.protocol_version,@@ -591,7 +591,7 @@ export class RunnerConnections {};});const commandId = `registration-snapshot-${this.context.createId()}`;- connection.registrationSnapshotCommandId = commandId;+ (connection.pendingRegistrationSnapshots ??= new Set()).add(commandId);await this.send(connection, {type: "runtime.registration.snapshot",protocol_version: connection.hello.protocol_version,@@ -611,7 +611,7 @@ export class RunnerConnections {if (envelope.type === "runtime.registration.observed") {if (envelope.connection_epoch !== connection.connectionEpoch ||- envelope.command_id !== connection.registrationSnapshotCommandId+ !connection.pendingRegistrationSnapshots?.delete(envelope.command_id)) {throw new RunnerGatewayProtocolError("Local Runtime Registration receipt identity mismatch",diff --git a/apps/node-services/src/agent/runner-gateway/runner-gateway-context.ts b/apps/node-services/src/agent/runner-gateway/runner-gateway-context.tsindex a3bbf25b..212e64b9 100644--- a/apps/node-services/src/agent/runner-gateway/runner-gateway-context.ts+++ b/apps/node-services/src/agent/runner-gateway/runner-gateway-context.ts@@ -221,7 +221,12 @@ export interface ConnectedRunner {phase: "reconciling" | "ready";operationReconciled: boolean;runtimeDiagnosticsRevision: number;- registrationSnapshotCommandId?: string;+ /**+ * Registration snapshots sent on this connection whose receipt has not+ * arrived. A diagnostics change can send a new snapshot before the Daemon+ * acknowledges the previous one, so every unacknowledged one is valid.+ */+ pendingRegistrationSnapshots?: Set<string>;}export interface AgentRunnerStateWaiter {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.tsindex 6ae8a0d8..cb8f7885 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@@ -269,6 +269,52 @@ describe("RunnerGateway", () => {connection.disconnect();});+ it("accepts a receipt for a snapshot that a newer snapshot overtook", async () => {+ const gateway = createTestRunnerGateway({ heartbeatIntervalMs: 1_000 });+ const peer = new RecordingPeer();+ const connection = await gateway.acceptConnection(+ authenticatedPrincipal(),+ hello(),+ peer,+ );+ 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({+ authenticationRequired: ["codex"],+ ready: [],+ }),+ });+ expect(peer.registrationSnapshots).toHaveLength(2);+ const receipt = (snapshot: (typeof peer.registrationSnapshots)[number]) =>+ connection.receive({+ type: "runtime.registration.observed",+ protocol_version: snapshot.protocol_version,+ command_id: snapshot.command_id,+ runner_id: snapshot.runner_id,+ connection_epoch: snapshot.connection_epoch,+ observed_count: 1,+ });+ // The Daemon acknowledges the first snapshot after the second was sent.+ await expect(+ receipt(peer.registrationSnapshots[0]!),+ ).resolves.toBeUndefined();+ await expect(+ receipt(peer.registrationSnapshots[1]!),+ ).resolves.toBeUndefined();+ // A receipt for a snapshot never sent, or sent twice, is still a violation.+ await expect(receipt(peer.registrationSnapshots[0]!)).rejects.toThrow(+ "Local Runtime Registration receipt identity mismatch",+ );+ expect(peer.closed).toContainEqual({+ code: 1002,+ reason: "Runner protocol violation",+ });+ });+it("omits target_release when this image ships no Computer release", async () => {const gateway = createTestRunnerGateway({heartbeatIntervalMs: 1_000,