Skip to content

test(ci): no test connects to a localhost service it did not start, and a guard fails one that does #1741

Closed

Description

@dan-petty

Split from #1725 (CI time budget), so that this row is one issue delivered by one pull request.

Friction

Tests connect to localhost services they didn't start. The network block refuses each connect, which sends the client into its retry backoff.

Counts from a full-suite probe (each line: service, port, tests):

  • OTLP export, 4318: 2,249 tests, 8,116 connects.
  • Valkey, 6379: 79 tests.
  • Qdrant, 6333: 10 tests.
  • Ollama, 11434: 5 tests, with 1+2+4+8s of retries on a thread that outlived its test.
  • The gateway, 4000 and 8787: 2 tests.
  • k8s port-forward probes: 2 tests.
  • Ports picked by hand to refuse: about 12 tests.

Remedy

  • Tests that need a model use model_fake.
  • Tests that need a service to be down use a refusing_port the test binds and never listens on.
  • Retry waits behind a direct time.sleep return at once through the stdlib clock fallback.
  • The floor sends telemetry export and the Valkey cache to a refusing port bound for the run.
  • A guard fails any test that connects to a loopback port no socket in the test process binds, even when the code swallowed the refusal.

Acceptance criteria

  • A full-suite probe finds no in-process loopback connect to a port the test process didn't bind.
  • The guard fails a test that makes one, with red evidence.
  • The affected tests' time is measured before and after, with every assertion kept.
  • uv run devops ci passes.

Activity

  1. added this to the v0.2.38 milestone on Oct 20, 2026
  2. added
    type/test
    priority/p0-critical
    scope/ci
    source/agent
    on Oct 20, 2026
  3. dan-petty commented on Oct 20, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1744, merged into release/v0.2.38 as 49c0c61.

    No test connects to a localhost service it didn't start, and a guard fails a test that does. This row was split from #1725's CI time budget.

    26 file(s) changed.

    How it was verified

    Check runs at dbe3461:

    • Audit Defect PR Hardening: skipping
    • Prune PR DevContainer Images: pass
    • zizmor: pass
    • devops-cli: pass
    • bandit: pass
    • Fail-to-Pass Check: pass
    • Fail-to-Pass Self-Check: pass
    • CodeQL: pass
    • Static Analysis: pass
    • Analyze (python): pass
    • Tests & Coverage: pass
    • Changed-Test Independence: pass
    • Rule Pack Tests: pass
    • Analyze (actions): pass
    • Service Image: skipping
    • Dependency Freshness: skipping
    • DevContainer Image: skipping

    Acceptance Criteria of docs/agent/tasks/task-1741-no-test-reaches-an-unstarted-localhost-service.md:

    No Acceptance Criteria section.

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

    priority/p0-criticalscope/cisource/agenttype/test

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions