Skip to content

fix(agents): preserve child handoffs after completed-task cleanup - #187270

Merged
fuller-stack-dev merged 4 commits into
mainfrom
openclaw/fresh-shrimp
Oct 29, 2026
Merged

fuller-stack-dev merged 4 commits into
mainfrom
openclaw/fresh-shrimp

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes child-result handoffs failing when completed-task cleanup removes a delivered result still needed by the active parent task.

User Impact

Parents can finish collecting their child results after the cleanup interval, including a paused child resumed within the same task. No user action or configuration change is required.

Why This Change Was Made

Keep only the canonical delivered row needed by its exact live, accepting requester instance and matching task/child receipt. Preserve the existing accounting metadata during actual same-task paused resumption, while binding fresh completion permission—not retaining old permission.

Normal TTL cleanup resumes after the requester closes. Missing receipts still fail closed; no stored schema, configuration, or TTL setting changes.

Scope

This fixes the demonstrated live-instance retention and paused-resumption paths. It does not establish or fix the unproved historical compaction cause, general requester-claim changes, or delayed waiting-status callbacks.

Evidence

  • Committed regression coverage; 238 focused tests passed across 7 files, including all 43 child-coordination tests. Both touched test files were audited in full.
  • Maintained core type-aware lint passed for the 9 originally changed files; formatting and the current-source QA runtime build passed.
  • Local automated P0/P1 review completed one full pass over those 9 source files with no findings; two independent source reviews passed.
  • A type-only follow-up moves the completion custody types beside the registry memory owner, removing the import cycle flagged in review. Its 3 files passed type-aware lint and the other 7 files are unchanged; the 43 coordination tests and a fresh runtime build passed again, and both independent reviews plus a code-comment review of all 10 files found nothing open.
  • The full local TypeScript compiler did not run: dependency-runtime containment refused launch. Required exact-head CI passed; the CodeQL aggregate was neutral, with unrun configurations not counted as tested. Independent exact-base/head verification passed: the base hit three intended handoff failures, while the same 43 cases passed with the fix; real Gateway/model healthy-flow controls passed on both revisions.
  • An expanded root-work test failure reproduced identically on the unchanged base; it is not counted as passing or attributed to this fix.

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: L labels Oct 29, 2026
@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review October 29, 2026 04:24
@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. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 29, 2026
@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves delivered child-result records while their exact live parent still needs them to settle its accepted work.

Example: A parent receives RECEIPT-1, continues working for six minutes, then yields while awaiting three more child results.

  • Before: The five-minute cleanup can delete the first result's registry row, preventing complete parent settlement.
  • After: The matching live requester receipt preserves that row until settlement, after which normal cleanup resumes.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported repair with the previous blocker resolved and passing exact-head CI; changed-behavior evidence remains at the in-process boundary.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its changed cleanup and paused-resumption paths have in-process regression coverage, while the reported real Gateway/model runs cover healthy controls rather than the repaired trigger.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A parent can fail to finish collecting accepted child work after cleanup removes an earlier delivered result's accounting row.
Reason: The maintainer-authored direction restores the existing completion contract with a bounded exception to premature cleanup.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a current child-handoff failure, and the previous import-cycle finding is resolved; no new actionable defect was found.

Priority: P2
Reviewed head: f0dd14cb25361c862b86a18bb3a13385d00af05f

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied healthy Gateway/model controls do not demonstrate parent settlement after the cleanup interval or paused-child resumption through a shipped entry point.
Agent review details

How this fits together

Session tools register accepted child work in the subagent registry, which owns completion delivery, parent settlement, and eventual record cleanup.

flowchart TD
  A[Parent session] --> B[Sessions send]
  B --> C[Subagent registry]
  C --> D[Child completion]
  D --> E[Parent settlement]
  C --> F[Retention sweeper]
  G[Live requester receipts] --> F
  F --> C
Loading

Technical review

Best possible solution:

Keep the existing registry as the sole completion owner and retain only the delivered rows required by exact live requester receipts.

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

Current-main source establishes the failure path: cleanup removes a delivered row after five minutes, then complete-batch settlement refuses its surviving receipt; the PR reports three intended base failures and passing head coverage, which this read-only review did not execute.

Is this the best way to solve the issue?

The repair addresses premature deletion at its existing owner, preserves fail-closed settlement, and uses in-process accounting metadata without introducing another store or changing completion permissions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1032118cede1.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +78, Tests +563. Total +641 across 10 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 8 95 17 +78
Tests 2 563 0 +563
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 658 17 +641

Review metrics

Metric Value Why it matters
Production versus test changes Production +95/-17 lines; tests and test support +563/-0 lines. The production growth extends existing custody accounting and cleanup; the test table exercises distinct receipt, lifecycle, and settlement boundaries.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: The repair addresses child-result settlement after the cleanup interval, with a limited trigger and no demonstrated broad outage.
  • 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.

  • For stronger confidence, capture a real Gateway parent settling after the five-minute cleanup interval, including same-task paused-child resumption.

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-29T04:43:07.703Z sha 14e12c3 :: needs changes before merge. :: [P2] Keep completion custody out of the shared record-types module

Reviewed October 29, 2026, 1:51 AM ET / 05:51 UTC (Revision 2).

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 29, 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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 29, 2026
@fuller-stack-dev
fuller-stack-dev merged commit 903b5f2 into main Oct 29, 2026
155 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the openclaw/fresh-shrimp branch October 29, 2026 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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.

1 participant