Skip to content

runtime-host control endpoint hardcodes /tmp and sweeps same-rootId directories on startup #2133

Description

@jackwener

Found during Slock task #147 investigation (unrelated to the flakes, structurally real).

packages/runtime-host/src/control/endpoint.ts:4:

const POSIX_ENDPOINT_ROOT = '/tmp';   // hardcoded, ignores os.tmpdir()

Two problems:

  1. The parallel test runner assigns each workspace an isolated TMPDIR (run-workspace-tests-parallel.mjs:87) — this path bypasses it.
  2. removeStaleEndpointDirectories() (endpoint.ts:94) deletes ALL /tmp directories matching the same rootId prefix before each host start. Measured up to 6 concurrent m-<uid>-… endpoint dirs during a parallel run. Two hosts with the same rootId starting concurrently: the later one deletes the earlier one's live socket directory. Tests currently survive only because each withHostPaths uses a distinct mkdtemp rootId — safety by coincidence, not by design.

Ask: read os.tmpdir() (honoring TMPDIR), and scope stale-cleanup to provably-dead directories (pidfile/lock heuristic) rather than same-prefix sweep.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions