Skip to content

Claim beater never stops when the agent's shell is adopted by a Linux subreaper #36

Closed

Description

@edkog

agentSession() walks up past shells and takes the first other ancestor as the agent session. When the CLI's shell was orphaned and adopted by systemd --user, that subreaper becomes the agent. The claim beater then never stops, so a dead agent's seat reads live and its claim is never released.

rows:
  - B3
env: Node 26.13.1, Ubuntu 26.04 with a systemd user session, no local changes
version: "0.9.4"
ran: pullboard heartbeat --claims, from a backgrounded shell loop whose parent shell had already exited
cause: agentSession() in apps/cli/src/io/beater.js stops its walk only at pid 1. On Linux an orphan is adopted by the nearest PR_SET_CHILD_SUBREAPER process, here systemd --user at a higher pid. It is not in CARRIERS, so it is returned as the agent session, and agentAlive() stays true for the whole login session. The intent is in beater.test.js clause 1 ("only shells up to launchd: no session, so no beater"); the same code is on main today.
blocks: release of a dead agent's claim and its replacement; the seat stays live until the user session ends or the beater is killed by hand
forbidden:
  - matching only the name systemd; tini, containerd-shim and other subreapers adopt orphans the same way
compat:
  - shells up to pid 1 still return null, so no beater starts
  - PULLBOARD_AGENT_PID still names the agent session outright
  - a real agent session behind its shells still binds as today
bar:
  - 1: agentSession returns null when the walk reaches the process that adopted an orphaned shell (systemd --user or another subreaper), as it does for pid 1 [test]
check:
  - 1: apps/cli/journeys/heartbeat/beater.test.js > clause 1: an init or subreaper that adopted an orphaned shell is never the agent session [B3]
error: |
  ps on the affected machine: a beater whose agent is the user's systemd, not the agent that claimed.
    PID     PPID  COMMAND
    736380  1506  node <prefix>/apps/cli/src/io/beater/run.js {"seat":"<seat>",...,"agent":{"pid":1506,"start":"Sat Nov 21 02:15:14 2026"},"everyMs":30000}
    739194  1506  node <prefix>/bin/pullboard heartbeat --claims
    1506    1     /usr/lib/systemd/systemd --user
  The agent that claimed the seat had exited; the beater kept beating for 27+ minutes and would not stop.

Activity

  1. coreyolson commented on Nov 22, 2026

    @coreyolson
    Collaborator

    Thanks, confirmed. agentSession() treats a subreaper (systemd --user, tini, containerd-shim) that adopted an orphaned shell as the agent. Fix is in progress for 0.9.5: the walk now returns null at an adopting process, the same as at pid 1, with PULLBOARD_AGENT_PID and normal agent binding unchanged.

  2. coreyolson commented on Nov 22, 2026

    @coreyolson
    Collaborator

    Also, thank you for filing this in the issue-skill format: rows, env, version, cause, forbidden, compat and a ready bar. It went straight onto the board as a buildable item with almost no translation. That is exactly what makes reports fast to act on.

  3. added
    bug
    on Nov 22, 2026
  4. coreyolson commented on Nov 22, 2026

    @coreyolson
    Collaborator

    Fixed on main in 01fbc55e3f and shipping in 0.9.5. When an orphaned shell is adopted by a Linux subreaper, the claim beater now notices that its session is gone and stops. It no longer keeps the claim alive. macOS behavior is unchanged. Thank you for the report and the clear reproduction, @edkog!

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions