Skip to content

Select the credential from recorded quota state via agent-shim #128

Open

Description

@Mearman

The action picks among the credentials in its fallback secret without knowing which account has headroom, so a limited account can be tried first. The idea is to let agent-shim make that selection from recorded quota state.

Findings so far, from a throwaway probe workflow run against a haiku request and the usage route:

  • Setup tokens return 403 permission_error on /api/oauth/usage (inference-only scope), so the usage route cannot be read with them.
  • A normal run's stream-json carries a rate_limit_event, so selection from recorded state looks viable without the usage route.
  • One credential in the fallback list returns 401 authentication_error and needs replacing (a secret only a maintainer can mint).

Not yet done: probe B, which supplies a full-scope refresh token through CLAUDE_CODE_OAUTH_REFRESH_TOKEN and CLAUDE_CODE_OAUTH_SCOPES to see whether the usage route is readable in CI. It needs one interactive browser login into an isolated config directory, so it cannot run unattended. The selection step itself is not started.

Activity

  1. claude commented on Oct 13, 2026

    @claude

    What this looks like: An enhancement proposal/research note (filed by a repo maintainer) about improving the credential fallback mechanism in action.yml: instead of always trying fallback credentials in the order configured, select based on recorded quota/rate-limit state so an already-exhausted account isn't tried first. It's written as in-progress investigation notes rather than a finished spec — no bug, no urgency, nothing user-facing broken today.

    Note: the issue body appears to have passed through a compression layer before reaching me (it rendered as a <<ccr:...>> placeholder via the normal view, and the raw API fetch came back as a lossy summary rather than verbatim text), so the detail below is my best reconstruction, not a quote — worth a human double-checking the original body for exact wording (error codes, env var names, etc.) before acting on it.

    Related issues: none found. I searched issue/PR history for "fallback credential", "oauth usage", "rate_limit_event", and "agent-shim" and found no prior or duplicate issue; docs/credentials.md documents the existing ordered fallback chain but nothing about quota-aware selection.

    What is missing:

    • "agent-shim" doesn't appear anywhere in this repository (action.yml, docs/, prompts, workflows) — it's not clear whether this refers to an external tool, a planned component, or something that lives elsewhere. Worth clarifying what it is and how it would plug into the five statically-unrolled attempt_N steps in action.yml.
    • The investigation itself isn't finished: probe B (full-scope token via CLAUDE_CODE_OAUTH_REFRESH_TOKEN/CLAUDE_CODE_OAUTH_SCOPES to check whether the usage route is readable in CI) is blocked on an interactive browser login that can't run unattended, and the selection step hasn't been started.
    • Separately, the note mentions one credential in the fallback list currently returns a 401 — that's a live, low-effort cleanup item (rotating that secret) independent of the larger quota-selection idea.

    Suggested next step: Given the /api/oauth/usage 403 for setup-token scopes, the more promising path noted here is using the rate_limit_event already present in a run's stream-json output rather than pursuing the usage-route probe further — that data is already being read in a related form by scripts/execution-result.sh for the rate-limit retry gate (see docs/credentials.md). A concrete first step would be a small design note on where recorded quota state would be persisted between runs (a composite action's steps don't share state across separate workflow runs) before touching the attempt_N steps in action.yml.

    Labels applied: enhancement. No native issue type set — only Bug appears on existing issues in this repository's history, and this isn't a bug.

  2. github-actions commented on Oct 13, 2026

    @github-actions

    🗜️ Headroom context compression

    Metric Value
    Requests proxied 20
    Tokens saved 22674
    Aggregate savings 2.5% of all tokens sent
    Average per-request compression 3.4%
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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions