Repository navigation
fix: keep interrupted child results visible after restart - #202592
Conversation
Require visible saved-result fallback before consumed requester input can settle completion delivery. Commit failure notices with child identifiers before delete cleanup can retire the last result, and retain owed fallback work across restart.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review Please review head |
|
🦞👀 Re-review progress:
|
|
Full 35 GiB qualification is waived for this PR: it repairs correctness/reliability—visible fallback before settlement and failure notices before delete cleanup—rather than optimizing performance. The bounded 10,000-session / 1,000,000-event btrfs fixture (2.26 GiB database, full 62,000-file workspace) is accepted as sufficient regression evidence. The larger fixture will not be built; measured costs and limitations remain disclosed. Attribution, as expressly required by the decision-maker: this is the Team perf-loop lead’s decision, an agent acting under Peter’s standing unattended instruction, not Peter’s personal decision. |
Codex Review Summary: ✅ CompletedThis 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. |
|
Codex review: needs maintainer review before merge. What this changesThis PR records saved child results and identifying failure notices before completion settlement can retire them. Example: After a Gateway restart, requester run parent-17 consumes child-42's saved result and yields without answering.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it addresses a concrete restart-recovery defect, and the latest head resolves the prior private-handoff finding without a new confirmed code defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherSubagent completion owners take saved child outcomes and requester-consumption facts, publish transcript notices when required, and settle registry delivery and cleanup. flowchart TD
A[Child execution ends] --> B[Saved completion record]
B --> C[Requester consumes input]
C --> D[Completion settlement]
D --> E[Existing transcript notice writer]
E --> F[Registry delivery and cleanup]
Technical reviewBest possible solution: Use the existing settlement and transcript owners to require visible fallback before retirement while preserving private custody, ambiguous sends, and no replay. Do we have a high-confidence way to reproduce the issue? Current-main source exposes consumption-based success without visible fallback, and the supplied regressions report base failures; no product reproduction was run during this read-only review. Is this the best way to solve the issue? The approach fixes the owning settlement boundary and shares the existing notice writer without adding storage, scheduling, or competing delivery policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b9aa2b7e6cd2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +70, Tests +369, Docs +11, Other +206. Total +656 across 15 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed November 20, 2026, 12:58 PM ET / 17:58 UTC (Revision 4). |
|
Response to the latest review's open item, checked against head
The source owner remains @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e142180045
ℹ️ 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".
| const settled = resolveRequesterDeliveryOutcome(entries, outcome)!; | ||
| const required = entries.filter((entry) => entry.expectsCompletionMessage === true); | ||
| if (settled !== outcome && required[0]) { | ||
| await recordRequiredCompletionNotice( |
There was a problem hiding this comment.
Preserve private completion handoffs when adding visible fallbacks
For a consumed completionTarget: "parent" result, resolveRequesterDeliveryOutcome also converts intentional non-delivery into success; that conversion does not mean a visible reply was required. For example, the private-continuation cancellation exercised in subagent-registry-lifecycle-delivery.test-support.ts reaches this branch with reason: "delivery_suppressed". The new call then appends the complete child findings with display: true, exposing a private result in the requester chat despite the cancellation. This contradicts the private-input contract documented in docs/tools/subagents/announce.md. Distinguish private transcript custody from a failed visible-response obligation before emitting the fallback.
Useful? React with 👍 / 👎.
|
Response to all four open items in review comment 7045528150, checked against
The review's Knowledge-screenshot references are unrelated: this PR supplies no screenshot evidence and makes no such claim. Exact-head CI and the latest review must complete before landing; the prior head is not final-head proof. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Response to both remaining items in the review of
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…02592) * fix: keep interrupted child results visible after restart Require visible saved-result fallback before consumed requester input can settle completion delivery. Commit failure notices with child identifiers before delete cleanup can retire the last result, and retain owed fallback work across restart. * fix(agents): align child delivery consumers with retained settlement * fix(agents): distinguish saved results from separate completion partitions * fix(agents): preserve consumed private completion handoffs
What Problem This Solves
After a Gateway restart interrupts a subagent, its requester can consume the saved result and then yield or abort without showing it. That result can be counted as delivered and cleaned up. A failed background announcement can also leave only a generic error, without identifying the interrupted child.
Related: #202423, #202420. Overlap: #199455 proposes notice-authority changes in the same settlement owners. This patch preserves current requester targeting and fixes visible-result custody/retirement ordering; later integration of #199455 must retain the visible-before-retirement invariant. Its separate authority proposal is not required by this fix.
User Impact
Consumed child results that still owe a visible reply receive a saved-result fallback before delivery is settled. Intentionally private handoffs retain their existing consumption-only settlement. If that write fails, the result remains owed across restart. Failure notices identify the child session/run and restart interruption so the requester can start replacement work; an unconsumed failure is also available to the requester model. No configuration or schema changes are required.
Why This Change Was Made
Committed model input prevents replay, but does not establish visible delivery. The existing notice writer now serves both announce cleanup and retained requester settlement, and failure notices commit before delete cleanup can retire the last result row. Existing private-consumption eligibility, explicit no-completion requests, stopped/deleted requester behavior, and ambiguous channel-send handling remain intact.
Production code grows by 70 net lines to render the saved result and enforce write-before-retirement. The existing admission-store writer is shared rather than duplicated; no new cache, state store, or retry scheduler is introduced.
Evidence
Four synthetic owner-boundary regressions fail on base
5e6db3e87ad4d6f27a5d0cb6e6c4fed961a2118dand pass with the fix: spawn/drain/restart/resume followed by yielded settlement, unconsumed aborted announce, consumed aborted announce, and fallback-write failure followed by another restart. A separate regression proves that a failed notice append cannot retire an owed delete-cleanup row, including a mixed optional/already-delivered/owed batch.The final private-handoff repair passed all 219 lifecycle tests and 47 requester-boundary tests. After extracting the shared settlement routine to meet the line cap, all eight focused private/restart/partition cases passed again. Earlier affected consumer proof passed 40 dispatch tests, 27 wake tests, 46 admission tests, and prompt-prefix stability. Fresh Codex autoreview is scoped-clean at P0–P2. These tests use real persistence/controller ownership and synthetic announce responses; they are not live-model/channel proof. The exact production sequence deleting both a child session and its run remains unproven from the available metadata.
Additional regressions caught and repaired during review: distinct admitted partitions now have distinct saved-result identities; restored or cancelled private-only handoffs emit no visible child result. Both behaviors have pre-fix failing tests. The visible private-parent case explicitly carries
yieldedFinalDeliverable: true. The original notice writer remains in its module, with no identity-allowlist exception; the shared settlement routine is a small sibling used by both delivery owners.Changed checks passed core/test typechecking, core lint, format, SQLite guards and import-cycle checks. The benchmark script lint is fixed and passes its focused rerun. The composite
pnpm check:changedremains red for unused exports reproduced on exact base5e6db3e8:CronScheduleintroduced by #202416 (44ec89e71877e), andinstallSpawnThreadBindingFixture/installSpawnAttachmentFixtureleft without callers by #202522 (c23cb9f0cd39e). These are main regressions, not noise; no ignore/baseline exception was added. Full 35 GiB qualification is waived for this correctness/reliability fix (qualification decision). The bounded 2.26 GiB btrfs fixture (10,000 sessions, one million events, full 62,000-file workspace) is accepted as sufficient regression evidence for this PR; measured scale and costs remain disclosed below.Bounded performance evidence (50 warm samples per arm; median / p95):
The first operation adds one visible report where base wrote none; its extra work is the required correctness cost, not a performance improvement. A/A abort-notice wall medians were 17.752 and 16.050 ms, with noisy p95s of 134.225 and 45.258 ms. Allocation is a separate V8 sampling run for the host isolate; CPU includes process worker work. These are owner costs on the smaller local fixture, not end-to-end Gateway latency. Successful announcement behavior is unchanged and not benchmarked here.