Report
Bug report: subagent-watchdog has systemic ownership, liveness, process-tree, monitor lifecycle, recovery/supersession, and acknowledgement defects.
Context/evidence from a long authorized lm-saas OpenRouter-agent run:
- The watchdog correctly prevented false completion and detected a real detached rollout after TaskStop.
- However, live agents with empty
.output files were repeatedly classified stale even while SendMessage, tool calls, progress journals, heartbeats, and child processes showed activity.
- TaskStop reported success while descendant heartbeat-run/sync_rollout/PowerShell/WSL processes remained alive and continued mutating a checkout.
- Failed API/context tasks kept blocking after replacement workers independently completed and verified the work.
- Ownerless
tail -F monitors accumulated as stale background IDs after their agents terminated.
- Watchdog surfaced background IDs that TaskStop could not resolve because Agent, Bash, and Monitor IDs use incompatible registries.
- Terminal task-notifications did not reconcile the watchdog registry; manual ack remained necessary.
- The suggested manual Node ack command failed under Windows/Git Bash quoting and relative-path resolution before an absolute POSIX-style invocation worked.
- Identical findings were emitted repeatedly without state-hash deduplication (many repeated SubagentStop inspections saying no process/no lock/clean checkout).
- Recovery agents themselves created new tasks, monitors, journals, context growth, and additional watchdog alerts.
- Command-line substring process scans matched their own diagnostic commands.
- Repo-owned P0 tombstones, released writer locks, free leases, and absence of processes were ignored by the platform watchdog.
running but silent, failed and untrusted, stop-partial, orphan monitor, and recovered/superseded all produced effectively the same inspect/resume/stop guidance.
Root design gap:
Agent task <-> OS process tree <-> Monitor <-> worktree <-> run-id <-> progress journal <-> replacement/recovery task are not represented as one ownership graph.
P0 requested fixes:
- Launch every Agent in an OS process group / Windows Job Object. TaskStop is successful only when ownerAlive=false, descendantsAlive=0, writersAlive=0; otherwise status=stop-partial.
- Owner-bind every Monitor (ownerTaskId, ownerRunId, autoStopOnOwnerTerminal).
- Unified typed work registry and StopBackgroundWork API for agent/shell/monitor IDs.
- Aggregate liveness from tool activity, SendMessage, progress journal pulse, heartbeat, run-state, and process group; output-file mtime only as fallback.
- Automatic terminal reconciliation from task-notification: failed-uninspected -> failed-inspected/recovered/superseded.
- Supersession graph: failed task A can be closed by verified recovery B + gate evidence C.
- Deduplicate findings by (taskId, stateVersion, findingHash).
- Built-in WatchdogAck tool or stable CLI wrapper; no generated long Node command.
- Repo P0 adapter: matching tombstone + no processes + no writer lock/lease => terminal-clean.
- Structured process identity (owner token/environment), excluding current PID/ancestors; no command-line substring grep.
- Read-only InspectBackgroundTask reconciler so routine inspection does not spawn another Agent.
- Distinct verdict/action states: live-running(wait), silent-running(inspect), stop-partial(kill descendants), failed-uninspected(inspect result), failed-superseded(auto-close), monitor-orphaned(auto-stop), terminal-clean(no block).
P1:
- UI showing task, PID tree, worktree, run-id, monitor, writer lock and lease.
- Recovery capsule instead of full transcript.
- Automatic postmortem metrics: productive time, watchdog recovery time, false-stale count, orphan-monitor count, context overflows, detached-process count.
- Progress notifications only on phase start, newly verified blocker, terminal result.
Required regression tests:
- Active Agent, output=0, SendMessage activity => not stale.
- Active Agent with journal pulse => not stale.
- Agent stopped while child PowerShell/WSL remains => stop-partial.
- Owner terminal automatically stops Monitor.
- Failed Agent + verified replacement => old task recovered-superseded.
- Same finding hash emits once.
- Unified stop accepts Monitor ID.
- Terminal task notification updates registry automatically.
- Process inspection cannot match itself.
- Matching P0 tombstone + no process/locks => terminal-clean.
- API failure => failed-uninspected, never running.
- Ack works from PowerShell, Git Bash, and WSL.
- Job Object terminates detached WSL descendants.
- Context-overflow replacement does not inherit old monitors.
- Recovery terminal-clean does not create a new watchdog alert.
Severity: P0. The gate is valuable and must not be weakened; it needs ownership/process/recovery semantics so safety does not produce alert storms and context-overflow feedback loops.
Environment
- Reported with dev-pomogator
Report
Bug report: subagent-watchdog has systemic ownership, liveness, process-tree, monitor lifecycle, recovery/supersession, and acknowledgement defects.
Context/evidence from a long authorized lm-saas OpenRouter-agent run:
.outputfiles were repeatedly classified stale even while SendMessage, tool calls, progress journals, heartbeats, and child processes showed activity.tail -Fmonitors accumulated as stale background IDs after their agents terminated.running but silent,failed and untrusted,stop-partial,orphan monitor, andrecovered/supersededall produced effectively the same inspect/resume/stop guidance.Root design gap:
Agent task <-> OS process tree <-> Monitor <-> worktree <-> run-id <-> progress journal <-> replacement/recovery task are not represented as one ownership graph.
P0 requested fixes:
P1:
Required regression tests:
Severity: P0. The gate is valuable and must not be weakened; it needs ownership/process/recovery semantics so safety does not produce alert storms and context-overflow feedback loops.
Environment