Skip to content

Flaky: daemon-start-failure.spec.ts port-conflict premise fails #933

Closed

Description

@V3RON

e2e/console/daemon-start-failure.spec.ts:32 › a daemon start that cannot bind its HTTP port reports the port conflict

Error: premise: the daemon bound port … which this test holds

Failed on branches with unrelated changes: task/914 (runs 39943171887, 39945182674) and task/910 (run 39944528098). Passed on main, task/913, task/912, task/919. Failing runs end after about 2.6 s where passing runs take about 4.0 s.

Suspect (not proven): the fixture treats daemon start as successful once the log shows "HTTP gateway listening", and a late line from an earlier start may satisfy it.

Written by an agent.

Activity

  1. added
    bug:new
    flaky-test
    on Oct 23, 2026
  2. removed
    bug:new
    on Oct 24, 2026
  3. self-assigned this
    on Oct 24, 2026
  4. V3RON commented on Oct 24, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Defect in the console fixture, not in the daemon. The suspect in the issue body is wrong: no late line from an earlier start is involved. The flake also happens on main: 3 of 20 runs failed locally before any change.

    The test on bug/933-repro now writes a slow fake-driver startup read before the held start. That makes daemon start exit 0 every time, and the test fails every time (5 of 5):

    pnpm test:console --project=chromium e2e/console/daemon-start-failure.spec.ts
    
    e2e/console/daemon-start-failure.spec.ts:37 › a daemon start that cannot bind its HTTP port reports the port conflict, even when `daemon start` exits 0
    Error: premise: the daemon bound port 55088, which this test holds
    

    Root cause

    e2e/console/fixtures.ts:335. The daemon answers daemon start's status probe while it is still starting, so the CLI can exit 0 before the daemon stops on the bind failure. In that case the fixture waits, finds EADDRINUSE in the log (line 326), and falls through to expect(started.code, …).toBe(0). This is the only failure on that path, and it passes because the code is 0. So start() resolves, and the test reports a bind that never happened. Runs where the daemon exits before the probe get a non-zero code and pass. That is why the failures are faster.

    daemon.log after the held start: "HTTP frontend failed to start" … EADDRINUSE
    daemon start: exit 0, stdout "Daemon running"
    

    Simplest fix

    Line 335: throw instead of asserting the exit code. Every path that reaches that line is a failed start. Checked: 5 of 5 pass.

    throw new Error(`daemon start failed (exit ${String(started.code)}): ${started.stderr}\n${tail}`);

    Alternatives rejected

    • Retry on the flake: rule 5 forbids it, and the fixture would still report a failed start as a success.
    • Remove the test's latency and keep the race: the exit-0 path would stay untested.

    Risk

    • The test now takes about 9 s: a 5 s startup read, and dispose waits for that daemon.
    • Other callers of start() that fail get an Error instead of an expect failure. The message is the same.

    Side findings

    Written by an agent.

  5. removed their assignment
    on Oct 24, 2026
  6. added
    bug:ready
    on Oct 24, 2026
  7. self-assigned this
    on Oct 24, 2026
  8. added a commit that references this issue on Oct 24, 2026
  9. V3RON commented on Oct 24, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #982 (#933)
    Parked: none
    Waiting: none
    Decided: none

    Written by an agent.

  10. removed their assignment
    on Oct 24, 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

    bug:readyflaky-test

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions