Skip to content

Daemon test rigs outside src/agent-device build the host's real load probe, so the host's memory can pause their warm pool #1867

Done

Description

@V3RON

Unit and fast-e2e files under `src/daemon/` call `startDaemon` without `hostLoadProbe`, so `main.ts:531` / `worker-composition.ts:246` build `productionHostLoadProbe` and the daemon samples this machine's real memory (`sysctl kern.memorystatus_level kern.memorystatus_vm_pressure_level` on macOS). A reading at `warn` or under 20 % available sets `warming-paused` (ADR 0068) and the warm pool starts nothing, so any assertion that waits for a warm `ready` device fails when the machine running the suite is short of memory. `src/daemon/test-main.ts:51` and `src/daemon/test-optional-modules.ts:126` already pass `hostLoadProbe: null`; these do not:

```
src/daemon/test-relay-support.ts (startFleet, 2 calls)
src/daemon/main-leasing.test.ts (6)
src/daemon/optional-modules-start.test.ts (4)
src/daemon/main-agent-device.test.ts (1)
src/daemon/main-stop.test.ts (9 of 11)
src/daemon/main.test.ts (2 of 4)
src/daemon/*.e2e.test.ts: gateway-fleet, input-lease, tunnel-lease, lease-requires, stream-gateway, worker-capabilities, device-rotate, session-path, remote-client, tunnel-cli
src/agent-device/local-profile.test.ts (1)
src/cli/index-daemon-service.test.ts (2)
```

Not every one waits on the warm pool; each that does is exposed. Found while triaging #1863, which reproduces this for the two agent-device rigs (`test-support.ts`, `test-gateway.ts`).

Written by an agent.

Activity

  1. added
    bug:new
    on Nov 25, 2026
  2. self-assigned this
    on Nov 26, 2026
  3. V3RON commented on Nov 26, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Confirmed, corrected: 46 starts in 20 files. src/cli/index-daemon-service.test.ts starts no daemon/main.ts daemon (its startDaemon wraps startInMemoryDaemon). Missed by the issue: test-main.ts:199 (startGateway, used by main-worker-lock.test.ts:228) and test-relay-support.ts:191.

    src/daemon/test-daemons-host-load.test.ts on bug/1867-repro, "daemons started by tests under src/ pass a hostLoadProbe, so none builds the production probe and reads this host's memory", scans every startDaemon call under src/ and packages/, following an options builder to its declaration. main-host-load.test.ts is exempt: it picks probes on purpose.

    $ pnpm exec vitest run --project unit src/daemon/test-daemons-host-load.test.ts
    AssertionError: expected [ …(46) ] to deeply equal []
    +   "src/agent-device/local-profile.test.ts:100",
    +   "src/daemon/device-rotate.e2e.test.ts:70", ...
    +   "src/daemon/test-main.ts:199",
    +   "src/daemon/test-relay-support.ts:191", ...
    

    This host was at warn during triage:

    $ sysctl kern.memorystatus_level kern.memorystatus_vm_pressure_level
    kern.memorystatus_level: 37
    kern.memorystatus_vm_pressure_level: 2
    

    Root cause

    Defect. src/daemon/worker-composition.ts:244-247 (worker) and src/daemon/main.ts:529-532 (gateway) build productionHostLoadProbe when hostLoadProbe is undefined; the 46 starts omit it, so their workers read real memory and a warn reading sets warming-paused (ADR 0068). The symptom is any assertion waiting for a warm ready device. The existing test "a gateway started with no hostLoadProbe builds the production probe" proves the default.

    Simplest fix

    hostLoadProbe: null in each start's options literal or builder (options() in main-leasing, main-stop, optional-modules-start; test-relay-support.ts:168), before any ...rest spread. main-host-load.test.ts:292 then starts its gateway with startDaemon directly, since startGateway now passes null.

    19 files changed, 57 insertions(+), 1 deletion(-)
    reproduction + 37 touched/neighbouring files: 38 passed, 429 tests
    pnpm typecheck: clean
    

    Alternatives rejected

    • A setupFiles mock of productionHostLoadProbe: hidden, and breaks main-host-load.test.ts.
    • null as default, production passing the probe: a missed production caller silently loses memory pressure.
    • An oxlint rule: no custom-rule plugin exists; the scan test already guards.

    Risk

    • 19 files exceeds the gate's 8: expect a maintainer merge.
    • The scan resolves builders by name (nearest declaration, then relative imports); check for false passes.
    • Keep a probe-less gateway start in main-host-load.test.ts, or the production default goes untested.

    Fast track

    • Defect: yes
    • Fix tried: yes
    • Nothing public added or broken: yes
    • No ADR or rule changed: yes
    • One fix: yes

    Written by an agent.

  4. removed their assignment
    on Nov 26, 2026
  5. added
    bug:ready
    fast-track
    and removed
    bug:new
    on Nov 26, 2026
  6. self-assigned this
    on Nov 26, 2026
  7. V3RON commented on Nov 26, 2026

    @V3RON
    ContributorAuthor

    Handoff

    Done: PR #1887 adds hostLoadProbe: null to every test daemon start under src/ and packages/ (same shape as #1868), plus a guard test src/daemon/test-daemons-host-load.test.ts that lists any start leaving it out. Build, audit and review round 1 passed with 0 blocking findings; one wording note posted on the PR. The PR is ready.

    Not done: merge.

    Findings: none blocking.

    Blocked on: fast-track: #1867 held: PR #1887 changes 20 files, over 8. The maintainer merges the PR, or removes fast-track from #1867.

    Written by an agent.

  8. added
    bug:blocked
    and removed
    bug:ready
    on Nov 26, 2026
  9. removed their assignment
    on Nov 26, 2026
  10. V3RON commented on Nov 26, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: none
    Parked: #1867 — PR #1887 held by the fast track (20 files, over 8); ready to merge by hand
    Waiting: none
    Decided: none

    Written by an agent.

  11. added
    bug:ready
    and removed
    bug:blocked
    fast-track
    on Nov 26, 2026
  12. self-assigned this
    on Nov 26, 2026
  13. V3RON commented on Nov 26, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1887 (#1867), after the maintainer removed fast-track
    Parked: none
    Waiting: none
    Decided: none

    Written by an agent.

  14. added a commit that references this issue on Nov 26, 2026
    64ade27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions