Skip to content

[Bug]: Proxy 403 "reset after N" soft-throttle aborts the session instead of retrying #42167

Open

Description

@0xharryriddle

Bug Description

When the main model is served through a local/self-hosted proxy that fronts upstream models (in my case custom:9router-proxy at http://localhost:20128/v1 fronting kr/claude-opus-4.8-thinking-agentic), the proxy signals a soft throttle as an HTTP 403 whose retry delay is embedded in the response body (HTTP 403 (reset after 2m)), not a standard HTTP Retry-After header.

agent/error_classifier.py maps every non-billing 403 to a permanent FailoverReason.auth (retryable=False). In agent/conversation_loop.py that becomes a non-retryable client error: it tries the fallback chain, and when no fallback is configured (fallback_providers: []) it aborts the session and prints "Your API key was rejected... run hermes setup" — even though the key is valid and the throttle is transient.

The sibling 429 path on the same proxy retries and recovers cleanly, proving the retry machinery works; only the 403 classification mishandles this case.

Steps to Reproduce

  1. Configure the main model behind a proxy that returns HTTP 403 with the delay in the body when throttling, e.g. in ~/.hermes/config.yaml:
    model:
      provider: custom
      base_url: http://localhost:20128/v1
      default: kr/claude-opus-4.8-thinking-agentic
    fallback_providers: []
  2. Drive enough traffic (or otherwise trip the proxy's rate limiter) so the
    proxy responds with HTTP 403: ... (reset after 2m).
  3. Observe the agent's behavior on that 403.

Expected Behavior

The 403 carries an explicit reset window (reset after 2m), so it should be treated as a transient throttle: the retry loop waits the advertised window (bounded/capped) and retries, the same way the 429 path on this proxy already recovers. A genuine credential-rejection 403 (no reset hint) should still abort fast with accurate guidance.

Actual Behavior

The 403 is classified as a permanent auth failure and the session aborts on the first throttle, with a misleading "API key was rejected" message:

⚠️  API call failed (attempt 1/3): PermissionDeniedError [HTTP 403]
   🔌 Provider: custom:9router-proxy  Model: kr/claude-opus-4.8-thinking-agentic
   🌐 Endpoint: http://localhost:20128/v1
   📝 Error: HTTP 403: [kiro/claude-opus-4.8-thinking-agentic] [403]: HTTP 403 (reset after 2m)
❌ Non-retryable error (HTTP 403): ...
❌ Non-retryable client error (HTTP 403). Aborting.
💡 Your API key was rejected by the provider. Check:
      • Is the key valid? Run: hermes setup
      • Does your account have access to kr/claude-opus-4.8-thinking-agentic?

The key is valid and the throttle is self-resolving within the advertised window, but the session has already aborted.

Affected Component

Configuration (config.yaml, .env, hermes setup), Agent Core (conversation loop, context compression, memory)

Messaging Platform (if gateway-related)

N/A (CLI only)

Debug Report

Debug report uploaded:
  Report       https://dpaste.com/BQPGXM865
  agent.log    https://dpaste.com/572T3692Z
  desktop.log  https://paste.rs/xORNe

Operating System

Ubuntu 24.04

Python Version

3.12.3

Hermes Version

0.16.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Activity

  1. added
    type/bugSomething isn't working
    P2Medium — degraded but workaround exists
    comp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint
    area/authAuthentication, OAuth, credential pools
    on Jun 8, 2026
  2. GottZ commented on Jul 29, 2026

    @GottZ

    This was generated by AI during triage.

    Summary

    One PR addresses #42167. #42168 adds body-hint parsing specifically to the 403 auth-classification path, preserving billing and ordinary auth behavior, and passes the parsed delay to the retry loop; however, its delay cap and retry-path coverage need revision against current main.

    Related pull requests

    • fix(error-classifier): treat proxy 403 "reset after N" as transient throttle #42168 best fix — (+278/-0) — partial fix / keep open: The diff reclassifies a non-billing 403 carrying a valid “reset after N” body hint as a retryable rate limit and wires its parsed delay into retry resolution while leaving genuine auth 403s non-retryable. The contributor keep_open review identifies two unresolved issues: the implementation restores a 120-second cap despite current main’s tested 600-second contract, and the new regression test mirrors local predicates and delay-resolution logic rather than exercising the actual AIAgent.run_conversation() retry/abort path; the visible classification change is in the 403 path and does not establish equivalent 429 body-hint classification.

    Suggested consolidation

    Merge #42168 after rebasing it on current main’s shared 600-second retry-delay policy and replacing or supplementing the mirrored-helper test with an actual AIAgent.run_conversation() retry-path regression test. It is the only candidate and directly targets #42167, but the contributor keep_open review and verify partial_fix verdict should remain controlling until those diff-level gaps are addressed; there are no duplicate PRs to close.

    Complex graph

    flowchart LR
        classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
        classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
        classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
        classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
        classDef best stroke-width:3px,stroke:#b45309
        classDef target stroke-width:3px,stroke:#4338ca
        I42167(["issue #42167 (open)"])
        P42168["PR #42168 (open)"]
        P42168 -->|best fix| I42167
        class I42167 open
        class I42167 target
        class P42168 open
        class P42168 best
        click I42167 "https://github.com/NousResearch/hermes-agent/issues/42167"
        click P42168 "https://github.com/NousResearch/hermes-agent/pull/42168"
    
    Loading

    Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed or no verify verdict yet (state tag in the node label).

    Cross-PR triage: Reviewed 1 pull request and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 15 kB of PR diffs, 10 kB of issue/PR text, 5 kB of discussion (3 comments), 2 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

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

    P2Medium — degraded but workaround existsarea/authAuthentication, OAuth, credential poolsarea/sessionsSession lifecycle, resume, persistence, historycomp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpointtype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions