Repository navigation
fix: chats stay queued after restoring obsolete child completions - #180704
roboclaw-bot merged 2 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR prevents obsolete child-completion batches from blocking new chat messages while preserving current results and cancellation reports. Example: A restored yielded batch contains settled-child and superseded-child.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a current restart-related chat blockage, and both prior review findings are resolved with no remaining actionable findings. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway restart restores durable child-completion obligations into the session mailbox; the requester-wake dispatcher selects current findings, admits a continuation, and commits the full batch's outcome. flowchart TD
A[Durable child records] --> B[Restart restoration]
B --> C[Session mailbox]
A --> D[Requester wake dispatcher]
D --> E[Current child findings]
E --> C
C --> F[Requester execution and settlement]
Technical reviewBest possible solution: Land the focused cohort-custody repair with its corrected consumer regressions once the existing exact-head gates pass. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the reservation/validation mismatch, and the contributor records failing base regressions plus successful built-Gateway restart behavior; this read-only review executed no target code. Is this the best way to solve the issue? The patch fixes the mismatch in existing restoration and settlement owners, preserves full-batch identity and cancellation reporting, and independently gates current findings before effects. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3e0475a199e5. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +40, Tests +191. Total +231 across 6 files. Added test files: 0. View PR surface stats
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 (1 earlier review cycle)
Reviewed October 22, 2026, 3:56 PM ET / 19:56 UTC (Revision 2). |
|
@clawsweeper re-review Current head The three original CI failures reproduce locally before this test-only repair. All 63 mailbox/wake/dispatch cases pass afterward, along with owning test types, scoped typed lint, formatting and fresh independent P0–P2 review. Production is unchanged, so the already accepted Gateway restart proof remains qualified to the same production patch. The PR body records the new checks and pending hosted CI; no new runtime capture or deployment is claimed. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…enclaw#180704) * fix: chats stay queued after restoring obsolete child completions * test: align completion consumers with obsolete wake handling
What Problem This Solves
Fixes chats remaining “Waiting for turn to start” after a Gateway restart restores a completion batch whose child executions have been superseded.
User Impact
New messages can start without being parked indefinitely behind an obsolete, unprepared completion reservation. A mixed batch can still deliver its current children's findings, and cancelled children that have not been superseded still report their outcome.
Why This Change Was Made
Restoration could reserve the full frozen completion cohort, while live preparation used the filtered findings list to revalidate that same cohort. An obsolete member made preparation return before adopting the reservation, leaving later inputs blocked in FIFO even with no active execution.
Use the existing current-cohort predicate before reserving wholly obsolete batches. Keep full-cohort identity and durable outcome custody separate from findings selection, quietly complete batches with no eligible findings, and recheck selected findings before effects. The existing completion-finalization composition moves into the adjacent state module to keep the dispatcher within its existing size limit.
Messaging policy, execution authority, schemas, and stored formats are unchanged. This is a follow-up bug fix to the lifecycle consolidation merged in #177698, independent of the outstanding policy proposals.
Evidence
Consumer-test repair at
1b361a0b53d6d06d3a974d41a4f2e6db06c8679eThe two review findings and all three reported CI assertions are repaired. The mailbox fixture now distinguishes cancellation from supersession: cancelled yielded work still reserves its owed report, while superseded work before or during requester lookup permits the real foreground mailbox claim. The mixed-child route-notice case now requires one delivery from the current siblings even when its triggering child is obsolete, excludes the obsolete output, and retains the sorted 1,024-character notice bound.
Before this repair, the unchanged reviewed head
1e346af8b9602b1244da9c23c74100b35650a909reproduced the two mailbox failures and the requester-wake failure locally. Afterward, 63 tests pass across the mailbox, requester-wake and requester-dispatch suites (23.94 seconds wrapper wall time across two shards). The mailbox table adds four explicit supersession cases; no assertions, cancellation guarantees, timeouts or baselines are weakened.Owning agent-session test types, scoped typed lint, formatting and whitespace checks pass. Fresh independent P0–P2 review of the complete test repair with the unchanged production owners found no actionable findings. This commit changes only two test files; the existing built-Gateway restart proof below remains evidence for the identical production patch. New-head hosted CI is pending, not claimed green.
Original production repair and runtime evidence
52df852cd5be: the obsolete reservation and mixed-cohort cases fail for the reported reasons; the current-cancelled-child control passes.1e346af8b960: 87 tests pass across requester dispatch, restart, cancellation, ownership, and durable requester-wake settlement. The added preparation race rejects findings that become superseded before execution or storage effects.node scripts/run-vitest.mjs src/agents/subagents/announce/subagent-announce.requester-settle-dispatch.test.ts src/agents/subagents/announce/subagent-announce.requester-settle-restart.test.ts src/agents/subagents/announce/subagent-announce.requester-settle-cancel.test.ts src/agents/subagents/announce/subagent-announce.requester-settle-ownership.test.ts src/agents/subagents/completion/subagent-completion-admission.requester-wake.test.ts --maxWorkers=1— 55.86 seconds wall time across two shards; the changed dispatch file's standalone run took 10.01 seconds wall time, about 0.3 seconds executing tests. CI timing is not yet available.An isolated built Gateway also passed the restart flow using a scripted loopback model provider (not a real-provider qualification):
The captured build contains this working patch on base
52df852cd5be; focused tests above cover mixed-cohort delivery and supersession during preparation. No claim of authenticated external-provider or browser testing is made. The build exited successfully but reported a UI startup bundle budget warning (318.1 KiB versus 318.0 KiB); this patch changes no UI files.Related symptom reports: #143334 and #158154. Their root causes have not been established as identical, so this PR does not claim to close them.
All regression fixtures are synthetic. No private transcripts, session identifiers, hostnames, endpoints, or credentials are included.
Related follow-up: #180728 repairs independently admitted child executions being rejected by an in-process facade after their recovered parent finishes. This PR instead repairs obsolete completion reservations blocking admission before an execution starts. The fixes are independent and complement the merged lifecycle consolidation #177698; neither changes messaging or authority policy.