Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Requesting maintainer review of the pairing changes at |
|
Codex review: blocked before merge. Reviewed September 29, 2026, 1:46 PM ET / 17:46 UTC (Revision 5). ClawSweeper reviewWhat this changesThe branch makes remote node input, progress, and results wait for pairing publication and recheck the connected node's authority before delivery or settlement. Merge readiness⛔ Blocked before merge - 4 items remain The current head appears to repair the pairing-publication interruption and addresses the earlier cached-authority finding. Real Gateway and WebSocket evidence supports the changed path. The disclosed cross-process authority boundary still needs exact-head security-owner acceptance before merge. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway pairs remote nodes and sends invocation traffic over their WebSocket connections. Pairing records feed the node registry, which decides whether input can be sent and whether progress or results can reach the caller. flowchart LR
A[Pairing records] --> B[Pairing publication]
C[Node WebSocket] --> D[Node registry]
B --> D
D --> E{Current pairing and invocation?}
E -->|Yes| F[Send or accept stream traffic]
E -->|No| G[Reject delivery]
Decision needed
Why: The patch and real transport proof cover revocation observed before the read, while the PR explicitly leaves the post-read foreign-commit window as a trust-model choice. Before merge
Findings
Agent review detailsSecurityNeeds attention: The diff adds no observed credential or supply-chain change, but exact-head approval is required for its disclosed pairing-authority observation boundary. PR surfaceSource +127, Tests +346. Total +473 across 12 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the guarded duplex path and have the security owner settle the documented foreign-commit observation boundary before the native merge gate proceeds. Do we have a high-confidence way to reproduce the issue? Yes. The pairing-publication overlap has a clear source path and an isolated real Gateway/WebSocket fixture; the disposable fault controls failed at the intended guards, though a pristine-base runtime failure was not run. Is this the best way to solve the issue? Yes, subject to security-owner acceptance. The change uses the existing pairing publication owner and rechecks authority at the final effect; stronger cross-process exclusion would require an explicit contract decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7098bf6cddd8. LabelsLabel changes: No label changes. Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
Won't fix: the four inherited fixture/routing mismatches below are outside this pairing patch. The other two runtime failure groups remain unresolved and still block readiness; no waiver or unrelated-cause claim is made. CI triage for Four shards have concrete source-level evidence of inherited fixture/routing drift from upstream #161124, already present in pinned base
Two failures remain unresolved; their attribution is not established:
No failing owner/test/config file above changes in this PR. This fact alone does not establish that the two unresolved runtime failures are unrelated. Exact-base source anchors:
Additional bounded path inspection:
Bounded local yield follow-up (no GitHub job/workflow rerun):
|
|
Response to ClawSweeper review: the real-transport evidence is below. The request for an unconditional external-revocation guarantee is not satisfied; the negative control demonstrates the observation window. That authority-contract decision and exact-head maintainer approval remain open. Additional real Gateway/WebSocket evidence for I ran the attached scratch fixture against the final patch's source contents in an isolated checkout. All three changed source files matched the published head by SHA-256. This fixture was not added to the PR. It starts an actual Gateway kernel/listener and authenticated node WebSocket client using the repository's existing test hooks and temporary synthetic state. It does not use a production Gateway, real coding workload, or production pairing database. The first run compiled the cold Gateway worker bundle in 247.236 seconds; total runner wall time was 361 seconds. The service exited and fixture cleanup retired the Gateway and SQLite owners. The last observed peak memory was approximately 5.08 GB. For reproduction, save the attached fixture as node scripts/run-vitest.mjs run \
--config test/vitest/vitest.gateway-server.config.ts \
src/gateway/server.pairing-publication-live-proof.test.ts \
--maxWorkers=1Environment: Linux, Node 26.8.2, pnpm 12.5.1, Vitest 5.0.1. The Gateway project uses the fork pool; this file ran in Fixture SHA-256: The metadata case wraps and delegates the real binding resolver, then pauses its return after its actual worker lookup. It queues the real metadata mutation behind a second deterministic barrier. While that write remains queued, The revoke and rotate cases queue their actual mutation adapters and verify that input is denied before the server socket's Explicit freshness limitation: the negative-control case also passes by demonstrating the weaker behavior: an external SQLite deletion made while metadata is queued, before a worker read or receipt observes it, still permits an input frame using the cached committed binding. After the metadata receipt and fresh lookup observe the deletion, subsequent input and progress are denied. This patch therefore does not establish instantaneous cross-process revocation at every synchronous effect. It preserves local authority-mutation fences and already-observed revocation. Whether external commits must invalidate synchronous leases immediately is a separate authority-contract decision; these results should not be read as proving that stronger guarantee. The existing worker/publication contract describes detection through worker reads and commit receipts. These results support retaining that contract; they do not substitute for a maintainer decision about this relaxation. Reproducible scratch integration fixture// Scratch integration evidence for PR #161209; not part of the published patch.
import { DatabaseSync } from "node:sqlite";
import { expect, test, vi } from "vitest";
import { runQaGatewayFixture } from "../../test/helpers/qa-gateway-cleanup.js";
import { writeConfigFile } from "../config/config.js";
import { approveNodePairing, requestNodePairing } from "../infra/device-pairing-node.js";
import * as nodeState from "../infra/device-pairing-node-state.js";
import { revokeDeviceToken, rotateDeviceToken } from "../infra/device-pairing-tokens.js";
import { getPairedDevice, updatePairedDeviceMetadata } from "../infra/device-pairing.js";
import { withTimeout } from "../infra/fs-safe.js";
import { createDeferredCore } from "../shared/deferred.js";
import * as stateWorker from "../state/openclaw-state-worker-store.js";
import { resolveOpenClawStateSqlitePath } from "../state/openclaw-state-db.paths.js";
import { withEnvAsync } from "../test-utils/env.js";
import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../utils/message-channel.js";
import { pairDeviceIdentity } from "./device-authz.test-helpers.js";
import { createGatewayKernel } from "./server-kernel.js";
import { connectGatewayClient } from "./test-helpers.e2e.js";
import { installGatewayTestHooks, startServer } from "./test-helpers.js";
installGatewayTestHooks({ scope: "suite" });
test.each(["metadata", "revoke", "rotate", "observed-external", "unobserved-external"] as const)(
"real WebSocket pairing publication boundary: %s",
async (mode) => {
if (!process.env.OPENCLAW_STATE_DIR) throw new Error("isolated state required");
const paired = await pairDeviceIdentity({
name: `pairing-proof-${mode}`,
role: "node",
scopes: [],
clientId: GATEWAY_CLIENT_NAMES.NODE_HOST,
clientMode: GATEWAY_CLIENT_MODES.NODE,
});
const nodeId = paired.identity.deviceId;
const pairing = await requestNodePairing({
nodeId,
platform: "linux",
deviceFamily: "Linux",
commands: ["camera.list"],
});
await approveNodePairing(pairing.request.requestId, {
callerScopes: ["operator.pairing", "operator.write"],
});
await writeConfigFile({ gateway: { nodes: { commands: { allow: ["camera.list"] } } } });
let kernel: Awaited<ReturnType<typeof createGatewayKernel>> | undefined;
const createKernel = createGatewayKernel;
const factory = vi.spyOn(await import("./server-kernel.js"), "createGatewayKernel")
.mockImplementation(async (...args) => {
kernel = await createKernel(...args);
return kernel;
});
const realResolve = nodeState.resolveCurrentPairedDeviceNodeBinding;
const readReady = createDeferredCore();
const releaseRead = createDeferredCore();
let holdNextRead = false;
const resolver = vi.spyOn(nodeState, "resolveCurrentPairedDeviceNodeBinding")
.mockImplementation(async (id) => {
const binding = await realResolve(id);
if (holdNextRead && id === nodeId) {
holdNextRead = false;
readReady.resolve();
await releaseRead.promise;
}
return binding;
});
let started: Awaited<ReturnType<typeof startServer>>;
try {
started = await withEnvAsync({ OPENCLAW_TEST_MINIMAL_GATEWAY: undefined }, () => startServer("secret"));
} catch (error) {
factory.mockRestore();
resolver.mockRestore();
throw error;
}
const { port, server } = started;
let node: Awaited<ReturnType<typeof connectGatewayClient>> | undefined;
let invocation: ReturnType<NonNullable<typeof kernel>["nodeRegistry"]["invoke"]> | undefined;
let progress: Promise<unknown> | undefined;
let mutation: Promise<unknown> | undefined;
let writer: ReturnType<typeof vi.spyOn> | undefined;
let transport: ReturnType<typeof vi.spyOn> | undefined;
const releaseMutation = createDeferredCore();
const queued = createDeferredCore();
const dispatched = createDeferredCore<{ id: string; nodeId: string }>();
const inputReceived = createDeferredCore<unknown>();
const chunks: string[] = [];
const unblock = () => { releaseRead.resolve(); releaseMutation.resolve(); };
await runQaGatewayFixture(async () => {
await server.startupSettled;
if (!kernel) throw new Error("real Gateway kernel missing");
node = await connectGatewayClient({
url: `ws://127.0.0.1:${port}`,
token: "secret",
role: "node",
clientName: GATEWAY_CLIENT_NAMES.NODE_HOST,
mode: GATEWAY_CLIENT_MODES.NODE,
platform: "linux",
deviceFamily: "Linux",
scopes: [],
commands: ["camera.list"],
deviceIdentity: paired.identity,
onEvent: (event) => {
if (event.event === "node.invoke.request") dispatched.resolve(event.payload as { id: string; nodeId: string });
if (event.event === "node.invoke.input") inputReceived.resolve(event.payload);
},
});
invocation = kernel.nodeRegistry.invoke({
nodeId, command: "camera.list", timeoutMs: 30_000, idleTimeoutMs: 20_000,
onProgress: (chunk) => chunks.push(chunk),
});
const frame = await withTimeout(dispatched.promise, 10_000, "real invoke request");
const session = kernel.nodeRegistry.get(nodeId);
if (!session) throw new Error("registered real socket missing");
transport = vi.spyOn(session.client.socket, "send");
if (mode === "metadata") {
holdNextRead = true;
progress = node.request("node.invoke.progress", { invokeId: frame.id, nodeId, seq: 0, chunk: "working" });
void progress.catch(() => undefined);
await withTimeout(readReady.promise, 10_000, "real progress pairing read");
}
const deleteExternally = () => {
const external = new DatabaseSync(resolveOpenClawStateSqlitePath());
try { external.prepare("DELETE FROM device_pairing_paired WHERE device_id = ?").run(nodeId); }
finally { external.close(); }
};
if (mode === "observed-external") {
deleteExternally();
expect(await getPairedDevice(nodeId)).toBeNull();
}
{
const realWrite = stateWorker.runOpenClawStateWorkerOperation;
writer = vi.spyOn(stateWorker, "runOpenClawStateWorkerOperation")
.mockImplementationOnce(async (...args) => {
queued.resolve();
await releaseMutation.promise;
return realWrite(...args);
});
mutation = mode === "metadata" || mode === "observed-external" || mode === "unobserved-external"
? updatePairedDeviceMetadata(nodeId, { displayName: "telemetry" })
: mode === "revoke"
? revokeDeviceToken({ deviceId: nodeId, role: "node" })
: rotateDeviceToken({ deviceId: nodeId, role: "node", scopes: [] });
void mutation.catch(() => undefined);
await withTimeout(Promise.race([queued.promise, mutation]), 10_000, "queued pairing mutation");
}
if (mode === "unobserved-external") {
deleteExternally();
// Explicit negative control: cross-process edits are not instant publication invalidations.
expect(() => kernel!.nodeRegistry.sendInvokeInput(frame.id, { command: "before-observation" })).not.toThrow();
await withTimeout(inputReceived.promise, 10_000, "unobserved external edit still permits cached input");
releaseMutation.resolve();
await expect(mutation).resolves.toBe(false);
expect(await getPairedDevice(nodeId)).toBeNull();
transport.mockClear();
}
if (mode === "metadata") {
expect(() => kernel!.nodeRegistry.sendInvokeInput(frame.id, { command: "continue" })).not.toThrow();
await withTimeout(inputReceived.promise, 10_000, "real input socket delivery");
releaseRead.resolve();
await expect(progress).resolves.toMatchObject({ ok: true });
expect(chunks).toEqual(["working"]);
releaseMutation.resolve();
await expect(mutation).resolves.toBe(true);
await node.request("node.invoke.result", { id: frame.id, nodeId, ok: true, payload: { proof: true } });
await expect(invocation).resolves.toMatchObject({ ok: true });
} else {
expect(() => kernel!.nodeRegistry.sendInvokeInput(frame.id, { command: "must-not-send" })).toThrow();
expect(transport.mock.calls.filter(([payload]) => typeof payload === "string" && payload.includes('"event":"node.invoke.input"'))).toHaveLength(0);
releaseMutation.resolve();
if (mode === "observed-external" || mode === "unobserved-external") await expect(mutation).resolves.toBe(false);
else await expect(mutation).resolves.toMatchObject({ ok: true });
await expect(node.request("node.invoke.progress", { invokeId: frame.id, nodeId, seq: 0, chunk: "revoked" })).rejects.toThrow();
expect(chunks).toEqual([]);
}
},
unblock,
async () => { await Promise.allSettled([mutation, progress]); writer?.mockRestore(); transport?.mockRestore(); },
async () => { await node?.stopAndWait(); },
async () => { await server.close({ reason: "pairing proof complete" }); },
async () => { await Promise.allSettled([invocation]); },
() => { resolver.mockRestore(); factory.mockRestore(); });
},
120_000,
); |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Response to ClawSweeper revision 2 at Disposition: escalated for an explicit security-owner contract decision. The documented worker-observation contract explains the implementation choice, but it is not a substitute for acceptance of this changed interval. This PR remains blocked unless the owner accepts that boundary at this exact head or requests a final-I/O repair. No approval or waiver is assumed. The existing exact-head approval request remains outstanding. The transport-proof request is satisfied according to revision 2. Its remaining security, merge-risk, patch-quality, and next-step bullets all refer to the same unresolved external-revocation finding and owner approval; none is being marked resolved. CI is separately red, with the diagnosis linked in the description. |
|
Response to ClawSweeper revision 3: fixed in Removed the metadata The prior negative-control behavior is superseded: an isolated real Gateway plus authenticated node WebSocket now sends zero queued input and accepts no queued progress/result after external deletion, revocation, or rotation. Valid metadata overlap waits and then delivers exactly one input. Local revoke/rotate also deny. All six cases passed. This proves commits preceding the fresh read are observed; it does not claim atomic exclusion of foreign SQLite commits after that read. The PR body is being updated to describe the final implementation and current evidence. Exact-head maintainer security approval remains a separate required gate; no approval is claimed. Independent review disposition: the cached-authority P1 is removed. One AutoReview P2 asked to defer idle expiry while progress awaits authority. We retained the existing deadlines: base already waits during an active pairing mutation at router admission, and unverified/duplicate progress must not extend invocation lifetime. The added post-router final check deliberately closes that authority gap. Metadata waiting is bounded by existing invocation deadlines, as the PR description now states. Validation of this candidate: 466 unique tracked tests passed across 13 files, plus the six isolated Gateway/WebSocket cases. Format, typed lint, core types, three relevant test-type graphs, and commit-hook secret scan passed. The exact committed portal test passed in 18.942s under its unchanged 30s timeout. An earlier combined batch timed out on that test; its timing/order cause remains unproven. These isolated passes do not erase that failure. Full local build/suite, aggregate throughput benchmark, and a deployed Codex workload were not run. Reproducible transport fixtureRun the fixture below as node scripts/run-vitest.mjs run --config test/vitest/vitest.gateway-server.config.ts src/gateway/server.pairing-publication-live-proof.test.ts --maxWorkers=1The executed fixture SHA256 was Six-case real Gateway/WebSocket fixture// Scratch integration evidence for PR #161209; not part of the published patch.
import { DatabaseSync } from "node:sqlite";
import { expect, test, vi } from "vitest";
import { runQaGatewayFixture } from "../../test/helpers/qa-gateway-cleanup.js";
import { writeConfigFile } from "../config/config.js";
import * as nodeState from "../infra/device-pairing-node-state.js";
import { approveNodePairing, requestNodePairing } from "../infra/device-pairing-node.js";
import { revokeDeviceToken, rotateDeviceToken } from "../infra/device-pairing-tokens.js";
import { updatePairedDeviceMetadata } from "../infra/device-pairing.js";
import { withTimeout } from "../infra/fs-safe.js";
import { createDeferredCore } from "../shared/deferred.js";
import { resolveOpenClawStateSqlitePath } from "../state/openclaw-state-db.paths.js";
import * as stateWorker from "../state/openclaw-state-worker-store.js";
import { withEnvAsync } from "../test-utils/env.js";
import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../utils/message-channel.js";
import { pairDeviceIdentity } from "./device-authz.test-helpers.js";
import { createGatewayKernel } from "./server-kernel.js";
import { connectGatewayClient } from "./test-helpers.e2e.js";
import { installGatewayTestHooks, startServer } from "./test-helpers.js";
installGatewayTestHooks({ scope: "suite" });
const modes = [
"metadata",
"revoke",
"rotate",
"external-delete",
"external-revoke",
"external-rotate",
] as const;
test.each(modes)(
"real WebSocket fresh pairing effect boundary: %s",
async (mode) => {
if (!process.env.OPENCLAW_STATE_DIR) throw new Error("isolated state required");
const paired = await pairDeviceIdentity({
name: `pairing-proof-${mode}`,
role: "node",
scopes: [],
clientId: GATEWAY_CLIENT_NAMES.NODE_HOST,
clientMode: GATEWAY_CLIENT_MODES.NODE,
});
const nodeId = paired.identity.deviceId;
const pairing = await requestNodePairing({
nodeId,
platform: "linux",
deviceFamily: "Linux",
commands: ["camera.list"],
});
await approveNodePairing(pairing.request.requestId, {
callerScopes: ["operator.pairing", "operator.write"],
});
await writeConfigFile({ gateway: { nodes: { commands: { allow: ["camera.list"] } } } });
let kernel: Awaited<ReturnType<typeof createGatewayKernel>> | undefined;
const realCreateKernel = createGatewayKernel;
const factory = vi
.spyOn(await import("./server-kernel.js"), "createGatewayKernel")
.mockImplementation(async (...args) => {
kernel = await realCreateKernel(...args);
return kernel;
});
const realOwner = nodeState.withCurrentPairedDeviceNodeBinding;
const queuedReads = createDeferredCore();
let observeOwner = false;
let ownerCalls = 0;
let ownerEffects = 0;
const requiredOwnerCalls = mode === "metadata" ? 2 : 3;
// Observe the production owner entry and effect; never replace its read, binding, or lock.
const owner = vi
.spyOn(nodeState, "withCurrentPairedDeviceNodeBinding")
.mockImplementation(function <T>(
id: string,
effect: (binding: nodeState.PairedDeviceNodeBinding | undefined) => T,
baseDir?: string,
): Promise<T> {
const observed = observeOwner && id === nodeId;
if (observed && ++ownerCalls >= requiredOwnerCalls) queuedReads.resolve();
return realOwner(
id,
(binding) => {
if (observed) ownerEffects++;
return effect(binding);
},
baseDir,
);
});
let started: Awaited<ReturnType<typeof startServer>>;
try {
started = await withEnvAsync({ OPENCLAW_TEST_MINIMAL_GATEWAY: undefined }, () =>
startServer("secret"),
);
} catch (error) {
factory.mockRestore();
owner.mockRestore();
throw error;
}
const { port, server } = started;
let node: Awaited<ReturnType<typeof connectGatewayClient>> | undefined;
let invocation: ReturnType<NonNullable<typeof kernel>["nodeRegistry"]["invoke"]> | undefined;
let input: Promise<void> | undefined;
let progress: Promise<unknown> | undefined;
let result: Promise<unknown> | undefined;
let mutation: Promise<unknown> | undefined;
let writer: ReturnType<typeof vi.spyOn> | undefined;
let transport: ReturnType<typeof vi.spyOn> | undefined;
const releaseMutation = createDeferredCore();
const queuedMutation = createDeferredCore();
const dispatched = createDeferredCore<{ id: string; nodeId: string }>();
const inputReceived = createDeferredCore<unknown>();
const inputFrames: unknown[] = [];
const chunks: string[] = [];
const inputSends = () =>
transport?.mock.calls.filter(
([payload]: unknown[]) =>
typeof payload === "string" && payload.includes('"event":"node.invoke.input"'),
) ?? [];
await runQaGatewayFixture(
async () => {
await server.startupSettled;
if (!kernel) throw new Error("real Gateway kernel missing");
node = await connectGatewayClient({
url: `ws://127.0.0.1:${port}`,
token: "secret",
role: "node",
clientName: GATEWAY_CLIENT_NAMES.NODE_HOST,
mode: GATEWAY_CLIENT_MODES.NODE,
platform: "linux",
deviceFamily: "Linux",
scopes: [],
commands: ["camera.list"],
deviceIdentity: paired.identity,
onEvent: (event) => {
if (event.event === "node.invoke.request")
dispatched.resolve(event.payload as { id: string; nodeId: string });
if (event.event === "node.invoke.input") {
inputFrames.push(event.payload);
inputReceived.resolve(event.payload);
}
},
});
invocation = kernel.nodeRegistry.invoke({
nodeId,
command: "camera.list",
timeoutMs: 30_000,
idleTimeoutMs: 20_000,
onProgress: (chunk) => chunks.push(chunk),
});
void invocation.catch(() => undefined);
const frame = await withTimeout(dispatched.promise, 10_000, "real invoke request");
const session = kernel.nodeRegistry.get(nodeId);
if (!session) throw new Error("registered real socket missing");
transport = vi.spyOn(session.client.socket, "send");
const realWrite = stateWorker.runOpenClawStateWorkerOperation;
writer = vi
.spyOn(stateWorker, "runOpenClawStateWorkerOperation")
.mockImplementationOnce(async (...args) => {
queuedMutation.resolve();
await releaseMutation.promise;
return realWrite(...args);
});
mutation =
mode === "revoke"
? revokeDeviceToken({ deviceId: nodeId, role: "node" })
: mode === "rotate"
? rotateDeviceToken({ deviceId: nodeId, role: "node", scopes: [] })
: updatePairedDeviceMetadata(nodeId, { displayName: "telemetry" });
void mutation.catch(() => undefined);
await withTimeout(
Promise.race([queuedMutation.promise, mutation]),
10_000,
"queued pairing mutation",
);
observeOwner = true;
input = kernel.nodeRegistry.sendInvokeInputWhenCurrent(frame.id, { command: "continue" });
void input.catch(() => undefined);
progress = node.request("node.invoke.progress", {
invokeId: frame.id,
nodeId,
seq: 0,
chunk: "working",
});
void progress.catch(() => undefined);
if (mode !== "metadata") {
result = node.request("node.invoke.result", {
id: frame.id,
nodeId,
ok: true,
payload: { mustNotEscape: true },
});
void result.catch(() => undefined);
}
await withTimeout(
queuedReads.promise,
10_000,
"input and inbound RPCs waiting on real owner",
);
expect(ownerEffects).toBe(0);
expect(inputSends()).toHaveLength(0);
expect(inputFrames).toHaveLength(0);
expect(chunks).toEqual([]);
if (mode.startsWith("external-")) {
const external = new DatabaseSync(resolveOpenClawStateSqlitePath());
try {
if (mode === "external-delete") {
external.prepare("DELETE FROM device_pairing_paired WHERE device_id = ?").run(nodeId);
} else if (mode === "external-revoke") {
external
.prepare(
"UPDATE device_pairing_paired SET tokens_json = json_set(tokens_json, '$.node.revokedAtMs', 100) WHERE device_id = ?",
)
.run(nodeId);
} else {
external
.prepare(
"UPDATE device_pairing_paired SET tokens_json = json_set(tokens_json, '$.node.token', 'scratch-external-replacement', '$.node.rotatedAtMs', 100) WHERE device_id = ?",
)
.run(nodeId);
}
} finally {
external.close();
}
}
releaseMutation.resolve();
await mutation;
if (mode === "metadata") {
await expect(input).resolves.toBeUndefined();
await withTimeout(
inputReceived.promise,
10_000,
"exactly one real input delivery after metadata",
);
await expect(progress).resolves.toMatchObject({ ok: true, ignored: false });
expect(inputSends()).toHaveLength(1);
expect(inputFrames).toHaveLength(1);
expect(chunks).toEqual(["working"]);
result = node.request("node.invoke.result", {
id: frame.id,
nodeId,
ok: true,
payload: { proof: true },
});
await expect(result).resolves.toMatchObject({ ok: true });
await expect(invocation).resolves.toMatchObject({ ok: true });
} else {
await expect(input).rejects.toThrow();
const replies = await Promise.allSettled([progress, result]);
for (const reply of replies) {
// Router denial may reject/close the connection; late handlers may safely ignore.
if (reply.status === "fulfilled") expect(reply.value).toMatchObject({ ignored: true });
}
expect(inputSends()).toHaveLength(0);
expect(inputFrames).toHaveLength(0);
expect(chunks).toEqual([]);
await expect(invocation).resolves.toMatchObject({ ok: false });
}
expect(ownerEffects).toBeGreaterThan(0);
},
() => {
releaseMutation.resolve();
},
async () => {
await Promise.allSettled([mutation, input, progress, result]);
writer?.mockRestore();
transport?.mockRestore();
},
async () => {
await node?.stopAndWait();
},
async () => {
await server.close({ reason: "pairing proof complete" });
},
async () => {
await Promise.allSettled([invocation]);
},
() => {
owner.mockRestore();
factory.mockRestore();
},
);
},
120_000,
); |
|
Recorded follow-through for ClawSweeper revision 4 confirms the prior cached-authority finding is addressed, accepts the real transport proof, and marks this ready for maintainer look. Its remaining decision is exact-head security-owner acceptance of the disclosed fresh-read/local-lock observation boundary. That approval is not claimed here. CI is testing merge
The exact base-to-CI-merge comparison contains only this PR's 13 effective pairing/Gateway files. These are source/path attributions, not standalone base-runtime reproductions. No unrelated fixtures were changed and no CI jobs were manually rerun. At 16:14 UTC this CI run had 7 failed jobs and 3 still running; this is not a green-CI claim. The required approval gate remains blocked. A separately requested test-value/simplification audit is now underway; these observations remain bound to the published head above. Final late result, 17:34 UTC: Node shard 41 also failed: |
|
Test-audit follow-up in
Validation: 174/174 focused tests across five files passed (88.1s wrapper), followed by 19/19 publication cases on the final formatted source (34.0s wrapper). Targeted formatting and typed lint passed; core types (110.5s) and selected gateway-server/infra test-type graphs (545.0s including setup) passed. Tests ran serially with one worker in an isolated checkout; cold worker preparation cost 459.0s for the final run. Three disposable fault controls each failed for the intended reason: replacing only the asynchronous input guard with the real synchronous send caused Fresh repository Codex AutoReview reports no P0–P2 findings. The final formatting-only indentation change has an empty whitespace-insensitive diff from that reviewed candidate. These checks do not claim paired vendor scans (requester waiver), a full build/suite, a throughput benchmark, or a production deployment. The final authority semantics and disclosed foreign-commit observation limit are unchanged from the head ClawSweeper reviewed in revision 4. Exact-head maintainer security approval remains required; none is claimed. |
|
Current-head CI follow-through for ClawSweeper revision 5 reports no concrete contributor-facing blocker and sufficient real-behavior proof. Its remaining decision is exact-head security-owner acceptance of the disclosed foreign-commit observation boundary; no maintainer approval is claimed. CI run 36606101603 checks merge
No unrelated fixtures or UI were changed, and no CI job was manually rerun. At the end of the 20-minute watch (17:56 UTC), this run had 103 passed jobs, five failed jobs listed above, and nine still running. This is not a green-CI claim. Required code-owner/security approval is also absent; the PR remains blocked. The bounded watch has ended. |
|
Thanks @gisk0 — this PR found the real problem: routine device writes (presence, metadata, host stats) fenced every node's pairing binding while the write was in flight, so active node streams and requests failed even though nothing about their own pairing changed. That fence is now handled at its owner instead of being worked around in node transport:
With both on main, queuing duplex I/O behind pairing publication is no longer needed, so I'm closing this as superseded. Your diagnosis is credited in #169575. Thank you for the careful work here, including keeping revocation strict when the first revision relaxed it. |
tl;dr
Routine device updates can interrupt active remote coding streams. Queue duplex traffic behind pairing publication, refresh authority, then perform the final synchronous effect before releasing the local owner.
Related: #148693. Complements #148770, which retires genuinely stale connections.
What Problem This Solves
Presence and host-statistics writes temporarily fence the node binding. Input or progress overlapping that fence can fail a valid coding session. An earlier PR revision bypassed that fence for metadata, which allowed stale authority after an external SQLite deletion. This revision retains the original strict fence and waits for fresh authority instead.
User Impact
Active coding streams wait for routine updates within existing invocation deadlines, then continue if their exact pairing and invocation remain valid. Revocation, rotation, deletion, cancellation, replacement connections, and withdrawn caller authority prevent delivery. No configuration, protocol, or database migration is needed.
Why This Change Was Made
Duplex input and incoming progress/results wait for the pairing owner, read current authority, recheck the exact pending invocation/connection/generation and caller policy, then perform the synchronous send or settlement while holding that owner. Existing framing preserves message order. The publication owner itself is unchanged from the base.
The local lock serializes local writers. Foreign commits preceding the fresh worker read are observed; this does not exclude foreign commits after that read. Per-fragment reads add work; aggregate throughput is unbenchmarked. Exact-head security-owner acceptance of this boundary remains required.
Evidence
Head
d69797077ef8500efec17b8f4f23e5a02a5bf26a; local validation base52618fc09b.failed to send node invoke inputduring the metadata fence; replacing only the progress or result guard with its real synchronous method independently producedexpected true to be falseafter an external pairing deletion. These are guard-bypass controls, not pristine-base executions. No production source was altered for the controls; the scratch file was excluded from the published patch.f9027947; the guarded transport implementation is unchanged in this simplification. The new isolated inbound tests establish each guard independently.Paired vendor security scans were waived by the requester; independent review and focused tests were used. Full local build/suite, aggregate throughput benchmark, and production deployment of this upstream revision were not run.