Skip to content

fix(agents): keep unfinished restored cohorts out of the requester FIFO - #184022

Merged
steipete merged 2 commits into
mainfrom
steipete/i143334-parked-requester-fifo
Oct 26, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/i143334-parked-requester-fifo

Conversation

@steipete

@steipete steipete commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

After a Gateway restart, a requester whose subagent cohort was still unfinished could get stuck: the next user message sat behind a restored controller reservation and never ran.

User Impact

Ordinary user input can run in FIFO order while restored child or descendant work remains unfinished. No configuration changes or migration are required.

Why This Change Was Made

Root cause

reserveRestoredSubagentControllerSources (src/agents/subagents/announce/subagent-announce-controller-source.ts) reserved foreground mailbox custody for restored settle-wake batches even when members, or their descendants, were still running. The live dispatch path already refuses those batches through the descendant-settlement policy. Restart recovery skipped that check, so an unprepared reservation held the requester FIFO.

Fix

Restored sources now reuse the same readiness checks as live settlement: isRequesterSettleMemberReady plus the requester descendant reader and waitForRequesterDescendants. Unfinished cohorts stay out of the requester FIFO until they actually settle. Explicit sessions_yield pause notices keep their existing custody. The readiness predicate moves into subagent-announce.requester-settle-state.ts so live and restored paths share one owner.

Evidence

  • New regression cases (child and descendant unfinished) time out on base, blocking the first user turn: Tests 2 failed | 13 passed. With the fix they pass.
  • Seven owner suites green twice: controller inputs (15), settle wake (21), settle dispatch/deadline (25), requester-wake e2e (36), completion mailbox (20), restart priority (4), session mailbox (30).
  • Format, oxlint, tsgo:core, and agents/sessions test typecheck pass.

The historical post-acceptance timeout from the report was already repaired by #138966. This PR fixes the remaining restored-cohort FIFO starvation.

Fixes #143334

CI follow-up

The first CI run found a type-only import cycle introduced by the shared readiness predicate. The delivery-state parameter now spells its existing Omit<RequesterSettleWakeState, "retireAfterSettle"> type directly instead of importing the alias from the announce layer. Runtime behavior is unchanged. The same Madge guard now reports zero cycles; targeted lint and formatting pass, and independent review found no actionable issue in the repair.

Restore requester completion reservations only once their child and descendant
work can run through the existing settle path. Share live member readiness and
reuse descendant settlement policy so unfinished obligations stay in the
registry without starving ordinary user input.

Cover child and descendant waits through the real session store, registry and
controller, preserve the obligation until completion, and verify queued user
turns run in FIFO order. Keep retirement fixtures on settled child delivery.

Refs #143334.
@clawsweeper

clawsweeper Bot commented Oct 26, 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.

@steipete
steipete marked this pull request as ready for review October 26, 2026 00:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T01:01:32.687644Z 5632a16 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: S labels Oct 26, 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. labels Oct 26, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR prevents unfinished restored subagent cohorts from reserving the requester’s mailbox before they can run.

Example: After restart, child-a has finished but child-b or its grandchild is still running.

  • Before: A restored completion reservation prevents the requester’s next two user turns from starting.
  • After: The user turns run in FIFO order, while the registry retains the completion obligation until the cohort is ready.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct repair with useful boundary regressions and green exact-head CI, but only in-process evidence for this change and partial coverage of the linked issue.
Proof confidence 🦐 gold shrimp (3/6) The supplied host policy treats this PR as maintainer-authored, outside the ordinary contributor proof gate; supporting evidence exercises real in-process registry/controller owners, while linked media belongs to the older timeout repair and does not demonstrate this changed path.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: After restart, an unfinished child cohort can leave later user messages waiting indefinitely.
Reason: The maintainer-authorized direction restores runnable-input FIFO semantics using existing owners, while the linked incident report has broader unresolved cases.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR repairs a current recovery/FIFO defect, and no actionable patch defect was found; its scope covers only part of the linked issue.

Priority: P1
Reviewed head: fd870418a874e2d51842780dbe3c076c870e951b

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No supplied current-PR shipped-Gateway run demonstrates restart with an unfinished cohort, a responding user turn, and eventual completion delivery.
Agent review details

How this fits together

Gateway recovery reads durable subagent obligations and rebuilds process-local session-controller reservations; live settlement later admits ready continuations through the same mailbox.

flowchart TD
  A[Durable subagent registry] --> B[Restart restoration]
  B --> C[Shared readiness checks]
  C -->|Unfinished| A
  C -->|Ready| D[Requester mailbox]
  E[User input] --> D
  D --> F[Session controller]
  F --> G[Requester turn]
