Skip to content

fix: chats stay queued after restoring obsolete child completions - #180704

Merged
roboclaw-bot merged 2 commits into
openclaw:mainfrom
enki:fix/obsolete-requester-reservations-20261022
Oct 23, 2026
Merged

roboclaw-bot merged 2 commits into
openclaw:mainfrom
enki:fix/obsolete-requester-reservations-20261022

Conversation

@enki

@enki enki commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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 1b361a0b53d6d06d3a974d41a4f2e6db06c8679e

The 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 1e346af8b9602b1244da9c23c74100b35650a909 reproduced 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

  • Synthetic regressions on base 52df852cd5be: the obsolete reservation and mixed-cohort cases fail for the reported reasons; the current-cancelled-child control passes.
  • Original production candidate 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.
  • Original focused test command: 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.
  • The full production build, targeted agent/session typechecking, lint, and formatting pass. Independent Codex review found no actionable P0–P2 findings.

An isolated built Gateway also passed the restart flow using a scripted loopback model provider (not a real-provider qualification):

public sessions.create: requester and two children created
fixture Gateway: stopped and joined
canonical offline fixture writer: 2 terminal, suppressed, superseded child rows
restored wake: dispatching yielded cohort, attemptCount=1, rearmGeneration=1
same-profile Gateway restart: registryActivationRuns=2, active=0, recovered=0, success
public chat.send: started
agent.wait: ok
persisted assistant reply: present, same requester incarnation
obsolete child findings injected: false
all owned fixture processes: stopped and joined

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.

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@enki
enki marked this pull request as ready for review October 22, 2026 14:45
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M labels Oct 22, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: Filtered findings fail full-batch validation, leaving the completion reservation blocking later messages.
  • After: The batch retains its settlement identity, delivers settled-child's result once, excludes obsolete findings, and releases foreground admission.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful repair with shipped-Gateway evidence and corrected consumer contracts; no remaining actionable finding was identified.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The recorded isolated built-Gateway flow restores synthetic superseded child rows, restarts the same profile, accepts public chat.send, completes agent.wait, and persists the requester response without obsolete findings; its scripted provider exercises the changed admission boundary, and the latest commit leaves production unchanged.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: New chat messages remain at “Waiting for turn to start” after restart restores obsolete child completions.
Reason: This restores working admission without changing queue policy, configuration, permissions, or public APIs.

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
Reviewed head: 1b361a0b53d6d06d3a974d41a4f2e6db06c8679e

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway 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]
Loading

Technical review

Best 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

  • Restored yielded-cohort reservation keeps the original intent (f83b7ad: Retain a yielded cohort's owed cancellation report even after individual completion obligations retire.)
  • Full-cohort revalidation changes intended behavior with a stated reason (3f761a8: Preserve completion custody across ordered registry publications while rejecting genuine ownership loss; later refactoring retained findings filtering at this call site.)
  • Post-commit attachment and Goal finalization keeps the original intent (d79b0a4: Return Goal continuation custody only after durable child-batch settlement while retaining Stop and identity checks.)
  • Bounded route-notice regression keeps the original intent (d6bc637: Consolidate overlapping tests while retaining meaningful announcement coverage.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +40, Tests +191. Total +231 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 78 38 +40
Tests 3 203 12 +191
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 281 50 +231

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: An obsolete restored completion reservation can indefinitely prevent new messages from starting in an affected chat despite no active execution.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-22T15:05:21.304Z sha 1e346af :: needs changes before merge. :: [P2] Separate killed and superseded cases in the mailbox consumer test | [P2] Update the stale-anchor wake test to assert current sibling delivery

Reviewed October 22, 2026, 3:56 PM ET / 19:56 UTC (Revision 2).

@enki

enki commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Current head 1b361a0b53d6d06d3a974d41a4f2e6db06c8679e repairs both requested consumer contracts. Cancellation without supersession still reserves the yielded report; explicit supersession before or during requester lookup permits the actual foreground mailbox claim. A mixed batch now delivers current siblings once from an obsolete trigger, excludes obsolete findings, and preserves sorted bounded route notices.

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.

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 22, 2026
@clawsweeper clawsweeper Bot removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@roboclaw-bot
roboclaw-bot merged commit 0f6a954 into openclaw:main Oct 23, 2026
146 of 147 checks passed
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
…enclaw#180704)

* fix: chats stay queued after restoring obsolete child completions

* test: align completion consumers with obsolete wake handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants