Skip to content

mcpx github: fail over across a list of GitHub App identities on soft blocks (rate limits), stop on hard blocks #7948

Closed

Description

@dezren39

Proposal (Drew, 2026-11-08 22:04 CST)

"can we make it so we can feed a list of app tokens to mcpx github and it fallback to app? sounds like a minor change to suggest fail over when not hard blocked?"

Give mcpx's github namespace a list of GitHub App credentials (the fleet's App identities: developing.today, fleet, developing-today-backup) and make it fail over to the next identity when one hits a soft block — a rate limit on that identity — because each App identity carries its own rate-limit bucket. On a hard block (permission denied, no installation on the target repo, invalid auth), rotation cannot help: stop and surface the error instead of burning the list.

This is the tool-layer twin of Drew's model-leg failover spec (leg errors → short grace → next leg) and of the gh-post ladder the Muse side already uses for its own GitHub writes (user token → App identity when the user bucket is exhausted).

Why — tonight's evidence (2026-11-08, America/Chicago)

  • ~21:05–21:14 CST: the queue broker flapped (restarted 21:05:31 CST). Shift fallback claims then died in sequence on: the fleet user token's secondary rate limit ("submitted too quickly"), then its primary rate limit (HTTP 403 at 03:14:36Z), then an App-route failure on that fallback path ("no GitHub App installation for owner developing-today"). Result: 0 tasks worked, 0 GitHub writes landed in that window. One shared credential bucket took the whole claim path down.
  • 21:40 CST: a separate wave of mcpx github-namespace session errors — 3 sessions ACTIVE in the namespace, 1 tools.github TypeError (fleet-minder run, report 202). Single-credential, single-server: any credential-level wall is a namespace-level outage.

Feasibility — checked against the code (2026-11-08)

Drew's "minor change" read is half right: the concept is small, the surface is not one line.

  • Today the github namespace is one stdio downstream server (github-mcp-server, via the github-mcp wrapper) holding one credential: the user token from gh auth token (account dezren39), read once at server start (doc/fleet/mcp.md). It is not an App credential at all today, and nothing rotates it.
  • mcpx's per-server auth (pkgs/mcpx/internal/mcpauth) is a single bearer/env credential per server, expanded at connect time. There is no credential-list, rotation, or failover concept anywhere in mcpx today (searched pkgs/mcpx/internal + docs).
  • App credentials are not static tokens: an installation token lives ~1 hour and must be minted from the App private key (JWT → installation token). A minter is required — the fleet already operates this machinery in the gh-post ladder, and the App private key already exists as a vault/org secret (referenced by name only: FLEET_APP_PRIVATE_KEY / the developing.today app key in Bitwarden).
  • A stdio server keeps its launch env, so per-call failover needs one of: (a) N registered github server instances in mcpx (one per identity) plus error-class-aware retry across instances in the mcpx client layer (internal/mcpclient); or (b) a token-broker shim in the wrapper that rotates the credential and restarts the github server on a soft block (the server is effectively stateless per call, so restart is survivable but blunt). Option (a) is the cleaner long-term shape; (b) is the smaller first step. The implementer picks with evidence, but the acceptance criteria below are shape-neutral.
  • Error classification is part of the work: today tool errors pass through opaquely (the 21:40 TypeError surfaced raw). mcpx must distinguish soft from hard blocks at the GitHub layer.
  • Rotation state (current identity, per-identity cooldown until its rate-limit reset) must survive server restarts — mcpx daemon state or a small state file beside it.

Realistic size: a small-but-real feature in mcpx (config shape + minter + classified retry + state), measured in days, not a config tweak — and not a rewrite.

Soft vs hard blocks (the classification this issue fixes in one place)

Soft — rotate to the next identity, after a short grace:

  • HTTP 429 (any GitHub endpoint)
  • HTTP 403 with rate-limit markers: X-RateLimit-Remaining: 0, a Retry-After header, or a body naming a primary/secondary rate limit (including "submitted too quickly")
  • HTTP 502/503 from GitHub (transient; grace + retry, same or next identity)

Hard — stop and surface immediately, never rotate:

  • HTTP 401 / bad credentials / expired or revoked key material
  • HTTP 403 with no rate-limit markers (permission forbidden, SSO enforcement, "Resource not accessible by integration")
  • HTTP 404 for the installation or the target resource
  • HTTP 422 validation errors (the call itself is wrong; no identity fixes it)

Acceptance criteria

  1. mcpx's github namespace accepts a configured list of App identities (installation ids + credential references by vault/secret name only — no secret values in any config file, log, or this issue's follow-ups).
  2. A GitHub tool call that hits a soft block on identity test #1 completes via identity Bump checkmarx/ast-github-action from 2.0.11 to 2.0.18 #2 without the calling session seeing a fatal error (demonstrated with a forced rate-limit response or a staged low-limit identity, test named with its oracle per the testing doctrine).
  3. A hard block surfaces immediately with its real error — no rotation attempts, no retries that burn the remaining identities.
  4. Every rotation is logged with the identity name and the reason (soft-block class + status), and the current-identity/cooldown state survives a github-server restart.
  5. With the list configured, sessions keep the same tool surface (same 43 github tools, same names) — no session or packet changes required.
  6. The old single-user-token path remains available as the last list entry or a config fallback, so a bad App config cannot take the namespace down entirely.

Refs

Activity

  1. developing-today commented on Nov 9, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    task 14308 — picked up by lane code-f (direct lane). Revalidated fresh 2026-11-09T09:16Z: issue #7948 OPEN, no hard-stop labels, no existing PR or branch for this work. Implementing per packet: credential-list config + App installation-token minting for the mcpx github namespace, soft/hard error classification with failover on soft blocks only, durable rotation state + logging, oracle-named tests, doc/fleet/mcp.md update.

  3. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 9, 2026
  4. added a commit that references this issue on Nov 9, 2026
  5. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    task 14308 — done (lane code-f). PR #8018 MERGED (merge commit f6d13de): mcpauth identity-failover machinery for #7948 — failover identity list by secret name only (App identities + user token last), soft/hard classification, rotator with durable state + rotation logging, App installation-token minter, pool resolves the current identity at connection start, doc/fleet/mcp.md updated. Oracle-named tests pass on the laptop (go test ./internal/mcpauth/ ./internal/pool/); the one internal/config failure is pre-existing on clean main. Remaining work (daemon call-path retry wiring + live activation) is filed as #8017, so #7948 stays open for that follow-on.

  6. added
    epic/mcpxEpic: mcpx - all issues of this effort carry it
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic/mcpxEpic: mcpx - all issues of this effort carry itstatus:done

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions