Skip to content

Flaky: daemon-client explicit-lifecycle tests time out near the 5 s limit and cascade #4848

Closed

Description

@thymikee

Purpose

Three tests in packages/daemon-client/src/__tests__/daemon-client-ensure-explicit-lifecycle.test.ts failed together in the Coverage job of #4839, a PR that does not touch daemon-client. A rerun with no code change passed. The file can fail any PR.

Evidence

Run https://github.com/callstack/agent-device/actions/runs/44781188813/job/136443984822 at 314ce9f:

  • ensureDaemon reports contention when the daemon keeps changing under it: timed out at 5000 ms (5.07 s).
  • ensureDaemon does not start a daemon over one it could not confirm retired: spawn.mock.calls.length was 2, expected 0.
  • a quiesce the daemon never hears is judged again, not reported as a transport failure: timed out at 5000 ms (5.08 s).

The other 21,796 tests passed. On a loaded development host the same two timing tests ran 2.7 s and 4.1 s against a 2.5 s budget.

Likely cause (not proven)

  • The two timing tests wait real time close to the 5 s test timeout.
  • The assertion failure looks like a cascade: spawn is a module-level mock, and afterEach resets it while the ensureDaemon call of the test that timed out is still running. That call can then record spawns in the next test.

Required behavior

  • The two timing tests do not wait real time: the retry and poll budget is injected or asserted, as docs/agents/testing.md requires.
  • A test that times out cannot change the result of the next test. Its ensureDaemon call is finished or cancelled before the shared spawn mock is reset.

Completion conditions

  • Both tests run under the 2.5 s slow-test budget on CI.
  • The file passes 20 repeated runs on a loaded host.
  • A forced timeout in one test does not fail the test after it.

Activity

  1. added
    bug
    needs-triage
    on Nov 20, 2026
  2. apex-sentinel-staging commented on Nov 20, 2026

    @apex-sentinel-staging

    Apex Sentinel · Issue review

    Suggested label: bug

    The issue reports concrete flaky test failures in daemon-client explicit-lifecycle tests with named test names, CI run evidence, timing values, and a cascading mock-reset mechanism, indicating existing test/CI behavior is broken.

    Required sections

    • Steps to reproduce (missing)
    • Expected and actual behavior (missing)
    • Version or environment (missing)
  3. added
    in-progress
    and removed
    needs-triage
    on Nov 21, 2026
  4. removed
    in-progress
    on Nov 21, 2026
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

    bugready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions