# Agent-hub 0.12.5 verification

Implementation and candidate verification for issues #113, #112 and #109 (T3 groundwork), performed on 2026-10-03. Native CLIs: Codex 0.160.0 (it replaced 0.159.3 on this machine during the work), Claude Code 2.1.288; the v2 manifests pin both. Production application is verified separately after publication.

## #113: the leftover after an interrupted arm

Cause, reproduced before any fix: a fixture hub with the real Codex, a Codex turn running `sleep 40`, torn down as the runner did (pause, close, `ahub kill`, `projects remove`). `codex` is a node launcher (`codex.js`) that forwards SIGTERM to the native app-server and waits; mid-turn the app-server does not exit, so after 1 s the hub SIGKILLed the launcher alone. The app-server went on under init (PPID 1) with its MCP servers, holding the launcher's stderr pipe, and the daemon, its state removed and its claim released, stayed alive on that pipe: `kill` answered "hub is not running". With the app-server in its own process group, stopped as one, nothing of the fixture was left and `kill` took 173 ms instead of 1,087 ms.

What Codex starts (MCP servers, tool commands such as `sleep 40`) leads process groups of its own (read from the live table). A group stop alone does not reach them if the native is SIGKILLed before it cleans up, so the hub's stop records them by parent links, before the stop and every 100 ms of the grace period, then freezes what is left (SIGSTOP) before reading the table again and killing it, and is done only when the table shows none of it. Tests (`test/shutdown.test.ts`): a launcher that waits for a child ignoring SIGTERM, a member that outlives its leader, a descendant in a group of its own, a process started and orphaned during the grace period (the test fails without the recording during the grace period), no process table at all (the group's own answer decides), and a table that keeps showing a member (the stop gives up at its deadline, never claims done).

Live interrupted-arm smokes, on case 0 (`pallets_click_task:2068`) with real agents, Codex 0.160.0 and Claude Code 2.1.288. Each prepared its own run directory and built a protect list of every earlier benchmark artifact and native session file. After each run exited, the process table was searched for anything with a fixture in its argv and `lsof` for anything with a fixture as its working directory.

| Run | Source | Arm | Stopped at | Signal | Cleanup | Left running (argv, cwd) | Restoration |
|---|---|---|---|---|---|---|---|
| A | `9d9f552` | solo Codex | 30.5 s into the work, Codex mid-turn | SIGTERM to the runner | `clean` (normal shutdown 533 ms) | nothing, nothing | inputs, sibling locks |
| B | `9d9f552` | advisory | 41.0 s into the work | SIGINT to the runner's process group | `clean` (918 ms) | nothing, nothing | inputs, locks, trust |
| C1 | `9d9f552` | solo Claude | completed normally (44.3 s) | none | `clean` (460 ms) | nothing, nothing | inputs, locks, trust |
| C2 | `9d9f552` | advisory (the next arm of C1's run) | 8.9 s into the work | SIGTERM to the runner | `clean` (707 ms) | nothing, nothing | inputs, locks, trust |
| D | `9d9f552` | advisory | setup, before the hub started (`ahub kill` said "hub is not running", recorded) | SIGTERM to the runner | `clean` (170 ms) | nothing, nothing | inputs, locks |
| E | `9d9f552` | turn-free | 31.1 s into the work, and again during teardown | SIGINT to the group, twice | `clean` (916 ms) | nothing, nothing | inputs, locks, trust |
| S1 | `9d9f552` | advisory | native startup: the hub up, Claude's channel prompt confirmed, its sandbox probe not run yet | SIGTERM to the runner | `clean` (380 ms) | nothing, nothing | inputs, locks, trust |
| S2 | `9d9f552` | advisory | native readiness: Claude's probe done, Codex's thread started and its MCP ready, the Codex probe not finished | SIGINT to the group | `clean` (561 ms) | nothing, nothing | inputs, locks, trust |
| V | `9d9f552` | solo Codex, with a visitor: a `sleep` started in the arm's fixture by the test, not by the arm | 30.4 s into the work | SIGTERM to the runner | `incomplete_or_unknown`: the visitor, working in the fixture, unresolved and left alone | the visitor only | withheld; `restore.ts` refused while the visitor ran, restored once it left |
| F | `c9d7ff0` | advisory | 40.2 s into the work | SIGINT to the group | `incomplete_or_unknown`: the Orca terminal shell working in the fixture was not recorded | nothing, nothing | withheld; `restore.ts` restored after its checks |

Runs A, B, E, V and S2 were repeated on `5a30876`, the last commit to change code, with the same outcomes (every cleanup `clean`, V `incomplete_or_unknown` and recovered once its visitor left, nothing of a fixture left running). V and F are the fail-closed path. In V, at the head's source, a process the arm did not start sits in the fixture: the runner leaves it alone, keeps the protected inputs and sibling locks in place, writes the record to `recovery/` and stops the cohort; `bun scripts/benchmarks/restore.ts --run <run>` refuses while the visitor runs (it names it twice: unresolved in the record, and working in the fixture), and once it is gone restores the modes, moves the record into `runs/` and leaves the upstream checkout readable again. In F, on an earlier source, the same path was taken for real: the Orca terminal's login shell, which runs Claude's launcher and works in the fixture, outlives the terminal close by a moment and was not recorded; since `d692534` it is recorded as part of Claude's launch chain (the parent of the launcher, working in the fixture). Setup-stage stops are recorded as `interrupted` with their error kept. C1's completed arm waited for Claude's turn end (bound 30 s): the session's `turn_duration` row (proved on the probe turn in every Claude arm that got that far) arrived after 1.01 s (on `1b33179` it had already been written when the wait began), and its tree was the same after the verified teardown as at the end of its active time. Every arm that reached Codex recorded `conditions.codex.skills` from `skills/list`, a summary only (counts by scope and a hash of the names): 177 user skills, all enabled, in every arm, and a number of system skills that Codex reported differently from arm to arm on the same machine and Codex configuration: 4 or 5 within the batch on `9d9f552`, 4 on `1b33179`, none on `65d6acc` and 5 on `24390de`, while direct `skills/list` calls in between saw 5. The cause is in Codex and was not established. Each record therefore says what `skills/list` answered for its arm at thread start, which a comparison of arms can read; that this was the session's effective skill availability is not shown. No record keeps the `skills/list` answer itself (no skill path in any record since `24390de`, against 183 paths in a record from the source before). D stopped before Codex and says so. Process start times in the records are read in UTC since `65d6acc`. Runs on the sources in between (`ab11387`, `488a2df`, `d692534`, `557c40c`, `28475c3`, `52972ff`, `24390de`, `65d6acc`, `3d017ed`, `1b33179`) gave the same outcomes; those before `c9d7ff0` did not yet scan working directories.

The turn-end marker: in the 0.12.4 release runs, all 126 Claude turns that ended with an `end_turn` answer were followed by a `turn_duration` row of the session before the next activity; the 5 transcripts whose last activity has no such row are cut-off attempts.

Fault fixtures (`test/benchmarks/teardown.test.ts`, in-memory process tables and one real process tree): a normal shutdown is `clean` with nothing signalled; a lost acknowledgement gets a fallback on proven identities only, group leaders by their group: `clean_with_fallback`; a fallback that cannot stop an actor, an unreadable table and unreadable working directories are `incomplete_or_unknown`; a first read that fails keeps every recorded actor for the fallback; a reused pid, a replacement hub on the same fixture and a foreign process naming the fixture are never signalled, and the last two leave the cleanup incomplete; Codex's argv without the fixture is owned by lineage; a background job in a recorded group is the arm's while that group is known, and one that left it, or a shell merely working in the fixture, is left alone and keeps the cleanup open. Turn end: tool-use-only rows, a final answer without the marker, another session's marker and a new turn after the marker do not pass; the bounded wait reports ended, timeout, interrupted and unreadable. Restoration: modes back parents first with failures named, a trust entry the user changed kept, and the recovery tool refusing while the runner, a recorded process or anything working in the fixture runs, or while working directories cannot be read, then restoring and moving the kept record into `runs/`. The ledger keeps the frozen transcript prefix when Claude Code appends after it, reports `late_append_bytes`, and leaves an open turn's settlement unknown.

## #112 and #109

Unit tests: the seen-cap and touched-limit notices survive a dropped offer, are spent by an acknowledgement, and a new session starts both and its touched list afresh (the session test fails with the reset removed); a rewrite with HEAD's bytes under a named directory is neither named nor counted against `current()`, a real change is; a names-only offer counts its names in `named`, and the ledger reports them per path (unknown for events written before 0.12.5). Split records: a hand-over is tagged with the new owner's profile, observations count only with the current profile, an unknown version makes the prediction unknown, and a `routing` record is made only for a first assignment routing chose while the overlapped task has not started (the reassignment case fails with that rule removed); Codex's version comes from app-server's `userAgent`, Claude Code's from its transcript (daemon test). Calibration and the held-out assessment (T3) and opt-in rerouting (T4) stay open: the data source and sample size are preregistered in #110 first.

## Upgrade

`scripts/smoke-recovery-09-10.ts` recovered the real published 0.12.4 package (protocol 13) into the candidate (protocol 13): operation `46160c3c-0f87-4be3-8cfa-3739f36bcab7`, queued envelope ids and the task identity and state digest preserved.

## Automated gate and review

`scripts/check.sh` at `5a30876`: 730 tests passed, 0 failed, 3,677 expectations across 66 files; typecheck, bundle freshness, npm package contents and process ownership passed; `check: OK`. CI on `5a30876`, `241fbe7`, `9d9f552`, `c988054`, `1b33179`, `3d017ed` and `fcc27e9`: both platforms passed at the first attempt. CI on `65d6acc`: Ubuntu passed; macOS passed on its third attempt. The first hung in `test/daemon.test.ts` after `conflicts: with experiments.stale_notices deliver ...` until the job's 15-minute limit, with no test reaching its own timeout (the event loop was blocked, as in one local run earlier in this work that showed the test process at 99.6% CPU with no child process). The second failed `a peer can never answer a permission request` (`permission=cancelled`), a test that failed the same way on this branch before and on the 0.12.4 branch. Neither reproduced locally: 8 runs of `daemon.test.ts` alone and 8 of it with the facts, benchmark and events tests all passed. Both are recorded as open, not as fixed.

Independent host Claude Code OCR delegation reviews (read-only reviewers with the OCR rule groups, `REVIEW.md`, the `AGENTS.md` invariants and the issue contracts) on the exact head. The first round, on `ce1901d`, found that #113 had been amended ("Review correction") before the first commit and that the runner met only its earlier contract; the runner's teardown was rebuilt to the amended contract. Its other findings, all fixed: a localized `ps` that parsed to nothing and still read as clean; restoration while a survivor could read the inputs; the completion wait running before the agents were paused; a daemon still finishing its exit counted as a leftover; fallback by pid where a group was needed; a transcript read error able to skip the teardown; process groups of Codex's own children; group stops confirmed by the leader's exit alone; a new session told about the old one's touched files; the touched-limit notice without a name cap; the HEAD check reading a second version of a file; Claude's version lost behind a big transcript row; escalations and relays counted as routing records; `route explain` and the record describing different pairs; the skills condition a constant; `teardown.ts` unpinned; ledger gaps; the 0.12.4 upgrade claim without proof. The second round, on `615dce9`, found a macOS EPERM from a group whose members were all zombies (CI), recorded actors dropped when the first table read failed, a background job that could escape the reads, `restore.ts` restoring without a recovery record or while the runner ran, a replacement daemon adoptable at teardown, kept records invisible to grading, records with teardown errors graded, an end reason overwritten by later flags, `restoration.json` silent about sibling locks, the completion wait writing the agent's index, failures of an escalation or decline charged to the new owner's split observations, and smaller items; all were fixed, and the live runs above were repeated with the working-directory scan. The third round, on `049b2cd`, found that a process the tree started during the stop's grace period escaped it (the third gap of the same kind, so the stop was redesigned: freeze what is left, read the table again, then kill; the rule is in `AGENTS.md`), split observations that charged nobody for a decline or escalation away, large files outside the HEAD comparison, a run-level restoration that an early exception could let through, unbounded runner commands and an unhandled SIGHUP, a completion-wait hash that followed links, a registration left by an interrupted setup, `restore.ts` not taking back the trust entry and `runner.py restore` as a second, unchecked path, a doc overclaim and inconsistencies in this record; all were fixed and the live runs above repeated. The fourth round, on `a92b475`, found the benchmark fallback still reading the table while the actors ran (it now records what they start while it waits and freezes before SIGKILL), the ledger counting attempts grading had made unavailable (one gate now serves both), a completion wait able to run past the active limit or let a write into the patch unflagged, trust restored while containment was uncertain and never retried after a failure, a recovery that followed links, a ledger written in place, an unbounded `lsof`, an unrecorded member of a group whose id may have been reused (left alone, and the stop no longer called done), descendants without a grace period, a synchronous table read blocking the hub, and PII-named files dropped from the counts; all were fixed and the live runs above repeated, the fail-closed path (V) included. The fifth round, on `a390aec`, found a startup race in a new stop test that turned Linux CI red (its children now report readiness only after their handler is set), a HEAD check that could follow a link or block on a fifo swapped in for a large file (now hashed in-process, opened as facts open files), a narrow window that could leave a process frozen and not killed (what is frozen is now killed or continued, in the hub's stop and the benchmark fallback alike), group membership judged from a recorded instead of a current pgid, end flags that grading and the ledger did not report (now `end_story`), a tree check that ended before the kill (now from the end of the active time to after the verified teardown), the recovery's ledger written in place, the regime in force missing from split profiles, and smaller items; all were fixed and the live runs above repeated. The sixth round, on `768b60e`, found the `skills/list` answer, with absolute skill paths, kept in every run record beside its hashed summary (its response is no longer recorded), records from before 0.12.3 graded invalid by the ledger instead of unknown, the capture of an arm's processes and the new pins without tests (the capture is now a function tested on fixture tables, the pins are tested in `prepare` and `grade`), a stop that read as done when a launcher had exited and left members in its group (it now fails, its group unsignalled), pipes not dropped after a successful stop, an offer read back late spending the notice of a later drop of the same file, large files hashed again at every boundary (now once per version), and smaller items; all were fixed. The seventh round, on `24390de`, found no Critical or Important defect; its Minor findings were fixed: process start times read in local time, so a reader in another time zone (or a zone change during a run) would see every identity as changed (now read in UTC); descendants leading groups of their own given no SIGTERM before the freeze (a tool command such as `git` killed without a chance to remove its lock; now each gets its own SIGTERM and the grace period); a pre-0.12.3 record with a definite isolation failure reported as unknown; the restoration ledger rewritten every 5 s in full (now only when the recorded actors change, without restored sibling maps); a recovery that could reach through a replaced parent directory; and test gaps (the adapter's launcher-and-native group stop, a reused pid in the hub's stop). The eighth round, on `fcc27e9`, again found no Critical or Important defect; its Minor findings were fixed: a process that a read after the freeze showed for the first time was killed without being frozen (it is now frozen and the table read again, up to five times, in the hub's stop and the runner's fallback alike); after a failed read following the freeze, a pid whose STOP had failed could still be killed from the earlier read (now only what the STOP reached is killed); a frozen tree could wait on a slow `ps` for its SIGKILL (the read after the freeze is given up after 1 s); a launcher that had exited, whose pid now led someone else's group, failed every later stop and so blocked a Codex restart (a live process holding the leader's pid now proves the group is not the hub's, and zombies are not counted); large-file hashing in one call is capped at 64 MiB; the completion wait's bound is taken when the wait starts; a `skills/list` error is recorded as its class, not its message; a process not the arm's is recorded by program name, never its arguments; the tree hash and the metadata hash open files without blocking; and `restoration.json` and the recovered records are written atomically. The ninth round, on `3d017ed`, found no Critical or Important defect; its Minor findings were fixed: a per-call budget for large-file hashing that let an integration target move without a byte changing (whether large files are compared now depends on their total size alone, and a file is hashed only as the version observed), a calibration record for work routing gave back to its proposer, whose observation is left out (no record now either), a process frozen in a later round that was continued instead of killed when the next read failed (now killed by the last read that showed it), 0.12.3 and 0.12.4 records' `cleanup_complete` read as a verified teardown by the ledger (unknown now), and `setupMs` that counted the teardown of an arm stopped in setup. The tenth round, on `c988054`, found one Important defect, fixed: routing-time calibration records would almost always read `not available`, because the owner of the overlapped task is busy taking it when the next task is routed (it now counts as available while that task is not started, as the routed peer does; #109 amended). Its Minor findings were fixed too: an exited launcher's group id that could be reused before a later stop (the group is now followed after the launcher exits until it is gone), a group SIGTERM sent after the leader may have been reaped, no capture during the completion wait (now every 5 s there too), the tree hashed after the pause rather than first, pre-0.12.5 records re-judged by the ledger (now judged by their own flags, their teardown shown as not verified), and documentation of what `teardown_errors` covers. Live runs S1 and S2 now cover a stop during native startup and readiness. The eleventh round, on `241fbe7`, found no Critical or Important defect; its Minor findings were fixed: a process that led a group of its own only after it was recorded had that group's other members left out of what the runner owns, which could read as a complete cleanup (groups are now followed by the table as it is now), what the runner froze and did not kill was continued only when one more read succeeded (now by the last read that showed it), the failed stop of an exited launcher did not name the members it left (now it does), a routing record written after the board write without a guard (now guarded), and documentation of the Linux clock-step limit, the exited launcher's limit and what 0.12.3 and 0.12.4 recorded. The twelfth round, on `f63c5ea`, found no Critical or Important defect. Two of its Minor findings were documentation and were fixed: the 64 MiB rule described as a limit per file, where it is the total of the large files in one comparison, and the skills condition described as what each arm had, where it is what `skills/list` answered at thread start. Its other Minor findings were deferred. From the seventh round on, the round summaries above name the findings that were fixed; the Minor findings they do not name were recorded as known limits (below) or deferred. The pull request lists the deferred ones, and later rounds.

Known limits: the hub sees its own hooks only, so a profile does not tell the user's or plugins' hooks apart, and only Claude and Codex report a version; a process that leaves the recorded parent links and groups between two reads (every 5 s while the agents work) is not recorded, and keeps the cleanup open only if it names a fixture or works in one; the hub's own stop records what the tree starts during the grace period every 100 ms, so a process started and orphaned within one such interval escapes it (an unrecorded process left in a recorded group is never signalled, and the stop is then not called done); identity is the pid with a start time of one-second resolution, and on Linux `ps` derives that time from the boot time, which moves when the clock is stepped, so a stop across a clock step sees its processes as replaced and leaves them alone: the hub's own stop then reads incomplete, never done, while the runner's teardown counts such an owned process as gone and keeps the cleanup open only if it names or works in the fixture (the benchmark runs on macOS); the hub's own stop does not sweep the group of a Codex launcher that was killed from outside before the stop (while that group has members the stop fails instead of reading as done, naming them), nor processes that left that group for groups of their own before the stop (an MCP server or a tool command orphaned with the launcher): its pipes are dropped so they cannot keep the hub alive; a file too large to read is compared by its raw bytes, so with git's end-of-line conversion or LFS it reads as changed and is named; the trust entry is written by read, change and rename, so a write another Claude Code session makes to `~/.claude.json` in the milliseconds between is lost (as before this release).
