microsoft / microsoft/amplifier

CLI fails completely (start/update) when GITHUB_TOKEN is set with insufficient permissions — should fall back gracefully

Open
#377 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.1k
Forks
261
Avg merge
3h 28m
Merged PRs (30d)
13

Description

Summary

When GITHUB_TOKEN is set in the environment, the Amplifier CLI fails completely — it cannot start, cannot self-update, etc. This appears to happen when the token does not have the required permissions (e.g. a token exported globally for another tool that happens to lack the scope the CLI needs, or one scoped to a different org).

Impact

A single unrelated GITHUB_TOKEN in the environment can render the CLI entirely unusable. Many developers keep a GITHUB_TOKEN exported globally for other tooling, so this is easy to hit and produces a hard failure with no obvious cause.

Expected behavior

The CLI should degrade gracefully instead of failing hard when GITHUB_TOKEN is present but insufficient. At least one of:

  1. Fall back to a different auth mechanism (e.g. gh CLI credentials, SSH, or anonymous/unauthenticated access) when the provided token is rejected (401/403).
  2. Fall back to whatever is already cached locally, so the CLI can still start and run with previously fetched resources even if the token-based fetch fails.
  3. At minimum, treat an invalid/insufficient token as "no usable token" and continue with a clear warning instead of a fatal error.

Actual behavior

With GITHUB_TOKEN set to a token lacking the right permissions, the CLI fails completely — startup and self-update both fail.

Suggested fix

  • Detect auth failures on token-based GitHub requests and fall back to alternate auth or unauthenticated/cached paths rather than aborting.
  • Never treat a GitHub fetch failure as fatal when a viable local cache exists.

Environment

  • Package: amplifier-app-cli 0.1.1 (amplifier-core 1.6.1)
  • Platform: Linux (Linux-6.17.0-8-generic-x86_64, glibc 2.42)
  • Trigger: GITHUB_TOKEN set with insufficient permissions

(Filed against microsoft/amplifier because Issues are disabled on microsoft/amplifier-app-cli, which is the package that exhibits the bug.)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with an insufficient GITHUB_TOKEN, then trace the CLI startup and self-update GitHub fetch paths mentioned in the report. Inspect how token authentication errors and cached resources are handled; done means startup and self-update continue with a clear warning or viable fallback when the token returns 401/403.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, python
Domain
authentication, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.