Skip to content

Follow-ups from #919: zombie classification edges, caller list, mail-lock test gaps #927

Open

Description

@tps-flint

Follow-ups from the review of #919 (non-blocking), tracked here as one issue.

Classification edges (pidState, packages/agent/src/lib/mail-lock.ts)

  1. A process whose thread-group leader called pthread_exit while other threads keep running shows Z in /proc/<pid>/stat and reads "gone". Not reachable for Bun or Node lock owners; note it in the doc comment.
  2. A zombie owned by another uid stays "alive" (kill(pid, 0) returns EPERM before the stat read), so its lock is never reclaimed. Unchanged behaviour; decide whether to read /proc on EPERM too.
  3. A /proc mounted from a different pid namespace can misclassify a pid (this already affects the start token).

Callers
4. The PR's caller audit missed several production callers (status.ts, launch-attestation.ts, launch-snapshots.ts, connection-state.ts and others found by git grep); the review found all of them safe with a zombie read as gone. Keep a complete list in the code or the docs.
5. office.ts (~109): pidState(pid) === "gone" now subsumes the linuxProcessExited(pid) arm on Linux; the second arm can go.

Tests
6. Add a zombie-owner case for the CLI's tryAcquireMailLock in packages/cli.
7. If the zombie helper throws after spawn (its 10 s deadline), the child is never registered for afterEach; register it before the wait loop. Add cases for the readProcStatFields branches (no ), a truncated line).
8. packages/agent/test/mail-lock.test.ts's contended synchronous-acquisition test fails intermittently with EPIPE (3 of 10 runs on unmodified main on one Linux host; passes standalone). Find the cause, and check whether CI runs the packages/agent tests at all.

Refs #713, #919.

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

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions