brl-subagent 2.9.2 → 2.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +366 -0
- package/README.md +2 -2
- package/package.json +12 -10
- package/src/background-pipeline.ts +2 -4
- package/src/delegate-handler.ts +12 -6
- package/src/dispatch-header.ts +3 -7
- package/src/history.ts +0 -6
- package/src/index.ts +1 -5
- package/src/kill-escalation.ts +32 -9
- package/src/mode-prologue.ts +3 -11
- package/src/mode-runners.ts +0 -3
- package/src/params.ts +1 -1
- package/src/prelude.ts +1 -9
- package/src/proc.ts +73 -15
- package/src/project-flags.ts +3 -4
- package/src/run-registry.ts +95 -0
- package/src/runner.ts +308 -10
- package/src/schema.ts +0 -11
- package/src/session-manager.ts +80 -16
- package/src/state.ts +16 -1
- package/src/terminal-notifier.ts +1 -1
- package/src/types.ts +16 -0
- package/src/unit-run.ts +7 -2
- package/src/validate.ts +6 -102
- package/src/dispatch-line.ts +0 -144
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Release history for brl-subagent. Newest first. The full narrative for each release lives in the GitHub release notes.
|
|
4
|
+
|
|
5
|
+
## [2.9.3] - 2026-12-06
|
|
6
|
+
|
|
7
|
+
- **Internal — Jev removed from the development process (issue #655, ADR 0030):** removed the pre-dispatch Jev line requirement (`src/dispatch-line.ts`), the `noJev` parameter on `delegate_task` (dev-only behind `brl-subagent.processChecks` and part of the published schema with zero external callers — not a semver break), `merge-guard.sh` checks `(e)` and `(f)`, `.pi/skills/worktree/jev-check.mjs`, `scripts/lib/provenance-ledger.mjs`, the CI `jev-check` steps, `jev-recheck:`/`--log` in `scripts/review-record.mjs`, and the ritual/template `${jev}` slots. **Leading `jev:` consequence (A1):** `src/dispatch-header.ts` now recognises only `dispatch:` and `brief:` as header-block lines, so a brief whose block leads with `jev:` has an empty header block and is refused as a missing dispatch header (`dispatch:` must come first). **Unchanged and not weakened:** the `dispatch:` header, the signed-brief contract, `brl-subagent.processChecks`, the worktree guard, `handoff-verify`, and merge-gate checks `(a)`/`(b)`/`(c)`/`(d)`/`(g)` (with `Risk class: C1|C2|C3` enforced in full-gate `check_record`).
|
|
8
|
+
|
|
9
|
+
- **A vanished `/proc` read is `ESRCH` as well as `ENOENT` (issue #644):** a process reaped between the `/proc` listing and its `stat` read is answered with `ESRCH`, which the scan classified as a *partial* inspection — so a complete scan read as UNKNOWN, the kill path refused every signal, and the refused final group `SIGKILL` was then reported as a **survivor it never signalled**: a phantom orphan in the boot scan and a red recovery test people re-ran. The same one-code rule in `pidGone` made a reaped leader read as "alive but foreign", refusing the group `SIGTERM` **and** the final `SIGKILL` while its members still ran. One private `VANISHED_READ_CODES` set now serves both readers, and every ambiguous failure (`EACCES`, `EIO`, a parse anomaly) stays UNKNOWN, so the tri-state fail-safe is untouched. Measured, not assumed: 400/400 with a held file descriptor, and 48 `ESRCH` against 25,462 `ENOENT` in 10,291 real scans under foreign churn.
|
|
10
|
+
|
|
11
|
+
- **Subagent spend lands in the footer (issue #648):** every terminal settle now records its usage through `pi.appendUsage`, one entry per `(provider, model)` group, covering all four footer sources; the run record's cost and token totals derive from the same groups the footer receives, so the two agree by construction. The live probe moved the footer from `$0.0022431` to `$0.0066725`.
|
|
12
|
+
|
|
13
|
+
- **The test-fixture rule is true and enforced (issue #244, the residual of #644):** the `/proc` suites' shared `node:fs` double states when a test may depend on a live scan; its registry named three exempt tests when five existed, and two unnamed ones could redden when a live `stat` scan stayed partial. A per-test `declareLiveScan(kind, reason)` plus a teardown check over the log of reads that reached the real kernel now **fails the test that made the read**, so a new live-scan test trips the guard instead of ageing a list nobody re-reads. The investigation also produced a correction: the describe-wide exemption that had been justified as "a leftover owner record" was masking a `void escalateKill` that outlived its test, woke after the fixture reset and swept the machine inside the next test. It is fixed with a guarded, test-only drain (`__awaitEscalationsForTest`, unreachable in production and pinned by a throw test) awaited before the guard and the reset, and the exemption is **deleted** rather than justified.
|
|
14
|
+
|
|
15
|
+
- **Compatibility — pi 1.8.0 SDK parity (issue #646):** the `@earendil-works/*` dependencies track pi 1.8.0 with no breaking impact, and `check-repo` now reports the runtime/lockfile match.
|
|
16
|
+
|
|
17
|
+
- **Internal — the stop-lineage fixture cannot expire (issue #650):** the 7-day scan window in the `stop_lineage` test is anchored to now rather than a fixed date, so the fixture stops failing when the calendar moves. Test-only.
|
|
18
|
+
|
|
19
|
+
- **Internal — vitest 5.1.1 → 5.1.2 (dependabot, lockfile only)** and the CodeGraph CLI pinned at 1.6.7 with a fresh index.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [2.9.2] - 2026-12-02
|
|
23
|
+
|
|
24
|
+
- **Internal — background worktree protection (issue #620):** projects can explicitly name a background guard with `brl-subagent.backgroundGuard`. The named extension is loaded from the conductor's project and checked for its required handlers before the background session starts; a missing or broken guard is refused rather than silently omitted. Extension discovery remains disabled for background sessions.
|
|
25
|
+
|
|
26
|
+
- **Internal — resume and handoff tooling (issues #552, #562, #625, #626, #632, #634):** `scripts/loop-state.mjs` reports the repository, PRs, worktrees, provenance, scratch artifacts and handoff state to help resume after a drop, while naming unavailable or incomplete sources. Its drop test uses a synthetic process, not a real pi session. Handoff verification checks the cycle boundary, distinguishes an uncheckable input from drift, and accepts `Next action: none` when there is no selected issue; suite capture refuses a dirty tree. The maintenance notes and their ledger receipts were reconciled; the metrics tool can record an explicit reconciliation exception.
|
|
27
|
+
|
|
28
|
+
- **Compatibility and test reliability (issues #610, #613, #615, #631):** the development SDK dependencies track pi 1.7.0 and Vitest moves to 5.1.1. The recovery test waits for a valid child PID rather than just a file's existence, and suite setup isolates inherited subagent depth and marker variables so CI exercises the nested-conductor case.
|
|
29
|
+
|
|
30
|
+
- **`stop_subagent` now stops a dispatch, and says only what it can prove (issue #616):** the tool stopped one agent id and printed `Stopped agent <id>` for any record it found — including an attempt that had died on a transport error while its automatic retry, a **different id under the same label**, kept running and kept writing (it produced a merge-gating review record nine seconds before it was killed by hand). A stop now resolves an 8-hex prefix, expands the dispatch family, and stops every live **automatic transport retry** plus the id you named — sequentially, each in its own containment — then re-reads each record from the store before the word "Stopped" may describe it. A manual retry is a **scope filter, not an immunity**: naming its id stops it, and an unnamed one is disclosed as residue while the call still succeeds. The one universal sentence ("nothing of this dispatch is running") is suppressed when any of five conditions holds — an armed retry, an unknown cause, an unverified stop, a truncated lineage scan, or a live run left alone by scope — each with its own disclosure line instead. Support: an additive `retryCause` (`transport | manual`) on the dispatch identity, and a durable **armed-retry intent** that closes the window between a retry being minted and its record landing, governed by one categorical rule — **age may reclaim an intent, never a cancel** — with a pre-prompt gate that also refuses to prompt a run whose own record is already terminal. Residuals are stated rather than papered over: a cancel whose spawn never materialises keeps that dispatch's "not claimed quiescent" disclosure forever (a false *not-quiescent* is survivable; a false *quiescent* is the bug), and `armRetry` can erase a pending cancel past the spawn bound — latent, unreachable through its sole writer. The tool description, the README section and the message literals are all pinned by tests.
|
|
31
|
+
|
|
32
|
+
- **A settle row can say which attempt did the work (issue #616, #623):** a transport auto-retry runs under the same label and never passes through `delegate_task`, so the ledger held one row for two agents and the single settle row could not say which produced the outcome — the incident's row reads `stopped … ran deepseek/deepseek-flash` while its retry did the work. `--settle` now takes two optional keyed columns, `--attempt <n>` and `--cause transport|manual`, appended to the outcome row; a row written with neither is **byte-identical** to the previous format (pinned against a captured pre-change row), the settle key is unchanged (one settle per dispatch, a second still refused), and malformed values are refused rather than coerced — plain digits only, no `1e+21`, no `2.0`, no padded or prefixed forms.
|
|
33
|
+
|
|
34
|
+
- **Internal — the front door is enforceable: a grill, a signed brief and a mandatory dispatch header (issue #606 Unit 1, cycle `front-door`):** the interview that turns a want into a plan is a skill (`grill`) whose result is a **signed brief** at `briefs/<slug>.md`, and a project that opts in via `brl-subagent.processChecks` refuses an `impl` dispatch that names no brief, or a brief that does not satisfy the contract (a `## Want` in the human's words, `## Facts` with provenance, `## Settled decisions` with non-blank cells, and a `confirmed:` marker as the last non-blank line). Every dispatch carries a leading `dispatch: <kind>` header, templates render it, and routing classifies the body rather than the header so a dispatch line can never re-route a task; `brief: none — <reason>` is the one stated escape, surfaced as a warning with the reason in the payload. The outcome set is three, never a silent fourth: refused, signed, escaped. Unit 3 shipped the vocabulary as a mechanism (`.development/VOCABULARY.md`, `scripts/check-vocabulary.mjs` with a 0/1/2 contract and a CI line, one ban `worker` → `subagent`); Unit 2 was the handoff index, recorded under issue #607 below.
|
|
35
|
+
|
|
36
|
+
- **Internal — a worktree guard that classifies durability by git identity, and a reminder that reaches the model (issues #617, #621):** the guard anchored on the session's cwd, so in a linked worktree every `src/` write was refused and the worktree exemption could never fire — the mechanism enforcing "code changes go through a worktree" blocked the sanctioned place to obey it — while the same classifier allowed the cockpit's `src/` to be written by absolute path. Durability is now decided per tree from git metadata only (no subprocess, no cache): the target's real-path ancestor chain, durable iff the common gitdir matches the session's **and** the tree is the main worktree, on `main`/`dev`, or bears one of two known checkout names; unreadable metadata fails closed with `could not classify`. `before_agent_start` now returns the documented `{ customType, content, display }` object instead of a bare string, so the reminder is actually delivered (pinned by a test the old string fails) and a live probe showed the model receiving it. Background coverage for an explicitly named guard was added later in #620.
|
|
37
|
+
|
|
38
|
+
- **Internal — a plan-critic preset at `medium` (issue #609, cycle `front-door`):** a review preset for critiquing a plan before it becomes a dispatch, shipped with its own thinking level so a plan critique does not inherit a code-review budget.
|
|
39
|
+
|
|
40
|
+
- **An agent record is written atomically, so a crash mid-write can no longer leave a record no boot can repair (issue #554):** `persistAgent` wrote the record in place — open, truncate, write — so a kill between the truncate and the completed write left invalid JSON. It now writes through one atomic-write module (same-directory temp file + rename — process-kill atomicity, **not** power-loss durability and **not** writer isolation), a boot sweep bounds a stray `*.tmp` at one hour (never a fresh one), and the reader distinguishes `corrupt` from `unreadable`, reporting the corrupt count separately so a failed boot's meaning is not lost. The permission contract changed — a writable directory replaces a read-only record — and deterministic crash points are the proof, not the kill probe.
|
|
41
|
+
|
|
42
|
+
- **A background run's repeated transport death is now named in the completion notice (issue #556):** the completion notice carries the change-shape rule **only** when the durable records prove the lineage — this attempt is transport, it is attempt ≥ 2, and the `resumeOf` record was also transport — and it names the source's recorded attempt. The `retryOnTimeout` description stops teaching the false rule, and the settle row records `attempt`/`resumeOf`. No signature widening, no new retry.
|
|
43
|
+
|
|
44
|
+
- **Internal — the friction ledger and its candidate machinery (cycle `process-receipts`, 2026-11-22):** a cumulative ledger (`scripts/friction-disposition.mjs`) classifies every cycle-window row with a disposition (`P0 #N` / `fixed <sha>` / `folded` / `accepted → <file>::<heading>` / `stale`); close candidates gain a repeatable `--source-root` that re-points each cited log line's hash, and the six friction kinds (`failed`, `deadline`, `retry`, `stop`, `steer`) are derived from structured sources. `handoff-verify --root` evaluates another checkout against its own git facts, the review contract becomes "no tracked-file writes" with `review-record.mjs` as the one expected write, the spec-evidence checklist states the five rules a spec's evidence must satisfy, and the worktree skill is a third budget surface.
|
|
45
|
+
|
|
46
|
+
- **Internal — the PR evidence block is a validated, generated artifact, and the test-budget ceiling is 90 s (issues #583, #585):** the block's `suite:` count is derived from an asserted vitest report rather than a typed number, the head claim is a field and the block a marker line, and the two CI guards return literal exit codes; the owner-ordered wall ceiling moves 60 s → 90 s after a measured A/B showed the PR tree 1.6 s faster than its base and CI red inside the runner's variance.
|
|
47
|
+
|
|
48
|
+
- **Internal — the verification guards are pinned on the file they check (cycle `guard-integrity`, 2026-11-22):** a size claim must actually claim (`index.ts 356` is a claim, a bare prose number is not), the handoff structure check is one fence-aware scanner so a duplicated §STATE is a named drift, and the test-budget band guard no longer dereferences a null corpus.
|
|
49
|
+
|
|
50
|
+
- **Internal — the proof machinery no longer certifies a vacuous pass (cycle `proof-integrity`, 2026-11-22):** a provenance row must come from a response-shaped payload (a hand-built one is refused at the chokepoint), a test run that matched nothing is a failure and a refused dispatch is not a dispatch, transport deaths are counted per label in the default sprint report, and the merge gate's own selftest runs in CI as a parsed, asserted step.
|
|
51
|
+
|
|
52
|
+
- **Internal — one ledger reader, and the recheck line is resolved rather than transcribed (cycle `provenance`, 2026-11-27):** the review record's `jev-recheck:` line is resolved from the newest `recheck-<pr>` provenance row (the `--recheck` flag is gone), the gate reads the ledger through one module, and the dogfood was #601's own review record, built with no `--recheck` and accepted by the gate on the first run.
|
|
53
|
+
|
|
54
|
+
- **Internal — the handoff is an index, not a history (issue #607):** the handoff — 62% unactionable history — is now a lean index (Verified · In flight · Next action · Invariants · a pointer table · a resume protocol) with the mechanical claims in a state page and the `Since the last handover` chain archived, not migrated. `handoff-verify` gained five fail-loud checks — budget, index completeness, citation liveness, no counts in prose, one next action — plus a section-bound shape; a fresh session reaches the next action in two commands and under 10k tokens.
|
|
55
|
+
|
|
56
|
+
## [2.9.1] - 2026-11-21
|
|
57
|
+
|
|
58
|
+
- **A background dispatch now settles its own record even when the prompt was never reached (issues #450, #542, #546):** three separate crash windows in one path. The settle handlers used to be attached *after* `session.prompt()` returned, so a synchronous throw or a fast failure inside the prompt call could leave the run with no settle path at all; they now attach to a deferred registered **before** the prompt, and the pre-start catch and the post-start routing are **two syntactic regimes** — a post-start fault structurally cannot call the pre-start path, and a caller's resume sees `agent.status: running` deterministically. A pre-start throw then settles the agent record through one per-step-contained helper (`run entry → record flip → transcript`, each in its own try, the session ref released inline), so a failure that never reached the prompt no longer leaves a `running` row behind — the record flips in memory **and** on disk, one note is written, one `subagent:failed` is emitted, and both branch refusals settle the same way. The remaining window — a crash between the memory flip and registry retirement — is closed by a durable **`recordFlipPending`** marker written **before** retirement: retirement moves last via an opt-in `deferRetire` (every other caller keeps retire-then-append), the boot applier is disk-only, and the scan reports `repaired` / `retired` / `held` with three counters, **holding** when a dependency is missing rather than inventing a state. A torn write to the marker is the one residual (a 395 → 0-byte record reads as absent), stated in the code and tracked as #554.
|
|
59
|
+
- **A log call can no longer throw out of the logging path (issues #543, #545):** the console mirror had its own `try` covering selection and call, so a mirror fault is swallowed like a file-write fault instead of escaping `log.*`; and the entry's serialisation is defensive — an **ancestor-tracking** replacer turns a cycle into `[Circular]`, a `BigInt` into `"10n"` and preserves shared non-cyclic references, while a whole-stringify `catch` emits a guarded fallback marker. The message always survives and the line still reaches the conditional file-write attempt; the 28 cases pin `toJSON`-throws, `BigInt`, cycles and the fallback, with 9 red on the base.
|
|
60
|
+
- **The deadline guidance and the pre-flight capability rows are now portable and true (issues #426 E, #537):** `delegate_task`'s `timeout` description states the contract — milliseconds, think in minutes, the 30-minute background default is a default and not a floor, a foreground run has no default, **pass `timeout: 7200000`** for two hours — and `AGENT.md` carries the measured reference priors (217 settled runs to 2026-11-18). The pre-flight's capability rows now let `bash` satisfy write/create, edit and delete, so the false "task involves writing but write/edit is not available" warning no longer fires on the correctly-shaped bash-writing reviewer; the selftest pins both arms.
|
|
61
|
+
- **pi 1.6.0 render contract (issue #541):** the TUI render compatibility fix and the devDependencies parity, so the extension runs against the current harness. No configuration change.
|
|
62
|
+
|
|
63
|
+
## [2.9.0] - 2026-11-14
|
|
64
|
+
|
|
65
|
+
- **Internal — the test budget is a per-PR flow rule (U0a/U0b, ADR 0028; cycle 2026-11-14):** the stock ratio is reported against its 1.95 warning band and **never fails**; what the merge gate enforces is each pull request's **flow** (`allowance = 120 + 2 × net source growth`, per surface, `--no-renames`, measured by the cockpit copy rather than the PR tree), with a bare `Test budget:` declaration for a deliberate backfill. The old direct-import floor became a **reachability** floor — every non-test module must be reachable from a test, directly or transitively (7 modules are reached only transitively) — and a pointed audit of the largest test file recovered **9 lines** of genuinely duplicated assertions while withdrawing its own candidate numbers: a "61 no-assert blocks" count was a brace-matcher artifact (**7 of 2,745** are real), five "identical" guardrail bodies assert five different sentences, and the doc-guard quartet has zero genuine duplicates. The generator-facing half of the policy lives in ADR 0028, which supersedes ADR 0027 D7's ratio clause. No user-visible change.
|
|
66
|
+
|
|
67
|
+
- **A run's progress bank now lives under a private, validated cache root instead of the system temp directory (issue #511):** the extension told agents to bank progress at `/tmp/brl-<label>-bank.md`, and `/tmp` is the wrong place for the one file a run must be able to come back to — world-writable (anyone can pre-create the path, and rename authority comes from write permission on its parent), ambiguous about who wrote it, and on most Linux hosts a `tmpfs`, so the bank does not survive the reboot it exists to survive. The bank now lives at `<root>/runs/<runId>/bank.md`, where `<root>` is `~/.cache/brl-subagent` on Linux and other POSIX, `~/Library/Caches/brl-subagent` on macOS and `%LOCALAPPDATA%\brl-subagent` on Windows, created and validated owner-only (`0700`, every ancestor a real directory owned by root or by you — a foreign owner is a named refusal, `ancestor-not-owned` — while a group/other write bit on an ancestor is a **warning**, not a refusal: a shared or corporate machine's home is often `0775`, and the bank is a convenience, so the warning names the path, the on-disk mode and what a co-worker with write there could do, and the run proceeds): `XDG_CACHE_HOME` is deliberately ignored, because a path the environment chooses is not a path that is yours, and there is **no system-temp fallback** — a root that cannot be placed is a named refusal rather than a quiet move back to `/tmp`. On Linux a root that turns out to be on a `tmpfs` is a **warning** (a home on `tmpfs` is a legitimate setup) that says the bank will not survive a reboot, not a refusal. **Foreground** child processes now receive their run's directory as `BRL_SCRATCH` in their environment, so a child never has to guess or construct the path; it is set as an override rather than an allowlisted variable, so a grandchild resolves its own run instead of inheriting its parent's. The transport auto-retry's resume preamble names the run's **own** bank — the recorded path when the run has one, otherwise the deterministic recomputation from the run id — and stays silent when that directory does not exist (a legacy or pruned run gets no dead path, and the label no longer reaches the filename at all). The pre-flight's third check now proves the **scratch root** is writable — inside the root when it exists, otherwise in its nearest existing ancestor, where the root would be created — instead of writing a file into the system temp directory; a failure names the resolved root, and the old "set TMPDIR or TEMP" advice is gone, because the root is not configurable from the environment. That check is an early warning only: every spawn still resolves the root, re-validates it and creates the run directory, so the pre-flight is never the only place a bad root is caught. **No shipped code path probes, names or falls back to a system temp directory any more**, and a test scans the shipped modules to keep it that way. Settled run directories are pruned after 14 days; a bank an older version left in `/tmp` is neither read, migrated nor deleted — it is simply no longer the convention. No new configuration.
|
|
68
|
+
- **Internal — scratch hygiene (issues #509, #512, #513, #516, #518, #520, #522; cycle 2026-11-13):** the tooling no longer writes durable artifacts to the system temp directory. `scripts/lib/scratch-root.mjs` validates a private root (`~/.cache/brl-subagent`) in two zones — above it a real directory owned by root or us with no group/other write, at and below it ours at `0700` — and on Linux refuses a `tmpfs` before creating anything; it then offers explicit-flag create (`O_CREAT|O_EXCL|O_NOFOLLOW`), no-follow append, and an atomic replace through a same-directory temporary file plus `rename`. Records are keyed to the pull request, written under the root by default, and serialized: every write path takes a lock carrying pid, boot id and process start time, re-reads the prior head inside it, and a lock is reported stale only with evidence — a live holder is never removed. Test reports are validated rather than trusted: the count is derived from per-file results (so a fabricated `numPassedTests` is not proof), a hollow or inconsistent report is refused through both the explicit and the scanned path, competing candidates error instead of resolving to "newest", and a provenance sidecar binds a report to the tested commit — reports default to `<root>/reports/<head>.json`, so `/tmp` left the default path entirely. `scripts/audit-scratch-instructions.mjs` scans the tracked skill corpus (exit 1 on a hit) and names the seven ignored local overrides without modifying them. `scripts/review-record.mjs` gains `--break-lock`, and `scripts/suite-report.mjs` captures a report with its sidecar in one command. No user-visible change; the published artifact is unchanged.
|
|
69
|
+
|
|
70
|
+
- **Internal — the generated-artifact toolchain (issues #487 / #488 / #489 / #500 / #503 / #504 / #505, cycle 2026-11-08):** the numbers that PRs, reviews, handoffs and cycle metrics publish are now generated, and checked by a command rather than by memory, closing the three Rule 11 P0s from the composition-root cycle **and the three defects this cycle surfaced itself**. `scripts/review-record.mjs` emits the review record and `--verify` prints a one-line proof (`verdict · head · findings · sha256`) the conductor recomputes; `merge-guard --check-record` validates it offline, and the gate echoes the record's resolved path and `sha256`. `scripts/pr-evidence.mjs` writes a five-key evidence block into a PR body and **recomputes** every key from the tree — a count with no block fails `missing-block`, a count outside the block fails `unattributed-count`, and the body is never executed. `scripts/handoff-verify.mjs` diffs §STATE's mechanical claims (the `Verified:` range, `dev` resolved past its own handoff commits, the install path, the open set, suite counts, module/ADR counts, per-file sizes). `sprint-metrics` counts codemode-routed dispatches and reconciles them against the extension log's spawns, exiting 3 and appending no row when the delta is unexplained. `merge-guard` gains check (g) — the PR body — proven no looser than the previous gate across nine decision functions. `.pi/skills/worktree/run.sh` returns the **command's** status through a filter (`PIPESTATUS[0]`, non-zero filters reported loudly) and is exercised by CI. The test budget is two surfaces — `src` 1.99/2.0 and `scripts` 0.64/1.0 — with a floor that every gate script is imported by a test. No user-visible change.
|
|
71
|
+
|
|
72
|
+
- **A settled failure now reports the worktree it may have left behind (issue #474):** every settled-failure surface — a single crash, the `isSubagentError` exit, **each per-unit `SubTaskResult`** at the unit's own cwd, rethrown crashes, `allSettled` rejections and the background wake — carries a read-only, index-safe probe of the run's working tree (`git status --porcelain=v1 -z -uall` with `GIT_OPTIONAL_LOCKS=0`), classified `not-repo` / `unavailable`, formatted by `worktree-report.ts`, and never throwing into the failure path. **Disclosed behaviour change:** a crashed graph node no longer disappears from a dispatch — the dispatch settles `failed` instead of `done`; the old tests pinned the defect. Advisories, not defects: the probe's worst case is ~15 s on the failure path (five 3 s reads; a single porcelain-v2 read is the follow-up), and a stderr path echo is capped at 160 characters.
|
|
73
|
+
|
|
74
|
+
- **Internal — the composition root (ADR 0027, issues #430 / #482 / #483):** `src/index.ts` fell from 4,720 to 356 lines. The runtime context and the three mode runners, the background pipeline, boot recovery and the terminal notifier, the command and tool registrations, and `delegate_task`'s execute are now factories over one `RuntimeContext`, with per-factory latches and instance identity held by injection; the `delegate_task` handler's complexity fell from 125 to 7, and an ordered-effect-log harness committed before the refactor pins behaviour across twelve dispatch paths. The import convention is guarded in CI (#476). No user-visible change.
|
|
75
|
+
|
|
76
|
+
## [2.8.0] - 2026-11-08
|
|
77
|
+
|
|
78
|
+
- **A crashed branch run leaves a durable head state, so the boot can restore the base branch and keep the work (issue #466):** a `gitMode: "branch"` run created `brl-subagent-<8hex>` and kept the starting HEAD only in a local variable, so a run that never settled (a deaf prompt, a crash) left the working tree on the orphan branch with nothing durable naming the base — and the next dispatch read the orphan as *its* base, putting the earlier run's work outside its diff window (re-measured two-process, `W466P-P2B`). The boot could not see it either: the deadline writes the run record terminal, and a terminal record retires the registry claim, so the recovery scan had no candidate. A branch run now writes **one `HeadStateRecord` per repository** — `{version, repoRoot, runId, kind, base, workBranch, owner, createdAt}` — at `.pi/head-state/<sha256(repoRoot)[0:16]>.json`, `0o700`/`0o600`, atomic temp+rename, **inside the per-repo lock, after the dirty check and before the branch exists** (which is why the branch name is now minted by the caller, `newWorkBranchName()`); the foreground branch path writes and clears the same record with `kind: "foreground"`, so "no record" means "no orphan" for every branch run, not only background ones. At boot, between the recovery scan and the recovery notice, the records are reconciled in a **fixed** row order: parse → `repoRoot` resolves → owner **provably dead** → HEAD is exactly the recorded work branch → a deleted-but-checked-out branch (unborn HEAD) still restores, and that row comes *before* the dirty check because `status` reads dirty there for the wrong reason → tree clean → `restoreHead(base)`, verify, clear. Only that last row moves git, only to the **recorded** base (the policy replays a branch, it never chooses one), never with `checkout -f` or `reset --hard`, and the work branch is **never deleted**: after a crash the diff was never captured, so the branch is the only copy of the work. Everything else — a dirty tree, an unreadable record, a vanished repository, a failed restore — leaves the tree alone, keeps the record, and is named in **one** notice on the same `nextTurn` channel as the recovery notice and under the same `config.recovery` gate; the *repair* is never gated, because a tree left on a dead run's branch is a correctness problem rather than a recovery offer. A branch dispatch in a repository whose record is still unresolved and whose owner is not alive now **refuses before the dirty check**, naming the work branch, the base and the exact commands, and ends as the same terminal `failed` dispatch every other refused spawn ends as; a record whose owner is *alive* never refuses, and an unparseable record is never acted on. A record whose repository no longer resolves is swept after 30 days (precedent: `cleanupTempDirs`), and only then — an old record for a *live* repository is never swept by age, because it may be the only name of an orphaned base. **Stated limits:** a `bash` child spawned detached survives a conductor `SIGKILL` and can keep writing while the boot restores (measured 38 B/s), so stray files can land in the restored tree — visible in `git status`, recoverable with `git checkout -- .`, never a commit, and not detectable from the record because background runs carry no `childMarker`; on a host without `/proc` no owner is provably dead, so the policy degrades to name-and-refuse (no pid-only fallback — pid reuse would make it unsound); the store is cwd-relative like the other two, so only a restart **in the same project** repairs; two concurrent pi processes in one repository are not serialized (pre-existing), so the record is last-writer-wins and the earlier orphan becomes an unrecorded `brl-subagent-*` branch; and older orphans are leaked refs — reported by count, never deleted. ADR 0026 records the decision; it qualifies ADR 0023 decision 2 (the deadline still owns no git resource and releases no lock — a *new* owner, the boot, restores only for a record whose owner it has proved dead).
|
|
79
|
+
- **A repository locked by a branch-mode run that never settled now refuses the next branch-mode dispatch by name, and one locked repository no longer stalls every spawn (issue #465):** two measured defects in `spawnBackgroundSession`, one amplifier and one wedge. **(d) The convoy.** The module-level `spawnQueue` exists to serialize pi API access (the dynamic import and `createAgentSession`), but the per-repo branch-lock wait sat inside the same `try` — so it ran *inside* that critical section, and because a branch-mode run holds its repository for its whole lifetime, a perfectly healthy run blocked every spawn in the process: measured, a non-git dispatch stayed **`PENDING`** until the branch run settled (#460 M2, and #460 §1.3 shows the everyday 20-minute version). The queue is now released immediately before that wait, behind an idempotent guard the spawn's `finally` shares, so the release happens on every exit path exactly once; the git chain is unchanged — a same-repo branch-mode spawn still cannot touch the working tree until it holds the lock — and the pi-API region stays serialized. **(b) The wedge.** A branch-mode run's lock is released **only** by its settle, so a run the deadline wrote terminal (`stopped` + `completedAt`) that then ignored the abort held its repository forever, and the only signal was a tool call that never returned. The lock's **owner** is now recorded beside it (`gitBranchLockOwners`, keyed like the lock, set only when the lock is actually acquired and deleted only by the matching release so a stale release cannot disown a new holder), the run's **work branch** is stamped on the durable agent record (`workBranch` — `result.gitBranch` is settle-only, which is exactly what a stuck run never reaches), and a branch-mode dispatch whose owner is terminal-but-unsettled past a **30 s grace** is refused **before** its chain link is installed and before it waits, so later dispatches fail fast instead of hanging. Both predicate clauses are deliberate: `completedAt` says a terminal status was written, `_sessionRef` says the settle — the only releaser — has not begun its teardown; the grace bounds the settle-in-flight window (measured 88 ms from the deadline to a cooperative settle, W460P-P6) and was not guessed. The refusal flips the refused dispatch's record `failed`, finalizes its run entry `failed`, completes its transcript `failed` and retires its registry entry **before** throwing, because a throw without the record flip leaves a `running` zombie row for a dispatch that provably never started (#460 §4.4 measured exactly that), and it names the owner run id and its work branch so the human can recover by hand; the caller sees it through the existing spawn-failure result, with no new channel. **Stated limits:** a branch-mode run's lock is held until it settles, so a run whose prompt ignores the abort keeps its repository; from then on branch-mode dispatches in that repository **fail fast with a named reason** rather than blocking; the repository remains checked out on that run's work branch and the lock is cleared only by a **process restart**, and the boot-time repair of the orphan branch is **#466**, not this change. Nothing releases a lock from a timer and no second timer is added (ADR 0023 Decision 2 stands); `stopAgent`, the foreground path, the slot queue (`concurrency.ts`) and the pi-API serialization are untouched, and a non-git dispatch is never refused.
|
|
80
|
+
- **The background deadline has ONE owner — the spawn — and only a settle ends a run (issue #453):** the 30-minute default was armed by the caller while an explicit timeout was armed by `spawnBackgroundSession`, with a `deadlineOwner` flag arbitrating between them. That split left one hole nobody could close and one ownership predicate nobody could shorten: a throw anywhere in the caller's tail *after* the spawn returned left the run **unbounded** (measured: zero timers, zero aborts, still `running` after two hours of fake time — the reason #448 deferred it), while the flag existed only to stop the same run being armed twice. `spawnBackgroundSession` now arms the deadline on **every** path — the explicit timeout or the default — before `prompt()`, and the caller's timer, its three `clearTimeout` sites and the flag are deleted; `effectiveBackgroundBudget` collapses both cases into one expression. The caller keeps the 2 s poller, and that poller is the **cleanup owner** for a deadline stop, exactly as it already was for an explicit timeout: the timer sets `status: stopped` + `completedAt`, so the poller's next tick captures the output, claims the finalize, releases the footer counter and repaints. The timer is now **cooperative and prune-free**: it flips the status, notes the transcript, attempts **one** abort, and writes a terminal-run **snapshot** — `status: "failed"` with `errorCategory: "timeout"` (the run vocabulary is `running | done | failed`; there is no `stopped`), passing `isSubagentRunShape` — but it **never prunes the session directory and never releases the branch lock**, because a prompt that ignores the abort may still be writing that directory (a prune there produced a real `ENOENT` for the live child). The single `runFinalized` guard is now **two**: `entryWritten` (set only *after* the append resolves, so a throwing write still lets the settle classify the run) and `pruned` (evaluated by the settle alone, even when the entry already exists — one flag for both would have made a successful deadline write suppress the prune). A late settle **amends** the snapshot instead of writing a second classification: cost, tokens, turns, output, `finishedAt` and `durationMs` move; `status`, `errorCategory`, `stopReason` and `errorMessage` stay the snapshot's. That amendment is what stops timed-out runs reporting `cost: 0`, and the settle now captures the final output **before** it records, so output produced after the deadline lands in the amendment rather than being lost. Because a run can now have three entries sharing its id, **one logical run per id** is the reading contract: `projectLogicalRuns` (exported beside `resolveTerminalRunEntry`) yields the last entry per id, and every raw-entry consumer applies it *before* any window or cap — SLA metrics and the SLA window, cost accounting, history, the three compliance reports, the dashboard, and the visibility bridge — while `maxHistoryEntries` now caps **runs**, so an amendment can never be windowed away from the snapshot it amends. `resolveTerminalRunEntry` takes the **last** non-running entry (`findLast`), and `findSpawnRunById` still takes the first on purpose (it wants the spawn record's `originalParams`). The budget is now **anchored at record creation**: `armDeadline(budgetMs, delayMs)` keeps the reason naming the full budget while the delay is `max(0, budget − elapsed since startedAt)`, so the armed timer matches the displayed `deadlineAt` instead of drifting past it by the setup cost (measured 42–246 ms; `normalizeTimeout` is the wrong path for a remainder, it would read 0 as "no timeout"). **Stated limits that remain:** the abort is cooperative, so a prompt that ignores it keeps running; such a run keeps its session directory, keeps its branch lock until process exit, and has **no registry entry** (the terminal snapshot retires that claim, since the registry means "an owner may still be running"). #448's "a caller throw leaves the run unbounded" limit is **removed** by this change — the arm no longer depends on any caller statement. Out of scope and unchanged: the branch-lock convoy (#460), #439's containment, and the foreground path.
|
|
81
|
+
- **A dispatch that never reached the prompt is no longer offered as an interrupted, retryable run (issue #447):** the durable run/registry entry is written long before `session.prompt()`, so a pre-start throw left residue the next boot could only read one way — as a run that started and died. Measured on `78feb6e` (#439 §1.2): an `appendEntry` throw at dispatch (`ENOENT`, a real removed session dir) rejected the spawn while the registry entry survived with no `interruptedAt`, and a `startTranscript` failure (`ENOTDIR`) additionally left the session run entry `running`; `prompt()` was never called in either, and nothing cleared the residue in-process. The reverse direction was equally wrong: nothing distinguished "prompt never invoked" from "prompt accepted, provider silent" — both were `status: "running"`. The records now carry an **acceptance marker**, `acceptedAt`, additive and persisted on both the run entry and the registry entry: written as **`null` at creation** (JSON keeps `null`, so "tracked, not yet accepted" stays distinguishable from a record written before the field), then set to an ISO timestamp by **one** write immediately before `session.prompt()`. That write goes through the same `persistRunRecord` choke point, so the two records cannot disagree — and it is fail-safe: if it throws, the dispatch **does not start**. Every throw between the durable writes and the prompt (the transcript start, the acceptance write, a synchronous prompt throw) now runs one **pre-start cleanup** — clear an armed deadline, tear the work branch down, finalize the run entry `failed` with `Subagent prompt was never issued: <cause>`, retire the registry entry — and rethrows, so the caller still sees the spawn failure unchanged (its classification is #439's). Pruning is provably safe there and only there: nothing can be writing to a run that never started, and no retry is offered for it. The **boot scan** reads the marker as a tri-state: an ISO value is today's behaviour exactly (dead owner ⇒ interrupted, listed, retryable); `null` means never started — no `interruptedAt`, finalized `failed`, not listed and not retryable, and only once its recorded owner is **provably dead** (a live owner may still be inside its own pre-start window, and settling it would stamp a false terminal record the run's real settle could never outrank) (`BootScanSummary.neverStarted` counts the entries actually settled); the field **absent** is a legacy record and keeps today's behaviour, so a pre-upgrade record never loses its retry offer. The display vocabulary is unchanged (`running | completed | failed | stopped`) and there is no fourth status — "started, outcome unknown" remains #439's business. Two limits are stated rather than papered over: the acceptance write lands before the prompt, so a process death in that instant still leaves an accepted record for a prompt that may not have run (the point of no return is inherent — the window shrinks from the whole pre-start region to that one write); and a never-started background dispatch's **agent record** is still left `running` by the spawn-throw paths (a zombie `get_subagent_result` row), which is a separate defect and out of this issue's scope. A third run-entry append per dispatch is the visible cost of the acceptance record; history, retry and recovery surfaces already collapse by run id, while raw-entry consumers (SLA totals, the dashboard's recent-runs list) count it as they already count the spawn entry.
|
|
82
|
+
- **A run that started is never reported as a failed spawn (issue #439):** everything `startBackgroundAgent` did *after* the spawn — live-monitor registration, the footer counter, the repaint, the 2s progress poller, the default deadline and the final log — ran uncontained, so a throw in any of them reached the callers' catch and returned **"Failed to spawn background agent"** with `isError: true` while the agent was live. The transport auto-retry reads `isError` as "did not start", so the same throw also made it surface the **source** failure for a run that had started. The shared tail now captures a plain identity record (`id`, `description`, `task`, `status`, `model`, `label`) immediately after the spawn and contains everything else in one outer containment with three independently contained groups — bookkeeping, poller, deadline — each recording its failure into a `tailFailures` ledger; a fault in one group never skips the others, and the tail returns `{ agent, identity, tailFailures }` instead of a bare agent. Both callers (single background and the `tasks` fan-out) format every field from `identity` and classify a non-empty ledger as a **started** run — `isError: false`, the normal "Background agent started: <id>" text plus a "Monitoring degraded" paragraph naming the failure and saying *do not re-dispatch — the run is live; retrieve with `get_subagent_result`* — never as a spawn failure; a fan-out unit's started-degraded report also survives a later unit's failure or a cancellation, and a rejected spawn keeps the existing failure wording unchanged. The bookkeeping group now counts **before** it registers the live row and repaints (counter → row → repaint), so a live row always implies a counted run and the monitor's stale sweep can only ever release that run's own count rather than a sibling's; all five poller/deadline decrement sites share one claim-gated shape that also refuses to decrement a run that never counted. One advisory per run is emitted after aggregation — a `subagent-monitoring-degraded` message plus a warning toast, each on its own try so a closed channel cannot swallow the other — and it is **not** a terminal notice: it never takes the terminal claim, so the run's genuine completion notice is still delivered when it settles (a run whose advisory is emitted but whose settle has no listener degrades to "advisory only" — a stated limit, not a silent one). A second stated limit: the counter is released only by a monitor the run actually owns, so if bookkeeping, poller **and** deadline all fail for one run, its count stays one high on the footer for the rest of the session — the honest reading of a real, unmonitored run, and the alternative (releasing from a group that never attached) is exactly how a sibling's count was stolen. The retry path is otherwise unchanged: it still reads only `isError`, so a degraded retry counts as spawned and the source notice stays suppressed.
|
|
83
|
+
- **A batch unit's own high-thinking deadline is dropped by the dispatch pre-flight (issue #434):** the pre-flight judged the **dispatch-level** pair only, while `tasks`/`chain`/`graph` units carry their own `thinkingLevel` and `timeout` and `mergeSubTaskParams` lets the unit value win — so a unit declaring `thinkingLevel: "high"` + `timeout: 600000` under a dispatch with no top-level pair reproduced the 2026-11-06 incident **for that unit alone**: the predicate exited on `params.timeout === undefined`, and every unit site handed `merged.timeout` to the runner. The pre-flight now has a **unit projection** beside the dispatch predicate (one rule, two levels — the same seam, not a second copy): in an opted-in project, a unit that declares its own pair, inherits a high/xhigh declared level, runs **foreground** and carries a **positive** merged deadline has that deadline dropped before its run record is written, so a retry re-derives an absent deadline instead of restoring the cap. The judgement uses the **declared** level, never the capped one (the default cap is `off`, so judging it would silently disable the rule), and `processChecks` is **threaded** from the dispatch — a per-unit re-read of a relative `cwd` measures a different directory. The **#434/#431 boundary** is the unit's own declaration: a unit declaring neither field inherits the dispatch's pair and keeps the old behaviour, chain and graph included, while `thinkingLevel: ""` still means inheritance and `timeout: 0` still overrides an inherited deadline and arms nothing. Background fan-out units are untouched — there the deadline is the legitimate 30-minute budget. At most **one** additional notice is emitted per dispatch, after the unit holds its slot and immediately before its run (never in a pre-pass, so a unit a cancellation skips is never named), and none at all when a dispatch arm already announced; the wording deliberately claims no completeness. `force: true` still keeps the declared timeouts. ADR 0024 records the decision and closes ADR 0022's deferral.
|
|
84
|
+
- **A process that has just been sent SIGKILL is no longer classified as a survivor (issue #455):** `escalateKill` decided its survivor list by sampling death **in the same pass that sent the signal**, but SIGKILL delivery is asynchronous — a 40-iteration probe read `alive` **40/40** times at that instant (state `R`, delivery pending, or `Z`, awaiting reap), so the survivor list was decided by a race. In the suite that was the `recovery.test.ts` `#299 A1` flake (fails 2/2 under full-suite load, passes 3/3 alone) — which is to say the "flaky test" was a **producer** defect; in production it is a false "could not kill" warning for a process that is already dead. The SIGKILL pass is now three phases — **A** force-kill, **B** a bounded post-SIGKILL drain of `verifyDeath()` for exactly the force-killed targets, **C** classify — with `drainMs` (default 100 ms; non-positive restores the legacy single-sample classification) threaded through `RecoveryDeps`. Both the new drain and the pre-existing grace loop are bounded **twice**, by the clock and by `ceil(window / pollMs)` iterations, because the clock bound alone is defeated by a no-op injected sleep: measured 61,657 samples inside one 100 ms window (787,234 on the reviewer's box), so a frozen clock now costs at most the poll count and never a hot spin. The acceptance signal is the original test, **byte-identical** (`git diff dev...HEAD -- src/__tests__/recovery.test.ts` empty), now green under full-suite load where it failed before. **Stated cost:** worst-case added latency is `drainMs` (100 ms) per escalation and only when a SIGKILL was actually issued — zero when nothing needed killing; the refused-group rule and the unconditional final group SIGKILL still run **after** classification, because a refusal is a decision, not a timing window.
|
|
85
|
+
- **A preset field declared on the interface can no longer be silently dropped (issue #436):** `presetFromFrontmatter` re-stated the `SubagentPreset` field list by hand, so a field added to the interface but missing from the mapper was dropped without an error — `outputFile` was exactly that, and a preset author writing `outputFile:` got neither an error nor a file, while the merge layer (`params.ts:441`) and the template loader both already expected the value. The mapper is now a **table pinned by the type system**: `PRESET_FIELD_MAPPERS satisfies PresetFieldMappers`, where `PresetFieldMappers` is a mapped type over `Exclude<keyof SubagentPreset, OmittedPresetField>`. Adding a field without a mapper is a compile error (`TS2741`); a mapper for a field the interface no longer declares is an excess-property error (`TS2353`) — both proven by adding a probe field and a stale key in the real tree. `outputFile` is mapped, a non-string value is refused at load, and a preset-derived `outputFile` reaches `validatePreTask` and inherits the same hard write-tool conflict as the call parameter. `timeout` stays the one deliberate omission, allowlisted with its ADR 0022 §6 reason and pinned to exactly `"timeout"` by a type-level assertion, so the omission cannot grow silently; its tests are byte-identical, and a preset declaring `timeout: 600000` still loads without one. The template loader got the same table and the same pin — the sibling the issue asked to check. **Ramification:** a preset that already declares `outputFile` now *works* (previously silent) and will hard-error if it also excludes `write` — the intended H1 conflict, not a regression — and `timeout` remains unreachable from presets by design, because mapping it would re-merge a deadline the ADR 0022 drop arm believes it removed.
|
|
86
|
+
- **A terminal-notice dedupe overflow no longer forgets the claim it just made (issue #440):** `markTerminalSeen` cleared its whole dedupe set when it exceeded the 200-entry cap — **including the id claimed in that same call** — so at the 200→201 boundary an immediate duplicate terminal event for the same run id claimed again and was delivered twice. Reproduced through the real claim surface (`claimTerminalNotice`, not the private set): claim 200 ids, claim `id-overflow` → `true`, claim it again → **`false`**; on the old code the second call returned `true`. The set now evicts the **oldest** entry (a `Set` iterates in insertion order) and clamps a degenerate cap to at least 1, so retention stays bounded and the claim just made is never the eviction victim. The documented contract — "an evicted id may be delivered again" — keeps its meaning with a different victim, and the invariant is now stated as "the claim just made survives". **Blast radius:** terminal-notice dedupe only (wake and crash notices for background runs); no delivery decision, no `DEDUPE_CAP` value and no path or format change, and reverting is a one-line edit.
|
|
87
|
+
|
|
88
|
+
- **A deadline abort no longer depends on the bookkeeping before it, and a direct spawn is bounded (issue #448):** two measured defects in the background deadline path. **(1) A throwing bookkeeping call suppressed the abort.** The timeout handler ran `updateAgentStatus('stopped')` → `completeTranscript('stopped')` → `session.abort()` inside one `try`, so any throw in the first two steps skipped the abort entirely. Reproduced on this tree with the run's transcript path made a real directory (`EISDIR` from `appendFileSync`): the record said `stopped`, `abort()` was **never called**, and the child kept running. `session.abort()` is now attempted **exactly once, outside** the fallible block, and a bookkeeping failure is surfaced in the log (`spawnBackgroundSession: deadline bookkeeping failed for <id>`, the same file log the settle paths use — no new user-facing notice). The status still flips **before** the abort, because the settle path classifies the run as stopped from that pre-set status. **(2) A direct spawn armed no deadline.** The 30-minute default was the caller's (`index.ts`), armed after the spawn returned, so `spawnBackgroundSession` called directly with no `timeout` armed nothing (measured: zero timers, `abort: 0`, `status: running` after an hour). The spawn now arms `effectiveBackgroundBudget(undefined)` itself — the single definition of the default, never re-spelled — **before** `prompt()`, and a new internal `deadlineOwner: "caller" | "spawn"` (default `"spawn"`) tells it when the caller already owns that default: the one production call site (all dispatch, fan-out and retry paths route through it) passes `"caller"` and keeps its own timer, so an ordinary dispatch still has exactly one deadline. The timer remains **abort-only** — status, transcript note, `session.abort()`, with no finalization and no session-dir pruning — is cleared by both settle handlers, and is cleared **in the synchronous-throw catch before that catch's own cleanup**, because no settle handler attaches on that path. An explicit timeout is still honoured verbatim and a raw value `>= 2^31-1` still normalizes to "no timeout" with the default applying. **Two limits, stated in writing:** a caller-side throw *before* the caller arms its timer still leaves the run unbounded (`timers: 0, abort: 0, running`) — deferred to #453 — and the abort is **cooperative**, so a non-settling prompt still stays `running` and is deliberately not finalized, because finalizing there would prune a session a still-writing child may hold (#453). Two small, deliberate presentation changes ride along: the timeout reason now reports the **normalized** budget, so a raw `>= 2^31-1` value reads `Timed out after 1800000ms` rather than the sentinel; and the zero-timeout test in `session-manager.test.ts` now asserts the **owner rule** instead of "no timer", because a direct spawn is supposed to arm one — the assertion was rewritten because the behaviour it pinned was the defect. Escalation, `stopAgent`/`stop_subagent` and the foreground path are untouched.
|
|
89
|
+
|
|
90
|
+
- **A background run that settles with no assistant output is a failure, not a success (issue #449):** pi 1.5.0 can remove the only assistant message from the **projected** session before a run settles — a provider turn that stops on `max_tokens` while reporting fewer output tokens than the model's catalog `maxTokens` is classified as a recoverable length and omitted (`_omitRecoveryAttempt`), and when the branch is too young for the recovery compaction to find anything to summarise, that omission stands and `prompt()` still resolves. The settle site read the projection, found no assistant message, got an `undefined` stopReason and classified the run as **completed**; measured end to end on the real SDK over a loopback provider, that is `status: completed`, `exitCode: 0`, `usage.turns: 0`, `finalOutput: ""`, a `done`/`stop` run entry with no category, and a completion wake saying `category: success`. The classifier now takes an **assistant-evidence** signal (`"present" | "absent" | "unknown"`, defaulting to `"unknown"` so every other caller is untouched) that only the background settle site supplies, read from the same projection the stopReason comes from; `"absent"` means exactly one thing — an array that was read and holds no assistant message. The displayed outcome for this class changes from **completed** to **failed** (`incomplete`, `exitCode 1`, a failure wake), and the status vocabulary is unchanged: no new status, category or field. An already-known terminal reason always wins (an explicit `stop` still completes; `error`/`length`/`toolUse`/`deferred`/`pending` keep their own categories; a pre-stamped stop stays `stopped`), and a zero-output run **with** an assistant message (empty content, empty text, thinking-only, tool-use-then-empty) still completes. The reason is a fixed headline — `Run settled with no assistant output — the provider's response may have been truncated and omitted by the SDK (see #449)` — which states the observation, offers truncation only as a possibility, and **wins over** a stale `session.state.errorMessage` (that text may be appended, never substituted). It matches no transport signature and its `incomplete` category is excluded by the retry class gate, so the **automatic transport retry never fires** for this class. **Limits:** the guard is structural, not diagnostic — the omitted message is unrecoverable, so it cannot distinguish a truncation omission from any other resolve-with-no-assistant-message and does not prove truncation; a throwing/missing `messages` projection still takes the settle catch-all and is not covered; and the run's session directory is still pruned on this path, so the fix removes the false success, not the data loss (retention is a separate decision). The **foreground** path is deliberately untouched: its child emits `message_end` for that turn, so `runner.ts` already records `stopReason "length"` and `isSubagentError` already fails it — and widening that predicate would reclassify deliberately handled input (an extension returning `{action:"handled"}` exits 0 with zero message events). A minimal reproduction (loopback fake provider + the real SDK) lives in `.development/investigations/repro/issue-449/`.
|
|
91
|
+
|
|
92
|
+
- **An unknown `thinkingLevel` is rejected instead of silently running at pi's default (issue #443):** the level was resolved by clamping — `resolveThinkingLevel` clamps but cannot fail — so an unknown declaration (`"bogus"`, `"MAX"`, `"High"`, `" high"`) had index -1 and resolved to `undefined`. That value reached the child as `--thinking undefined`; pi warned `Invalid thinking level "undefined"` and ran at **its own** default, so the configured cap was bypassed rather than a launch refused. Measured on pi 1.5.0 with the cap set to `off`: the child initialised at `high`. Background behaved the same (an SDK session at the model default while the run record said `medium` and `originalParams.thinkingLevel` kept the bad value), a bad **second** unit still started the whole batch, and a restored record could re-launch it. A declared level is now checked **before resolution**, at every seam that can reach a launch: the per-call value; the selected preset's (named **or** auto-routed — an in-memory preset object never passed the preset-file validator); each `tasks`/`chain`/`graph` unit before any spawn, and the background fan-out's per-task pre-pass (so a bad second unit rejects the batch with nothing started); a value restored by `retryRunId`; and the transport auto-retry's rebuilt params, where a rejection starts no SDK session and still surfaces the **original** failure notice. Matching is case- and whitespace-exact, `""` keeps its existing meaning (top level → the configured maximum, per unit → the global level) and an omitted field is unchanged, while pi's own `max` is now a rejection naming the supported set. The schema's `thinkingLevel` gained an `enum` as a first line of defence — it names the whole set in pi's error and keeps `""` valid — but it validates raw tool arguments only, which is why the runtime guard exists; the cap semantics, `resolveThinkingLevel`'s clamp, and every valid declaration are untouched. **Limit:** a level already erased into a persisted unit record (stored resolved as `undefined`) cannot be truthfully rejected later — that is a documentation limit, not a migration; a corrupt non-string persisted `maxThinkingLevel` is a follow-up.
|
|
93
|
+
|
|
94
|
+
- **`tools: []` now means no child tools (issue #442):** an explicitly empty allowlist used to be indistinguishable from an omitted one at the spawn boundary — `resolveSubagentParams` kept `tools: []`, but `buildSubagentArgs` only mapped a *non-empty* list to `--tools` and otherwise added no restriction at all, so a dispatch that asked for zero tools got pi's full defaults. Measured on Pi 1.5.0 against the real foreground `runSubagent` path: with `tools: []` a scratch extension tool and a direct-exposure MCP tool both executed. An empty list now maps to pi's `--no-tools` **before** the `noBuiltinTools` branch, so `[]` disables built-in, extension, custom and MCP tools and can never widen into `--no-builtin-tools` (built-ins off, extension tools *on*); `--exclude-tools` stays additive and cannot re-enable anything. Omitted, non-empty `--tools`, `noBuiltinTools` and `excludeTools` behave exactly as before, and the edit-implies-write rule is unchanged — `[]` plus `outputFile` is still rejected before launch, because no write tool exists. Background needs no change: `spawnBackgroundSession` already passed the empty list through to the SDK session (`tools: []` = zero active tools) and still loads no extensions, no skills and no MCP servers. **This is a tool-access setting, not a security sandbox:** in the foreground, configured extensions and MCP servers still initialise and connect (users rely on their startup and on extension hooks), so `[]` denies the model their tools rather than preventing the code from running, and it is no defence against an extension that reactivates tools deliberately. The README states the distinction and the schema's `tools` description points at it.
|
|
95
|
+
|
|
96
|
+
- **A shut-down runtime can no longer steal the next session's completion wake (issue #437):** the extension's three terminal event-bus listeners (`subagent:completed` / `failed` / `stopped`) were anonymous closures that nothing ever removed, so a clean session replacement (`/new`, `/resume`, `/fork`, `/reload`, quit) left the old runtime's listeners on the shared bus. The bus preserves registration order, so the stale listener won the shared one-notice-per-id claim for a run the NEW session had started, then delivered it through — or threw on — its dead `pi`/`ctx` handles, and the live runtime's wake was lost. Each factory instance now keeps the exact listener references it registered and unsubscribes only those, synchronously, as the first step of `session_shutdown` (before the reap await or any fallible cleanup), idempotently on a repeated shutdown; other subscribers and the next runtime's fresh listeners are untouched, and the delivery matrix, transport auto-retry, claim timing and crash-notice dedupe are unchanged. Users should still avoid `/new` while background runs are active: delivery or cleanup for a run already in flight remains out of scope, and the retry-start/unknown-outcome problem stays with #439.
|
|
97
|
+
|
|
98
|
+
- **A foreground dispatch can no longer be killed by its own timeout — and the pre-flight can no longer turn a valid dispatch into a rejection (issues #431, #433):** the durable-shape pre-flight (#412) only fired for an **explicit** `background: false`, so the exact 2026-11-06 shape — `high` thinking, `background` omitted, `timeout: 600000`, an effective `writes` mode that the #361 default keeps foreground — kept its deadline and the run was killed at 10m0s. The pre-flight now has **two outcomes** in an opted-in project: where a background run is possible (explicit `background: false` with `auto`/`writes`) the dispatch is switched to background and the timeout dropped, exactly as before; where it is not — an effective `always`, or an omitted `background` that the `writes`/`always` default keeps foreground — the run **stays foreground and the explicit timeout is dropped**, because a foreground run has no default deadline at all, so no clock kills it while its approval gate stays exactly where the user put it. A drop is announced on both channels with the actual dropped ms value; `force: true` keeps the explicit timeout on either arm, and it never fires on an outcome that changed nothing. The same rule closes a pre-flight bug that could reject a valid call: an explicit-foreground dispatch with `approvalMode: 'always'` was switched into background and then refused by the background gate (no dialog there) — it now stays foreground with no deadline instead, so **the pre-flight never switches a dispatch into a rejection**. `chain`/`graph` stay exempt (per-unit dimensions still bypass the pre-flight — #434), the `auto`/`writes` switch arm is unchanged, and without the project's `processChecks` opt-in nothing changes. ADR 0022 records the decision and supersedes ADR 0018's omitted-background exemption.
|
|
99
|
+
|
|
100
|
+
- **A running subagent's budget is visible on every surface (issue #423):** the budget existed only as a dispatch-time parameter and was rendered nowhere afterwards, so a run could hit its deadline without the human (or the conductor) ever seeing what the deadline was. A background run now persists its **effective** budget (`timeoutMs`: the explicit timeout, else the 30-minute default) on the record at spawn, and every live entry carries an absolute `deadlineAt` — background runs and foreground/chain/parallel/graph units alike, through the existing `registerLiveRun` registration (a foreground run has **no** default deadline, so a deadline appears there only when a timeout was actually passed). The footer shows the age of the **oldest still-running** agent plus the nearest deadline — `ran: 4m 12s · deadline in 34s` — turning into `ran: 4m 12s · deadline: stopping` at or past zero; the monitor rows and the dashboard's Active Subagents panel show `4m 12s / 30m (86% left)` per row, skip settled-but-lingering ids, and order by the soonest deadline; the drill-in now opens the row that was actually **rendered**, so a spawn or a finalize between paint and Enter cannot open a different agent than the one highlighted. `get_subagent_result` appends `Budget: 30m — 4m 12s used, 25m 48s left` whenever the record states one (an old record gains no invented deadline), and the completion wake carries the same line — `Budget: 30m (exhausted)` only on timeout evidence, never for a user abort or a completed run — as its own paragraph for `stopped`/`failed` runs. Nothing about timing changed: the 30-minute default, both deadline timers, the foreground kill escalation and the no-flag behaviour are exactly as before, and a displayed deadline still precedes the real kill by the in-prompt preflight.
|
|
101
|
+
|
|
102
|
+
- **A project's engineering bar is injected at the spawn seam, not selected by preset (issue #421):** the SOLID/DRY quality bar and the design-assumptions checklist lived in the repo-local `project-implementer`/`project-reviewer` presets, so four implementation dispatches that ran on the shipped `dev-agent` preset silently lost them; the checklist itself was untracked and got deleted as a "ghost". Both are now one tracked reference, `.pi/skills/worktree/references/engineering-bar.md`, appended to the child's **system prompt** as a conductor-authored `<engineering-bar>` section by both spawn seams — the background `appendSystemPrompt` array (ordered after `<resume-context>`) and the foreground `--append-system-prompt` file at the shared `runSubagent` chokepoint. The section is gated by the project-local `processChecks` flag (ADR 0019, fail-open): in a user's project neither the section nor the file read happens, and no preset choice can drop it in this one. A missing or empty reference logs one warning and skips the section — never a crash, never a silent skip. The section now also carries the review addendum (Gate A, the `SOLID/DRY violations flagged: N` line, and the structural-closure block for refactor PRs), so a reviewer gets it without the reference doc being read. The file is outside `package.json.files`, so it never ships; tests pin both directions, the file's required sections, and the packed tarball.
|
|
103
|
+
|
|
104
|
+
- **A `noJev` bypass has to state a reason in words (issue #419):** `delegate_task`'s bypass for the Jev dispatch-line pre-flight was declared a non-empty reason string and described as refusing `true` and an empty string at the schema layer (ADR 0018 §2). That held only for the empty string. The harness validates tool arguments with coercion on, and pi-schema's string rule stringifies booleans and numbers before the handler is called, so `noJev: true` arrived as the string `"true"`, satisfied `Type.String({ minLength: 1 })`, and dispatched a run whose warning named "true" as the reason (live probe, 2026-11-02) — while a value with no text form, such as `{}`, reached `config.noJev.trim()` and threw `TypeError: config.noJev.trim is not a function` instead of being rejected. The reason is now read through a runtime guard: a string, trimmed non-empty, and **not** a coerced primitive (`true`/`false`/a bare number). Anything else is a clean **error** — the normal missing-line refusal plus an `invalid noJev: …` diagnostic — so a boolean can neither bypass the check nor crash it, and a genuine reason still downgrades the rejection to a warning that names it. The read stays inside the project's `processChecks` opt-in (ADR 0019), so a user's dispatch is never examined; the schema's description now says the reason is validated in the handler, ADR 0020 records why, and the suite pins the coercion through the real validator rather than the declared JSON shape. ADR 0018 is untouched — superseded on this one claim, not edited.
|
|
105
|
+
|
|
106
|
+
## [2.7.0] - 2026-11-01
|
|
107
|
+
|
|
108
|
+
- **A project's process checks are one opt-in flag; the durable-shape pre-flight applies only where they are enabled (issues #412, #415):** in a project whose `package.json` sets `{"brl-subagent": {"processChecks": true}}` (this repository), a `thinkingLevel: "high"`/`"xhigh"` dispatch with `background: false` and an explicit `timeout` is auto-switched to a background run with the explicit timeout **dropped** (the 30-minute background default applies) and a notice stating why: foreground runs persist nothing, so a timeout there loses the run's whole work, while a background run keeps its session and is retried on a transport error. `force: true` keeps it foreground (logged — the dispatch text is the reason; `force` gains no reason field), and when enabled the switch is recorded before the retry snapshot so the run keeps its transport auto-retry. **Without the field nothing happens**: `background: false` and the explicit timeout stand exactly as passed, because an explicit foreground timeout is usually the caller's budget cap and the switch is a maintainer decision rule, not product behavior. **Fail-open**: a missing, unreadable or malformed `package.json` means the checks are off, so a user's dispatch is never rejected or reshaped. Everything else is untouched even when enabled: `medium`/lower, a dispatch with no explicit timeout, an omitted `background` (the #361 default already accounts for approval modes), and `chain`/`graph`. ADR 0019 records the opt-in decision and supersedes ADR 0018's global scope.
|
|
109
|
+
|
|
110
|
+
- **A project can require the Jev dispatch line, and the line can now be proven (issues #407, #412, #415):** in a project whose `package.json` opts into process checks, `validatePreTask` rejects a dispatch whose task carries no usable `jev: <level> (<conf>) · C<n> · worktree <y|n>` line — before anything spawns, on every path (foreground, background, fan-out, chain, parallel, graph). The check is **opt-in per project** through the same umbrella flag, `{"brl-subagent": {"processChecks": true}}` (renamed from the unreleased `requireJevLine`); without that field nothing changes, so a user's dispatch is never rejected. `jev: unavailable` is an accepted form, and `noJev: "<reason>"` is the stated bypass (a non-empty string; it bypasses only the line check and surfaces the reason as a warning). `jev-check --line '<json>' --label <name>` now appends the printed line to a gitignored provenance log, and `jev-check --log --require-provenance` (run by the merge guard) fails a line no classifier printed — the format check alone passes an invented confidence (2026-10-31: `medium (0.70)` dispatched, the classifier had said `high (0.32)`).
|
|
111
|
+
|
|
112
|
+
- **A retry's resume preamble is now system-side (issue #411):** the transport auto-retry's resume block used to be prepended to the replayed task, which put instruction-shaped text *inside* the `<task>…</task>` data fence the Task Boundary directive tells the child to ignore (ADR 0001). It now rides the child's **system prompt** as a conductor-authored `<resume-context>` section (ordered after `<system-prompt>` in `appendSystemPrompt`), outside the fence — the wrapped task stays **byte-identical to the recorded original**, so routing isolation, `originalParams.task`, and the attempt-3 non-compounding invariant are unchanged, and the preamble text itself is untouched. The spawn result's `Task:` line no longer shows the resume marker; `attempt`/`resumeOf` carry the lineage. ADR 0017 records the decision.
|
|
113
|
+
|
|
114
|
+
- **The persistent stores are actually owner-only (issue #408):** F6's `0o700` intent was never enforced on a directory that already existed — `mkdirSync`'s `mode` applies only on CREATE — so `.pi/subagents`, its per-run session directories, `.pi/run-registry` and `.pi/output` were world-readable on an existing checkout. Every store now repairs its directory mode on every write (`0o700`: no traversal for other local users, which is the confidentiality boundary; read-only paths do not repair, so a dormant checkout stays as it was), a fresh store is created owner-only, and the per-run session files are repaired to `0o600` best-effort at spawn and at a retained settle (defense-in-depth; other record/transcript files keep their create-time mode). A repair failure is logged and never thrown into a spawn, settle, or registry write.
|
|
115
|
+
|
|
116
|
+
- **A transport-failed run keeps its session for the retry (issue #404):** the settle path used to prune every terminal run's SDK session directory, including the one case a retry automatically serves — so attempt 2 could recover the working tree and the bank, but not attempt 1's conversation. A transport-class failure on the original background dispatch now retains that directory (marked `.transport-retained`) and the resume preamble names it as an **absolute** path, telling the retry's child to read the newest `.jsonl` inside; the pointer is emitted only when the directory exists. Retention is bounded by a sweep at the same choke point: marked directories only, oldest first, while the set exceeds 5 dirs / 50 MB / 14 days (marker mtime is the recency source). The directory being retained is exempt for that settle, so one oversized run can overshoot by one and the next settle reclaims it. Sessions under 2 KB are not retained, a failed marker write falls back to pruning, and interrupted-run directories stay unmarked and exempt. Attempt-2 transport failures, non-transport failures and completed runs prune exactly as before; the store stays bounded.
|
|
117
|
+
|
|
118
|
+
- **A retried run's lineage is visible (issue #396):** `get_subagent_result` now accepts the 8-hex id form the notices render (unique prefixes only; ambiguous ones are refused), names the latest attempt when the requested run was retried, appends `Superseded by <id> (attempt N, <status>, started <iso>)` when a terminal source has a later attempt, and says whether the durable registry still lists an id with no lineage. The lookup stats first and reads only records from the last 7 days (capped at 200), so a tool call never parses the whole agent store.
|
|
119
|
+
|
|
120
|
+
- **A transport auto-retry resumes instead of restarting (issue #401):** the one automatic background replay now delivers a bounded resume block on the child's **system prompt** (moved there by #411, above, out of the `<task>` fence) — previous attempt id, "this directory may already contain its uncommitted edits", `git status --short` / `git log --oneline -8`, the `/tmp/brl-<label>-bank.md` progress bank, and the previous attempt's transcript when that file exists — ending with "continue from what exists; do NOT redo committed, written, or banked work". The block is system-prompt-only: `resolveSubagentParams`, auto-routing, thinking level, H1 keyword warnings and the capability pre-flight still see the recorded original task, and the original is also kept on the retry's own record so a further retry cannot stack preambles. Dispatch briefs now name the bank convention for implementation and plan-critique runs too.
|
|
121
|
+
|
|
122
|
+
- **For contributors — the review speaks one smell vocabulary:** review guidance now uses the tool-independent keys (`oversized-function`, `too-many-parameters`, `deep-nesting`, `duplicated-code`, `oversized-file`) with a coaching-guide shape, and a new guard fails the suite when the same ≥80-char sentence lives on two surfaces — the prose-drift class (e.g. the `retryOnTimeout` duplication) is now mechanical.
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
- **For contributors — the Jev ritual is checkable:** a ledger check and a dispatch-line formatter run in CI, so a pre-dispatch classification skipped in practice (a bare level with no confidence) now fails the build instead of silently eroding the calibration record.
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
- **Background transport failures auto-retry once (issue #365):** a background run that settles `failed` / `exit_error` with a transport signature (`Connection error.`, `ECONNRESET`, `socket hang up`, `fetch failed`, `ETIMEDOUT`, …) is re-dispatched **once** through the `retryRunId` machinery — recorded task/model/thinking/tools/cwd/timeout restored, all gates re-run, the record continued as `resumeOf` the source with `attempt: 2`. The source completion message is suppressed and replaced by a warning toast, so the retry's settle is the one wake; a second failure surfaces normally and nothing else retries (foreground, non-transport, fan-out units, chain/graph are untouched). Found by the 2026-10-24 cycle close: the connection-error class recurred four times, all recovered by hand.
|
|
129
|
+
|
|
130
|
+
- **Test-suite stewardship (issue #368):** a CI **budget guard** now pins the suite's wall time (≤ 60 s; ~16 s today) and its test:source LOC ratio (≤ 2.0; 1.62 today) — ceilings, not targets. The first mutation-sampled audit mutated six modules across hazard classes: five were killed by existing tests, one genuine survivor (an interrupted run's first timestamp could be silently overwritten by a second boot scan) is now pinned. **No tests were removed.** The audit repeats one module per cycle.
|
|
131
|
+
|
|
132
|
+
## [2.6.0] - 2026-10-24
|
|
133
|
+
|
|
134
|
+
- **`background` is the conditional default (issue #361):** omitted, a single task or a `tasks` fan-out now runs in the **background** when the *effective* approval mode is `auto` (per-call param, else config) — the tool returns an agent id immediately and the conductor is woken on terminal state — and stays **foreground** under `writes`/`always` or for `chain`/`graph`. The fallback is the safety property: a background run has no approval dialog, so a gate that needs the user can never be reached by a default (`always` was a hard rejection, `writes` silently auto-approved). Explicit `true`/`false` keeps exactly today's semantics, including the verbatim `background: true` + chain/graph rejection; the effective value is recorded on the run so a retry restores the shape it actually had. A background run still defaults to the 30-minute deadline; pass `background: false` for a quick probe whose answer the next step needs inline.
|
|
135
|
+
- **Toolchain — Pi 1.4.0 parity (issue #359):** the `@earendil-works/*` devDependencies move to `^1.4.0` (`typebox` stays at the host pin 1.3.27; the peer ranges stay `*`), so the type surface the extension compiles against matches the host it runs on. No source change was needed: 1.4.0 has no breaking section, every symbol we import still resolves to the same signature, and the notable changes (`generateSummary()` ignoring `reserveTokens`, `before_provider_headers` attribution, the new `pi-ai/models` subpath) are all outside our call paths — the dialog-concurrency fix only makes our stacked `custom()` overlays behave correctly. The lockfile gains one transitive dependency (`marked-cjk-friendly`, pulled by pi-tui's Markdown renderer).
|
|
136
|
+
- **A live footer while subagents run (issue #354):** the footer status line is now a real activity indicator — a 150 ms braille spinner while any run is active, the oldest active run's elapsed time, and a completion segment with spaced `✓`/`✗` symbols coloured as one unit by outcome (`success` when nothing failed, `warning` when success and failure are mixed, `error` when everything failed). The existing 3-second linger keeps the result visible before the idle config line returns; the ticker stops with the last run and on session shutdown, and the linger timer is a single edge-triggered handle, so repeated repaints cannot stack timers. The idle line is unchanged.
|
|
137
|
+
- **`/brl-subagent` menu polish (issue #345, PRs #346–#352):** a presentation-only consistency pass over the config menu tree. The menu groups its sections with dividers (viewport 10 → 15 rows, duplicated header deleted), and every row follows one label/value grammar (canonical unset and `(current)` markers, verb-led titles, canonical input prompts). The Templates manager now wears the Presets shell — customs-first with a divider, tier counts in the title, a real description fallback and an explicit empty state — while the Presets manager gains the same empty state, a tier suffix in its detail view, one unset-field policy and one field-label vocabulary; selecting a divider is now a no-op re-render. The preset/template tier label is fixed: a custom file whose name contains spaces no longer renders `[B]` (builtin). Actions, keys and row values are unchanged throughout.
|
|
138
|
+
- **For contributors:** the handoff mechanism (issue #353) — the project extension injects the `.development/HANDOFF.md` §STATE at session start and after compaction (cockpit-only guards), `/handoff` shows it and `/handoff mark` sets the `Verified:` line; the worktree lifecycle gained a step 0 (orient from §STATE). The footer status also gained a single repaint chokepoint and `showDashboard` was split into six pure panel renderers with byte-identical output (issue #356).
|
|
139
|
+
- **Dependency hygiene:** vitest 5.0.5 adopted (dev tooling only; the local suite drops from ~29 s to ~17 s). `typebox` stays at the host pin 1.3.27 — the dependabot 1.4.2 proposal is held and stays visible as the signal.
|
|
140
|
+
- 1701 tests across 82 files.
|
|
141
|
+
|
|
142
|
+
## [2.5.2] - 2026-10-17
|
|
143
|
+
|
|
144
|
+
- **Gate rejections no longer leave phantom runs (issue #340):** a foreground dispatch rejected by the circuit breaker — or cancelled while waiting for a concurrency slot — used to leave a `running` record behind, surfacing at the next boot as an interrupted run that never started (and, on a retry, as a dangling twin beside the source). Both pre-start paths now finalize the persisted record before returning: terminal `failed`/`aborted` with the exact gate message, the inflight registry row cleared, and the live entry released; the retry-source retention is unchanged. Found by the FGP review, mutation-verified and live-probed.
|
|
145
|
+
- **Toolchain — Pi 1.3.0 parity (issue #337):** the `@earendil-works/*` devDependencies move to `^1.3.0` (`typebox` stays at the host pin 1.3.27); the 1.3.0 changes were checked against our paths — no breaking changes, and two upstream fixes (the overlay `done()` fix, transient-provider retries) land in them.
|
|
146
|
+
- **Boundary guards (issue #336):** the silent partial-read class now has mechanical checks — a documented cycle-end count reconciliation (>20% delta ⇒ suspect the window), an 11-file window/parser audit, a terminal-call-boundary rule in the Recon checkpoint, and a permanent `sprint-metrics.py --selftest` in CI.
|
|
147
|
+
- **Dependency hygiene:** vitest 5.0.4 adopted (dev tooling); `typebox` is held at the pi host pin (1.3.27) and was split out of dependabot's combined group — a held version never rides along with an adopted one, and no `ignore` entries are used (every proposal stays visible).
|
|
148
|
+
- 1509 tests across 74 files.
|
|
149
|
+
|
|
150
|
+
## [2.5.1] - 2026-10-13
|
|
151
|
+
|
|
152
|
+
- **Interrupted runs are recoverable (issue #296 — U2 + U3):** after a conductor crash the next boot names what was lost — one notice lists every unresolved interrupted run with its task and age, Run History shows an `Interrupted` row, and the retry menu offers a one-key re-dispatch through `retryRunId` (or an abandon). Background sessions are file-backed (per-run `.pi/subagents/sessions/<id>/`, pruned at the single finalize choke point; interrupted files retained until resolved), and a registry-union visibility bridge makes all four surfaces agree even on a genuine fresh boot.
|
|
153
|
+
- **A crashed foreground run keeps its task and dispatch shape (O3):** after a conductor crash + fresh boot a FOREGROUND/unit run's durable registry entry carried only identity, so the recovery notice showed `(task unavailable)` and `retryRunId` could neither restore the task nor the execution shape (it silently defaulted to the current session config). The registry now persists the run summary — `task`, `label`, `model`, `thinkingLevel` and the full `originalParams` snapshot — at the single write choke point, and the U3 bridge consumes it: a post-crash retry restores the same 17 fields a same-session retry restores (including `force`, per the 2026-10-11 decision), with explicit caller values still winning. Reads are lenient — a tampered enrichment field degrades to absent rather than dropping the entry and losing the interruption mark. Additive/optional, so old entries read as before.
|
|
154
|
+
- **A successful retry retires the source entry:** an interrupted run that has been successfully retried is no longer re-offered at every subsequent boot (a failed retry start leaves it intact and retryable). The background agent record's own resolution remains U4's work; this fold clears the registry entry only.
|
|
155
|
+
- **Bridged retries inherit the recorded dispatch identity (issue #329):** the visibility bridge now projects `dispatchId`/`attempt` from the durable entry, so a post-crash retry continues the original logical dispatch instead of minting a fresh id — found by the live end-to-end probe.
|
|
156
|
+
- **Run lists render newest-first (issue #330):** Run History and the retry menu share one `sortNewestFirst` ordering, and the recovery bridge merges its rows by recency instead of appending them to the bottom — also a probe finding.
|
|
157
|
+
- **Orphan-tree reaping reaches the process group (issue #299):** POSIX runs spawn detached and the kill paths signal the whole group (stat-prefix membership contract, signal-time marker verification, honest survivor reporting); Windows keeps the child-only fallback.
|
|
158
|
+
- **Toolchain — Pi 1.2.0 parity (issue #333):** the `@earendil-works/*` devDependencies move to `^1.2.0` and `typebox` is pinned to the host's 1.3.27; the 1.2.0 breaking changes were checked one-by-one and none touch the extension.
|
|
159
|
+
|
|
160
|
+
## [2.5.0] - 2026-10-10
|
|
161
|
+
|
|
162
|
+
- **Conductor-death recovery (issue #296):** a run that was in flight when the conductor died is now recovered at the next boot — the orphaned subagent process is reaped (identity-verified via its `/proc` marker before any signal) and the run is marked interrupted. Built on a durable `.pi/run-registry/` mirror written before every run's effect and cleared on finalize; the boot scan reads only that registry (no full agent-store parse), waits one grace window total, and skips entries it cannot verify.
|
|
163
|
+
- **Abort/timeout escalation now force-kills (issue #303):** the single-child death check is the real process exit, not `child.killed` (true the moment the signal is *sent*) — a child that ignores SIGTERM is SIGKILLed at the grace boundary, and cooperative children finish early.
|
|
164
|
+
- **The recovery ledger cannot lie (issue #304):** registry-mark failures are logged and counted (`markFailures`), `markInterrupted` never throws out of the scan, and entries whose ids fail the safety guard are skipped fail-closed.
|
|
165
|
+
- **The test suite no longer mutates the checkout (issues #302, #308):** the branch-mode end-to-end test runs against a throwaway git repo behind an invariant guard; a detached starting checkout is restored with its work preserved instead of leaking a work branch or losing the merged commit.
|
|
166
|
+
- **Renderer predicate centralization (issue #298) + review polish (issue #306):** the overloaded `exitCode === -1` partial-vs-settled decision lives in one architecture-ratcheted predicate; the escalation timing seam is unreachable outside tests.
|
|
167
|
+
- **Tooling:** ADR 0015 splits the knowledge layers — CodeGraph as the structural index, graphify as the semantic layer — with a measured dogfood window in progress.
|
|
168
|
+
|
|
169
|
+
## [2.4.0] - 2026-10-03
|
|
170
|
+
|
|
171
|
+
- **Explicit timeouts are honored (issue #240):** the 30-minute "hard cap" silently shortened any explicit `timeout`, so a legitimate long background run could not be given one. An explicit timeout is now honored verbatim — 30 minutes is the default for a background run that passes none (the orphan protection for unattended runs), never a ceiling.
|
|
172
|
+
- **One deadline timer per run (issue #244):** with an explicit timeout, two timers armed at the same deadline; the session-manager now owns it and the index-level timer arms only on the no-timeout default path. User-visible wording says "deadline", and `retryOnTimeout` is documented as foreground-only.
|
|
173
|
+
- **Steering actually steers (issue #241):** `steer_subagent` recorded the request and flipped a status but never delivered the message — it now delivers to the live session via the SDK, and writes its transcript audit line only after a successful delivery.
|
|
174
|
+
- **Toolchain parity with pi 1.0.0 (issue #255):** the `@earendil-works/*` devDependencies move to 1.0.0, closing a long-standing skew between the types the extension compiles against and the runtime it executes on; `erasableSyntaxOnly` now pins the property pi's direct TypeScript-source loading depends on.
|
|
175
|
+
- **TypeScript 7.0.2 + ES2024 (issue #256):** TypeScript 7 removed the classic compiler API from the package root; the four guards that consumed it — three AST ratchets and the release-gating packaging scanner — now run through a single containment adapter (`scripts/ts-ast.mjs`) holding every `typescript/unstable/*` import. All seven architecture mutations were re-proven after the port; the compiler is pinned exactly, and ADR 0013 records that TypeScript majors are deliberate migrations.
|
|
176
|
+
- **Hardening (issues #229, #239, #233, #235):** retry pins (origin e2e + snapshot/resolve drift guard), parameter types derived from the registered schema, and dead-code removals.
|
|
177
|
+
- **For contributors (issues #247, #249, #251, #253 — GitHub-visible):** development docs and tooling are tracked on `dev` (see `CONTRIBUTING.md`); `ARCHITECTURE.md` is a lean current-state document whose module map is generated and CI-guarded; seven architecture rules execute as tests; thirteen ADRs record the load-bearing decisions behind a guarded index.
|
|
178
|
+
- 1212 tests across 58 files.
|
|
179
|
+
|
|
180
|
+
## [2.3.9] - 2026-09-27
|
|
181
|
+
|
|
182
|
+
- **A running subagent no longer flashes ✗ (issue #206):** while a foreground run was using tools, its rendered line showed the failure icon (and before the first turn, ✓) because every live partial update was classified with the *settled-result* predicate — a mid-run `stopReason: "toolUse"` reads as an error there. Live partials now carry the unsettled sentinel (`exitCode: -1`), so a streaming run renders as running until the real result lands; a run that genuinely *ends* on a tool turn still renders ✗. This is the release's only user-visible runtime change. It also adds the first tests for the live-render path (level-1 emitted partials through the real paths; level-2 renderer assertions) — mutation-verified: reverting the one-line fix fails exactly the two partial assertions.
|
|
183
|
+
- **Dispatch capability guards (issue #216):** the pre-task check now models **directory exploration** (`search`/`grep`/`find`/`list`/`locate`/`glob` → any of `find`/`ls`/`grep`/`bash`) alongside the existing requirements, and an unambiguous capability mismatch — `run`/`execute`/`test`/`compile`/`benchmark` without `bash`, or an exploration task with no reader — **blocks before any spawn** with the fix named in the error. A new `force: true` parameter downgrades a **capability** block to a warning (never an `outputFile`-without-write conflict, which stays a hard error). Pre-task **warnings are now surfaced in the result** in every mode (foreground success and failure, background spawn, fan-out with per-task prefixes) instead of being log-only, and auto-routing states its evidence (`[auto-routed to preset 'x' (matched keyword 'y') — tools: …]`). +24 tests; two independent mutation probes confirmed the block/override teeth.
|
|
184
|
+
- **Per-step `cwd` is honoured in every multi-step mode (issue #222):** `chain`, `tasks` and `graph` silently ignored a step's own `cwd` — `mergeSubTaskParams` computed it, and the spawn sites passed the mode-level cwd. Each unit now validates and spawns in **its own** cwd (the mode-level one remains the fallback for steps that declare none), all units are validated **before any spawn**, and the per-unit pre-pass covers the capability checks and the step's `outputFile` against that step's cwd. The graph pre-pass validates the declared text with `{id}` placeholder tokens stripped, so a dependency whose id happens to be a keyword no longer trips the block. +21 tests.
|
|
185
|
+
- **Foreground `tasks` gets per-task validation (issue #220):** the foreground parallel shape validated only the mode entry, so per-task tool/capability problems and warnings never applied to it. It now runs the same validate-all-then-spawn pre-pass as the background fan-out, and the warning lead is normalized (`Task involves …`, never `Task task …`).
|
|
186
|
+
- **The branch lock is keyed by repository root (issue #224):** `gitBranchLocks` was keyed by the cwd path while its own comment promised per-repo serialization, so two concurrent branch-mode spawns in different directories of one repository took different locks — one could read the other's work branch as its base. The key is now the resolved repository root (`git rev-parse --show-toplevel`, cwd fallback for non-repo paths). Latent pre-existing bug; no test covered it — now it does.
|
|
187
|
+
- **Retries keep the original's execution shape (issue #227):** `resolveRetryParams` rebuilt a fixed field set, so `background`, `gitMode`, `approvalMode` and `force` were dropped — even when passed explicitly on the retry call — and a failed background run retried in the foreground. All four are now snapshotted and restored with explicit values winning. Fan-out units deliberately record none (a unit retry stays a single foreground run), and `chain`/`tasks`/`graph` remain unrestorable — re-issue those fresh.
|
|
188
|
+
- **`test-engineer` can run the tests it writes (issue #210):** the preset shipped without `bash`, so a test-writing agent could not execute (or mutation-verify) its own tests. It now has `bash` and a rule to verify what it writes.
|
|
189
|
+
- **Shipped docs made accurate — and audited (issues #204, #205, #217 + the v2.3.9 accuracy pass):** the built-in templates now carry the coverage-statement requirements (any search/read-derived claim states its query, count/range and reconciliation) and the probe/mutation target rules (name the target by unique context; state the expected failure before running); AGENT.md gained claim-verification guidance (ground run-state/liveness/time claims in observed results; records are finalized at settle) and lost a leftover internal rule reference. Then a systematic README/AGENT.md/schema-text audit against the code corrected the remaining gaps: the `stop_subagent` terminal contract (idempotent success, not an error), the `code-review` template example's slot (`${target}`), the timeout wording and the disclosed **30-minute background cap**, the missing parameter rows and the whole capability pre-flight section, the graph placeholder wording, and removal of `get_subagent_result`'s never-implemented `wait` parameter.
|
|
190
|
+
- **Development:** `@earendil-works/*` devDependencies to 0.87.1 (the runtime had moved ahead — now aligned with the type-check gate) and typebox 1.3.34; the shared delegation guard/validation prelude extracted into `src/prelude.ts` (#201 — the cost-gate shape now has a single construction site); the per-step-model suite no longer leaks a `/tmp` directory per test (#195). 1167 tests across 53 files.
|
|
191
|
+
|
|
192
|
+
## [2.3.8] - 2026-09-23
|
|
193
|
+
|
|
194
|
+
- **Background fan-out — `tasks` finally runs in the background (issues #196, #198):** `delegate_task({ tasks: [...], background: true })` now starts one independent background agent per task. The call returns immediately with **one id per task in task order**, and you are woken **once per agent** as each finishes. Before this, `background: true` combined with a batch mode was *silently ignored* — the call ran foreground and blocked while the caller believed it was background; that combination now rejects loudly, and for `tasks` it became the feature. The whole batch is resolved and validated **before any spawn**: a bad `cwd`, `outputFile`, or pre-task check rejects the call naming the task, with nothing started. Per-task overrides are honored (`model`, `thinkingLevel`, tools, prompts, `outputFile`, `timeout`, `cwd`, `priority`, `label`), and each agent's run entry snapshots its *own* params, so retrying one member restores that member — not the batch. Three checks reject up front: `approvalMode: 'always'`; `gitMode: 'branch'` (the per-repository git lock is awaited inside the first spawn and held until that agent settles, so a fan-out would block the call); and the session cost limit, now checked as per-task estimate × N. A spawn failure or abort mid-loop stops further spawns and reports the failed task plus the ids already started — those agents stay detached and still wake the conductor. `chain` and `graph` cannot be combined with `background: true` (they need sequential and dependency state) and are rejected loudly.
|
|
195
|
+
- **Run-entry lookups are explicit (issue #185):** every run appends two entries sharing its id — a spawn entry (`status: "running"`, carrying `originalParams`) and a terminal entry at settle. `findRunById` returned the *first* match, so finished runs were looked up as running: the TUI's stale-foreground fallback lost terminal output, and the #52 staleness sweep never reclaimed a poller-dead live entry. The terminal-preference rule now lives once in `resolveTerminalRunEntry`, with `findSpawnRunById` (retry params) and `findTerminalRunById` (finalized entry) used by intent at each call site.
|
|
196
|
+
- **Failed-run records are coherent (issue #187):** `finalTurnError` was derived from the *coerced* failure reason, so a hard-cap timeout or a synchronous spawn throw was recorded `finalTurnError: true` even with no provider error — it now derives from the raw terminal reason. The foreground `finalizeRunRecord` never set `stopReason`, so a failed foreground run was recorded failed with no reason; it now shares the background path's `coherentFailureReason` helper.
|
|
197
|
+
- **Two new ratchets (issues #183, #186):** every runtime string literal under `src/**` is now AST-scanned for internal process vocabulary (`Rule <n>`, `retry taxonomy`, `friction log`, `handoff`, `worktree`, `E<nn>`) and issue references — the exact leak class #174 shipped for months, including terms split across string concatenation. The terminal-status ratchet was a line-regex that matched one of eight spellings and ignored `exitCode`-as-success; it is now an AST walk covering comparisons (any quote style or alias), membership tests, failure-list definitions, and numeric exit-code comparisons, with recorded allow-list reasons for genuine exemptions.
|
|
198
|
+
- **Development:** `@earendil-works/*` devDependencies to 0.87.0 — the runtime had been ahead of the type-check gate; all five 0.87 breaking changes were verified to miss us, and a live probe on the new runtime confirmed the background settle path. 1102 tests across 50 files.
|
|
199
|
+
|
|
200
|
+
## [2.3.7] - 2026-09-20
|
|
201
|
+
|
|
202
|
+
- **A died run is no longer reported as a success (issue #179):** the SDK resolves `session.prompt()` on a mid-run provider death — `handleRunFailure` records an assistant message carrying `stopReason: "error"`, then the run *resolves*. Our settle path had no `error` branch: it derived status from `exitCode` alone and set `completed` unconditionally, so a death landed as `completed` / `exitCode: 0`. Three such deaths were observed in a single day, one of them *while implementing this very fix*. Status is now classified from the terminal `stopReason` — `stop` → completed, `aborted` → stopped, and `error`/`length`/`toolUse`/`deferred`/`pending` → **failed**, with `truncated`/`incomplete` distinguishing the non-error endings. The reason is carried into the run entry *and* the notification; work volume (`turns`, `tokensOut`, `finalTurnError`) is persisted so "did nothing" is distinguishable from "did work then died"; the failure headline is re-added after tail truncation instead of being pushed out of the body; and every failure verdict routes through one shared predicate — the TUI renderers and the parallel/chain/graph aggregates had private copies that stamped a green success on units recorded failed.
|
|
203
|
+
- **The extension finally writes its log file (issue #179, D6):** `createLogger(prefix, cwd?)` enables file output only when given a `cwd`, and **both call sites omitted it** — so `.pi/subagent-logs/brl-subagent.log` had never been written in the project's history. A `setLogCwd` setter now points it at the session cwd on session start, and a settle line records status, stopReason, turns, tokens and error. The 0o700/0o600 modes and rotation are preserved. This is the forensic trail whose absence made the day's deaths unexplainable.
|
|
204
|
+
- **Template-only and retry-only dispatch work again (issue #175):** both were rejected with `Invalid task: Task must not be empty.` because the single-mode sanitize ran *before* the two blocks that assign the task body. Templates are documented to carry the task body itself, and a retry re-runs the recorded task — both supported shapes that could not be used, reproduced live here and hit by a user's LLM in the wild. Template resolution now runs first, and the retry block sits between it and the sanitize (deliberately **not** before it — `resolveRetryParams` returns a fresh object that drops `template`). An explicit `task` that would have failed validation while a template wins now warns through the same `pi.sendMessage` path as the unknown-parameter warning, rather than vanishing silently.
|
|
205
|
+
- **Internal process vocabulary removed from runtime output (issue #174):** every completion message ended with *"apply the retry taxonomy … Rule 18 governs terminations"* — a rule defined only in a gitignored file users never receive, unfollowable by construction, shipped since v2.3.3. Also removed: `(issue #98)` from the retry-run-id tool result and `(issue #81)` from the dangling-preset warning. The test that had asserted the leaked string verbatim now pins the intent instead.
|
|
206
|
+
- **The release pipeline verifies the artifact before staging (process, issue #176):** `publish.yml` gated on `tsc` and `vitest`, both against the dev checkout, then staged — so nothing exercised what npm actually installs. A model-free, deterministic smoke test now packs the tarball, asserts the runtime assets `pkgPath()` resolves (including `AGENT.md`, the #158 regression), loads the packed entry via jiti, and checks every runtime import against the packed dependency declarations — all **before** `npm stage publish`, so a broken artifact cannot be staged.
|
|
207
|
+
- **Development:** the `@earendil-works/*` SDK devDependencies moved to 0.86.0 (type-only API changes; the peer range stays `*`, so nothing ships differently), alongside typebox 1.3.31 and a vitest bump. 1034 tests across 46 files.
|
|
208
|
+
|
|
209
|
+
## [2.3.6] - 2026-09-12
|
|
210
|
+
|
|
211
|
+
- **The 2.3.5 lessons became guards (issue #166):** the shipped docs' version claims are now pinned to `package.json` — the README `**Version:**` line must match it, and AGENT.md's H1 must stay version-free. That makes the release ritual's version inventory **mechanical**: a forgotten step now fails CI instead of shipping quietly, which is exactly how 2.3.5 shipped three stale strings. A forward-compat ratchet mirrors the existing #114 precedent.
|
|
212
|
+
- **Maintainer content out of the shipped AGENT.md (issue #165):** AGENT.md is in the package `files` allowlist, so its `## Local development` section — local-path installs, worktree pointing, the `sync-extension.sh` retirement — reached every user's conductor as part of the capability reference. It moved to the worktree skill (gitignored dev tooling), and the skill's cross-reference to it was repointed so nothing dangles.
|
|
213
|
+
- **npm is the sole user-facing install path (issue #171):** the documented git alternative was removed. Its own text admitted the trade — a pinned ref is never advanced by `pi update --extensions` — so following it pinned a user out of updates. Git installs remain possible via pi; they are simply no longer advertised.
|
|
214
|
+
- **The obsolete update notifier is gone (issue #164):** it duplicated pi's native *"Package updates are available. Run `pi update --extensions`"* notice, sent users to a GitHub release that updates nothing, and — because our pipeline publishes the GitHub release *before* the npm version goes live — could announce a version that `pi update --extensions` could not yet install. `src/update.ts` and its tests are deleted, the command/config-knob/state fields removed; the module count drops 31 → 30. Existing sessions carrying the old keys still load — they are ignored, not rejected.
|
|
215
|
+
- **Development:** dependabot bumped vitest 4 → 5 (a major, CI-verified) and typebox 1.3.25 → 1.3.29. The typebox dev/runtime divergence — pi bundles **1.3.7** — was verified **inert** for our surface (nine primitive builders; byte-identical schema output across 1.3.7, 1.3.25 and 1.3.29) and is now recorded in `ARCHITECTURE.md` so it need not be re-investigated. 979 tests across 44 files.
|
|
216
|
+
|
|
217
|
+
## [2.3.5] - 2026-09-11
|
|
218
|
+
|
|
219
|
+
- **brl-subagent is now a published pi package (npm):** install with `pi install npm:brl-subagent` (global) or `pi install -l npm:brl-subagent` (project-local), update with `pi update --extensions`, remove with `pi remove npm:brl-subagent`. The manifest gains `peerDependencies` for the five pi-bundled core packages (declared with `"*"` — pi supplies them, we do not bundle) so production installs (`--omit=dev`) resolve correctly, plus the `license`/`repository` metadata npm requires. Verified end-to-end: a sandboxed `pi install npm:brl-subagent` lands the extension and pulls exactly one package. Git installs remain supported and are documented as the pinned alternative.
|
|
220
|
+
- **AGENT.md now ships and resolves (issue #158):** the capability reference was omitted from the published tarball, and the `delegate_task` guideline hardcoded the retired sync-copy path — so npm-installed conductors were pointed at a file that did not exist. AGENT.md is now in `files`, and its path is derived from the extension's own directory (correct for npm-store, git-store, and local-path installs alike).
|
|
221
|
+
- **Package-root path resolution consolidated (issue #160):** a new `pkgPath()` helper single-sources the `<pkg>/src` → `<pkg>` resolution used for `presets/`, `templates/`, `package.json`, and `AGENT.md` — seven duplicated call sites across two modules. The focused review proved the refactor behaviour-preserving, including loading the nine built-in templates through the helper.
|
|
222
|
+
- **Guideline path contract pinned (issue #162):** the AGENT.md guidance test asserted only the filename, so a reverted hardcoded path would have stayed green. It now pins that the guideline interpolates the computed helper result, and asserts the retired path cannot return.
|
|
223
|
+
- **Development:** the release pipeline is token-free — `publish.yml` uses OIDC trusted publishing and **stages** each version for maintainer approval (npm's recommended posture; this trusted publisher is not permitted to publish directly). The changelog moved out of the README into this file, and the README's installation section is now npm-first. 979 tests across 45 files.
|
|
224
|
+
|
|
225
|
+
## [2.3.4] - 2026-09-04
|
|
226
|
+
|
|
227
|
+
- **The conductor knowledge gap closed (issue #154):** the LLM's only standing knowledge channel — the tool schema — was current for mechanics but stale at the behavioral layer, and two places actively taught the polling anti-pattern (pre-#147 text). The fix package: a new **AGENT.md** at the repo root (the authoritative agent-facing reference — execution models, the completion contract, delegation judgment, canonical shapes); **schema rewrites** replacing the poll-teaching text with the wake contract + the `completionNotify` knob dependency; a **generated template summary** in the guidance (mirroring the preset summary); a **pinning test** so behavioral features can't ship without their LLM-facing text. An adversarial review caught a critical interpolation bug (a `${…}` placeholder in a double-quoted string — dead code that shipped a literal placeholder, pre-existing in the preset line too) and a knob-inaccurate AGENT.md claim; both fixed, with the pinning test break-verified to genuinely catch regressions. The acceptance behavior — a conductor waiting for the wake instead of polling — was demonstrated live.
|
|
228
|
+
- **Development:** pi-sdk group aligned to ^0.85.0 (harness parity). The bump gate caught an upstream packaging gap — pi-coding-agent@0.85.0's main entry statically imports the undeclared `@earendil-works/pi-server`; a direct devDependency bridges it until pi declares the dep (filed upstream). 976 tests across 44 files.
|
|
229
|
+
|
|
230
|
+
## [2.3.3] - 2026-09-02
|
|
231
|
+
|
|
232
|
+
- **Completion-push wake (issue #147):** the extension now pushes a structured completion message into the conductor's session when a background run reaches a terminal state — `pi.sendMessage` with `triggerTurn: true` wakes an idle conductor, so the user no longer relays "subagent has completed its work". The message carries id · duration · cost · error category + output tail + a soft directive; delivery mode follows the urgency split (failed/stopped → steer, completed → followUp); the `completionNotify` knob (`all` / `failed` / `off`) controls the wake while delivery stays always-on. Verified live end-to-end (completed, stopped, and mid-turn delivery) — the first milestone of the conductor-autonomy arc.
|
|
233
|
+
- **One notification per run (issue #149):** the poller's pre-existing short completion echoes (`Background agent "X" completed.`) are removed — they duplicated the #147 wake with strictly less information and bypassed the knob. Crash notices (the poller-unique edges) stay. Reviewed and merged after the double-notification was discovered live during the #147 probes.
|
|
234
|
+
- **Development:** toolchain aligned with pi itself — TypeScript 5.9.3 (pi's published compiler line) and the pi-sdk group at 0.84.4 (the running harness). The proposed TypeScript 7.0.2 major was declined: we follow the published SDK's line, not the dev-branch experiment. 971 tests across 43 files.
|
|
235
|
+
|
|
236
|
+
## [2.3.2] - 2026-08-27
|
|
237
|
+
|
|
238
|
+
- **Honest termination records (issue #120):** user-cancelled and timed-out subagent runs no longer record an empty, indistinguishable failure — the kill paths stamp the abort source (`Subagent aborted by user` / `Timed out after Xms`) with honest error categories (`aborted` / `timeout`), foreground and background alike (including the catch-all path). Failure diagnostics also enrich the record with the model-error turn count. The status bar and SLA breakdown now tell the truth about how runs ended. (The dominant provider-side connection-error class is external — diagnosed and mitigated, not fixable here.)
|
|
239
|
+
- **Intercom [TO:] extraction only matches standalone lines (issue #129):** subagents that quoted the message format mid-sentence no longer have their instruction-quotes extracted as real messages — the anchored pattern + sender guidance keep the E10 channel clean, verified live with the exact adversarial shape (deepseek-v4-flash emitted both quote and real line; only the real line arrived).
|
|
240
|
+
- **Per-unit run-entry family complete (issue #136):** `finalizeUnitRunCrash`, `pruneHistoryIfNeeded`, and `registerLiveRun` single-source the remaining per-unit duplication — the #132 family's finish. The focused review caught and fixed a real label-fallback delta (unlabeled chain steps keep their `Step N` live label) before merge.
|
|
241
|
+
- **Dead code removed (issue #141):** the unused `stripMessageLines` function, its export, and its tests.
|
|
242
|
+
- **Process:** Rule 18 codified (termination triage + retry taxonomy + no time limits on implementers); every fix verified at point of use; all subagent dispatches background-by-default. 944 tests across 42 files.
|
|
243
|
+
|
|
244
|
+
## [2.3.1] - 2026-08-25
|
|
245
|
+
|
|
246
|
+
- **Graph and chain runs visible in the live monitor (issue #130):** nodes and steps register with `/brl-subagent monitor` for the first time — each row shows label, model, and per-unit priority (the call-level floor now applies in chain mode too), and the drill-in streams the node's current work exactly like parallel subtasks. Registration follows issue #119's crash-protected pattern — a spawn throw finalizes the entry, so no stuck `running` ghosts.
|
|
247
|
+
- **Run records + status-bar breakdown for graph/chain (issue #133):** the reason #130's entries were invisible: the monitor's staleness sweep treats a foreground live entry without a persisted run entry as stale and finalizes it on the first render. Graph/chain now get the full run-record lifecycle (persist `running` at spawn → finalize with status/cost/tokens/output at completion → crash-protected), restoring the sweep's invariant with zero changes to the sweep. New surfaces: **aggregate dispatch entries** in run history ("Graph dispatch: N tasks in M waves") and a live **mode breakdown in the status bar** — `graph wave x/y · node x/y` and `chain step x/y` — composed with the background counters.
|
|
248
|
+
- **Process:** PR #134 was reviewed (adversarial, approve-with-nits → 3 findings fixed pre-merge), reviewed by the user before merge, and verified end-to-end at point of use — the monitor/status-bar/history ritual that failed three times during #130's verification now passes for both graph and chain probes. 912 tests across 41 files.
|
|
249
|
+
|
|
250
|
+
## [2.3.0] - 2026-08-23
|
|
251
|
+
|
|
252
|
+
- **Parallel subtasks get run entries (issue #119):** the monitor's per-run drill-in now shows parallel subtasks like any other run — each subtask persists a `SubagentRun` at spawn (with its **per-unit priority** from issue #114) and finalizes at completion with status, model, duration, cost, tokens, and sanitized output. The prior known limitation (parallel priority was arbitration-only, invisible in the monitor) is closed. Crash-path finalize mirrors single mode (a spawn throw can no longer leave a stuck `running` entry).
|
|
253
|
+
- **Background run entries carry real cost + output (issue #122):** the finalized background run entry now populates `cost`/`tokensIn`/`tokensOut`/`outputSummary`/`fullOutput` — usage is extracted from the session's assistant messages (`accumulateUsage`, the same fold foreground uses) on every terminal path (completed, aborted, failed, catch-all). Timed-out runs no longer report zero tokens. The record's shape is fully honest (no undefined required fields).
|
|
254
|
+
- **Typecheck gate + 85 pre-existing type errors fixed (issue #117):** CI now runs `tsc --noEmit` (strict) between install and tests; a `typecheck` script and repo `tsconfig.json` (strict, bundler resolution, tests excluded) land with it. The 85 errors the gate surfaced — schema-vs-annotation drift, handler signatures mismatched to the SDK contract, a UI file written against a different SDK surface — are fixed at the root (17 remaining sites in the TUI are SDK-surface drift deliberately deferred to issue #124, marker-bridged with `@ts-expect-error` + issue refs). The pre-flight (`check-repo.sh`) runs the same gate locally, so drift is caught before a worktree builds on it.
|
|
255
|
+
- **Process:** PR #125 was reviewed in tiers (runtime-relevant adversarial tier → second opinion → checkpoint classification → config/markers), with the tiered protocol catching a dead-guard lie and three flaws in the proposed fix before merge. 892 tests across 40 files.
|
|
256
|
+
|
|
257
|
+
## [2.2.1] - 2026-08-18
|
|
258
|
+
|
|
259
|
+
- **Priority: from config knob to per-unit arbitration (issue #114):** the `/brl-subagent priority` menu item is removed — priority is decomposition-relative (a unit's importance is unknowable until the conductor plans), so it belongs in the conversation, not configuration. In its place: **per-unit `priority` on `tasks[]`/`graph[]` items** (the units that actually compete for concurrency slots; `chain[]` deliberately excluded — the array order IS the priority). Retries now **preserve priority** (the retry snapshot was missing it — a per-call `critical` delegation silently lost its priority on retry). The drill-in monitor shows `p:<priority>` on runs that declare it. Known limitation: parallel subtasks have no per-subtask run entries (pre-existing), so their priority is arbitration-only, not yet visible in the monitor.
|
|
260
|
+
|
|
261
|
+
## [2.2.0] - 2026-08-16
|
|
262
|
+
|
|
263
|
+
- **Foreground drill-in parity (issue #105):** the full-screen transcript overlay now works for **foreground** delegations too — the streaming `message_update` deltas (thinking/text/toolCall) that were previously discarded are captured and rendered through the same planner as the background path. Foreground runs also finalize + persist failed run entries on crash (no more stuck "running" rows) and fall back to the run entry's full output on stale selection. The monitor is now category-agnostic.
|
|
264
|
+
- **Background runs are retry-able (issue #98):** `spawnBackgroundSession` now persists a session run entry (`id == agent.id`) with an `originalParams` snapshot, finalized on every settle path — so `retryRunId: <agent-id>` resolves for background runs instead of silently no-oping. Unknown retry ids now fail loudly instead of warning quietly.
|
|
265
|
+
- **Warn on unknown `delegate_task` params (issue #99):** TypeBox's `Type.Object` allows additional properties by default and pi passes them through — a typo like `thinkinglevel` was silently ignored. `findUnknownParams` diffs received keys against the schema's known set and warns (never rejects). `priority` (critical/high/normal/low) is now a first-class schema param — fully plumbed to the concurrency queue for chain/parallel/graph/single modes. A ratchet test ties the known-key set to the registered schema, so the two can never drift.
|
|
266
|
+
- **Warn visibility (issue #110):** the unknown-param warn routes through `pi.sendMessage` (`delegate-notification`, `display: true`) so both the LLM and the human actually *see* the correction — `console.warn` alone is swallowed by the TUI.
|
|
267
|
+
- **Worktree tooling (issues #100/#106):** `worktree-prep.sh --force-isolated` for dependency-bump worktrees (with dangling-symlink repair and a pre-flight wiring), a post-merge staleness WARN in cleanup, and a worktree-guard backstop that blocks `npm install`/`npm ci` through a symlinked `node_modules`.
|
|
268
|
+
- **CI hardening (issue #104):** concurrency group with `cancel-in-progress` + 15-minute job timeout.
|
|
269
|
+
- **DRY (issue #108):** the 11-field `originalParams` snapshot is a single `snapshotOriginalParams` helper shared by both run-record creation sites.
|
|
270
|
+
|
|
271
|
+
## [2.1.7] - 2026-08-14
|
|
272
|
+
|
|
273
|
+
- **Monitor drill-in — full-screen transcript overlay (issue #89):** in `/brl-subagent monitor`, select a row (↑/↓) and press enter for a **full-screen live view of the subagent's chain of thought** — the last ~6 messages rendered from the live session: 🧠 thinking blocks (dimmed tail), 🛠 tool calls, 💬 user messages, 📝 assistant text, plus the in-progress streaming message, refreshing every 200ms. Esc returns to the list. Prototype-first: built on a branch, tested live against a real background review, then promoted.
|
|
274
|
+
- **Top-level `model` param (issue #96):** `delegate_task` now accepts `model: "provider/model-id"` to override the model per call — previously only per-step (chain/tasks) had this, and a top-level `model:` was silently ignored (running the default instead). Precedence: per-call > preset > config > conductor; an invalid or unavailable override falls back with a warning.
|
|
275
|
+
- **Recurring-task scheduler removed (issue #91):** `/brl-subagent schedule` is gone — it only ran while pi was open (cron is the right tool for real recurrence), reached `delegate_task` through a fragile private API, and was never used. The graph-mode scheduler is unaffected.
|
|
276
|
+
- **README commands table pinned (issue #92):** a test now asserts the documented commands match the real dispatch in both directions — it already caught a stale row and an undocumented command.
|
|
277
|
+
- Shipped as 5 commits (#90, #93, #94, #97 + docs). 846 tests across 39 files.
|
|
278
|
+
|
|
279
|
+
## [2.1.6] - 2026-08-09
|
|
280
|
+
|
|
281
|
+
- **Preset/template precedence fixed (issue #84):** the documented intent (PROJECT-LOCAL > USER-GLOBAL > BUILTIN) is now the actual behavior — both loaders dedup by name with project-first scanning. Previously a user-global override silently beat a project-local one; a test that had pinned the buggy behavior was inverted.
|
|
282
|
+
- **Builtin task templates (issue #66 follow-up):** 9 companion templates ship with the extension (`code-review`, `security-audit`, `write-tests`, `debug-issue`, `refactor`, `write-docs`, `analyze-data`, `implement-feature`, `prototype`) — one per builtin preset, each a thin teaching example with a `${param}` slot. The template architecture is now fully symmetric with presets: three tiers (builtin / user-global / project-local), identical precedence, same load lifecycle.
|
|
283
|
+
- **Tier labels in template browse:** `/brl-subagent templates` now shows `[B]`/`[G]`/`[P]` prefixes (and the detail view a tier suffix), so you can see at a glance which file to edit to override a template — mirroring the preset manager's convention.
|
|
284
|
+
- **Dangling preset references warn at load (issue #81):** a template whose `preset:` names a nonexistent preset no longer fails silently — a session-start cross-check warns naming the template, the dangling reference, and the consequence. Warn-not-skip: the run still proceeds preset-less, but the footgun is visible.
|
|
285
|
+
- Shipped as 4 commits (#85, #86, #87, #88). 827 tests across 38 files.
|
|
286
|
+
|
|
287
|
+
## [2.1.5] - 2026-08-08
|
|
288
|
+
|
|
289
|
+
- **DevDeps aligned with the pi runtime (issue #69):** all four `@earendil-works/*` packages bumped to `^0.84.1` — the caret on a 0.x range previously forbade the running version, so the contract tests verified the wrong SDK. The delta was pre-investigated safe (abort contract byte-identical); the contract-test tripwire passes.
|
|
290
|
+
- **Dependabot live (issue #69 part 2):** grouped weekly updates (`pi-sdk` lockstep group + `other` group); every bump PR runs the full test suite as the tripwire. First PR merged (typebox 1.3.10).
|
|
291
|
+
- **Memory retention fixed (issue #31):** `_sessionRef` is released on every terminal path — a completed background agent no longer holds a live session object. The poller was made null-safe so the release can't be misread as a crash.
|
|
292
|
+
- **Silent test drift killed (issue #59):** `resolveSubagentParams` extracted from the index.ts closure into `src/params.ts`; the drifting test replica was deleted and 29 tests now exercise the real function — mutation-verified to catch regressions.
|
|
293
|
+
- **TUI hygiene (issues #61 #45):** the monitor row-render is DRY via pure `src/tui-format.ts` helpers (caught an already-drifted elapsed format and unified it); the misleading `/brl-subagent gitmode` menu was removed — the per-call `gitMode` param is the real control.
|
|
294
|
+
- **File-backed task templates (issue #66):** templates now live as frontmatter+body `.md` files (body = task, multiline by construction) in `~/.pi/agent/brl-subagent/templates/` or `<project>/.pi/brl-subagent/templates/` — mirroring the proven custom-preset pattern. The single-line TUI add/remove was removed; `/brl-subagent templates` browses. Dogfooded on a real review.
|
|
295
|
+
- **Crash-result builder (issue #68):** the 3× duplicated crash-catch envelope is now one `buildCrashResult`; `steer_subagent`/`stop_subagent` error paths pass `ctx.cwd` so sibling-project paths are properly masked.
|
|
296
|
+
- Shipped as 8 commits (#72, #73, #74, #76, #77, #78, #79, #80). 792 tests across 37 files.
|
|
297
|
+
|
|
298
|
+
## [2.1.4] - 2026-08-07
|
|
299
|
+
|
|
300
|
+
- **Monitor liveness self-healing (issue #52):** the live monitor no longer shows stale "running" entries after the background poller dies mid-run (extension reload, crash). Both render loops sweep the live map and finalize entries that are provably terminal; `finalizeLiveSubagent` returns its claim so the sweep and a delayed poller can never double-decrement the active counter. Test storage is now injectable, so unit tests no longer pollute real `.pi/subagents` state.
|
|
301
|
+
- **Error & secret hygiene (issues #29 #30 #65):** persisted run data is written with owner-only permissions; error messages are sanitized before persist/echo (paths, trailing slashes, Windows boundaries), closing the residual raw-echo class across foreground, background tool-level, chain/graph, and runner paths.
|
|
302
|
+
- **Permissions non-retroactive (issue #68):** files created before the #29 fix keep their original permissions — there is no automatic migration. Re-apply owner-only perms with e.g. `find ~/.pi/agent/brl-subagent -type f -exec chmod 600 {} +` and `find ~/.pi/agent/brl-subagent -type d -exec chmod 700 {} +` (project-local installs: do the same for their `.pi/subagents` and `.pi/output` trees).
|
|
303
|
+
- **H1 pre-task validation (issue #34):** chain/parallel/graph modes now run the same pre-task validation as single mode — `outputFile` + `readonly` conflicts are caught before dispatch instead of silently ignored.
|
|
304
|
+
- **Auto-route intent (issue #57):** an explicitly-specified `preset` in `delegate_task` is no longer overridden by auto-route.
|
|
305
|
+
- **Monitor row disambiguation (issue #55):** the live monitor shows a short agent id per row, so same-named subagents are distinguishable.
|
|
306
|
+
- Shipped as 8 commits (#58, #60, #62, #63, #64, #67, #70, #71). 732 tests across 35 files.
|
|
307
|
+
|
|
308
|
+
## [2.1.3] - 2026-08-06
|
|
309
|
+
|
|
310
|
+
- **Real abort for background agents (issue #28):** the `stop_subagent` tool and async `stopAgent()` abort the live session via `session.abort()` — the pending `prompt()` resolves with `stopReason: "aborted"` and the agent is marked `stopped`. Previously steering/stopping only flipped a status flag and the session kept running.
|
|
311
|
+
- **Per-agent timeout + hard cap:** a deadline is armed before the prompt runs; when exceeded the session is aborted and the agent ends `stopped` with the timeout reason. The hard cap actually aborts now (was an orphaned-session leak). Timeouts are normalized (`0`/negative/`NaN`/`Infinity`/`≥2^31` → no timeout) and a double-fire guard prevents acting on an already-settled agent.
|
|
312
|
+
- **Background safety controls:** `gitMode: 'branch'` creates a work branch before the run, commits and captures the diff at teardown (surfaced via `get_subagent_result`), then discards the branch — dirty working trees are refused; `approvalMode: 'always'` is rejected in background (no dialog) and `'writes'` auto-approves with a warning; the R5 session cost limit gates background spawns.
|
|
313
|
+
- **Real-git test tier (Gate A):** new `*-real.test.ts` convention runs real git against scratch repos, covering the branch lifecycle and the `captureWorkingDiff` untracked-file fix.
|
|
314
|
+
- **Crash fix (incidental):** transcript completion no-ops on a missing transcript file (was an uncaughtException killing pi); defensive settle-handler wrappers across the background lifecycle.
|
|
315
|
+
- Shipped as 4 PRs (#47 real abort, #49 timeouts, #50 safety controls, #51 Gate A) + incidentals (#48 CI flake, #54 crash fix). Live-verified 2026-08-06 — foreground, background, timeout abort (stopped @ 20s), gitMode=branch lifecycle (branch created/discarded, diff rendered), stop_subagent — all pass. 684 tests across 34 files.
|
|
316
|
+
|
|
317
|
+
## [2.1.2] - 2026-08-01
|
|
318
|
+
|
|
319
|
+
- **Per-step model override:** chain/parallel/graph steps can declare their own `model` (`step.model > global preset > config > conductor`), availability-checked with fallback to the global model. Resolves issue #3 (per-step presets intentionally not implemented — see design decision).
|
|
320
|
+
- **Security hardening:** agent ids validated as UUIDs before any filesystem access (`assertSafeAgentId` — closes agent-id path traversal); background sessions never import extension/skill code from the target cwd (loader built with `noExtensions`/`noSkills` — closes cwd→code-execution RCE).
|
|
321
|
+
- **Preset tool visibility:** the `delegate_task` tool description now exposes each preset's tool restrictions (e.g. `security-auditor (read-only: excludes write, edit, bash)`); auto-routed presets are reported in the tool result.
|
|
322
|
+
- **H1 loud failure:** `outputFile` combined with an unavailable `write` tool is now a hard error before spawn (was a silent failure); background mode runs H1 validation too.
|
|
323
|
+
- **Background prompt injection:** background sessions receive the full built prompt (base + custom + preset guidance + subagent instructions) via `DefaultResourceLoader.appendSystemPrompt` — same semantics as pi's `--append-system-prompt`; background honors resolved `toolOptions` and resolves the model string to a real Model object.
|
|
324
|
+
- **Prompt guideline wiring:** `promptGuideline` from presets is now appended to the subagent prompt as a "## Preset Guidance" section.
|
|
325
|
+
- **Auth-aware model availability:** preset models are checked against catalog presence AND provider auth (extracted to `src/model-availability.ts`); SDK contract tests pin the real `ModelRegistry` surface.
|
|
326
|
+
- **SDK contract tests:** new `sdk-contract.test.ts` guards against silent SDK drift (real ModelRegistry, env-independent).
|
|
327
|
+
- 646 tests across 31 files.
|
|
328
|
+
|
|
329
|
+
## [2.1.1] - 2026-07-29
|
|
330
|
+
|
|
331
|
+
- **Background agent notifications:** the conductor sees a notification when a background agent completes, crashes, or times out (via `deliverAs: "followUp"`).
|
|
332
|
+
- **Custom preset discovery:** custom presets survive `pi install` updates — `.pi/brl-subagent/presets/` (project-local) and `~/.pi/agent/brl-subagent/presets/` (global), same YAML frontmatter format, override built-ins with the same name.
|
|
333
|
+
- **Live monitor & footer:** background subagents appear in the footer with live counters (running / completed / unseen); polling guards against double-decrement and stale contexts.
|
|
334
|
+
- **Tool system fixes:** `edit` auto-includes `write` (pi tool dependency chain); subagent prompt clarifies exactly which tools are available.
|
|
335
|
+
- **Removed:** sandbox system, backend system (dead code), 12 dead exports, 80K lines of bloat from git tracking.
|
|
336
|
+
|
|
337
|
+
## [2.1.0] - 2026-07-20
|
|
338
|
+
|
|
339
|
+
- **Footer live counters:** Footer now shows background subagent activity with live counters.
|
|
340
|
+
- **Background subagent concurrency fix:** Fixed dynamic import and serialization queue for reliable parallel execution.
|
|
341
|
+
- **Tool system fix:** `edit` tool now auto-includes `write`; prompt clarifies which tools are available to subagents.
|
|
342
|
+
- **Backend system removed:** Removed dead backend code that was no longer used.
|
|
343
|
+
- **Foreground transcript recording:** All tasks now record transcripts for full observability.
|
|
344
|
+
- **Dead code cleanup:** Removed 12 unused exports across the codebase.
|
|
345
|
+
- **Phase 5 Hardening complete (H1–H4):** Pre-task validation, integration tests, post-mortem diagnostics, and conductor guardrails finalized.
|
|
346
|
+
|
|
347
|
+
### H1 — Pre-task validation
|
|
348
|
+
|
|
349
|
+
Deterministic pre-spawn checks that validate tool configuration and thinking level match the task description. Warns about **thinking level mismatches** (e.g., `off` thinking on a complex debugging task) and **missing tools** for the requested task. **Hard-rejects** combinations that cannot work — e.g. `outputFile` when the `write` tool is unavailable (a preset like `security-auditor` excludes it) — with a visible error before any tokens are spent.
|
|
350
|
+
|
|
351
|
+
### H2 — Integration test suite
|
|
352
|
+
|
|
353
|
+
Two-tier test coverage:
|
|
354
|
+
- **Tier 1:** jiti import verification — confirms the extension loads without errors.
|
|
355
|
+
- **Tier 2:** Subprocess execution — verifies the extension can spawn and communicate with a subagent process.
|
|
356
|
+
|
|
357
|
+
### H3 — Post-mortem diagnostics
|
|
358
|
+
|
|
359
|
+
When a subagent fails, analyzes the failure and suggests concrete fixes:
|
|
360
|
+
- Git mode mismatch (e.g., `gitMode: 'branch'` when repo is dirty)
|
|
361
|
+
- Thinking level too low for the task complexity
|
|
362
|
+
- Timeout issues and recommendations for increasing limits
|
|
363
|
+
|
|
364
|
+
### H4 — Conductor guardrails
|
|
365
|
+
|
|
366
|
+
Behavior rules embedded in `promptGuidelines` and `SUBAGENT_INSTRUCTIONS` that guide the conductor LLM to configure subagents correctly before spawning. Prevents common misconfigurations at the prompt level.
|