Conversation
teknium1
reviewed
Jul 30, 2026
teknium1
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for isolating the persisted-token schema and omitted-refresh-token cases; both premises are present on current main (apps/desktop/electron/main.ts:6187,6222,6287).
Problems
- The replay cache does not deduplicate actual overlap.
hermes_cli/dashboard_auth/middleware.py:673checks the cache, but:677performs_attempt_refreshafter that lock has been released and:683only records the result afterward. Two requests can both miss and consume the same rotating token. - The new test is sequential:
tests/hermes_cli/test_dashboard_auth_401_reauth.py:295completesfirst.get()before:296starts the second request, so it cannot exercise that race. - The same single-use-token exposure remains in native desktop refresh:
apps/desktop/electron/main.ts:6262-6288has multiple callers and no in-flight coordinator;/auth/native/refreshdocuments reuse as a 401 condition inhermes_cli/dashboard_auth/routes.py:894-907.
Suggested changes
- Use keyed single-flight coordination around the dashboard refresh and add a genuinely overlapping regression test.
- Coalesce native
ensureNativeAccessTokenrefreshes per base URL, or scope the change's claims accordingly.
Automated hermes-sweeper review.
| if cached is not None: | ||
| return cached | ||
|
|
||
| refreshed = _attempt_refresh( |
Collaborator
There was a problem hiding this comment.
This call occurs after the cache-miss lock has been released, so two overlapping requests can both reach the provider before either reaches _remember_recent_refresh. Please use keyed single-flight coordination and re-check the completed result for waiters; the current test's sequential requests do not cover this interleaving.
19 tasks
This branch has not been deployed
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.
Fixes three session-persistence defects with behavior-first regression coverage:
Red evidence:
Verification after rebasing onto current main:
The replay cache is process-local, capped at 256 entries, keyed by a SHA-256 token digest plus client address and provider identity, and never logs or persists credential material.