Repository navigation
fix(oauth): clear refresh marker on connection failures - #664
Merged
Merged
Conversation
Destynova2
enabled auto-merge (squash)
October 28, 2026 14:38
Destynova2
force-pushed
the
fix/oauth-refresh-connect-wedge
branch
from
October 28, 2026 15:51
af50cb9 to
698eaf3
Compare
A refresh that fails before the TCP/TLS connection is established never reaches the issuer, so the stored refresh token is neither spent nor rotated. refresh_token left the .refresh.pending uncertainty marker in place on any error from do_refresh, so one transient connect failure wedged every later refresh with "Previous OAuth refresh outcome is unknown" until a manual re-auth, even though the refresh token was still valid. Clear the marker when do_refresh fails with a reqwest connection-phase error (is_connect()); timeouts and post-send failures still keep it, since there the outcome is genuinely unknown. Fixes #663
Destynova2
force-pushed
the
fix/oauth-refresh-connect-wedge
branch
from
October 28, 2026 16:11
698eaf3 to
a1b31e8
Compare
Destynova2
added a commit
that referenced
this pull request
Oct 28, 2026
## 🤖 New release * `grob`: 0.36.128 -> 0.36.129 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.36.129](v0.36.128...v0.36.129) - 2026-10-28 ### Fixed - *(oauth)* clear refresh marker on connection failures ([#664](#664)) - *(deps)* clear RUSTSEC-2026-0385 and RUSTSEC-2026-0387 ([#665](#665)) ### Other - *(deps)* update cargo minor updates ([#661](#661)) - *(deps)* update docker.io/grafana/otel-lgtm docker tag to v0.38.1 ([#662](#662)) - *(deps)* update docker.io/curlimages/curl docker tag to v8.23.0 ([#649](#649)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/).
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.
What
A refresh that fails before the TCP/TLS connection is established never reaches the issuer, so the stored refresh token is neither spent nor rotated. Yet
refresh_tokenleft the.refresh.pendinguncertainty marker in place on any error returned bydo_refresh:On the next tick,
begin_oauth_refreshfinds the marker's fingerprint equal to the current refresh token and refuses:So a single transient connect failure (brief outage, DNS hiccup, daemon waking from sleep) wedged every subsequent refresh permanently, until a manual
grob connect --force-reauth— even though the refresh token was still valid. The existing non-success handling only clears the marker on an explicit400/401/403, which the connection-never-opened case never reaches.Change
Clear the marker when
do_refreshfails with a reqwest connection-phase error (reqwest::Error::is_connect()): the request provably never left the client, so the next tick can safely retry the still-valid token.Timeouts and post-send/read failures intentionally keep the marker — there the outcome is genuinely unknown, and re-auth is the correct conservative answer.
Test
connect_failure_does_not_wedge_future_refreshespoints a store-backed client athttp://127.0.0.1:1(no listener → connect refused) and asserts that two consecutive refreshes both surface the connect error, and neither returns the "outcome is unknown" wedge. Before the fix, the second attempt wedged.Fixes #663