Repository navigation
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 7:24 AM ET / 11:24 UTC. ClawSweeper reviewWhat this changesThis PR cancels unread GitHub Copilot device-flow error response streams before releasing the guarded HTTP dispatcher, with regressions for both device-code and access-token failures. Merge readinessThe patch addresses a real current-main lifecycle gap at the device-flow helper: non-OK responses are thrown before their body is consumed, then the guarded dispatcher is released. The PR cancels that unread body at the owning boundary, preserves existing error text and successful polling, and supplies focused tests plus real localhost guarded-transport proof. No discrete repair finding remains; this should proceed through normal exact-head maintainer merge review. Priority: P2 Review scores
Verification
How this fits togetherThe GitHub Copilot plugin posts device-flow forms through OpenClaw's SSRF-guarded HTTP transport. The helper either parses a successful provider response for the login/polling flow or releases its dispatcher and reports the upstream HTTP failure. flowchart LR
A[Operator starts Copilot login] --> B[Device-flow form request]
B --> C[SSRF-guarded HTTP response]
C --> D{HTTP successful?}
D -->|No| E[Cancel unread response stream]
E --> F[Release dispatcher and report error]
D -->|Yes| G[Parse JSON and continue polling]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +2, Tests +63. Total +65 across 2 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Merge the narrow owner-boundary repair after the normal exact-head rebase/check refresh, retaining the existing success parser, polling behavior, SSRF policy, and public provider configuration unchanged. Do we have a high-confidence way to reproduce the issue? Yes. Current main shows the non-OK branch throws without consuming the response body before the finally block releases the dispatcher, and the PR supplies a concrete localhost guarded-transport reproduction using a never-ending error stream. Is this the best way to solve the issue? Yes. Cancelling at AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3629aeeef959. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
…rowing
postGitHubDeviceFlowForm now drops the unread response stream before it
raises on a non-OK HTTP status. GitHub OAuth error responses ship a JSON
body (`{error, error_description}`) that this helper never consumes, so
the underlying fetch connection previously stayed open holding the
payload until the caller's release() ran, keeping the device-flow socket
half-drained on every 4xx/5xx.
Mirrors the recently-merged qqbot/kilocode/tlon fixes for the same
'cancel body before throwing' pattern (openclaw#110008, openclaw#109950, openclaw#112059).
b4a2e49 to
c46096d
Compare
|
Maintainer verification on reviewed head
No external OAuth service or live credential was used. |
|
Merged via squash.
|
…rowing (openclaw#112268) * fix(github-copilot): cancel unread device-flow error bodies before throwing postGitHubDeviceFlowForm now drops the unread response stream before it raises on a non-OK HTTP status. GitHub OAuth error responses ship a JSON body (`{error, error_description}`) that this helper never consumes, so the underlying fetch connection previously stayed open holding the payload until the caller's release() ran, keeping the device-flow socket half-drained on every 4xx/5xx. Mirrors the recently-merged qqbot/kilocode/tlon fixes for the same 'cancel body before throwing' pattern (openclaw#110008, openclaw#109950, openclaw#112059). * style(github-copilot): clarify response release ordering --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
When GitHub Copilot device-code or access-token requests return a non-OK response with an unread streaming body,
postGitHubDeviceFlowFormthrows immediately and then closes the SSRF-guarded dispatcher infinally. Dispatcher release waits for the still-open response, unnecessarily delaying the existing HTTP error.Why This Change Was Made
Cancel the unread response body at its owning device-flow helper before throwing, so the existing release closes promptly. Both
/login/device/codeand/login/oauth/access_tokenshare this owner. The HTTP error labels, successful JSON reads, OAuth polling behavior, SSRF policy, and public provider configuration remain unchanged.Original fix and both device-flow regression tests: @xydt-juyaohui. Maintainer follow-up reduced the lifecycle explanation to one precise owner-boundary comment.
User Impact
Copilot sign-in reports upstream non-OK HTTP failures without waiting on an unread, never-ending response body. Successful device authorization and token polling continue through their existing paths.
Evidence
Focused actual plugin suite:
Result: 1 file passed; 14 tests passed, including both new unread-body cancellation regressions and unchanged device/token HTTP error labels.
Real localhost HTTP/Undici proof used the production
fetchWithSsrFGuardagainst an ephemeral127.0.0.1server that returned HTTP 503, streamed a partial JSON body, and intentionally never completed the response. Comparing the existing release-only path with cancel-before-release:/login/device/code: 100.9 ms → 3.0 ms; HTTP status remained 503;response.bodyUsedchanged fromfalsetotrue./login/oauth/access_token: 100.5 ms → 0.8 ms; HTTP status remained 503;response.bodyUsedchanged fromfalsetotrue.A separate real localhost HTTP 200 run used production
fetchWithSsrFGuardandreadProviderJsonResponse; all five actual response shapes were consumed unchanged: device code,authorization_pending,slow_down,access_denied, and authorized token.The localhost fixtures prove the production guarded HTTP transport and response-body lifecycle; the focused plugin suite proves the public device-flow HTTP errors and polling behavior. No external GitHub OAuth service or live account was used.