Repository navigation
feat(gateway): inspect HTTP headers without buffering responses - #157457
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 25, 2026, 3:24 AM ET / 07:24 UTC (Revision 8). ClawSweeper reviewWhat this changesThe branch adds a shared Apple transport method that returns HTTP response headers before an unfinished body completes, with native loopback tests for redirects, size limits, and cancellation. Merge readiness✅ Ready for maintainer review Keep open. Current main and the latest release lack the header-only transport behavior, and the paired iOS work has not landed. The prior review’s temporary scanner-exception decision is now recorded in the member-authored PR body; no introduced correctness defect is evident. Priority: P2 Review scores
Verification
How this fits togetherOpenClawKit supplies network transport to OpenClaw’s Apple apps. App requests pass through its URLSession certificate and redirect policy; this new method returns response headers to a future ingress probe and cancels the unused body. flowchart LR
A[Apple app request] --> B[Shared Apple transport]
B --> C[Certificate policy]
C --> D[URLSession task]
D --> E{Redirect allowed?}
E --> F[Response headers]
F --> G[Cancel unused body]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceOther +282. Total +282 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Let the iOS ingress owner consume this method in its activation PR, remove the targeted scanner exception then, and verify pinned HTTPS and credential isolation at that boundary. Do we have a high-confidence way to reproduce the issue? Not applicable to a current-main bug report: this PR adds a transport capability. Its native loopback fixture does reproduce the unfinished-body condition that motivates the method. Is this the best way to solve the issue? Yes. A request-owned delegate on the existing pinned session is a focused way to return refused-redirect headers early while retaining the established certificate and redirect policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fc3b2dca233a. 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 (7 earlier review cycles)
|
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review current head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Current head: |
|
🦞👀 Re-review progress:
|
57e0441 to
43e3790
Compare
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…claw#157457) * feat(gateway): inspect HTTP headers without buffering responses * test(gateway): leave probe response bodies incomplete * fix(gateway): return refused redirect headers before body completion * fix(gateway): retain public HTTP probe for ingress callers * fix(gateway): keep probe documentation attached to its API * test(gateway): allow independent HTTP probes to run concurrently Co-authored-by: Vincent Koc <[email protected]>
Related: #147238
What Problem This Solves
Native ingress detection needs response headers without downloading a complete sign-in page. URLSession AsyncBytes still waits for a refused redirect's response body, so a stalled sign-in page can stall that probe.
User Impact
This shared Apple transport prerequisite enables header inspection through the existing certificate and redirect policy. Browser setup and reauthorization remain in later app PRs; this PR does not activate them.
Why This Change Was Made
GatewayTLSPinningSession.response(for:)creates a data task on the existing session. A request-owned delegate completes from ordinary response headers or the refused-redirect callback, then cancels the unused body. Redirect decisions and unimplemented authentication callbacks retain the existing session owner. No additional session or trust policy is introduced.Two files: +73 production lines and +209 test lines. The private delegate is necessary to return refused redirect headers before their body finishes; the bounded-data reader remains intact.
Staging decision approved by @vincentkoc on September 25, 2026: retain the one declaration-specific
periphery:ignoreon the public response method for this prerequisite. Remove it when the first production app caller lands. The redundant private-delegate ignore was removed because Periphery retains references of ignored declarations. This approval is limited to this method; scanner policy and global exclusions do not change.Evidence
a604a2c9c82dfa030aa2b6a2fdcd44ed366f0723, rebased onto main19379a17f9f499cc031768b4f63d0282f8f3426d, which includes fix(gateway): restore native lint after transport changes #157516. That separate +22/-22 move repaired the inherited GatewayChannel file-length failure. This PR also moves its retention comment above the API documentation to fix the orphaned-doc-comment failure.git diff --checkpass. Current-head hosted CI passed after removing unnecessary suite serialization. ClawSweeper revision 7 found no actionable code or security findings; its sole owner decision is approved above. Each case owns its listener, ephemeral port, session, streams, and cleanup; fixture mutation stays MainActor-isolated. No shared pin or Keychain state is used.9170ec01of this head into main1a7ba53b45ed87ba93b5ee7bf986861b4068ddfe. Required CI and security gates passed; native iOS/macOS and Android checks passed.04fb3c8e35b3e1cb88630c797ac3ce4e50f38735: neither changed file, its timeout owner, Swift package contract, nor formatter configuration changed. Nearby shared changes add unrelated protocol fields and advance the native SQLite reader version ceiling. No transport conflict or new implementation input requires rewriting the reviewed head.NSURLSession.h:314-322task-delegate forwarding/lifetime contract and Periphery 3.8.0 comment-command/reference-retention behavior. Existing iOS/macOS media and source-resource callers were inspected; desktop application production files do not change.GatewayExternalAuthorizationErrorintroduced by feat(gateway): preserve browser sign-in requirements before connecting #157454, before its app producer lands. That separate retention/activation decision is tracked in fix(gateway): restore native lint after transport changes #157516; this PR does not alter that type.Before app activation: prove pinned HTTPS behavior, isolate typed HTTP trust diagnostics per request, and complete the app's browser/upgrade/UI proof and separately requested security review. Plain HTTP loopback tests do not prove a real TLS handshake or cancellation after the bounded reader has entered its body loop.