Loading

Technical review

Best possible solution:

Use the existing settlement readiness owners before restored mailbox reservation, retaining unfinished obligations in the registry.

Do we have a high-confidence way to reproduce the issue?

Current-main source exposes the reservation/readiness mismatch, and the PR reports matching red-on-base controller regressions; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch is the smallest complete repair for restored-cohort starvation, but a Related reference is more accurate than closing #143334 because its distinct completion-loss and reset cases remain outside this repair.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 05010ed700c7.

Provenance checked

  • Restored requester reservations changes intended behavior with a stated reason (36e277d: The session-controller refactor centralized turn and queue custody; later cohort filtering preserved frozen ownership while excluding obsolete completion sources.)
  • Live member readiness keeps the original intent (7d12927: Requester settlement must wait for surviving frozen members to terminate; the later lifecycle consolidation expressed this as the existing predicate now shared with restoration.)
  • Descendant settlement keeps the original intent (4881c9b: Lifecycle events re-evaluate requester settlement, with a bounded grace deadline for unresolved terminal delivery.)
  • Delivery-state transition type keeps the original intent (10e951e: Preserve committed requester settlement through publication failures; spelling the identical Omit type locally removes a dependency cycle without changing transition behavior.)
  • Restart FIFO documentation keeps the original intent (5d47168: Restored unclaimed reservations must not strand later requester work; the documentation now distinguishes ready reservations from unfinished obligations.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 4881c9b adds src/agents/subagents/announce/subagent-announce.requester-settle-wake.ts:193 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4881c9bbda01; files: src/agents/subagents/announce/subagent-announce.requester-settle-wake.ts)
  • Paul Bohm: Raw commit 0f6a954 adds src/agents/subagents/announce/subagent-announce-controller-source.ts:177 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0f6a95442d4c; files: src/agents/subagents/announce/subagent-announce-controller-source.ts)
  • Vito Cappello: Raw commit 7d12927 adds src/agents/subagent-announce.requester-settle-wake.ts:274 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 7d129279a44e; files: src/agents/subagent-announce.requester-settle-wake.ts)

PR surface

Source +32, Tests +116, Docs +3. Total +151 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 41 9 +32
Tests 2 117 1 +116
Docs 1 5 2 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 163 12 +151

Labels

Label changes:

  • add P1: A restored unfinished cohort can prevent accepted user messages from starting, breaking an active agent conversation.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P1: A restored unfinished cohort can prevent accepted user messages from starting, breaking an active agent conversation.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • An isolated Gateway restart recording or trace showing user input proceed before eventual cohort completion would strengthen confidence.

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.

Reviewed October 25, 2026, 9:29 PM ET / October 26, 2026, 01:29 UTC.

@steipete
steipete merged commit d738163 into main Oct 26, 2026
134 of 136 checks passed
@steipete
steipete deleted the steipete/i143334-parked-requester-fifo branch October 26, 2026 01:32
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 26, 2026
…FO (openclaw#184022)

* fix(agents): keep unfinished restored cohorts out of requester FIFO

Restore requester completion reservations only once their child and descendant
work can run through the existing settle path. Share live member readiness and
reuse descendant settlement policy so unfinished obligations stay in the
registry without starving ordinary user input.

Cover child and descendant waits through the real session store, registry and
controller, preserve the obligation until completion, and verify queued user
turns run in FIFO order. Keep retirement fixtures on settled child delivery.

Refs openclaw#143334.

* fix(agents): remove requester settlement type cycle
RomneyDa added a commit that referenced this pull request Oct 28, 2026
…FO (#184022)

* fix(agents): keep unfinished restored cohorts out of requester FIFO

Restore requester completion reservations only once their child and descendant
work can run through the existing settle path. Share live member readiness and
reuse descendant settlement policy so unfinished obligations stay in the
registry without starving ordinary user input.

Cover child and descendant waits through the real session store, registry and
controller, preserve the obligation until completion, and verify queued user
turns run in FIFO order. Keep retirement fixtures on settled child delivery.

Refs #143334.

* fix(agents): remove requester settlement type cycle

(cherry picked from commit d738163)

Adaptation-Base: cecd7059127eb19b4d2a2d2143e6bd4cb126b40b
Adaptation-Scope: Gate restored cohorts on terminal child and descendant readiness with exact batch membership
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit f1b0cd7834096a9c4ff62449a249f3c86b9e533d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

1 participant