fix(auth): clear errors for missing BL_WORKSPACE/BL_API_KEY (ENG-2253)#153
Merged
mstolarzblaxelai merged 1 commit intoMay 28, 2026
Merged
Conversation
Partial or absent credentials produced cryptic failures: a None workspace crashed httpx header encoding, a missing config file crashed at import, and no credentials surfaced an AttributeError or a misleading server-side "workspace is required" message. Resolve credentials safely and fail fast with an actionable message naming the missing piece (BL_API_KEY / BL_WORKSPACE / `bl login`): - get_workspace() no longer raises when the config file is absent - auth() returns a MissingCredentials sentinel instead of None - workspace is validated before any header is built or token request is made
Contributor
There was a problem hiding this comment.
LGTM
The fix is correct and well-scoped. One minor risk: except Exception in get_workspace() silently swallows YAML parse errors on a corrupt config file — the user would see "BL_WORKSPACE missing" rather than "bad YAML", but that's an acceptable trade-off given the stated goal and it's no worse than the pre-existing crash. No blocking issues.
Tag @mendral-app with feedback or questions. View session
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 ENG-2253.
bl login) before any request goes out.Note
Replaces cryptic
None-propagation failures (httpx encode crash, import-timeFileNotFoundError, misleading server-side error) with aMissingCredentialssentinel andCredentialsErrorthat names exactly which env var is missing. Adds_ensure_workspace()guard on every header/auth-flow path, and covers the three failure modes with unit tests.Written by Mendral for commit 0b408f6.