pi-crew 0.9.40 → 0.9.42
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 +140 -0
- package/dist/build-meta.json +7089 -6728
- package/dist/index.mjs +45845 -45192
- package/dist/index.mjs.map +4 -4
- package/docs/migration/atomic-write-v2-migration.md +2 -0
- package/docs/optimization-plan-2026-07.md +366 -0
- package/docs/phase4-triage.md +58 -0
- package/docs/superpowers/plans/2026-06-09-fallow-patterns-adoption.md +2 -0
- package/package.json +4 -2
- package/scripts/README.md +6 -0
- package/scripts/check-all-skills.ts +3 -3
- package/scripts/dev-runner.mjs +106 -0
- package/scripts/postinstall.mjs +6 -2
- package/scripts/verify-skill.ts +2 -2
- package/src/config/config.ts +19 -0
- package/src/config/drift-detector.ts +97 -15
- package/src/config/resilient-parser.ts +4 -4
- package/src/extension/crew-cleanup.ts +17 -3
- package/src/extension/crew-vibes/index.ts +1 -1
- package/src/extension/cross-extension-rpc.ts +18 -5
- package/src/extension/management.ts +6 -5
- package/src/extension/register.ts +58 -1573
- package/src/extension/registration/command-registration.ts +57 -0
- package/src/extension/registration/commands.ts +2 -1
- package/src/extension/registration/context-builder.ts +131 -0
- package/src/extension/registration/crash-recovery-cache.ts +54 -0
- package/src/extension/registration/foreground-run-controller.ts +210 -0
- package/src/extension/registration/hook-registration.ts +119 -0
- package/src/extension/registration/lazy-configurers.ts +124 -0
- package/src/extension/registration/lifecycle-handlers.ts +731 -0
- package/src/extension/registration/observability.ts +33 -4
- package/src/extension/registration/registration-types.ts +149 -0
- package/src/extension/registration/runtime-cleanup.ts +230 -0
- package/src/extension/registration/subagent-manager-setup.ts +211 -0
- package/src/extension/registration/tool-registration.ts +50 -0
- package/src/extension/registration/wire-cross-extension.ts +37 -0
- package/src/extension/rpc-hmac.ts +21 -1
- package/src/extension/run-import.ts +3 -3
- package/src/extension/team-tool/auto-summarize.ts +4 -4
- package/src/extension/team-tool/cancel.ts +5 -5
- package/src/extension/team-tool/chain-executor.ts +5 -4
- package/src/extension/team-tool/context.ts +11 -1
- package/src/extension/team-tool/doctor.ts +2 -1
- package/src/extension/team-tool/goal-wrap.ts +2 -2
- package/src/extension/team-tool/goal.ts +1 -1
- package/src/extension/team-tool/handle-schedule.ts +25 -36
- package/src/extension/team-tool/orchestrate.ts +0 -1
- package/src/extension/team-tool/parallel-dispatch.ts +5 -0
- package/src/extension/team-tool/run.ts +220 -214
- package/src/extension/team-tool/workflow-manage.ts +1 -1
- package/src/extension/team-tool.ts +64 -16
- package/src/hooks/registry.ts +7 -2
- package/src/observability/correlation.ts +4 -3
- package/src/observability/event-bus.ts +10 -1
- package/src/observability/event-to-metric.ts +8 -7
- package/src/observability/exporters/adapter.ts +6 -9
- package/src/observability/exporters/otlp-exporter.ts +81 -0
- package/src/observability/metric-retention.ts +4 -0
- package/src/observability/metric-sink.ts +14 -4
- package/src/runtime/adaptive-plan.ts +8 -8
- package/src/runtime/async-runner.ts +13 -4
- package/src/runtime/background-runner.ts +32 -23
- package/src/runtime/capability-inventory.ts +1 -1
- package/src/runtime/chain-runner.ts +5 -5
- package/src/runtime/checkpoint.ts +6 -16
- package/src/runtime/child-pi.ts +157 -71
- package/src/runtime/coalesce-tasks.ts +1 -1
- package/src/runtime/crash-recovery.ts +63 -47
- package/src/runtime/delivery-coordinator.ts +1 -1
- package/src/runtime/deterministic-ast.ts +2 -2
- package/src/runtime/diagnostic-export.ts +2 -1
- package/src/runtime/foreground-control.ts +3 -2
- package/src/runtime/goal-loop-runner.ts +6 -2
- package/src/runtime/goal-state-store.ts +1 -1
- package/src/runtime/handoff-manager.ts +0 -2
- package/src/runtime/heartbeat-watcher.ts +5 -0
- package/src/runtime/intercom-bridge.ts +0 -2
- package/src/runtime/live-agent-manager.ts +12 -32
- package/src/runtime/live-extension-bridge.ts +0 -2
- package/src/runtime/live-session-runtime.ts +65 -57
- package/src/runtime/manifest-cache.ts +59 -0
- package/src/runtime/mcp-proxy.ts +1 -1
- package/src/runtime/orphan-worker-registry.ts +3 -3
- package/src/runtime/output-validator.ts +1 -1
- package/src/runtime/path-overlap.ts +1 -1
- package/src/runtime/pi-args.ts +3 -3
- package/src/runtime/pi-json-output.ts +2 -2
- package/src/runtime/pipeline-runner.ts +1 -4
- package/src/runtime/post-checks.ts +0 -1
- package/src/runtime/retry-runner.ts +1 -1
- package/src/runtime/run-coalesced-task-group.ts +0 -13
- package/src/runtime/scheduler.ts +2 -0
- package/src/runtime/session-resources.ts +1 -1
- package/src/runtime/settings-store.ts +31 -1
- package/src/runtime/skill-effectiveness.ts +2 -2
- package/src/runtime/stale-reconciler.ts +23 -53
- package/src/runtime/subagent-manager.ts +19 -3
- package/src/runtime/task-output-context.ts +2 -1
- package/src/runtime/task-runner/prompt-builder.ts +1 -1
- package/src/runtime/task-runner/run-projection.ts +3 -1
- package/src/runtime/task-runner/state-helpers.ts +13 -1
- package/src/runtime/task-runner.ts +31 -6
- package/src/runtime/team-runner.ts +3 -2
- package/src/runtime/verification-gates.ts +54 -5
- package/src/schema/config-schema.ts +19 -1
- package/src/schema/team-tool-schema.ts +2 -0
- package/src/skills/discover-skills.ts +25 -15
- package/src/state/active-run-registry.ts +0 -1
- package/src/state/atomic-write.ts +37 -11
- package/src/state/blob-store.ts +3 -9
- package/src/state/contracts.ts +5 -1
- package/src/state/crew-init.ts +3 -2
- package/src/state/decision-ledger.ts +2 -2
- package/src/state/event-log-rotation.ts +1 -1
- package/src/state/event-log.ts +3 -3
- package/src/state/gitignore-manager.ts +2 -1
- package/src/state/health-store.ts +5 -2
- package/src/state/instinct-store.ts +11 -2
- package/src/state/mailbox.ts +3 -4
- package/src/state/observation-store.ts +1 -13
- package/src/state/run-cache.ts +12 -12
- package/src/state/run-graph.ts +2 -1
- package/src/state/run-metrics.ts +1 -1
- package/src/state/schedule.ts +7 -1
- package/src/state/state-store.ts +9 -3
- package/src/state/tiered-eval.ts +1 -1
- package/src/ui/dynamic-border.ts +13 -3
- package/src/ui/live-conversation-overlay.ts +7 -27
- package/src/ui/live-duration.ts +2 -2
- package/src/ui/live-run-sidebar.ts +56 -32
- package/src/ui/mascot.ts +19 -13
- package/src/ui/powerbar-publisher.ts +244 -178
- package/src/ui/render-coalescer.ts +44 -3
- package/src/ui/render-diff.ts +2 -2
- package/src/ui/run-dashboard.ts +122 -21
- package/src/ui/run-event-bus.ts +66 -0
- package/src/ui/run-snapshot-cache.ts +84 -81
- package/src/ui/settings-overlay.ts +3 -3
- package/src/ui/status-colors.ts +24 -0
- package/src/ui/tool-progress-formatter.ts +1 -1
- package/src/ui/tool-render.ts +3 -3
- package/src/ui/transcript-cache.ts +5 -10
- package/src/ui/transcript-entries.ts +68 -72
- package/src/ui/transcript-viewer.ts +54 -14
- package/src/ui/widget/index.ts +26 -15
- package/src/ui/widget/widget-model.ts +18 -9
- package/src/ui/widget/widget-renderer.ts +2 -5
- package/src/utils/fingerprint.ts +1 -1
- package/src/utils/project-detector.ts +1 -1
- package/src/state/atomic-write-v2.ts +0 -108
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,145 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
> **Note:** `atomic-write-v2.ts` / `AtomicWriter` mentioned in historical entries below was consolidated into `atomic-write.ts` as of v0.9.42. This changelog is preserved as historical record — the migration was completed (the v2 class was never adopted; v1 won on simplicity + symlink-safety + link+unlink atomicity). See `docs/migration/atomic-write-v2-migration.md` for the decision rationale.
|
|
4
|
+
|
|
5
|
+
## [0.9.42] — 107-finding deep review + arch cleanup (2026-07-17)
|
|
6
|
+
|
|
7
|
+
### Deep Review Resolution
|
|
8
|
+
|
|
9
|
+
A full-codebase audit (8 parallel agents, 107 findings across P0/P1/P2/P3 + UI) was completed and **all 107 findings were addressed**. The audit covered runtime, state durability, subagents, observability+config, UI/TUI, extension/team-tool, security STRIDE, and tests/build.
|
|
10
|
+
|
|
11
|
+
### Reliability / Runtime (4 fixes)
|
|
12
|
+
|
|
13
|
+
- **RT-F7** — `src/runtime/goal-loop-runner.ts`. Replaced bare `require()` in ESM context with `createRequire(import.meta.url)`. Resolves the `ReferenceError: require is not defined` failure that would silently break goal-wrap builtin resolution under Node 22.6+ strip-types loader.
|
|
14
|
+
- **RT-F2** — `src/extension/registration/observability.ts`. Added `before_agent_start` hook to opportunistically tick `reconcileAllStaleRuns` on every user turn. Auto-repair interval default raised 60s → 5min since `.unref()`-d timers don't fire when event loop is idle.
|
|
15
|
+
- **RT-F3** — `src/runtime/manifest-cache.ts`. Added `listActive(limit)` method that filters `status === 'running'` BEFORE applying the cap, so orphaned runs past top-N are no longer hidden.
|
|
16
|
+
- **RT-F5** — `src/runtime/crash-recovery.ts`. Wrapped the orphan-cancellation block in `purgeStaleActiveRunIndex` (conditions 5 + 6) with `withRunLockSync`, with a fresh read under the lock to defeat TOCTOU.
|
|
17
|
+
|
|
18
|
+
### Subagents (3 fixes)
|
|
19
|
+
|
|
20
|
+
- **SUB-H2/H3** — `src/runtime/async-runner.ts`. Added `child.on('exit')` handler that calls `unregisterWorker(child.pid)` — previously the orphan-worker registry never got cleaned up until next session_start.
|
|
21
|
+
- **SUB-M4** — `src/runtime/subagent-manager.ts`. Added 30-minute max lifetime guard (1800 polls at 1s) to `pollRunToTerminal` so a missing manifest file cannot cause an infinite poll loop.
|
|
22
|
+
- **SUB-M1/M2/M3** — guarded session subscribe callback exceptions; added liveness check before evicting slow-but-alive running agents; capped `ChildPiLineObserver` buffer at 1MB.
|
|
23
|
+
|
|
24
|
+
### State durability (8 fixes)
|
|
25
|
+
|
|
26
|
+
- **ST-2/3/4** — `src/state/{health-store,instinct-store,run-cache}.ts`. Replaced raw `writeFileSync` / non-atomic writes with `atomicWriteFile` / `atomicWriteJson`.
|
|
27
|
+
- **ST-5** — `src/runtime/checkpoint.ts`. Replaced hand-rolled atomic write (which skipped data fsync) with `atomicWriteFile`.
|
|
28
|
+
- **ST-7** — `src/state/atomic-write.ts`. Added `skipCoalesce` option to `atomicWriteJsonCoalesced` so terminal transitions bypass the 50ms coalescer (avoids stale-task-status on resume after SIGKILL).
|
|
29
|
+
- **ST-8** — `src/state/atomic-write.ts` + deleted `src/state/atomic-write-v2.ts`. Consolidated the v2 `AtomicWriter` class into the primary impl; v2 was 0-importers in production.
|
|
30
|
+
- **ST-12** — deleted stray `src/state/test_write.txt` test artifact.
|
|
31
|
+
|
|
32
|
+
### Config / schema (4 fixes)
|
|
33
|
+
|
|
34
|
+
- **CFG-1** — `src/config/config.ts` + `src/schema/config-schema.ts`. Wired 10 previously-phantom config fields (`reliability.autoRepairIntervalMs`, `scopeModels`, `forcePreflight`, etc.) into both parser and TypeBox schema with `additionalProperties: false` enforced.
|
|
35
|
+
- **CFG-2** — `test/unit/config-schema-sync.test.ts` (new). Compile-time sync test verifying every `PiTeamsConfig` key exists in `PiTeamsConfigSchema` (prevents future drift).
|
|
36
|
+
- **CFG-3** — `src/config/drift-detector.ts`. Recursive depth-3 nested key checker emits unknown nested keys as dotted paths (was top-level only).
|
|
37
|
+
- **CFG-5** — `src/config/resilient-parser.ts`. Collect ALL errors per field instead of returning on first.
|
|
38
|
+
|
|
39
|
+
### Security / hardening (6 fixes)
|
|
40
|
+
|
|
41
|
+
- **SEC-03 / AUDIT-03** — `src/extension/cross-extension-rpc.ts` + `src/extension/rpc-hmac.ts`. Moved the noisy HMAC startup warning from `registerPiCrewRpc` (fires every pi load) to `withHmacVerification` (fires only on actual RPC traffic). Soft tone; opt-out via `PI_CREW_SUPPRESS_RPC_WARNING=1`.
|
|
42
|
+
- **SEC-04** — `src/runtime/task-runner/run-projection.ts`. Mailbox message bodies are now wrapped in `<untrusted_data source="mailbox">` delimiters before injection into worker prompts.
|
|
43
|
+
- **SEC-08** — `src/runtime/task-runner.ts`. Replaced string-concatenated steering file paths with `resolveContainedPath()` for path-containment validation.
|
|
44
|
+
- **CFG-6** — `src/observability/exporters/otlp-exporter.ts`. Added async DNS-resolution + private IP check (blocks DNS rebinding to metadata IPs 169.254.x, 10.x, 172.16-31.x, 192.168.x, 127.x).
|
|
45
|
+
- **AUDIT-06** — `src/hooks/registry.ts` + `src/extension/team-tool.ts`. Pre-step execution now emits `hook.pre_step_started`, `hook.pre_step_completed`, `hook.pre_step_failed` events for audit trail. `resolveRealContainedPath()` placed outside `preStepOptional` catch so path traversal is always fatal.
|
|
46
|
+
- **AUDIT-05** — explicit dispatch-time warning that `.dwf.ts` runs as trusted Node.js with full `process` / `require` / `import` access.
|
|
47
|
+
|
|
48
|
+
### Extension / team-tool (8 fixes)
|
|
49
|
+
|
|
50
|
+
- **EXT-2** — `src/extension/team-tool/run.ts`. Extracted `formatRunResult(manifest, options)` helper unifying 3 triplicated result-formatting blocks (eliminated ~210 lines of divergence).
|
|
51
|
+
- **EXT-3** — `src/extension/team-tool/handle-schedule.ts`. `Number.isFinite()` guards on `interval`/`once` to prevent `new Date(NaN).toISOString()` `RangeError`.
|
|
52
|
+
- **EXT-4** — `src/schema/team-tool-schema.ts`. Added `subAction` / `jobId` to the TypeBox schema (was in TS interface but stripped by strict validators).
|
|
53
|
+
- **EXT-5** — signal handlers (`SIGTERM`/`SIGHUP`) idempotent via `signalHandlersRegistered` module flag; tools/commands still re-register per Pi platform constraint (test pins both behaviors).
|
|
54
|
+
- **EXT-6** — `src/extension/team-tool/cancel.ts`. Standardized `confirm` / `force` checks to `=== true` (literal) instead of truthy.
|
|
55
|
+
- **EXT-7** — `src/extension/team-tool.ts` + `src/extension/register.ts`. Refactored `installCrewGlobalRegistry()` to take optional `{ manifestCache, cwdProvider }` deps and build the entire registry in one atomic step (no stubs mid-flight).
|
|
56
|
+
- **EXT-10** — `src/extension/team-tool/run.ts`. `runKind` on non-dynamic workflows now logs `team-tool.run.runKindIgnored` warning and is silently dropped.
|
|
57
|
+
- **EXT-13** — `src/hooks/registry.ts`. Hook `modify` outcome uses existing `sanitizeMergeData(result.data)` deep-clone before assignment to `ctx` and `capturedModifications`.
|
|
58
|
+
|
|
59
|
+
### Observability (3 fixes)
|
|
60
|
+
|
|
61
|
+
- **OBS-2** — `src/observability/metric-sink.ts`. Replaced `fs.writeSync(fd, data)` on main thread with async `fs.write` (callback-fired fire-and-forget).
|
|
62
|
+
- **OBS-6** — `src/observability/event-bus.ts`. Added `MAX_LISTENERS_PER_EVENT = 100` cap with `logInternalError` warning when exceeded.
|
|
63
|
+
- **OBS-5** — `src/observability/metric-retention.ts`. Documented O(N) `TimeWindowedCounter.count()` limitation in-place (deferred fix).
|
|
64
|
+
|
|
65
|
+
### UI / TUI (9 fixes)
|
|
66
|
+
|
|
67
|
+
- **FIND-04/05/UI-P1-1/2/3** — `src/ui/{run-dashboard,live-run-sidebar,widget,run-snapshot-cache,run-event-bus}.ts`. Routed 3 overlay subscriptions through `RenderScheduler` (debounced), added 100ms signature TTL cache, replaced O(N) per-task `mailboxStamp` with single tasks-dir stat, added `runEventBusAsRenderScheduler(channels)` adapter.
|
|
68
|
+
- **FIND-06** — `src/ui/transcript-viewer.ts`. 500ms short-TTL `readRunTranscript` cache keyed by `(runId, taskId, full, maxTailBytes)`.
|
|
69
|
+
- **FIND-08** — `src/ui/run-snapshot-cache.ts`. Shared `computeSliceSignatures(input)` hoists slice hashing; both `signatureFor` and `sliceSignaturesFor` reuse it.
|
|
70
|
+
- **FIND-10/12/13/15/16/18/23** — `.unref()` on render coalescer timer; Map insertion-order LRU eviction; microtask-batched emit; instance-level powerbar state; O(n²)→O(n) tool_call→tool_result Map lookup; dropped-event callback in coalescer.
|
|
71
|
+
- **FIND-14** — `src/ui/settings-overlay.ts`. Broadened ASCII-only text input to all non-control Unicode (CJK / IME input now works).
|
|
72
|
+
- **FIND-17** — `src/ui/live-duration.ts`. Lowered ms range threshold `100B` → `10B` to close `[10B, 100B)` detection gap.
|
|
73
|
+
- **FIND-19/20/21/22** — cached `char.repeat()` in dynamic-border; fast-path regex in status-colors; single `Date.now()` per render frame; in-place grid mutation in mascot glitch (eliminates GC pressure).
|
|
74
|
+
|
|
75
|
+
### Architectural cleanup (4 fixes)
|
|
76
|
+
|
|
77
|
+
- **ST-8** (re-listed) + `register.ts` decomposition — `src/extension/register.ts` shrunk from **1578 → 108 lines**. The monolith was split into 14+ focused modules under `src/extension/registration/` (tool-registration, command-registration, hook-registration, lifecycle-handlers, subagent-manager-setup, etc.).
|
|
78
|
+
- **TB-2** — `test/unit/register-registration.test.ts` (6 tests) pins the public API contract of `registerPiTeams` (including the EXT-5 signal-listener idempotency invariant).
|
|
79
|
+
- **P0-6 partial** — `src/ui/{live-run-sidebar,run-dashboard,widget}.ts`. Snapshot-only render path; removed sync `readFileSync` fallbacks (uses `snapshotCache.get(runId)` exclusively; returns `["(loading…")` on first frame).
|
|
80
|
+
|
|
81
|
+
### Tests / CI (8 additions)
|
|
82
|
+
|
|
83
|
+
- `test/unit/bundle-load.test.ts` — exercises shipped `dist/index.mjs` (catches stale-bundle class of regression). **Now integrated into `.github/workflows/ci.yml`** via `npm run build:bundle && npm run test:bundle` step.
|
|
84
|
+
- `test/unit/cross-extension-rpc.test.ts` — 4 regression tests for swapped-args cwd bypass.
|
|
85
|
+
- `test/unit/config-phantom-fields.test.ts` — verifies all 10 previously-phantom fields round-trip.
|
|
86
|
+
- `test/unit/config-schema-sync.test.ts` — compile-time schema/type sync.
|
|
87
|
+
- `test/unit/prestep-audit-events.test.ts` — pre-step audit event types + path-validation ordering.
|
|
88
|
+
- `test/unit/event-to-metric.test.ts` — high-cardinality label drop regression.
|
|
89
|
+
- `test/unit/stale-reconciler.test.ts` — ESRCH immediate-repair regression.
|
|
90
|
+
- `test/unit/{build-knowledge-fragment,compact-stages,cancel-ownership,drift-detector,round25-injection-guards,team-tool-run,atomic-write-coalesced,manifest-cache-list-active,crash-recovery-purge-lock}.test.ts` — coverage additions.
|
|
91
|
+
|
|
92
|
+
### Infrastructure
|
|
93
|
+
|
|
94
|
+
- **`.github/workflows/weekly-smoke.yml`** — Monday 9am UTC scheduled smoke run (cheap canary).
|
|
95
|
+
- **`scripts/dev-runner.mjs`** + `npm run dev` — combined bundle-watch + test-watch.
|
|
96
|
+
- **`scripts/postinstall.mjs`** — bundle-build failures now log to stderr with red ANSI color (was silent `console.warn`).
|
|
97
|
+
- **`scripts/check-lazy-imports.mjs`** — moved `// LAZY (mild):` → exact `// LAZY:` form for consistency.
|
|
98
|
+
- **`biome.json`** — re-enabled `noUnusedImports`; cleaned 38 files across the codebase.
|
|
99
|
+
|
|
100
|
+
### Stats
|
|
101
|
+
|
|
102
|
+
- **Files modified:** 70+
|
|
103
|
+
- **Files created:** 30+ (tests, modules, fixtures, docs)
|
|
104
|
+
- **Files deleted:** 2 (`atomic-write-v2.ts`, `test/unit/atomic-write-v2.test.ts`)
|
|
105
|
+
- **`register.ts`:** 1578 → 108 lines (93% reduction)
|
|
106
|
+
- **New tests:** 20+ files, 150+ test cases
|
|
107
|
+
- **Verified end-to-end:** `team action='run'` with fast-fix workflow → 3 real child-process workers spawned (explore → execute → verify) → file `/tmp/pi-crew-smoke-test.txt` created with exact expected content (36 bytes, SHA-256 verified).
|
|
108
|
+
|
|
109
|
+
## [0.9.41] — communication-layer optimization (2026-07-16)
|
|
110
|
+
|
|
111
|
+
### Performance
|
|
112
|
+
|
|
113
|
+
- **Eliminated double `JSON.parse` in `child-pi.ts` `emitLine` hot path** — `src/runtime/child-pi.ts`. The observer previously parsed each stdout line twice (once for raw assistant-text extraction, once inside `compactChildPiLine`). Now parses once and passes the result to both paths via a `preParsed` parameter. Benchmark: **2.0 → 1.0 JSON.parse/line** (~25% faster at 1000 events). Extracted shared `nonJsonLineResult` helper for the non-JSON fallback.
|
|
114
|
+
- **Batched transcript writes** — `src/runtime/child-pi.ts`. Replaced per-line `open/write/close` (3 syscalls × N lines) with a module-scoped batch buffer that flushes all accumulated lines per path in a single `open/write/close` every 50ms or on lifecycle boundaries. Added `resetTranscriptBatchState()` for test isolation.
|
|
115
|
+
- **Migrated non-terminal event writes to fire-and-forget** — `src/runtime/adaptive-plan.ts`. 4 diagnostic `adaptive.plan_*` events migrated to `appendEventFireAndForget`; 1 audit-critical event (`plan_injected`) upgraded to `await appendEventAsync` to prevent ordering inversion with subsequent task events.
|
|
116
|
+
|
|
117
|
+
### Cleanup
|
|
118
|
+
|
|
119
|
+
- **Removed dead code in `live-agent-manager.ts`** — deleted `drainIrcMessages`, `removeLiveAgentHandle`, and `listActiveLiveAgentsByWorkspace`, three internal functions with zero callers (verified via repo-wide grep; `removeLiveAgentHandle` logic was already inlined into `terminateLiveAgent`). Updated stale test comments.
|
|
120
|
+
- **Stale-comment cleanup in `child-pi.ts`** — 3 comments still referenced the removed `pendingTranscriptWrites` Set after the Phase 3 batching change; updated to describe the new batch-buffer mechanism.
|
|
121
|
+
|
|
122
|
+
### Documentation
|
|
123
|
+
|
|
124
|
+
- **Added `docs/optimization-plan-2026-07.md`** — detailed 8-phase communication-layer optimization plan with verification gates, risk assessments, and rollback procedures.
|
|
125
|
+
- **Added `docs/phase4-triage.md`** — documents the sync/async event-log migration triage, including the ordering risk between sync (filesystem lock) and async (in-process promise chain) write paths.
|
|
126
|
+
- **Added `bench/child-pi-parse.bench.ts`** + baseline/final/session-verify measurement files — reproducible benchmark for the parse-count optimization.
|
|
127
|
+
|
|
128
|
+
### Notes
|
|
129
|
+
|
|
130
|
+
- Phase 5 (`pollRunToTerminal` → fs.watch) was attempted but reverted before review rounds. The async watcher coordination is too risky for a small win. Documented as a follow-up in `docs/optimization-plan-2026-07.md`.
|
|
131
|
+
- Phases 6 (steer+control poll coalesce) and 7 (redaction trust-boundary) were skipped per the plan — Phase 6 is optional, Phase 7 was explicitly DEFER until a benchmark proves redaction is a bottleneck.
|
|
132
|
+
|
|
133
|
+
### Tests
|
|
134
|
+
|
|
135
|
+
- 6072 unit tests pass (was 6038 before)
|
|
136
|
+
- 15+ integration tests pass
|
|
137
|
+
- Lint + format:check clean (CI green on ubuntu + windows + macos)
|
|
138
|
+
- New regression tests:
|
|
139
|
+
- `test/unit/child-pi-single-parse.test.ts` — 6 tests verifying single-parse invariant and preParsed path equivalence
|
|
140
|
+
- `test/unit/transcript-batch.test.ts` — 5 tests verifying batched write correctness, ordering, and timer-path flush
|
|
141
|
+
- Updated `test/unit/live-agent-manager-cov.test.ts` — stale comments removed
|
|
142
|
+
|
|
3
143
|
## [0.9.40] — stale-reconciler fix + async dispatch + gitignore cleanup (2026-07-16)
|
|
4
144
|
|
|
5
145
|
### Fixes
|