Repository navigation
fix: explain Robots permission recovery in the CLI - #80
Merged
Merged
Conversation
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.
Overview
Robots
403 insufficient_scoperesponses fall through to generic CLI error formatting, losing structured permission and recovery details for agents. Preserve the API error and give recovery instructions for the credential actually in use.What was changed
insufficient_scopetype.Suggested review order
src/lib/errors.ts.src/lib/errors.test.ts.Note
Low Risk
Localized CLI error-handling for Robots permission responses; no auth or API behavior changes beyond clearer messages and JSON shape for one error type.
Overview
Robots
insufficient_scopeerrors now get a dedicated path inhandleCommandErrorinstead of generic CLI formatting.When the Robots API returns a
PermissionDeniedErrorwitherror.type === 'insufficient_scope', the CLI keeps the server messages and emits structured JSON (error,messages,api_response) for agent/JSON modes. It also appends recovery text based on how the user is authenticated: dashboard token replacement (includingMUX_TOKEN_ID/MUX_TOKEN_SECRETprecedence), OAuth re-login withMUX_OAUTH_SCOPESguidance, or a fallback when local credentials cannot be loaded.The special case is narrow: only Robots + explicit
insufficient_scopeon permission errors (not other 403 types, wrong status codes, or non-robots command groups). Tests cover Basic vs Bearer auth, credential lookup failure, agent/JSON output, and cases that must not be relabeled.Reviewed by Cursor Bugbot for commit 8b56a3c. Bugbot is set up for automated code reviews on this repo. Configure here.