fix(subagents): harden lifecycle, completion delivery, and transcript UX across the stack - #347
Closed
Rinat S (rsolmano) wants to merge 6 commits into
Closed
fix(subagents): harden lifecycle, completion delivery, and transcript UX across the stack#347Rinat S (rsolmano) wants to merge 6 commits into
Rinat S (rsolmano) wants to merge 6 commits into
Conversation
… UX across the stack
Rinat S (rsolmano)
requested review from
Olga Lavrichenko (OLavrik),
Rustam Sadykov (SBOne-Kenobi) and
danyaberezun
as code owners
August 29, 2026 00:47
…regression tests ThinkRail-Todo: 01a053ed-7b0c-7dc8-8bce-ade4311381df/t_9586d77c8e53
…indings ThinkRail-Todo: 01a053ed-7b0c-7dc8-8bce-ade4311381df/t_5211549183f4
…bagents-hardening
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Post-merge hardening for the subagents stack (#302/#303/#304), from a full-feature review with adversarial verification of every finding. Fixes the still-open #303 review thread (child settings parity) plus confirmed defects across all three layers: lost aborts, silently-dropped background completions, false-permanent transcript errors, an unrestricted-tools parsing hole, and missing regression pins.
Changes
packages/pi-delegationprompt()preflight (before streaming starts) is now re-delivered from the run's event subscription — previously the child streamed to full completion, billed, returned asabortedwith the completedfinalText, and delete/archive flows blocked on the whole natural run.finalTextderives from the run's ownturn_end-captured assistant message (index-scan fallback retained) — a mid-run compaction no longer misreads a completed run as "(no output)".steer()rejects with typednot-runningunless a run is queued/running; aborted-before-start runs clear the pi queue, so a stale steer can no longer contaminate the child's next run.onUpdatecallbacks are exception-isolated — a throwing embedder callback can no longer reject a completing run or abandon a disposal cascade.onUpdatenow always delivers aqueueddetails object beforerunning(makes the UI's queued state live).DelegationBindings.settingsManagerseam; typedunknown-modelerror; a rejected fallbackModelRuntime.create()is evicted instead of cached forever.packages/pi-subagentstools:/skills:and fails closed: a list-valued key with zero parseable items skips the definition instead of granting pi's default read/bash/edit/write toolset.serviceForrefuses to recreate the fallback service aftersession_shutdown; unknown-id error wording covers disposed children, not just host restarts.session_shutdown → disposeChildrenOffix is now regression-pinned; the detached-survives-abort test is gate-driven instead of sleep-timed.packages/server+packages/contractsbuildSessionSettingsvia the new binding, and the curated child extension set includes the oversized-image guard — closes the open feat(host): embed pi-delegation/pi-subagents in the engine host #303 review thread (packaged-app child image reads). The pin exposed and fixes a latent parent-side bug too: pi'sSettingsManager.reload()dropped theautoResize:falseoverride during every session assembly.readChildTranscriptconsults the run registry before throwing: a queued/unflushed child returns{ messages: [], status }instead of a false-permanent NOT_FOUND (pi creates the session file only at the first assistant message).session_shutdown(idempotent) before disposing/trashing in delete flows, so completions arriving during the unboundedtrashFilewindow are suppressed instead of triggering a billed turn on a chat being deleted.agent_settledand post-reload, guarded byhasQueuedMessagesand the transcript-as-delivery-record) redelivers background completions lost to queue drains or mid-runsession.reload().subagent.abortwire method (PROTOCOL_VERSION 54), lineage-checked likesubagent.getTranscript.apps/websubagent.abort); background-ack cards note that runs survive a chat Stop.data-outcome) instead of the green success check; the queued card state now renders on the live path.e2esubagents-ui.spec.ts(hydrated three-state Agent cards, completion turn, disk-transcript dialog, restart-reconciliation lost state) — the subagent UI previously had zero commit-gate coverage. New fixture helper seeds child transcripts under the delegation root.Deliberately not changed (recorded design decisions): per-child session GC ("no per-parent GC in V1"), within-lineage provider-mirror semantics,
WorkspaceProvider.disposesync typing, vanilla-pi/reloadchild disposal.Testing
bun run test— 14/14 tasks green (server 870, web 909, pi-delegation 44, pi-subagents 46+).bun run typecheck,bun run lint,bun run check:deps,bun run check:boundaries,bun run check:seams— green.subagents-ui.spec.ts.