Skip to content

fix(batch): live workers die with the watcher's systemd tick; failed workers never reaped #592

Closed

Description

@Jammy2211

Overview

Pilot live shift 1 (2026-11-06, PyAutoLabs/PyAutoMind#542; pilot #574): all 3 workers were spawned at 10:10:30 and were failed by about 10:11 with no transcript and 0 tokens.

  1. systemd kills them. pyauto-orchestrator.service is Type=oneshot with the default KillMode=control-group. The first claude --bg starts the background-session daemon inside the tick's cgroup, so when the tick exits, systemd kills the daemon and every worker. (claude logs: connect ENOENT …/control.sock.) Phase 3b only ever spawned from an interactive shell.
  2. The watcher can't see a dead worker. _reap reads any claude agents state other than blocked/done/unlisted as alive, so the 3 failed workers held their leases for 40 minutes, shown as "running". Close-outs have the same gap.

Plan

  • bin/systemd/pyauto-orchestrator.service: KillMode=process, so only the tick itself is stopped and the workers and daemon outlive it. The human recopies the unit.
  • _orchestrator: ENDED_STATES (failed, error, killed, stopped, …). An ended real worker with no .done is a crash at once (no grace: it can never write one): re-dispatched once, then abandoned. An ended close-out is refused.
  • _digest._lease_state / batch watch: an ended worker shows ended (failed), not running.
  • Tests: a failed worker is reaped as a crash and re-dispatched; a failed close-out is refused; the unit template carries KillMode=process. Manual: one systemd tick that spawns a real claude --bg stub, which outlives the tick.

Tier: glance — merge mode: auto-merge on green if the Witness passes, post-merge summary (a non-PASS Witness → human /prm).

🤖 Generated with Claude Code

Activity

  1. Jammy2211 commented on Nov 6, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    Merged in #593 (a55960c3) as a glance-tier in-turn merge: Witness PASS (real systemd check plus a control), CI green, Heart STALE acknowledged by the human. Installed units must be copied again (daemon-reload) to pick up KillMode=process.

    Revert: git revert -m 1 a55960c3 in PyAutoBrain.

    🤖 Generated with Claude Code

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

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions