pi-crew 0.10.2 → 0.10.4
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/AGENTS.md +2 -1
- package/CHANGELOG.md +249 -0
- package/README.md +5 -1
- package/dist/index.mjs +10844 -7250
- package/docs/architecture.md +4 -4
- package/docs/commands-reference.md +3 -0
- package/docs/publishing.md +15 -3
- package/install.mjs +90 -39
- package/package.json +9 -3
- package/schema.json +11 -0
- package/scripts/README.md +4 -3
- package/skills/real-test-pi-crew/REPORT-TEMPLATE.md +7 -2
- package/skills/real-test-pi-crew/SKILL.md +428 -82
- package/src/config/config-merge.ts +11 -1
- package/src/config/config-validation.ts +40 -1
- package/src/config/config.ts +28 -6
- package/src/config/defaults.ts +35 -10
- package/src/config/env-vars.ts +27 -2
- package/src/config/migration-validator.ts +113 -0
- package/src/config/types.ts +36 -0
- package/src/extension/cross-extension-rpc.ts +3 -7
- package/src/extension/register.ts +13 -0
- package/src/extension/registration/lifecycle-handlers.ts +40 -9
- package/src/extension/registration/observability.ts +3 -7
- package/src/extension/registration/subagent-tools.ts +3 -7
- package/src/extension/registration/team-tool.ts +56 -12
- package/src/extension/registration/ui.ts +3 -8
- package/src/extension/registration/viewers.ts +3 -10
- package/src/extension/team-manager-command.ts +3 -7
- package/src/extension/team-tool/api/agent-control.ts +17 -10
- package/src/extension/team-tool/api/heartbeat.ts +4 -3
- package/src/extension/team-tool/api/mailbox.ts +33 -20
- package/src/extension/team-tool/api/plan-approval.ts +5 -5
- package/src/extension/team-tool/api/task-claims.ts +8 -7
- package/src/extension/team-tool/cancel.ts +6 -0
- package/src/extension/team-tool/doctor.ts +364 -7
- package/src/extension/team-tool/handle-settings.ts +23 -1
- package/src/extension/team-tool/inspect.ts +10 -2
- package/src/extension/team-tool/run.ts +3 -7
- package/src/extension/team-tool/status.ts +12 -0
- package/src/extension/team-tool.ts +41 -16
- package/src/hooks/registry.ts +62 -56
- package/src/prompt/inbox-poll.ts +90 -0
- package/src/prompt/message-tool.ts +166 -0
- package/src/prompt/prompt-runtime.ts +201 -18
- package/src/prompt/scratchpad-lifecycle.ts +3 -3
- package/src/prompt/surface-worker.ts +720 -0
- package/src/prompt/worker-events-channel.ts +49 -3
- package/src/runtime/async-runner.ts +29 -1
- package/src/runtime/background-runner.ts +43 -42
- package/src/runtime/broker/broker-issuer.ts +27 -2
- package/src/runtime/broker/crew-broker-tokens.ts +56 -4
- package/src/runtime/broker/crew-broker.ts +334 -443
- package/src/runtime/broker/delegate/delegate-event.ts +37 -0
- package/src/runtime/broker/mailbox-observer/mailbox-fanout.ts +59 -0
- package/src/runtime/broker/protocol/connection-state.ts +103 -0
- package/src/runtime/broker/protocol/events-replay.ts +68 -0
- package/src/runtime/broker/protocol/manifest-loader.ts +20 -0
- package/src/runtime/broker/protocol/msg-inbox.ts +69 -0
- package/src/runtime/broker/protocol/request-parsers.ts +175 -0
- package/src/runtime/broker/protocol/wait-auth.ts +46 -0
- package/src/runtime/child-pi/child-pi-spawn.ts +23 -9
- package/src/runtime/child-pi/child-pi-streams.ts +9 -1
- package/src/runtime/child-pi/child-pi.ts +368 -5
- package/src/runtime/crew-agent-records.ts +13 -1
- package/src/runtime/dispatch-batch.ts +12 -1
- package/src/runtime/event-log-tail-source.ts +374 -0
- package/src/runtime/finalize-run.ts +19 -7
- package/src/runtime/foreground-control.ts +19 -6
- package/src/runtime/goal-workflow/dynamic-workflow-context.ts +6 -0
- package/src/runtime/goal-workflow/dynamic-workflow-runner.ts +3 -0
- package/src/runtime/goal-workflow/goal-loop-runner.ts +29 -27
- package/src/runtime/goal-workflow/goal-state-store.ts +3 -0
- package/src/runtime/heartbeat/heartbeat-watcher.ts +3 -3
- package/src/runtime/live-session/live-agent-manager.ts +34 -1
- package/src/runtime/live-session/live-control-realtime.ts +10 -0
- package/src/runtime/live-session/live-session-runtime.ts +47 -27
- package/src/runtime/manifest-cache.ts +128 -17
- package/src/runtime/model/pi-args.ts +59 -65
- package/src/runtime/output/sidechain-output.ts +61 -6
- package/src/runtime/plan-replan.ts +3 -0
- package/src/runtime/process/proc-stat.ts +46 -0
- package/src/runtime/process/zombie-scanner.ts +32 -19
- package/src/runtime/spawn-policy.ts +27 -41
- package/src/runtime/stale-reconciler.ts +28 -3
- package/src/runtime/supervisor-contact.ts +3 -0
- package/src/runtime/surface/degrade.ts +776 -0
- package/src/runtime/surface/herdr-provider.ts +546 -0
- package/src/runtime/surface/launch-script.ts +172 -0
- package/src/runtime/surface/resolve-surface.ts +274 -0
- package/src/runtime/surface/surface-provider.ts +129 -0
- package/src/runtime/surface/surface-spawn.ts +475 -0
- package/src/runtime/surface/tmux-provider.ts +400 -0
- package/src/runtime/task-runner/child-executor.ts +80 -0
- package/src/runtime/task-runner/post-execution.ts +57 -2
- package/src/runtime/task-runner/prompt-builder.ts +1 -0
- package/src/runtime/task-runner/retrieval-orchestrator.ts +191 -56
- package/src/runtime/task-runner/state-helpers.ts +54 -30
- package/src/runtime/task-runner.ts +4 -2
- package/src/runtime/team-runner.ts +104 -3
- package/src/schema/config-schema.ts +24 -0
- package/src/state/atomic-write.ts +219 -40
- package/src/state/coordination/locks.ts +7 -5
- package/src/state/coordination/mailbox.ts +56 -10
- package/src/state/event-log/cursor.ts +413 -23
- package/src/state/event-log/event-log.ts +120 -113
- package/src/state/event-log/sequence-cache.ts +21 -3
- package/src/state/stores/ownership-map.ts +5 -4
- package/src/state/stores/plan-store.ts +12 -0
- package/src/state/stores/state-store.ts +103 -6
- package/src/state/types.ts +51 -0
- package/src/ui/inline-panel/agent-pane.ts +3 -0
- package/src/ui/powerbar-publisher.ts +3 -7
- package/src/ui/render-diff.ts +16 -8
- package/src/ui/run-action-dispatcher.ts +7 -10
- package/src/ui/run-dashboard.ts +87 -42
- package/src/ui/run-event-bus.ts +10 -1
- package/src/ui/run-snapshot-cache.ts +83 -35
- package/src/ui/settings-overlay.ts +4 -1
- package/src/ui/transcript-cache.ts +101 -13
- package/src/ui/transcript-viewer.ts +92 -24
- package/src/ui/widget/index.ts +32 -8
- package/src/utils/visual.ts +43 -0
- package/src/worktree/worktree-manager.ts +65 -4
package/AGENTS.md
CHANGED
|
@@ -69,7 +69,8 @@ npm test
|
|
|
69
69
|
|
|
70
70
|
- `src/extension/team-tool.ts` — main tool actions
|
|
71
71
|
- `src/runtime/team-runner.ts` — workflow scheduler
|
|
72
|
-
- `src/runtime/task-runner.ts` — task execution and artifacts
|
|
72
|
+
- `src/runtime/task-runner.ts` + `src/runtime/task-runner/` — task execution and artifacts (thin entry + phase modules: pre-execution, child-executor, post-execution, …)
|
|
73
|
+
- `src/runtime/child-pi/` — child Pi process runtime (spawn/streams/kill/steering/timers/transcript modules)
|
|
73
74
|
- `src/state/` — durable state/event/artifact store
|
|
74
75
|
- `src/worktree/` — worktree creation and cleanup
|
|
75
76
|
- `agents/`, `teams/`, `workflows/` — builtin resources
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,255 @@
|
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
+
## [0.10.3] — MuxSurface: workers in real panes + per-team-run tabs (2026-09-01)
|
|
6
|
+
|
|
7
|
+
128 commits since v0.10.2. The headline feature is **MuxSurface A1** (spec
|
|
8
|
+
`docs/superpowers/specs/2026-08-26-mux-surface-design.md` v0.7.1, ADR
|
|
9
|
+
`docs/decisions/2026-08-26-mux-surface-a1.md`): crew workers can now live in
|
|
10
|
+
REAL multiplexer panes instead of headless stdio pipes.
|
|
11
|
+
|
|
12
|
+
### MuxSurface A1 — pane-backed workers
|
|
13
|
+
|
|
14
|
+
- **SurfaceProvider abstraction** (`src/runtime/surface/`) with twin backends:
|
|
15
|
+
tmux (libtmux-style CLI) and herdr (socket API, newline-JSON). Fail-closed
|
|
16
|
+
by design: every failure (no mux, forced-mode detect fail, depth, cap, role)
|
|
17
|
+
degrades to the headless path and the run still completes — pane engagement
|
|
18
|
+
is proven by events (`worker.surface_spawned`/`worker.surface_closed`),
|
|
19
|
+
never by the run's green status alone.
|
|
20
|
+
- **Surface gating follows env + config, not run-mode**: `runtime.surface.mode`
|
|
21
|
+
(auto/tmux/herdr/off) + `runtime.surface.visibleAgents` opt-in (default
|
|
22
|
+
`[]` = nobody). Async runs engage panes exactly like sync runs — the detached
|
|
23
|
+
background runner forwards mux env (TMUX/HERDR_*) so `no-mux` detection sees
|
|
24
|
+
the host's multiplexer (fix `f0a41a16`, verified live: 3/3 workers in panes
|
|
25
|
+
on an async run, tab closed at run end).
|
|
26
|
+
- **Per-team-run tabs (tab-layout, spec 2026-08-27)**: every TEAM RUN gets its
|
|
27
|
+
own tab/window (tmux `new-window -d` / herdr `tab.create`), max 8 worker
|
|
28
|
+
panes per tab before a new tab opens, alternating down/right splits, and the
|
|
29
|
+
tab closes ONLY when the run ends/cancels/is killed — workers finishing do
|
|
30
|
+
not close panes. Doctor closes orphan tabs by id + mux liveness.
|
|
31
|
+
- **herdr pane-parent fix**: spawns target the caller's pane via
|
|
32
|
+
`HERDR_PANE_ID` (never the focused pane — `pane.current` without
|
|
33
|
+
`caller_pane_id` follows focus, verified live on herdr 0.8.2).
|
|
34
|
+
- **Worker-side recorder + host tail**: surface workers write per-agent
|
|
35
|
+
`events.jsonl` (same shape as the host); the host tails it via
|
|
36
|
+
`EventLogTailSource` (incremental byte-offset reads, drain-before-close for
|
|
37
|
+
fast-closing panes, ENOENT backoff + log-once, and a steady-poll safety net
|
|
38
|
+
for FSEvents append coalescing on macOS).
|
|
39
|
+
- **D5 full-loadout**: workers are FULL pi sessions by default — no
|
|
40
|
+
`--no-extensions`, no tool allowlists; restrictions are per-agent opt-in via
|
|
41
|
+
frontmatter. **D8 nesting**: every role gets the `delegate` tool
|
|
42
|
+
(`nesting.maxDepth: 4`, kill switch in user config only). **D9 `message`**
|
|
43
|
+
tool: non-blocking notify/DM/group via broker with anti-spoof `from`
|
|
44
|
+
override.
|
|
45
|
+
- **ask gate flip**: `broker.waitMethodsEnabled` now defaults `true` — the
|
|
46
|
+
worker→parent blocking question path works out of the box (it had silently
|
|
47
|
+
slept behind the old default-off gate).
|
|
48
|
+
- **Broker token revocation**: stale-token + secret-based checks; terminal
|
|
49
|
+
runs (completed/failed/cancelled) reject worker tokens by definition
|
|
50
|
+
(late-worker protection).
|
|
51
|
+
|
|
52
|
+
### Verification for this release
|
|
53
|
+
|
|
54
|
+
- E2E real-mux suites: tmux 4/4 + herdr 5/5 (spawn/self-close,
|
|
55
|
+
kill-pane→degrade→headless resume, doctor orphan cleanup, tab per-run,
|
|
56
|
+
closeTabById fallback).
|
|
57
|
+
- Two full real-test batteries from live pi sessions
|
|
58
|
+
(`docs/real-test/reports/real-test-2026-08-30-post-tab-layout-live.md`,
|
|
59
|
+
`real-test-2026-08-31-post-fixes-live.md`): tab-layout verified with live
|
|
60
|
+
tmux polls (window per run, sequential worker panes, tab closed at run end),
|
|
61
|
+
async surface engagement verified post-fix, `set <array-key> []` config
|
|
62
|
+
round-trip fixed.
|
|
63
|
+
- CI all-green on ubuntu + macOS + Windows (first time since 2026-08-24);
|
|
64
|
+
lint/format drift and 5 layers of hidden cross-OS test failures cleared.
|
|
65
|
+
|
|
66
|
+
### Perf rounds also shipping in 0.10.3
|
|
67
|
+
|
|
68
|
+
Retained verbatim below: round-3 retrieval single-pass, round-2 fsync cleanup
|
|
69
|
+
+ polling latency, and the 2026-08-24 performance-review fixes.
|
|
70
|
+
|
|
71
|
+
### [0.10.3] perf: round 3 retrieval single-pass (retrieval 7.1s → 2.0s cold / 0.28s warm per task)
|
|
72
|
+
|
|
73
|
+
Root cause (measured on real run `team_20260826002634`, 2026-08-26 real test):
|
|
74
|
+
`runRetrievalCycle` spent up to ~7s CPU per task — 3 unconditional cycles (the
|
|
75
|
+
0.7 convergence threshold is unreachable with path-only scoring, observed
|
|
76
|
+
max 0.64), 55 keywords incl. filler over ~57k files, and a duplicate-
|
|
77
|
+
accumulating evaluation list (same file up to 3× in the top-10).
|
|
78
|
+
|
|
79
|
+
- Single discovery pass + dedupe by absolute path (`retrieval-orchestrator.ts`)
|
|
80
|
+
- STOPWORDS expanded (filler verbs/pronouns out; path-meaningful words kept)
|
|
81
|
+
- rg discovery cached per cwd, 60s TTL, cap 32 (fallback walk uncached)
|
|
82
|
+
- b13 bench guards cold <2s / cache-hit <400ms on the repo itself
|
|
83
|
+
|
|
84
|
+
| Metric (my_pi monorepo, full-length real-run goal) | Before (`745cf9f1`) | After | Delta |
|
|
85
|
+
|---|---|---|---|
|
|
86
|
+
| runRetrievalCycle cold | 7055 ms | 1980 ms | −72% |
|
|
87
|
+
| warm, new keywords (discovery cache) | 3335 ms | 275 ms | −92% |
|
|
88
|
+
| keywords from tokenize | 55 | 41 | −25% |
|
|
89
|
+
| duplicate paths in top-10 | up to 3×¹ | 0 | — |
|
|
90
|
+
|
|
91
|
+
¹ Observed ×3 on the original real-run workload; the identical-input baseline
|
|
92
|
+
re-measure shows max 1 (score-tie ordering can keep cycle-2/3 duplicates out
|
|
93
|
+
of the top slice — the cross-cycle accumulation mechanism itself is what T1
|
|
94
|
+
removed). See the probe report footnote.
|
|
95
|
+
|
|
96
|
+
Prompt-pipeline impact: the measured 6-8s/task gap (real test) had retrieval
|
|
97
|
+
as its dominant component; post-fix retrieval is 2.0s cold / 0.28s warm —
|
|
98
|
+
the non-retrieval remainder was not re-measured end-to-end yet (next real
|
|
99
|
+
test will confirm).
|
|
100
|
+
|
|
101
|
+
b13 (`bench/b13-retrieval-latency.bench.ts`) runs on the small pi-crew repo
|
|
102
|
+
(cold 83 ms / cache-hit 8 ms) — it is a smoke guard, not the monorepo
|
|
103
|
+
context above; a regression back to 3-cycle behavior stays under its budget
|
|
104
|
+
at that scale. Full follow-up note: `docs/real-test/reports/perf-round3-probe.md`.
|
|
105
|
+
Every number above was measured, not estimated.
|
|
106
|
+
|
|
107
|
+
### [0.10.3] perf round 2 (2026-08-25): fsync cleanup + polling latency
|
|
108
|
+
|
|
109
|
+
13 commits after the 2026-08-24 round (45 after `v0.10.2`) (27 files, +3,094/−105, excluding the plan doc and this changelog). Continuation of the 2026-08-24 performance review work, focused on durability escalations and polling latency. Implementation plan: `.superpowers/sdd/2026-08-25-perf-round2-fsync-and-polling/`. Validation evidence: task reports T1-T8 + `bench/b12-fsync-counts.bench.ts`.
|
|
110
|
+
|
|
111
|
+
### What changed (by area)
|
|
112
|
+
|
|
113
|
+
- **Pid files** — `withEventLogLockSync` writes lock pid files via `openSync(pidFile, "wx")` followed by plain write (0 fsyncs) instead of `atomicWriteFile` (2 fsyncs). The lock dir's `mkdir` is the mutex; pid files are mtime-stale-detected. Async `.alock` path unchanged.
|
|
114
|
+
- **Buffered event batch flush** — `appendBatchForBufferedWrite` skips fsync for all-non-terminal batches (terminal batches still fsync). Non-terminal buffered work now pays 0 fsyncs per batch.
|
|
115
|
+
- **Non-terminal tasks checkpoints** — opt-in best-effort fsync gate `PI_CREW_PERSISTENCE_SKIP_TASKS_FSYNC` (default `false`, beats config). When enabled, non-terminal `tasks.json` checkpoints are written with durability `"best-effort"` (0 fsyncs) while keeping the 50ms coalesced write grouping; terminal transitions and default-off path retain full durability. Reconstructible from the fsync'd event log.
|
|
116
|
+
- **Mailbox delivery marks** — `appendMailboxMessage` (regular sync delivery) now defaults to best-effort durability (delivery.json is informational; next message overwrites). Terminal `acknowledgeMailboxMessage` and `appendMailboxMessageAsync` paths keep explicit full durability.
|
|
117
|
+
- **Steering/ask polling** — event-driven adaptive cadence under live-session realtime: 50ms when realtime active (`hasLiveControlRealtimeListeners()`), 500ms when idle. Non-realtime workers stay at 500ms.
|
|
118
|
+
- **Events cursor tail reads** — verified watermark cache with inode-stamped entries (replaces unsound order-assumption fast path from first attempt). Unchanged stamps read zero bytes; growth reads only the appended delta `[verifiedOffset, size)` — the 4MB wide parse now happens only on cold/shrink/violation. Cache invalidates on inode change (compaction/rotation/rewrite) and drops entries on sinceSeq=0/no-limit reads.
|
|
119
|
+
- **Bench infra** — b5 (`deep-tracking`) repaired for deleted `observation-store` module; b11 (`dep-context-cache`) fixed NDJSON contract; new b12 (`b12.fsync-counts`) micro-bench spies `fs.fsyncSync` calls per operation.
|
|
120
|
+
- **Coalesced drain** — `flushPendingAtomicWrites` groups parent-dir fsyncs across all files in the drain (one `fsyncSync` per distinct dir, best-effort on win32). 4 files in one dir: 5 fsyncs total (4 data + 1 dir) vs 8 pre-grouping (4 data + 4 dir).
|
|
121
|
+
|
|
122
|
+
### Bench results (Linux x86_64, Node v22.23.1, `npm run bench`)
|
|
123
|
+
|
|
124
|
+
b12 fsync counts per operation (deterministic across runs; "before" refers to pre-round2 baseline):
|
|
125
|
+
|
|
126
|
+
| Operation | Before | After | Expectation |
|
|
127
|
+
|---|---|---|---|
|
|
128
|
+
| `appendEventSyncNonTerminal` | 2 | **0** | ≤1 (T1 pid write) |
|
|
129
|
+
| `appendEventSyncTerminal` | 3 | **1** | ==1 (documented) |
|
|
130
|
+
| `appendEventBufferedNonTerminalBatch8` | 1 | **0** | ==0 (T2 batch skip) |
|
|
131
|
+
| `tasksCheckpointNonTerminalFlagOff` | 2 | **2** | ≥1 (full durability) |
|
|
132
|
+
| `tasksCheckpointNonTerminalFlagOn` | 2 | **0** | ==0 (opt-in best-effort) |
|
|
133
|
+
| `appendMailboxMessageDeliveryMark` | 2 | **0** | ==0 (T4 best-effort) |
|
|
134
|
+
| `coalescedDrain4FilesOneDir` | 8 | **5** | ==5 (4 data + 1 dir, T8) |
|
|
135
|
+
|
|
136
|
+
Coalesced drain A/B (4 files, one dir, heavily loaded machine — indicative): median 36.6 ms (post-T8) vs 55.6 ms (pre-T8) for 5 vs 8 fsyncs. Idle-machine measurement: −61% wall-clock (pre-implementation plan measurement: 59.4→22.9ms; task-8's loaded A/B was 36.6 vs 55.6ms). The deterministic contract is the fsync count.
|
|
137
|
+
|
|
138
|
+
### Durability semantics
|
|
139
|
+
|
|
140
|
+
**Full durability retained** for: terminal event writes, terminal task transitions, all `acknowledgeMailboxMessage` calls, all direct `atomicWrite`/`atomicWriteJson` calls, and the default (flag-off) non-terminal checkpoint path. Every persistent state transition that is *not* reconstructible from the event log remains fsync'd.
|
|
141
|
+
|
|
142
|
+
**Best-effort (opt-in or informational-only)** for: pid files (lock dir is the mutex), non-terminal buffered event batches, non-terminal `tasks.json` checkpoints (when `PI_CREW_PERSISTENCE_SKIP_TASKS_FSYNC=1`), and `delivery.json` marks. These state components are reconstructible (pid files via mtime-stale detection; tasks.json from the fsync'd `events.jsonl`; delivery.json is informational and overwritten). A hard crash may lose the latest tail; recovery replays from the last fsync'd event.
|
|
143
|
+
|
|
144
|
+
### Known residuals (discovered, documented, left for follow-up)
|
|
145
|
+
|
|
146
|
+
- `flushOnePendingAtomicWrite`'s retry path is dead code (pre-existing; surfaced by T8): coalesced entries are deleted before the write attempt, so the catch block's `retryCount++` and `MAX_FLUSH_RETRIES` rethrow never execute. Fixing requires behavioral changes to failure semantics (separate task). *(→ resolved by the follow-up fixes below)*
|
|
147
|
+
- Cursor cache ino-recycle coincidence: same-path in-place truncate+regrowth would pass the delta-branch check if the rewrite preserved the inode (no current writer does; same accepted-risk class as transcript-cache). Documented in `src/state/event-log/cursor.ts`.
|
|
148
|
+
- Async mailbox twin (`appendMailboxMessageAsync`) retains full durability; T4 scoped to regular sync delivery only. *(→ resolved by the follow-up fixes below)*
|
|
149
|
+
- Tasks-checkpoint `loadConfig()` reads the flag at every save (negligible via 2s TTL cache).
|
|
150
|
+
|
|
151
|
+
### Follow-up fixes (branch `fix/round2-followups`, 2026-08-26)
|
|
152
|
+
|
|
153
|
+
- **Dead retry path fixed** — `flushOnePendingAtomicWrite`'s catch now re-queues the entry (the live map entry if a newer write arrived mid-flush, else the captured one) with exponential backoff, so a failed flush retries instead of silently dropping the buffered write; the error still propagates at `MAX_FLUSH_RETRIES`. Regression suite `test/unit/state/atomic-write-coalesced-retry.test.ts` (openSync ENOSPC injection; the coalescer contract is no-throw while retries remain).
|
|
154
|
+
- **Async mailbox twin aligned** — `appendMailboxMessageAsync` delivery marks drop to the best-effort default (mirror of the T4 sync-twin fix); third test in `mailbox-delivery-durability.test.ts` pins 0-fsync pure appends with init absorbed into the baseline.
|
|
155
|
+
- **Test isolation fix (not a production bug)** — `manifest-cache-list-active.test.ts` leaked the real user root into exact-membership assertions (listActive scans every run root by design, RT-F3); the suite now snapshots env and points `PI_CREW_HOME` at an empty temp home, deleting the precedence-winning `PI_TEAMS_HOME`.
|
|
156
|
+
|
|
157
|
+
### What did NOT improve
|
|
158
|
+
|
|
159
|
+
- Broker fan-out and worktree git-spawn memoization: unchanged (already addressed in round 1).
|
|
160
|
+
- Async mailbox path (`appendMailboxMessageAsync`): intentionally left at full durability (T4 scoped to sync delivery only). *(→ resolved by the follow-up fixes above)*
|
|
161
|
+
- Tasks-checkpoint coalescing: already present; T3 only added durability control, the 50ms grouping predates this branch.
|
|
162
|
+
|
|
163
|
+
### Verification
|
|
164
|
+
|
|
165
|
+
| Check | Result |
|
|
166
|
+
|---|---|
|
|
167
|
+
| `npm run typecheck` | pass |
|
|
168
|
+
| `npm run lint` | pass (2 warnings and 2 infos (all pre-existing)) |
|
|
169
|
+
| `npm run test:unit` | 7153 pass / 0 fail / 3 skipped (7156 total) (includes new T1/T2/T3/T4/T5/T6/T8 test suites) |
|
|
170
|
+
| `npm run bench` | legacy suite green; b5/b11 NDJSON contract repaired; b12 fsync-counts bench added (7 cases, all pass) |
|
|
171
|
+
|
|
172
|
+
### [0.10.3] perf: fix 2026-08-24 performance review findings (state persistence syscall ceremony, UI sync I/O storms, mailbox/event-log hot paths, broker fan-out, worktree git-spawn memoization)
|
|
173
|
+
|
|
174
|
+
28 commits after `v0.10.2` (53 files, +4,718/−433). Implements the plan at
|
|
175
|
+
`docs/superpowers/plans/2026-08-24-perf-review-fixes.md`: all Critical (C1–C3) and
|
|
176
|
+
High (H1–H6) findings from the 2026-08-24 performance review, plus the Medium sweep.
|
|
177
|
+
Validation evidence: `.superpowers/sdd/2026-08-24-perf-review-fixes/task-27-report.md`.
|
|
178
|
+
|
|
179
|
+
### What changed (by area)
|
|
180
|
+
|
|
181
|
+
- **State persistence syscall ceremony** — `persistSingleTaskUpdate` does a scoped
|
|
182
|
+
flush + in-lock CAS baseline (only the file being read is drained, not the whole
|
|
183
|
+
process); atomic-write coalescer gains a dir-exists memo and lazy stringify;
|
|
184
|
+
`saveRunTasksCoalesced` keeps the manifest half of the run cache across coalesced
|
|
185
|
+
saves (only tasks stamps are zeroed); artifacts containment verdict memoized 10s
|
|
186
|
+
(positives only); event-log lock pid files written ceremony-free (no fsync'd
|
|
187
|
+
tmp+rename for pid files) and the redundant post-reserve monotonic seq persist is
|
|
188
|
+
skipped (R16-B1 advance-on-reserve untouched); pre-append stat hoisted and
|
|
189
|
+
reader-less sequenceCache upkeep dropped; lock acquire pre-check caches the
|
|
190
|
+
symlink verdict; mailbox reads go through a stat-gated parse cache.
|
|
191
|
+
- **UI sync I/O storms** — widget refresh is coalesced on the `fs.watch` path
|
|
192
|
+
(scheduleRefresh, one async refresh per tick); transcripts render through a
|
|
193
|
+
tail-windowed wrap + incremental byte-offset reads (no full-file re-read per
|
|
194
|
+
frame); the dashboard resolves run snapshots once per frame; the widget cache is
|
|
195
|
+
truncate-once; `visibleWidth` gets a short-string cache; render-diff does a
|
|
196
|
+
single `diffWords` pass per changed line pair; `listLiveAgents` memoizes its sort
|
|
197
|
+
with a plain string compare; worker events channel tail is a 1-byte read;
|
|
198
|
+
config store path does a single `readCacheMtimes` pass.
|
|
199
|
+
- **Broker fan-out / worktree / live-session** — `msg.send` fan-out is chunked
|
|
200
|
+
over concurrent recipients; sync git probes in the worktree path are memoized
|
|
201
|
+
(cleanLeader verdict, rev-parse) with throttled per-repo prune; live-session
|
|
202
|
+
sidechain/transcript writers are batched per 50ms window with bounded (512 KiB)
|
|
203
|
+
stdout capture and a gated control poll.
|
|
204
|
+
|
|
205
|
+
### Bench results (Linux x86_64, Node v22.23.1, `npm run bench`)
|
|
206
|
+
|
|
207
|
+
Pre-fix = same-machine capture 2026-08-24 before the branch; post = this branch.
|
|
208
|
+
Fsync-dominated wall clocks drift ±10-25% day-to-day on this machine — a
|
|
209
|
+
same-day control run on `main` (see report) shows the b4 drift below is
|
|
210
|
+
environmental, not a regression. fsync intentionally remains in the durable path.
|
|
211
|
+
|
|
212
|
+
| Metric | Pre-fix (2026-08-24) | Post-fix (branch) | Δ |
|
|
213
|
+
|---|---|---|---|
|
|
214
|
+
| `atomic-write-json` warm p50 | 13.01 ms | 13.21 ms | ~flat (fsync floor; control-on-main 13.09 ms) |
|
|
215
|
+
| `b3.state-store-jsonl` n10 `atomicWriteMs` | 14.83 ms | 15.00 ms | ~flat; the "25% faster than same-day control (20.03 ms)" noted pre-merge was load drift — a post-merge interleaved A/B (main vs `519a5e4e`, same session) shows 16.6 vs 16.5 ms, no delta |
|
|
216
|
+
| `b4.event-log` n100 sync append | 1409 ms (70.96/s) | 1518 ms (65.89/s) | environmental drift (control-on-main 1503 ms, 66.53/s) |
|
|
217
|
+
| `b4.event-log` n100 async append | 156 ms (640.86/s) | 198 ms (506/s) | environmental drift (control-on-main 179 ms, 558.30/s); hoped-for async p50 drop did not materialize on wall clock |
|
|
218
|
+
| `b4.event-log` n100 buffered append | — | 261-263 ms (380/s) | new visibility |
|
|
219
|
+
| `snapshot-cache` cold / warm p50 | 1.12 / 1.13 ms | 0.79 / 0.79 ms | **−30%** |
|
|
220
|
+
| `render-flush` p50 | 0.10 ms | 0.10 ms | flat (already sub-budget) |
|
|
221
|
+
| `register-startup` import p50 | 1861.28 ms | 1739.55 ms | −6.5% (cold-cache import, high variance) |
|
|
222
|
+
| `event-append` serial p50 | 15.52 ms | 14.61 ms | −6% |
|
|
223
|
+
| `b2.broker-roundtrip` n1000 | — | 10,049 msgs/s | new visibility |
|
|
224
|
+
| `b7.startup` bundle load (warm avg) | — | 419.89 ms | new visibility |
|
|
225
|
+
|
|
226
|
+
The structural wins (syscall counts, stat storms, fan-out chunking, batched
|
|
227
|
+
writers) are mostly invisible to these wall-clock benches by design — they remove
|
|
228
|
+
kernel calls whose latency is dominated by the remaining fsync. See the task-27
|
|
229
|
+
report for run-to-run variance data, the same-day main control runs behind the
|
|
230
|
+
"environmental drift" rows, and the b5/b11 bench-infra notes.
|
|
231
|
+
|
|
232
|
+
Post-merge interleaved A/B (2026-08-25, main vs `519a5e4e` in a worktree, same
|
|
233
|
+
session, alternating runs — the CPU-bound paths the branch targeted, which the
|
|
234
|
+
fsync-floor rows above cannot show):
|
|
235
|
+
|
|
236
|
+
| Path | baseline | main | Δ |
|
|
237
|
+
|---|---|---|---|
|
|
238
|
+
| `readAllMailboxMessages` warm (160 msgs / 8 files) | 932-949 µs | 521-527 µs | **−44%** (stat-gated parse cache) |
|
|
239
|
+
| `readAllMailboxMessages` churn (60-msg file rewritten per read) | 1903-1970 µs | 1057-1088 µs | **−45%** |
|
|
240
|
+
| `b3` jsonl read n=100 | 1.32 ms | 0.23 ms | **−83%** (cache-keep + stamp reuse) |
|
|
241
|
+
| `b3` jsonl write (n10/100/1000) | 0.11/0.17/0.83 ms | 0.09/0.15/0.77 ms | ~−10% (lazy stringify) |
|
|
242
|
+
| manifest `list()` refresh after TTL (200 runs) | 61-64 µs | 45-66 µs | no measurable wall-time delta (win is syscall count, not latency) |
|
|
243
|
+
|
|
244
|
+
### Verification
|
|
245
|
+
|
|
246
|
+
| Check | Result |
|
|
247
|
+
|---|---|
|
|
248
|
+
| `npm run typecheck` | pass |
|
|
249
|
+
| `npm run lint` | pass (2 branch-introduced import-sort errors fixed in `src/state/event-log/event-log.ts`, `src/runtime/live-session/live-session-runtime.ts`) |
|
|
250
|
+
| `npm run test:unit` | 7115-7117 pass / 0-1 fail / 3 skipped — the 1 fail (run 1 of 2) is a pre-existing environmental flake (`session-summary-cov` vector #11 reads the real user-level `~/.pi/.../state/runs`; reproduced identically on `main`; run 2 fully green) |
|
|
251
|
+
| `npm run test:integration` | 189 pass / 0 fail / 4 skipped (env-gated real-model + placeholders), 238.8 s |
|
|
252
|
+
| `npm run bench` | legacy suite green; perf suite requires per-bench invocation until b11 emits NDJSON (pre-existing, see report) |
|
|
253
|
+
|
|
5
254
|
## [0.10.2] — UI rewrite + adaptive default team (2026-08-24)
|
|
6
255
|
|
|
7
256
|
40 commits after `v0.10.1` (≈3,500 LOC, 54 files). Headline: the UI surface
|
package/README.md
CHANGED
|
@@ -698,7 +698,11 @@ the `goal` action's completion-guarantee loop to builtin workflows.
|
|
|
698
698
|
|
|
699
699
|
| Key path | Type | Default | Description |
|
|
700
700
|
|----------|------|---------|-------------|
|
|
701
|
-
| `ui.widgetPlacement` | `aboveEditor \| belowEditor` | `
|
|
701
|
+
| `ui.widgetPlacement` | `aboveEditor \| belowEditor \| bottom` | `bottom` | Where the status widget renders. `bottom` docks inside the crew-vibes footer (very bottom of the screen), falling back to `belowEditor` when no footer sink exists. |
|
|
702
|
+
| `ui.widgetRowStyle` | `compact \| detailed` | `compact` | Per-agent row layout in the widget (`compact` = one width-budgeted line per agent; `detailed` = two-line tree). |
|
|
703
|
+
| `ui.inlinePanel` | `boolean` | `true` | Keyboard-navigable agent rows under the prompt (`↓` from an empty prompt). Yields to any extension that owns the editor component. |
|
|
704
|
+
| `ui.refreshMs` | `number` | `1000` | Internal UI refresh cadence default (not a user-settable `ui.*` schema key — kept here for completeness). |
|
|
705
|
+
| `ui.widgetDefaultFrameMs` | `number` | `1000` | Internal widget frame-budget default (not a user-settable `ui.*` schema key — kept here for completeness). |
|
|
702
706
|
| `ui.widgetMaxLines` | `number` | `8` | Max lines shown by the widget. |
|
|
703
707
|
| `ui.powerbar` | `boolean` | `true` | Show the power bar. |
|
|
704
708
|
| `ui.dashboardPlacement` | `center \| right` | `center` | Dashboard screen position. |
|