Skip to content

fix(roadmap): name a spent provider key, not a refused key #6821

Closed

Description

@dan-petty

Problem

Since 2026-11-22 15:17 UTC the roadmap stage and refine Jobs fail with ✗ Could not run the stage Job: The model refused the key (HTTP 403). (alert RoadmapServiceJobsFailing, 6 series on 2026-11-23 00:20).

  • The key is not refused. The gateway log gives the cause: OpenrouterException - {"error":{"message":"Key limit exceeded (total limit). ... $100.00 of $100.00 used; does not reset.","code":403, ...}}. The OpenRouter key of the gateway used all of its total spend limit.
  • model_call_error (src/devops_cli/roadmap/agent_run.py:66-67) maps each 401 and 403 to AICredentialsError("The model refused the key ..."). So the Job report, the alert and the person who reads them look at the gateway key, not at the spend limit of the provider key.
  • No alert names a spent provider key. The person finds the cause only in the gateway log.

Proposed remedy

  • Read the error body of a 403 reply: when the provider says that the key limit is used up (OpenRouter Key limit exceeded), raise a budget error that says "The provider key reached its spend limit" and names the person step (raise the limit or change the key at the provider), with no key, URL or amount from the reply.
  • Give that error its own outcome in the Job metrics, and an alert for it, so RoadmapServiceJobsFailing is not the only signal.

Acceptance criteria

  • A test: a 403 reply with the OpenRouter key-limit body gives the budget error; a 403 with another body still gives the credentials error.
  • The Job report and the new alert name the spend limit and the person step.

Dependencies

None.

Alternatives check of 2026-11-23: none.
Tool: none found.
Reason: Searches found only general LLM gateways such as LiteLLM, which normalise some provider errors but do not classify OpenRouter spend-limit 403 bodies; the outcome metric and alert are project-specific, so nothing covers the need.

Lacks:

  • Reads the 403 body and tells a spend limit from a refused key
  • Raises a distinct budget error with a person step
  • Own Job metric outcome and alert for a spent provider key
  • Keeps the existing credentials error for other 403 bodies

Activity

  1. added
    type/bug
    source/agent
    scope/roadmap
    status/new
    effort/medium
    on Nov 23, 2026
  2. dan-petty commented on Nov 23, 2026

    @dan-petty
    OwnerAuthor
    • Priority: P0-Critical. Roadmap stage and refine Jobs are failing and the alert RoadmapServiceJobsFiring is active, which matches the P0 criterion for service jobs failing.
    • Related: feat(roadmap): cost and token budgets per item and per day #3066, which asks for a different change. Both deal with budget limits in the roadmap Service, but #3066 adds new per-item and per-day budgets while the candidate fixes the error message and alert when an existing provider key spend limit is hit.
  3. added
    value/high
    priority/p0-critical
    owner/agent
    status/in-progress
    and removed
    status/new
    on Nov 23, 2026
  4. devops-cli-service commented on Nov 23, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (10)

    Tools considered:

    Searches run:

    • LiteLLM BudgetExceededError map provider 403 spend limit, results: 5
    • OpenRouter "Key limit exceeded" 403 error handling library, results: 5
    • litellm exceptions BudgetExceededError openrouter key limit, results: 5
    • openrouter python SDK APIError 403 key limit exceeded exception class, results: 5
    • openrouter error handling github, results: 5
    • LLM API error classification library budget vs authentication error, results: 5
    • openrouter, results: 5
    • litellm, results: 5
    • openrouter key limit exceeded error body, results: 5
    • llm gateway spend budget alert prometheus metrics, results: 5

    Sources:

  5. added
    status/in-review
    and removed
    status/in-progress
    on Nov 23, 2026
  6. removed
    status/in-review
    owner/agent
    on Nov 23, 2026
  7. devops-cli-service commented on Nov 23, 2026

    @devops-cli-service
    Contributor
  8. devops-cli-service commented on Nov 23, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-23 04:05 UTC

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

    effort/mediumpriority/p0-criticalscope/roadmapsource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions