Skip to content

fix(cli): request account:admin so account commands work with argos login - #413

Open
gregberge wants to merge 1 commit into
mainfrom
claude/dazzling-turing-d5d375
Open

gregberge wants to merge 1 commit into
mainfrom
claude/dazzling-turing-d5d375

Conversation

@gregberge

Copy link
Copy Markdown
Member

Problem

The Argos API protects every /accounts/{accountSlug}/... endpoint with patOrOAuthAuth(["account:admin"]). That covers account get and update, members, invites, domains, and the project tokens from argos-ci/argos#2747. argos login never requested account:admin, so with an argos login session every argos account * command failed with 403 Insufficient scope. The hint then said "run argos login again", which could never fix it. The argos-cli skill also said account * works with argos login.

Fix

account:admin is added to OAUTH_SCOPES (option 1 from the issue). On the backend consent page (apps/frontend/src/util/oauth-consent.ts in argos-ci/argos):

  • The page shows one access preset per scope level: "Read only", "Read and write" and "Admin". projects:write is already level: "admin", so the CLI already gets an "Admin" preset. Its description reads "Also create and configure projects, and manage organizations", which was untrue for the CLI until now.
  • account:admin is also level: "admin", so it joins that same preset. There is no new preset, and the default stays "Read and write" ("Administration is opted into").
  • Scopes only narrow the user's real role, which is checked again on every request. A team member who is not an owner still gets a 403.

The scope hint now names the missing scope (taken from the API's This endpoint requires: … message) and gives the fix that works. A session can now be missing a scope even after a fresh login, because the user can keep the default access level. So the hint has three cases:

  • admin scope (projects:write, account:admin): run argos login again and choose "Admin" access
  • other requested scope: run argos login again
  • scope the CLI never requests: use a personal access token, because logging in again can't help

Text that doesn't look like a scope is never echoed back.

Skill: skills/argos-cli/SKILL.md now says which commands need "Admin" access with argos login, and what to do on Insufficient scope.

Tests

  • run.test.ts: one test per hint case, a mixed admin and non-admin requirement, an unparseable message, and an injected escape sequence.
  • oauth.test.ts: the authorize URL requests account:admin.

pnpm -F @argos-ci/cli test (158 passed), tsc, eslint and prettier all pass.

Users who are already logged in must run argos login again and choose "Admin" before they can use account commands. The new hint tells them to.

🤖 Generated with Claude Code

…gos login`

Every `/accounts/{accountSlug}/...` endpoint requires the `account:admin`
OAuth scope, which `argos login` never requested, so `argos account *`
answered 403 with a hint (log in again) that could not help.

The consent screen already offers an "Admin" access level to the CLI,
because `projects:write` is an admin scope, and describes it as managing
organizations. `account:admin` now joins it there; the default access
level stays "Read and write".

The scope hint now names the missing scope and its fix: choose "Admin"
access for an admin scope, log in again for any other, or use a personal
access token for a scope `argos login` never requests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
argos-js-sdk-reference Ready Ready Preview Nov 5, 2026 1:42pm UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — 6f97fb5e Deployed Nov 5, 2026 by vercel[bot]
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