Repository navigation
fix(cli): send login session token in whoami - #100
Merged
Merged
Conversation
whoami used a sync httpx.get, but OAuthAuth only implements the async auth flow, so no bearer token was sent and whoami failed right after login. Query workspaces through an AsyncClient like the rest of the SDK. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
volkanarisli
approved these changes
Oct 23, 2026
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.
Proposed Changes?
whoamifailed with "Authentication failed" right after a successfulhaystack-enterprise login.Cause:
whoamiused a synchttpx.get(..., auth=OAuthAuth), butOAuthAuthonly implementsasync_auth_flow. Sync httpx falls back to the baseauth_flow, which attaches nothing, so no bearer token was sent. API-key auth was unaffected because the key goes in the header directly.Fix:
whoaminow fetches workspaces throughhttpx.AsyncClient(new_list_workspaceshelper), the same path the rest of the SDK uses, so the token is sent and refreshed on expiry or 401.How did you test it?
test_whoami_with_login_session: saves login credentials, noAPI_KEY, and asserts the bearer token reaches the transport. It failed before the fix.test_whoaminow asserts the API-key header at the transport level.make tests-unit(770 passed),make types,make all-fix.haystack-enterprise loginand thenwhoami. It reports "with a login session" and exits 0.Notes for the reviewer
I didn't add a
sync_auth_flowtoOAuthAuth, becausewhoamiis its only sync caller.Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01P3nCYHqG2BQyGPLbAfzLqA