Skip to content

refactor: share device and node RPC validation preambles - #177240

Merged
steipete merged 1 commit into
mainfrom
deslop/r01-36-gateway-devices-recovered-20261015
Oct 19, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/r01-36-gateway-devices-recovered-20261015

Conversation

@steipete

@steipete steipete commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Seven device/node RPC registrations duplicate the Gateway's existing parameter-validation preamble. Recover this small area from the wider parked cleanup so CI can attribute it independently.

User Impact

No intended behavior change. The same method names, validators, invalid-request responses and original handler options remain. Live authority checks, scope-upgrade identity binding, node progress byte limits, pending-work FIFO ordering and wake cleanup are unchanged. No configuration, schema, protocol, dependency or public SDK change.

Why This Change Was Made

Reuse the existing defineValidatedGatewayHandler owner rather than repeating validation and early-return boilerplate in five device/node modules. The owner was introduced in #156521 (caa1422d1c5a1c7c3ddc48828e4e2c3c6177e010) and is unchanged. This is an area slice of the wide parked family under rule 11: 32 net production lines removed (+453/-485); most churn is callback indentation. Tests are unchanged. Phase E is untouched.

Best-effort tradeoffs accepted

None newly introduced. Validation remains at the same RPC trust boundary; no security, authorization, concurrency, lifecycle or durability guard is removed.

Evidence

Own isolated frozen install passed 1,842 supply-chain checks with the current pinned native tooling. All 81 focused RPC tests across five files passed. Three protected-wrapper closure tests passed. Canonical targeted type-aware lint passed all five production files; formatting passed in 36ms. Runtime import cycles and Madge cycles are both zero. Full semantic Gateway graph typechecking is left to exact-head hosted CI under the local CPU budget; typed lint is not semantic typechecking.

The required suppression-policy suite passed13 cases and failed its global allowlist-tail assertion (actual98 vs expected97): the extra entry is ui/src/e2e/chat-managed-media-order.test-support.ts|typescript/unbound-method|2. This matches the coordinator's OPEN signature for scheduled main39232001367. The causal UI file (blob ded561cf48071a5316258484d84ea2253f76a9d6) and audit test (c8e30a677c171e3afd6db85b4f8ccbf70734ea6a) are unchanged from this slice's886ba0f base. This is a newer cause than an earlier, same-count native-MCP inventory failure. This slice adds no suppression and edits no allowlist. Combined local proof is 97 passed / 1 investigated inherited failure across98 cases, not all green. No timeout, retry, skip or baseline was weakened.

Fresh independent full-cut P0–P2 review completed scoped-clean with no actionable findings (confidence0.98); the actual report and machine status were inspected. Exact-head hosted CI remains the broad landing gate. No live Gateway or operator state was used.

Exact-head CI39236589474 completed successfully at signed 3704d6140564c44001ab93f6974285338400945b: all77 jobs completed with no failure. The full200-check census has75success/123skip/1neutral/1historical draft PR-context cancellation. No check is unfinished or failed; the cancelled non-execution draft-context check has a successful ready-context replacement. Skipped jobs are not claimed as execution proof. The local suppression inventory failure remains recorded above, not relabeled fixed.

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 19, 2026 10:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T10:21:15.341638Z 3704d61 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 3704d6140564c44001ab93f6974285338400945b
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/server-methods/device-pair-setup.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server-methods/device-scope-upgrade.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR moves seven device and node RPC registrations onto the existing shared validation wrapper.

Example: A client sends node.invoke.progress with invokeId="invoke-1", nodeId="node-1", seq=-1 and chunk="".

  • Before: The handler rejects the malformed sequence with INVALID_REQUEST before accessing runtime state.
  • After: The shared wrapper performs the same rejection before invoking the unchanged handler body.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct consolidation with passing exact-head checks; supplied behavioral evidence remains test-based.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate and does not materially change authority; supplied validation consists of focused tests and exact-head CI, with no live Gateway run claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The maintainer-authored direction removes repeated boundary plumbing without introducing another owner, changing product behavior, or expanding public contracts.

Merge readiness

✅ Ready for maintainer review

This PR is a useful, maintainer-directed refactor with no actionable findings; it preserves request validation and authority while removing duplicated preambles, and exact-head CI passes.

Priority: P3
Reviewed head: 3704d6140564c44001ab93f6974285338400945b

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Gateway RPC router supplies authenticated request options to device and node handlers, which validate parameters before invoking pairing, scope-upgrade, queue, or node-registry owners and returning an RPC response.

flowchart TD
  A[Authenticated RPC request] --> B[Gateway router]
  B --> C[Shared parameter validation]
  C --> D[Invalid request response]
  C --> E[Device or node handler]
  E --> F[Existing operation owner]
  F --> G[RPC response]
Loading

Technical review

Best possible solution:

Use the existing identity-preserving validation wrapper while keeping each operation's authorization, lifecycle, and response logic with its current owner.

Do we have a high-confidence way to reproduce the issue?

This is a refactor rather than a bug report; source inspection confirms the repeated validation preambles, and no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch is the smallest complete consolidation: every hunk serves the seven registration conversions, reuses the existing owner, and retains the historically justified pending-work type assertion.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 16f1ef80f9d5.

Provenance checked

  • Shared validation and request identity keeps the original intent (caa1422: Consolidate validation while preserving the original request object's admitted mutation authority.)
  • Device setup and completion keeps the original intent (feat: pair mobile devices from the Control UI #94672: Provide browser-driven mobile pairing through canonical setup helpers; later completion handling reconciles consumed credentials.)
  • Device scope upgrades keeps the original intent (cef0715: Give limited browsers an identity-bound approval path while preserving stored scope policy and checking the current role before releasing a token.)
  • Node pending work keeps the original intent (fix(gateway): avoid stale wake delays after node re-pairing #109647: Bind pending and wake work to canonical pairing generations so replaced or revoked nodes cannot inherit stale runtime authority.)
  • Node progress and tool publication validation keeps the original intent (8231076: Consolidate request validation without changing accepted payloads, error responses, input identity, or authorization policy.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit 9a165c4 adds src/gateway/server-methods/device-pair-setup.ts:70 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 9a165c492058; files: src/gateway/server-methods/device-pair-setup.ts)

PR surface

Source -32. Total -32 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 452 484 -32
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 452 484 -32

Review metrics

Metric Value Why it matters
Production versus test LOC Production +452/-484, net -32; tests unchanged. Most churn is indentation around existing callbacks; the reduction removes duplicate validation without adding machinery.

Labels

Label changes:

  • add P3: This is behavior-preserving internal cleanup with no reported user-facing defect.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is behavior-preserving internal cleanup with no reported user-facing defect.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 19, 2026, 6:35 AM ET / 10:35 UTC.

@steipete
steipete merged commit 0d2d6d0 into main Oct 19, 2026
217 of 218 checks passed
@steipete
steipete deleted the deslop/r01-36-gateway-devices-recovered-20261015 branch October 19, 2026 10:49
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant