Repository navigation
feat(gateway): await native upgrade headers before connecting - #147070
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: needs maintainer review before merge. Reviewed September 24, 2026, 2:14 PM ET / 18:14 UTC (Revision 29). ClawSweeper reviewWhat this changesThe shared Apple Gateway transport awaits a throwing upgrade-header provider, prevents retired routes from opening sockets, preserves retries after temporary provider errors, and adds native regression tests. Merge readiness✅ Ready for maintainer review Current main lacks this native authorization boundary. The member-owned PR remains the implementation candidate, and the exact-head review found no blocking patch defect. Priority: P2 Review scores
Verification
How this fits togetherApple apps use OpenClawKit to connect to a Gateway. A native session owns the route, while its channel prepares upgrade headers, opens the WebSocket, and handles reconnects. flowchart LR
A[Apple app route] --> B[Native session]
B --> C[Upgrade header provider]
C --> D{Route still active?}
D -->|Yes| E[WebSocket connection]
D -->|No| F[No socket]
E --> G[Callbacks and reconnects]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceOther +330. Total +330 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep route retirement with the native session and socket admission with the shared channel; complete browser sign-in and installed-app upgrade validation in the downstream iOS work. Do we have a high-confidence way to reproduce the issue? Not applicable: this adds a transport capability. Current-head native boundary tests exercise the route-retirement and retry scenarios. Is this the best way to solve the issue? Yes. The existing route owner retires admission, and the channel that creates sockets enforces that decision at creation and resume. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3e58afe69123. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (28 earlier review cycles; latest 8 shown)
|
f4962a5 to
f744a90
Compare
13f11fa to
fade3cc
Compare
f744a90 to
e978a5c
Compare
fade3cc to
e6b51ee
Compare
e978a5c to
33b2459
Compare
e6b51ee to
2735a7f
Compare
33b2459 to
252d1ea
Compare
2735a7f to
b35fa0f
Compare
252d1ea to
961b0be
Compare
b35fa0f to
c96e046
Compare
961b0be to
c472838
Compare
c96e046 to
7c0e423
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
970c028 to
4efcf25
Compare
679f3ae to
355778a
Compare
4efcf25 to
0a50cea
Compare
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
Merged via squash auto-merge.
|
What Problem This Solves
Native Gateway connections need to await authorization before opening a WebSocket. A route retired during that wait must never open a socket with its prepared headers.
User Impact
Shared Apple transport accepts asynchronous, throwing upgrade-header providers and preserves typed authorization failures. Existing synchronous callers remain valid. This prerequisite does not activate Cloudflare Access, change pairing or saved credentials, or change desktop production callers.
Why This Change Was Made
The channel owns socket creation; the native session owns route retirement. Retirement now closes a synchronous admission gate before detaching the channel, and socket creation plus resume occur under that same gate. Queued asynchronous shutdown can finish afterward without leaving a window for a retired route to open a socket. Ordinary reconnects retain admission; a replacement route gets a new channel.
A temporary provider failure before socket creation also retains the existing reconnect retry owner. Once a replacement socket is admitted, its generation owns subsequent retries. This resolves the retirement and reconnect findings without adding another retry policy. The macOS change is test-only. Browser sign-in, reauthentication, and installed-app upgrade proof remain in the downstream iOS app stack.
Evidence
Candidate:
e246f5b798f626d35ad233cafd0ff0b6e1d712c0, rebased onto79cc65fd2ef35e4c391ca7315fed2af21caadb6d. Exact-head ClawSweeper revision 28 is ready with no source or security findings. The native package job passed; remaining required CI is enforced before merge.git diff --checkpass. Current-head native package run passed 1,790 shared-kit tests in 141 suites (35.207 seconds); GatewayNodeSessionTests took 22.002 seconds.Already-admitted sockets continue through the existing asynchronous shutdown lifecycle; this does not claim instantaneous transport quiescence or withdrawal of bytes already sent.