Skip to content

fix(telemetry): resetting the tracer waits for its exports, so no test's exports run on into the next #1604

Closed

Description

@dan-petty

Friction

tests/test_roadmap_dry_runs.py::test_a_dry_run_through_the_entry_point_starts_no_process_and_opens_no_connection[migrate] fails intermittently in a full uv run devops ci run and passes alone, so a change's gate result depends on which tests ran before it in the same worker.

Evidence

  • On 2026-10-16 the test failed with repeated create_connection: (('localhost', 4318), 1.0) attempts, the OTLP endpoint every test configures (tests/conftest.py, isolate_devops_cli_config: telemetry enabled at http://localhost:4318). It passed alone and in the next full run.
  • The dry run itself sends nothing: OTelTelemetryClient._send_payload returns at once in a dry-run invocation (feat(cli): reachable --dry-run previews for delegated commands #412). The test refuses connections process-wide by patching socket.create_connection, so it also records connections from other threads.
  • reset_tracer() (src/devops_cli/telemetry/tracer.py), which the autouse fixture calls before and after every test, dropped the global tracer without shutting it down. Exports a test had queued kept running on the tracer's two-worker executor and reached the next test's patched socket.

Remedy

reset_tracer() shuts the dropped tracer down first; shutdown() already waits up to DEFAULT_OTEL_DRAIN_TIMEOUT_SECONDS for exports in flight and closes the executor. A test queues a slow export, resets the tracer, and checks the export finished before the reset returned.

Activity

  1. added
    source/agent
    type/test
    on Oct 16, 2026
  2. dan-petty commented on Oct 17, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Type: type/test. The candidate fixes a test that was failing due to test order and load dependencies.
    • Priority: P2-Medium. The issue affects test reliability but does not block core functionality or introduce security concerns.
    • Value: Medium. Fixing intermittent test failures improves development stability and confidence in the CI pipeline.
    • Effort: Low. The fix involves a small change to shutdown the tracer properly and add a check for export completion.
  3. changed the title [-]fix(test): the gateway stall and roadmap dry-run tests pass regardless of test order and load[/-] [+]fix(telemetry): resetting the tracer waits for its exports, so no test's exports run on into the next[/+] on Oct 17, 2026
  4. added a commit that references this issue on Oct 17, 2026
    0a95a1c
  5. dan-petty commented on Oct 17, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1606, merged into release/v0.2.36 as 0a95a1c.

    Closes #1604

    tests/test_roadmap_dry_runs.py::test_a_dry_run_through_the_entry_point_starts_no_process_and_opens_no_connection[migrate] failed intermittently in full devops ci runs with repeated create_connection: (('localhost', 4318), 1.0) attempts. The dry run sends nothing itself (OTelTelemetryClient._send_payload returns at once in a dry-run invocation, #412), but the test refuses connections process-wide, so it also recorded exports another test had queued.

    4 file(s) changed.

    How it was verified

    Check runs at 7a56c82:

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

    No task file.

  6. added this to the v0.2.36 milestone on Oct 17, 2026
  7. added a commit that references this issue on Oct 17, 2026
    3dd7fa6
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

    source/agenttype/test

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions