Skip to content

fix(run): clear stale session from keychain on invalid_grant#56

Draft
VishiATChoudhary wants to merge 1 commit intofix/54-classify-invalid-grantfrom
fix/54-clear-stale-session
Draft

fix(run): clear stale session from keychain on invalid_grant#56
VishiATChoudhary wants to merge 1 commit intofix/54-classify-invalid-grantfrom
fix/54-clear-stale-session

Conversation

@VishiATChoudhary
Copy link
Copy Markdown
Collaborator

Summary

  • explain the user-facing change
  • link the issue or context if relevant

Verification

  • go test ./...
  • go test -race ./...
  • go vet ./...
  • buf generate if protobuf or generated code changed

Release notes

  • conventional commit title matches semver intent

When auth.RefreshSession returns ErrInvalidGrant (refresh token
permanently rejected), the token source now:
  1. Calls auth.ClearSession() so the next `kontext start` forces a
     fresh login instead of re-loading the dead session.
  2. Latches a permanentlyFailed flag so subsequent calls short-circuit
     without hitting the network again.

The returned error still wraps ErrInvalidGrant so upstream callers
(sidecar — next PR) can detect the permanent failure via errors.Is and
shut down their retry loops instead of spamming logs every 30 seconds.

Package-level refreshSession/clearSession variables provide injection
seams so tests never touch the real system keyring.

Refs #54
Copy link
Copy Markdown
Collaborator Author

VishiATChoudhary commented Apr 13, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant