Skip to content

bug: a 503 from an exhausted credit balance is laundered into an "acceptable skip" across 32 tests #2889

Closed

Description

@vybe

Summary

About 32 tests across the api and agent_server tiers call pytest.skip(...) whenever a real chat/task call returns HTTP 503, with a generic reason like "Agent server not ready" / "Agent not ready (503)". A 503 caused by an exhausted model-provider credit balance is therefore reported as a benign skip rather than a failure — so a run stays green-looking while all chat, task, execution, parallel-task, and fan-out coverage is silently lost.

Context

Observed on an instance where the platform credential had no remaining balance and no subscription fallback was configured (GET /api/subscriptions returned []). A direct probe returns:

POST /api/agents/<agent>/task  ->  503
{"detail":"...Claude Code execution failed (exit code 1): Credit balance is too low.
  To resolve: (1) add credits to your account, or (2) assign a subscription token
  with available usage in Settings -> Subscriptions."}

The suite reported these 32 tests as skips. They are coverage loss, not acceptable skips. This contradicts the documented testing doctrine that a partial run is a failed run and that infra-broken skips must be counted as failures.

Skip-on-503 sites:

File Count
tests/test_parallel_task.py 12
tests/test_executions.py 11
tests/test_agent_chat.py 6
tests/test_execution_queue.py 1
tests/test_execution_streaming.py 1
tests/agent_server/test_agent_chat_direct.py 1

The shared wording is the core defect: "agent server still starting" and "provider credential is unusable" are indistinguishable in the report, so the second hides behind the first indefinitely.

Acceptance Criteria

  • A 503 whose body indicates credit / billing / subscription exhaustion FAILS the test rather than skipping it
  • A 503 that is a genuine transient readiness race still skips (or, better, retries with backoff), and the reason text states which of the two it concluded and on what evidence
  • Skip reasons distinguish "agent server still starting" from "provider credential unusable"
  • A session-level preflight fails fast with one clear message when the configured credential cannot execute at all, instead of producing 32 individually-skipped tests

Technical Notes

The classification policy should live in one place — e.g. a helper in tests/conftest.py that inspects a 503 body once — rather than being re-implemented at ~32 call sites, which is how the two causes came to share one reason string.

Activity

  1. added
    priority-p1
    type-bug
    theme-devex
    complexity-medium
    status-ready
    on Sep 18, 2026
  2. removed
    status-ready
    on Sep 18, 2026
  3. dolho commented on Sep 18, 2026

    @dolho
    Contributor

    /claim

  4. github-actions commented on Sep 18, 2026

    @github-actions

    Claimed by @dolho. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/2889-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #2889
  5. added
    status-in-progress
    on Sep 18, 2026
  6. added
    status-in-dev
    and removed
    status-in-progress
    on Sep 20, 2026
  7. removed
    status-in-dev
    on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

complexity-mediumpriority-p1theme-devextype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions