fix: close Pi subagent review gaps

This commit is contained in:
2026-08-23 13:14:03 +08:00
parent f1c7cd8ad4
commit 3de85d61d7
9 changed files with 234 additions and 34 deletions

View File

@@ -8,7 +8,7 @@
- Worktree: D:\Datas\OthersProjects\makelore-pi-child-workers-5c8e2a71
- Base commit: b806c78139aa11e338c680d4c3fa92e076901aa2
- Owner: codex
- Status: Implementation complete; planner review pending
- Status: Planner corrections complete; re-review pending
## Scope
@@ -62,6 +62,12 @@
a parent/run dispatch registry, shared `PiProcessBudget` acquisition, idle
parent reclamation when the eight-process budget is full, and deterministic
abort/error/skipped projection without raw child errors.
- Planner review of `f1c7cd8` found that a previously queued parent process
budget waiter could take a reclaimed idle permit before the child. The
corrected budget keeps normal waiters FIFO, keeps child waiters FIFO, and
prioritizes child reservations so a running parent cannot deadlock while
waiting on its own child. The child enters the priority queue before idle
reclamation releases capacity.
- Added the managed ephemeral child opener. It resolves only enabled,
unarchived project Agents from `.niancode/project.json`, materializes their
exact model/prompt/skills, keeps credentials in the child environment and
@@ -72,6 +78,10 @@
retain only the shared mutation-lease hooks required by coding tools. The
authenticated loopback bridge streams only NDJSON `subagent.v1` details and
rejects recursive child dispatch and stale identities.
- Planner review of `f1c7cd8` also found that Pi 0.84.2 treats `--tools` as a
strict whitelist across built-in and extension tools. The managed parent
default now explicitly includes `subagent`; child read-only/coding lists
remain exact and exclude both `subagent` and `ask_user`.
- Connected subagent dispatches to PI-070 generation resource cancellation so
parent abort/crash/recover/dispose and bridge disconnect stop unfinished
children and release child/process permits. Coding children join the same
@@ -92,12 +102,23 @@
parent generation cancellation with no orphan and zero leaked permits;
recursive child rejection; parent/child same-project write-lease queuing;
and unknown schema/version raw-payload suppression.
- Locked real Pi 0.84.2 smoke passed for both the parent worker and an
ephemeral read-only child launched through Electron Node with the child
extension role and `--no-session`: 2/2 tests passed. This smoke performs
`get_state` and clean stdin shutdown only; it does not call an external
- Locked real Pi 0.84.2 workspace smoke passed for both the parent worker and
an ephemeral read-only child launched through Electron Node with the child
extension role and `--no-session`. A probe extension reads Pi's actual
active-tool list at `session_start`: the parent includes `subagent`, while
the child is exactly `read,grep,find,ls`.
- `pnpm run test:pi-subagent:packaged` passed 3/3. The dedicated runner uses
PI-030's production bundler to create and validate a temporary staged
production closure/manifest, then starts the staged Pi CLI as an ephemeral
read-only child, verifies `get_state`, the exact active tools and child
extension role, and clean stdin shutdown. The normal suite skips only this
staging case so it does not perform a production `npm ci` on every unit run.
- The real materialized extension bundle test executes `subagent` through the
authenticated Main bridge; the active-tool process probes and bridge execute
test jointly cover visibility and tool invocation without an external
Provider.
- All cumulative Pi tests passed: 22 files, 106 tests.
- All cumulative Pi tests passed: 22 files, 106 passed and 1 staged-only
skipped; the staged-only command passed separately as described above.
- `pnpm run typecheck`: passed.
- `pnpm run lint:check`: passed with 0 errors and 6 pre-existing frontend
warnings outside this task.
@@ -106,7 +127,8 @@
- First full-suite run, executed concurrently with the build, passed 2208/2209
and hit the known Windows temporary JSON `rename` `EPERM` in the unchanged
conversation store. The failing test passed in isolation, then the serial
full-suite rerun passed: 202 files, 2209 tests.
full-suite rerun passed. After planner corrections the final serial full
suite passed: 202 files, 2209 passed and 1 staged-only skipped.
- Real external Provider validation remains **Explicitly Waived / Accepted
Risk** with `realTurnVerified=false`. Provider concurrency, credential
isolation, protocol compatibility, and image-path risk are accepted rather
@@ -129,8 +151,9 @@
the running parents wait on children. Evidence: the focused full-budget
scheduler regression test and the shared-budget implementation in PI-080.
Future impact: any final Main composition must pass one `PiProcessBudget` to
both the parent pool and child scheduler and wire the scheduler's capacity
reclaimer to `PiWorkerPool.reclaimIdleWorker`. Semantic conflicts: none with
the accepted PI runtime specification; this makes its parent/child cap
executable. Human confirmation required: no, unless integration changes the
accepted process-cap policy.
both the parent pool and child scheduler, preserve child-priority budget
reservations ahead of normal parent-start waiters, and wire the scheduler's
capacity reclaimer to `PiWorkerPool.reclaimIdleWorker`. Semantic conflicts:
none with the accepted PI runtime specification; this makes its parent/child
cap executable. Human confirmation required: no, unless integration changes
the accepted process-cap policy.