Repository navigation
fix: renew OAuth credentials during long custom transport attempts - #184791
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 changes before merge. What this changesThis PR adds an optional per-request credential capability so custom transports can renew OAuth credentials during one long agent attempt. Example: A custom transport makes a private continuation after its selected OAuth access token expires.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep open: this maintainer-directed fix addresses a real credential-lifetime gap, but its new authorization capture can reject supported runtime-only OAuth profiles before a turn starts. Priority: P2 Before merge
Findings
Provenance
Agent review detailsHow this fits togetherThe embedded runner selects credentials and supplies provider stream factories; custom transports consume the new capability while existing OAuth owners retain refresh and durable settlement. flowchart LR
A[Embedded run] --> B[Run auth controller]
B --> C[Request auth capability]
C --> D[Canonical credential resolver]
D --> E[Native OAuth refresh owner]
C --> F[Custom provider transport]
F --> G[Guarded provider request]
Technical reviewBest possible solution: Offer renewal only for canonically owned OAuth profiles while preserving runtime-only external credentials and the existing final-dispatch authority checks. Do we have a high-confidence way to reproduce the issue? Source shows that custom transports previously received captured attempt credentials without an in-attempt renewal capability; the PR supplies a recorded expiry-and-continuation composition, which was not rerun during this read-only review. Is this the best way to solve the issue? A versioned capability on the existing auth owner is appropriate, and the lifecycle cleanup serves its retained authority, but canonical capture must remain optional for externally owned runtime profiles. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0e90c04a8a83. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +242, Tests +909, Docs +47. Total +1198 across 21 files. Added test files: 2. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 26, 2026, 12:38 PM ET / 16:38 UTC. |
|
Merged via squash auto-merge.
|
…penclaw#184791) * fix: renew OAuth credentials during long custom transport attempts * fix: retain account authority through request auth and refresh admission * fix: preserve scoped OAuth and release failed startup auth * fix: retain setup OAuth access and complete startup cleanup
Serialize authorization capture across overlapping canonical stores so first-use lifetime enrollment cannot invalidate another capture of the same shared account. Keep each caller's own authority and the native writer's strict stale comparison, revocation checks, and uncertain-settlement refusal. Preserve same-account peer inheritance, restart behavior, and fail-closed mismatch and logout behavior. Regress the concurrent capture and independent disposal. Related: #185732, #184791
…185880) * fix(auth): prevent concurrent OAuth turns from failing after refresh Serialize authorization capture across overlapping canonical stores so first-use lifetime enrollment cannot invalidate another capture of the same shared account. Keep each caller's own authority and the native writer's strict stale comparison, revocation checks, and uncertain-settlement refusal. Preserve same-account peer inheritance, restart behavior, and fail-closed mismatch and logout behavior. Regress the concurrent capture and independent disposal. Related: #185732, #184791 * chore(test): refresh measured test-line ceiling Preserve the concurrent OAuth authority regression and its diagnostic assertion. The synchronized base already exceeds the ceiling by 472 lines; this change adds 17. Set the ceiling to the exact measured total with no extra headroom. Independently reviewed; the failed ratchet now passes.
…penclaw#185880) * fix(auth): prevent concurrent OAuth turns from failing after refresh Serialize authorization capture across overlapping canonical stores so first-use lifetime enrollment cannot invalidate another capture of the same shared account. Keep each caller's own authority and the native writer's strict stale comparison, revocation checks, and uncertain-settlement refusal. Preserve same-account peer inheritance, restart behavior, and fail-closed mismatch and logout behavior. Regress the concurrent capture and independent disposal. Related: openclaw#185732, openclaw#184791 * chore(test): refresh measured test-line ceiling Preserve the concurrent OAuth authority regression and its diagnostic assertion. The synchronized base already exceeds the ceiling by 472 lines; this change adds 17. Set the ceiling to the exact measured total with no extra headroom. Independently reviewed; the failed ratchet now passes.
What Problem This Solves
Fixes OAuth-backed custom transports continuing to use an expired access token when a single agent attempt runs long enough to require renewal.
User Impact
Participating provider plugins can renew the selected account's credentials before later physical requests, including private continuation and stream-recovery requests. Static API keys and older entrypoints are unchanged; bounded agent-exec, env-only auth views, and setup-owned replacement verification retain their existing credential behavior without this optional capability. Transports must adopt the capability to receive in-attempt renewal.
Why This Change Was Made
The existing run auth owner exposes a small per-request capability that re-enters canonical credential resolution. Native OAuth code still owns refresh and durable token settlement. The capability remains bound to the selected profile, canonical account authorization, run lifetime, cancellation, and automation authority. A closed or reconnected request cannot admit new refresh work, while an already-claimed refresh retains independent settlement. Errors never silently select another account or fall back to the captured token.
No new refresh manager, periodic OAuth task, HTTP 401 replay, configuration option, dependency, or credential store is introduced.
Evidence
Validation used isolated state and synthetic credentials; no live provider request or Gateway deployment is claimed.