Repository navigation
fix(gateway): promote nodes that connect during approval - #177944
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. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
|
Codex review: needs real behavior proof before merge. What this changesThis PR selects the connected node when capability approval commits so connections established during approval receive their approved commands. Example: Node node-connect-during-approval connects with system.run declared while its first capability approval is pending.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep open: this maintainer-authored PR addresses a current-main approval race with a focused change; no concrete patch defect was found. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway pairing handler consumes operator approval and committed pairing facts, updates the authenticated NodeRegistry session, and publishes approval notifications before subsequent node command dispatch. flowchart TD
A[Operator approval] --> B[Pairing mutation owner]
B --> C[Committed approval callback]
D[Connecting node] --> E[NodeRegistry]
C --> E
E --> F[Current authority checks]
F --> G[Node command transport]
Technical reviewBest possible solution: Retain the existing committed-approval owner and exact registry checks, with allowed and revoked-session command effects verified through that path. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the stale-absence path, and the added regression deterministically registers a connection after the old snapshot point; its reported red/green result was inspected but not rerun. Is this the best way to solve the issue? This is the smallest complete source fix: resolve the session in the existing committed callback, remove the redundant lookup, and retain the registry's authority and capability checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 07e3328ed3f7. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete bypass was found, but commit-time authority promotion needs final-effect validation. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -2, Tests +42. Total +40 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 19, 2026, 10:16 PM ET / October 20, 2026, 02:16 UTC. |
What Problem This Solves
A node can finish connecting while its first capability approval is being written.
node.pair.approvepreviously captured the live connection before that wait. When it captured absence, the approval committed but skipped the newly registered connection, leaving an approved, connected node with an empty command list.Select the live session in the existing committed-approval callback. Keep the exact pairing identity, previous generation, connection, and declared-surface checks before promoting it. This also removes the redundant pre-write pending lookup; no command registration, authorization policy, protocol, timeout, or retry behavior changes.
The regression registers a real
NodeRegistrysession while the handler enters its real pairing write. Before the fix, approval succeeds but the session still hascommands: []; after the fix it must havesystem.runand the committed pairing generation. Existing token-rotation and replacement refusal assertions remain intact.Evidence
commands: [].87692eba0956..353c6989892e: unchanged. The pre-write snapshot predates that window; none of the listed suspects is attributed as a deterministic registration regression.pnpm test src/gateway/server-methods/nodes.test.ts --maxWorkers=1 -t 'connects while its first surface approval is pending'fails with expected["system.run"], received[]before the fix.OPENCLAW_VITEST_RUNTIME=bun pnpm test src/gateway/server-methods/nodes.test.ts test/e2e/qa-lab/runtime/gateway-node-exec-routing.e2e.test.ts --maxWorkers=1passes 16 tests. This includes the original native command-routing/effect proof and existing token-rotation/replacement refusals.git diff --checkpass.