Repository navigation
fix(agents): fail stalled provider authentication at the run deadline - #189144
Merged
Merged
Conversation
Share the existing run deadline across credential lookup and token exchange, propagate cancellation, and reject late credentials before installation. Co-authored-by: Alex Mittell <[email protected]>
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
roboclaw-bot
marked this pull request as ready for review
October 31, 2026 06:41
Contributor
|
Co-authored-by: Alex Mittell <[email protected]>
Use the shared auth signal to distinguish run cancellation from a provider AbortError, preserving existing recovery while terminating expired auth. Co-authored-by: Alex Mittell <[email protected]>
Collaborator
Author
|
Merged via squash auto-merge.
|
This was referenced Oct 31, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 1, 2026
…openclaw#189144) * fix(agents): fail stalled provider authentication at the run deadline Share the existing run deadline across credential lookup and token exchange, propagate cancellation, and reject late credentials before installation. Co-authored-by: Alex Mittell <[email protected]> * fix(tests): return void from auth cleanup callbacks Co-authored-by: Alex Mittell <[email protected]> * fix(agents): preserve provider abort recovery before run expiry Use the shared auth signal to distinguish run cancellation from a provider AbortError, preserving existing recovery while terminating expired auth. Co-authored-by: Alex Mittell <[email protected]> --------- Co-authored-by: Alex Mittell <[email protected]>
This was referenced Nov 2, 2026
This was referenced Nov 15, 2026
RomneyDa
added a commit
that referenced
this pull request
Nov 17, 2026
Share the current execution deadline across credential resolution and token exchange, propagate cancellation, and reject late credentials before installation. Preserve durable refresh settlement, current authority checks and provider-abort recovery. Scoped self-review complete. Proof: source regression fails on baseline (still pending rather than AbortError); fixed auth-controller and binding suites pass. Typed lint and full live qualification remain pending. (cherry picked from commit 7bd53ff) Co-authored-by: Alex Mittell <[email protected]> Co-authored-by: RomneyDa <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #93952, thanks @amittell.
What Problem This Solves
Fixes agent runs that hang indefinitely when provider credential lookup or a runtime token exchange never returns.
User Impact
Authentication stops at the existing run deadline or cancellation with an error naming the provider and auth step and suggesting a retry. Run deadline and cancellation errors cannot fall through to AWS sentinel handling or further auth attempts. Provider-originated abort errors retain their existing recovery before run expiry. No new settings or credential storage are introduced.
Exchange hooks receive an optional cancellation signal and should pass it to their transport. JavaScript cannot forcibly stop a plugin that ignores cancellation; its late result is still rejected before credential installation. Claimed durable OAuth refreshes retain their existing settlement owner.
Why This Change Was Made
The auth controller shares one startup budget across lookup and exchange, then consumes the existing execution owner's published deadline, respecting paused or unlimited execution when an auth step starts. An already-running exchange keeps the deadline captured at entry; later deadline extensions do not rearm its timeout. Request-time OAuth lookup and exchange use the same bound and request cancellation. Final teardown cancels auth; temporary cleanup for forwarded harness candidates keeps later API-key candidates usable.
The simplification pass removed the duplicate unavailable-reason adapter and a redundant missing-state check. Production growth is +126 net lines: the shared deadline/cancellation helper, execution-deadline projection and wiring, request-time propagation, and abort/error boundaries are required to close the complete flow. Existing parameter types moved to the existing type module to keep the controller within its file limit. No test-routing registry changed. The separate 159-line allocation covers only this change's regression growth.
Evidence
e1cd21501dd59366fefc3ff8263d97eeacdc799e: focused negative control failed 4 of 5 selected cases. Hung lookup, hung exchange and AWS exchange remained pending at 100 ms; cancellation incorrectly installed credentials. Slow success passed.auth-controller.test.ts,auth-controller.binding.test.ts,auth-controller.request-auth.test.ts, andprovider-runtime-auth.test.ts(70.48 s including compiled-worker preparation). New coverage includes slow success, one shared budget, request-time lookup/exchange deadlines, request-specific cancellation, late-result rejection, and forwarded harness candidate transitions, and provider-originated abort recovery. Existing durable OAuth settlement and account-authority tests pass.void; the correction uses block bodies. Both affected files pass again: 52 tests in 19.81 s. The correction commit also has a clean P0–P2 autoreview; production source was unchanged by that cleanup correction. The final auth-signal simplification and added provider-abort regression were then validated by the complete 88-test run and a fresh full-candidate P0–P2 security review. Targeted type-aware oxlint, oxfmt, andgit diff --checkpass. Broad build/typecheck/test proof is delegated to this PR's CI; no broad suite ran on the production host.scoped-clean. Fixed its findings about reset budgets, request-time lookup/cancellation, and temporary harness transitions. No provider or review configuration changed.gh pr view/gh pr diff; it was never checked out or executed. The contributor's Gateway traces support the original diagnosis, but no new Gateway or external-provider proof is claimed for this replacement. The Team Gateway was not modified or restarted.Contributor credit: Alex Mittell [email protected], with
Co-authored-by: Alex Mittell <[email protected]>on the replacement commit.