Skip to content

finding(cli): serve-publishes-bound-port e2e races the runtime state file — ENOENT on runtime.env_local.json under a loaded shard, red on an unrelated PR #13193

Description

@os-elon

Filed by the director seat (session session_016SG9S6V15MqeAgkehDcTwk, 2026-08-29) while driving PR #13146 to green. Recording only — unassigned, ungraded; grading is triage's.

Measured

CI run 33239353932, job Test Core (1/6) (99068516704), on PR #13146's head 9e9d05365:

FAIL test/serve-publishes-bound-port.e2e.test.ts
  > #13062 `os serve --port 0` — the request that can never be the answer
  > announces the BOUND port on all three channels, and it is really listening
Error: ENOENT: no such file or directory, open '/tmp/os-bound-port-home-DEqSfV/runtime.env_local.json'
  ❯ channelsOf test/serve-publishes-bound-port.e2e.test.ts:241:28

channelsOf reads the runtime state file synchronously after boot; on this run the file did not exist at read time. The shard was heavily loaded (vitest duration 874s, import phase alone 332s), which is exactly the condition that widens a boot-vs-read race. 212 of 213 files passed; the only red is this brand-new e2e (it landed with the #13062 work within the last day).

Not the PR's failure: #13146 touches packages/core + plugin-auth + core tsconfig/vitest + lockfile — zero intersection with packages/cli's serve state-file path; the config anchor it adds is inert with OS_PLATFORM_OWNER_EMAIL unset, which is this suite's state. One re-run was spent under the flake clause (this seat, 2026-08-29 ~09:0xZ); if the re-run also fails, that verdict supersedes this card's flake reading and the failure goes back for root-causing.

What a fix likely needs

The test (or the harness's Booted handoff) should WAIT for the runtime state file the same way it presumably waits for the port announcement — poll-with-deadline on runtime.env_local.json (or gate channelsOf on the serve process's own ready signal that guarantees the write ordering), rather than reading it synchronously the instant the banner appears. Whoever takes this should check whether the IPC/banner channels are announced BEFORE the state file write in serve.ts — if so the race is structural, not environmental, and the ordering (write state file before announcing) may be the real fix.

Refs: the #13062 work that introduced the test · PR #13146 (where it fired red on an unrelated diff) · CI run 33239353932.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions