Repository navigation
Conversation
Before, spawn_agent held the parent's turn until the child settled: over 30 days, delegating runs spent 40 % of their wall time blocked on it (ADR-0054 § 4). Now a read spawn returns as soon as the child is durably admitted, with its session id, and the parent keeps working. Its answer (final reply, labelled interim report, or the reason it stopped plus its latest report) reaches the parent at a later turn boundary as a runtime notice: - Exactly once: admission inserts a child_deliveries row, and one transaction stamps it with the notice and the parent turn it precedes before that request is built. A parent that settles first gets the answer with its own settlement; recovery delivers to parents settled before their child. The next run assembles the notice from the row, so live and replayed context match. - Spend is charged once, at delivery. A delivered answer is progress; the admission receipt is not. - A reply without tool calls while children are outstanding waits for the next answer or steering and runs another turn. Cancellation, the deadline and a budget-final turn still settle the run; teardown cancels the children and the settlement delivers what they left. - Interrupts and the audit drain stop only blocking work; detached children keep reading. - Write children, audits, and runs with a finite token or cost bound still block (each child gets the whole remainder). Store schema 40 -> 41 (child_deliveries); agent prompt 15 -> 16. No protocol change. wait_agents, cancel_agent and interim-report delivery are AP4.2 with the descriptor bump. Linear: ENG-1004
…wers Fixes from the independent review of the non-blocking delegation slice: - A tool-free reply that the run continues past (waiting for sub-agents, or steering) is never an empty assistant message: it takes the empty-turn placeholder, as replay does. - The reference assembly loader knows child_deliveries. New tests compare each run's last live request with the follow-up's assembled context, pin the in-run compaction splice of delivered answers, and cover the deadline, an interrupt, an empty waiting reply, and a grandchild settling after its parent. - Delivered answers share one turn's tool-output budget per boundary, are stored as cut, and count against max_tool_output_bytes. - An answer that waits on an unsettled descendant is delivered when that descendant settles, not at the next restart. - DeliveryError keeps its store error; a poisoned child registry fails loudly instead of skipping the wait; a spawn call dropped while the receipt is in flight no longer cancels its detached child. Linear: ENG-1004
…ests, one budget per boundary The receipt-window test fails when the waiter cancels unconditionally on drop. A boundary the wait already delivered for is not delivered again with a fresh budget, and its cut names the child session that keeps the whole answer. Linear: ENG-1004
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70286ed484
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex review on #244 read 'a delivered answer is a progress event' as covering failure notices too. The rule, matching the blocking path and ADR-0054 § 1, is that only a child that answered restarts the parent's stall count: a cancelled, failed, or paused child's notice is context and spend, not output, so a parent spawning children that fail still reports. The docs now say so, and a test pins it; the test fails with every notice counted as progress. Linear: ENG-1004
This was referenced Oct 5, 2026
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.
Linear: ENG-1004. ADR-0054 § 4, slice AP4.1. Base: #242, which is stacked on #240 and #238.
What changes for users
A read sub-agent no longer blocks the agent that started it. Over 30 days of real use, runs that delegated spent 40 % of their wall time blocked on
spawn_agent. The v0.1.6 planning run was blocked for 209 of its 267 minutes.spawn_agentreturns as soon as the child is durably admitted, with its session id. The parent keeps working.Not in this PR:
wait_agents,cancel_agentand interim-report delivery. They are slice AP4.2, which also bumpsDESCRIPTOR_VERSION. The "waiting for sub-agents" UI is AC14.Design
child_deliveries. Admission inserts the child's row in the same transaction that creates the child.delivered_at_ms IS NULL, exactly one row changed).max_tool_output_bytes. A cut names the child session that keeps the whole answer.Verification
Tests: 2084 workspace tests and the soak pass; clippy and fmt are clean. The delegation, progress and nonblocking suites passed six runs in a row under load. New tests in
sessions/tests/nonblocking.rs:Each of the last three regression tests fails with its fix reverted.
Replay identity: each scenario compares the last live request with the follow-up run's assembled context, message for message, and checks the joined loader against the reference loader, which now reads deliveries. The in-run compaction splice is pinned. A write child still blocks, and the one-write-slot test is unchanged.
Independent review: the first review requested changes (2 blocking, 9 should-fix), all fixed. The re-review approved, and its should-fixes are done too. Details are in the ledger.
Benchmarks. Medians against the base branch; the machine was loaded.
child_admission: its children answer instantly, so detaching cannot shorten wall time. Unbounded runs take one more parent turn (spend 30 → 35); peak concurrency is unchanged.turn_overheadandcontext_assemblyare within noise. The per-turn check is an in-memory flag, so a run without detached children makes no store call.The real measure is the AP0 blocked share (target: under 20 %). It needs real use and is recorded in AP5.
Compatibility
PROTOCOL_VERSIONchange. Delivered answers reach clients through the child session's own events, and the notice is ordinary model context.Feature flow
flowchart LR A["Unbounded read child is durably admitted"] --> B["Return session receipt; parent continues"] B --> C["Child settles"] C --> D["Commit one delivery and its spend"] D --> E["Add notice at a parent turn boundary"] E --> F{"Child answered?"} F -->|Yes| G["Reset stall progress"] F -->|Failed or cancelled| H["Keep notice as context"]Combined-source validation — 2026-10-04
This exact PR head was composed locally with #227, #231, #238, #239, #240, #242, #243 and #244 at
8dcf7a7270a8ac936a74e2f07d4aca7a8ccfb8c4(tree13816472ac53b0e117f042b74d8c6f23b435e9ec). Non-author interaction review accepted compaction/child-delivery ordering and the ADR merge. 307 relative links in changed Markdown resolve.-D warningspassed.cargo test --locked --workspace -- --test-threads=2: 2,087 passed, 0 failed, 12 ignored.process_kill_preserves_the_side_effect_without_reexecution: 1 passed; each of two kill/reopen cycles preserved one journalled side effect without reexecution. The child environment is cleared and only local scripted providers/temporary SQLite are used.cargo build --locked --workspacepassed after an observed ENOSPC in this task's default-debug incremental output. Only owned build artifacts were removed; the successful remaining build/minimal/recovery checks usedCARGO_INCREMENTAL=0and local dev/test debug symbols disabled. Source/features/optimization were unchanged. The original failure and environment differences are retained.These are local source/runtime-fixture checks. Required hosted CI is verified separately on each individual PR head; the local composition has no hosted CI receipt. Existing per-PR performance evidence is reused, with no new combined performance or real-provider claim. Real model sessions, AP5 blocked-share qualification and the integrated paid customer journey remain unaccepted.