[Fix] Parse flat PublicError responses in the SDK - #37
Merged
Conversation
CLI login was falling back to a bare HTTP status when the API returned
a flat {error, message, metadata} body. Teach to_api_error to read
PublicError, OAuth error_description, and legacy top-level context so
the CLI can print the server message without a local hint table.
Auth-layer subscription_tier_required responses carry minimum_tier only, not a fake gumloop_api denied_key.
rbehal
approved these changes
Aug 12, 2026
This was referenced Aug 12, 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.
Summary
to_api_error/APIStatusErrorto understand Flask PublicError payloads:{error, message, metadata}error_descriptionwhen presentmetadata(and legacy top-level fields likeminimum_tier/denied_keys) into.details_ERROR_HINTStable — recovery copy stays server-ownedContext
Fixes the user-visible issue from gumloop-py#35 / PR #36 without maintaining client-side product copy.
Companion backend PR: https://github.com/gumloop/gumloop_backend/pull/6995
Note: FastAPI
{"detail": {...}}envelopes are intentionally not unwrapped; this SDK talks to the Flask public API.Test plan
uv run pytest tests/sdk/test_errors.py tests/cli/test_login.py tests/sdk/test_client.py tests/cli/test_sync_contract_fixtures.py -qgumloop loginwith a free-tier account prints the upgrade message and does not save credentials.code/.details