fix: Fix agent using stale oauth tokens#579
Merged
jonathanlab merged 6 commits intomainfrom Jan 23, 2026
Merged
Conversation
This was referenced Jan 23, 2026
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
8a652c9 to
147ed31
Compare
147ed31 to
2925552
Compare
daf8abc to
337a149
Compare
jonathanlab
approved these changes
Jan 23, 2026
Merge activity
|
2925552 to
ed2f889
Compare
337a149 to
b212408
Compare
ed2f889 to
71b2a50
Compare
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.

I think I have at least one of the reasons the agent gets stuck narrowed down. What happens for me, and has been reported by others is that you send a message and it either returns back with "Generated 0.0" or "Generated x.x" and infinitely counts up. Basically, you send a prompt and it's stuck there doing nothing.
What makes this difficult is there's no way to easily replicate it since it does not happen often, which is why @jonathanlab and I have been trying to move mountains on refactor and error boundary work.
Here's what I have found after debugging dev builds. It doesn't happen often but the agent has an invalid access token here, the renderer/main processes have a valid one (I made scripts to test those printed tokens out). So problem is the agent isn't getting the newly refreshed tokens.
I was going to move the token pair to main and centralize the tokens to one source of truth and at most pass a token provider reference instead of passing the raw token value around, PR currently W.I.P. here. For now, I went with removing the store subscriber and the logic around session status checking, and we just call the tRPC router directly right from the store anytime new tokens are set now.