[codex] fix(copilot): preserve BYOK bearer auth through proxy#99955
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 4, 2026, 9:42 AM ET / 13:42 UTC. Summary PR surface: Source +40, Tests +100. Total +140 across 3 files. Reproducibility: yes. Source inspection shows current main resolves authHeader into bearerToken, then the proxy forwards only incoming SDK headers, so a missing SDK Authorization header drops bearer auth before the guarded upstream fetch; the PR body also includes live after-fix provider probes. Review metrics: 2 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the focused nonce-gated proxy fix after Copilot/runtime or security owner sign-off confirms the credential boundary and exact-head proof remains valid. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main resolves authHeader into bearerToken, then the proxy forwards only incoming SDK headers, so a missing SDK Authorization header drops bearer auth before the guarded upstream fetch; the PR body also includes live after-fix provider probes. Is this the best way to solve the issue? Yes, pending owner sign-off on the sensitive boundary. Fixing the proxy's final guarded hop is narrower than forking SDK behavior or duplicating provider auth logic, and the tests cover both the missing-header and Azure nonce-less paths. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 787f3a2ce557. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +40, Tests +100. Total +140 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (5 earlier review cycles)
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
06bcb68 to
ef753a9
Compare
|
@clawsweeper automerge |
|
🦞✅ Approver: What merged:
Automerge notes:
The automerge loop is complete. Automerge progress:
|
|
🦞✅ Source: Why human review is needed: What the maintainer can do as a next step: I added |
|
@clawsweeper approve |
…aw#99955) Summary: - Merged [codex] fix(copilot): preserve BYOK bearer auth through proxy after ClawSweeper review. Automerge notes: - No ClawSweeper repair was needed after automerge opt-in. Validation: - ClawSweeper review passed for head ef753a9. - Required merge gates passed before the squash merge. Prepared head SHA: ef753a9 Review: openclaw#99955 (comment) Co-authored-by: Mason Huang <[email protected]> Approved-by: hxy91819
What Problem This Solves
Fixes an issue where users routing OpenAI-compatible BYOK providers through the GitHub Copilot harness could hit upstream 401s when the Copilot SDK/runtime omitted the resolved bearer
Authorizationheader before the loopback proxy forwarded the request.This was reproduced with Tencent TokenPlan/TokenHub-shaped Chat Completions providers: direct OpenClaw provider calls succeeded, while the same provider/model through Copilot BYOK could fail at the upstream auth hop.
AI-assisted: yes.
Why This Change Was Made
The Copilot BYOK proxy now carries OpenClaw's resolved bearer auth intent to the final SSRF-guarded upstream hop, but only for nonce-protected proxy requests and only when the SDK did not already send
authorization. Azure SDK nonce-less/openai/...proxy paths remain excluded so discovering the loopback port cannot turn the proxy into a bearer-token relay.The package install proof also confirms the existing
@github/copilot-sdkproduction dependency resolves the Copilot CLI package transitively, so this PR does not change the plugin dependency graph.User Impact
Users can run Tencent TokenPlan/TokenHub and Ollama Cloud OpenAI-compatible BYOK models through the Copilot harness without losing bearer auth at the proxy hop. The PR does not change the plugin dependency graph; the existing SDK dependency continues to resolve the Copilot CLI package in production installs.
Evidence
Focused local tests:
node scripts/run-vitest.mjs extensions/copilot/src/byok-proxy.test.ts extensions/copilot/src/provider-bridge.test.ts test/scripts/plugin-package-dependencies.test.ts test/plugin-npm-package-manifest.test.tspnpm exec oxfmt --check --threads=1 extensions/copilot/src/byok-proxy.ts extensions/copilot/src/byok-proxy.test.ts extensions/copilot/src/provider-bridge.test.ts my_docs/04-cases/2026-07-04-copilot-byok-tencent-harness-bug/00-case.mdgit diff --checkpnpm deadcode:dependencies@github/copilotas an SDK transitive dependency instead of a direct plugin dependency..agents/skills/autoreview/scripts/autoreview --mode branch --base origin/mainautoreview clean: no accepted/actionable findings reported.Package/install proof:
npm pack --pack-destination /tmpforextensions/copilot.package/package.jsonkeeps@github/copilot-sdk: 1.0.0-beta.9as the direct runtime dependency.package/dist/...contains the proxy bearer fix symbolsupstreamBearerAuthorizationandisNonceProtectedProxyRequest.npm install --package-lock-only --omit=dev --ignore-scripts <tgz>and confirmednode_modules/@github/copilotstill resolves from@github/copilot-sdk's production dependency graph without adding a direct plugin dependency.Live openclaw2 proof with real provider keys, redacted/no secret values printed:
openclaw plugins install npm-pack:/tmp/openclaw-copilot-byok-final-20260704.tgz --forceupstreamBearerAuthorization.2026.7.4 (80b40a8).127.0.0.1:28443.Final live model probes, all using:
Results:
custom-tokenplan-hy3/hy3through Copilot BYOK: returnedOK-LIVE-PROBE.custom-tokenhub-hy3/hy3through Copilot BYOK: returnedOK-LIVE-PROBE.ollama-cloud/deepseek-v4-flashdirect gateway path: returnedOK-LIVE-PROBE.custom-ollama-cloud-copilot/deepseek-v4-flashthrough Copilot BYOK: returnedOK-LIVE-PROBE.Cleanup proof:
agents.defaults.models["custom-ollama-cloud-copilot/deepseek-v4-flash"]allowlist entry were removed after the live probe.openclaw config validatepassed after cleanup.hasTempProvider=falseandhasTempAllowlist=false.Known unrelated environment noise on openclaw2:
Plugin version drift: 6 active official plugins not on gateway 2026.7.4.