Skip to content

fix: resume tasks after deferred startup recovery - #165184

Merged
roboclaw-bot merged 2 commits into
mainfrom
openclaw/investigating-why-a-pr-wasn-t-merged
Oct 4, 2026
Merged

roboclaw-bot merged 2 commits into
mainfrom
openclaw/investigating-why-a-pr-wasn-t-merged

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Tasks can remain stopped after a Gateway restart when database startup inspection is still pending or one child-completion group cannot transfer its retained result.

User Impact

Interrupted work keeps its resume obligation and retries automatically. A failed requester group no longer stops unrelated groups from recovering. Cancellation, supersession, and database/Gateway ownership checks remain intact. No configuration or schema migration is required.

Why This Change Was Made

Pending inspection is not a failed delivery: retain the existing wake, counters, and replay identity, then retry after 30 seconds. Startup activation isolates failed transfers and retries them under the original owner with existing 1-second exponential backoff capped at 30 seconds. Already-restored runs are not launched again.

Evidence

  • Regressions failed before the repair: pending inspection erased the wake; an invalid prepared cohort prevented a healthy later requester from activating.
  • 263 passing checks: 213 lifecycle tests, 28 requester persistence/replay tests, 13 native custody tests, 8 queued-recovery tests, and one real isolated Gateway WebSocket session-create/readback smoke.
  • Covers prolonged inspection, cancellation, confirmed inspection failure, persisted reload, per-child retention metadata, healthy groups beside failed groups, hydration order, reset, and Gateway replacement.
  • Core and all 27 core-test type graphs passed. Typed lint, formatting, line limits, dead exports, import cycles, and the other selected ownership/schema guards passed after fixture-only type/layout corrections. Independent review found no actionable P0–P2 findings.
  • No production Gateway was restarted. Persistence tests use real SQLite with fixture-owned Gateway transport; the separate socket smoke uses an isolated real Gateway.

Measured with the repository test wrappers and one worker: final lifecycle/requester invocation 87.30 seconds total (file durations 18.93 seconds for 213 tests and 49.28 seconds for 28 tests); native custody/queued invocation 52.35 seconds total (file durations 44.66 and 5.04 seconds). The longer existing suites retain native persistence, cleanup, and replay ordering rather than replacing those contracts with mocks. Published CI run: 46 executed jobs passed, 8053 summed job-seconds across parallel workers, 429 seconds from first job start to final gate completion. These are full-workflow costs, not per-test or incremental costs; conditionally skipped jobs are excluded.

Worked on by

Work sessions


View the OpenClaw team session

roboclaw-bot and others added 2 commits October 4, 2026 23:04
Retain pending requester wakes through database startup and isolate failed requester cohorts without weakening ownership or cancellation checks.

Co-authored-by: steipete <[email protected]>
Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: afcb2b20-cf2d-4500-af58-cad2b5562ce4
@clawsweeper

clawsweeper Bot commented Oct 4, 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 docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: L labels Oct 4, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 4, 2026 23:08
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 7:14 PM ET / 23:14 UTC.

ClawSweeper review

What this changes

The PR preserves task-resumption requests while database startup inspection is pending and lets independent task groups recover when another group's result transfer fails.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still contains both recovery failure paths, and this PR provides a focused repair with no actionable correctness findings.

Priority: P1
Reviewed head: 86a7573f39030f687476a34074d3a5bc4641e8bc

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-preserving repair with meaningful regression coverage and no actionable patch findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The bot-authored PR is exempt from ordinary contributor proof. Inspected SQLite-backed regressions exercise retained recovery state with fixture transport; the reported real WebSocket smoke covers session creation/readback. The patch changes no stored format or schema.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The bot-authored PR is exempt from ordinary contributor proof. Inspected SQLite-backed regressions exercise retained recovery state with fixture transport; the reported real WebSocket smoke covers session creation/readback. The patch changes no stored format or schema.
Evidence reviewed 7 items Introduced patch and merge result: Inspected the pinned merge-base-to-head changes. Comparing the verified test merge with its main parent confirms that the recovery changes survive the merge and are not base-branch drift.
Current-main defect: Current main treats pending database inspection as a failed wake and completes its retained bookkeeping. The branch instead preserves the existing batch state and writes a future retry deadline through the existing mutation owner.
Retry ownership and cancellation: Activation retries retain the original database context and Gateway-owner assertion. Wake mutations continue checking cancellation, run ownership, rearm generation, and current commit custody; existing transitions preserve each child's progress and retirement metadata.
Findings None None.
Security None None.

How this fits together

The subagent registry tracks delegated tasks and returns completed results to their requesting session. After a Gateway restart, it restores those records and schedules the remaining continuation work.

flowchart TD
  A[Gateway restart] --> B[Restore task records]
  B --> C[Recover requester groups]
  C --> D[Check current ownership]
  D --> E[Resume independent tasks]
  D --> F[Retry retained transfers]
  F --> D
  E --> G[Continue requester session]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +108, Tests +435, Docs +9. Total +552 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 3 199 91 +108
Tests 6 463 28 +435
Docs 1 10 1 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 672 120 +552

Review metrics

Metric Value Why it matters
Production versus regression coverage production +108 lines; tests and test support +535 lines Production growth supports cohort isolation and owner-bound retries; most added code exercises recovery invariants.

Technical review

Best possible solution:

Keep durable continuation custody with the existing registry owner while recovering independent groups without relaunching restored tasks.

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

Yes, from source: pending inspection reaches the terminal wake-rejection path, and an initial requester-transfer rejection interrupts the current-main activation loop. Added regressions target both mechanisms; this review did not execute them.

Is this the best way to solve the issue?

Yes. The patch reuses existing durable mutations and retry scheduling while retaining ownership checks and preventing duplicate restored-run activation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 81fd86410e1e.

Labels

Label changes:

  • add P1: The source-proven failures can strand delegated work and its requester continuation after a Gateway restart.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The bot-authored PR is exempt from ordinary contributor proof. Inspected SQLite-backed regressions exercise retained recovery state with fixture transport; the reported real WebSocket smoke covers session creation/readback. The patch changes no stored format or schema.

Label justifications:

  • P1: The source-proven failures can strand delegated work and its requester continuation after a Gateway restart.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The bot-authored PR is exempt from ordinary contributor proof. Inspected SQLite-backed regressions exercise retained recovery state with fixture transport; the reported real WebSocket smoke covers session creation/readback. The patch changes no stored format or schema.

Evidence

What I checked:

  • Introduced patch and merge result: Inspected the pinned merge-base-to-head changes. Comparing the verified test merge with its main parent confirms that the recovery changes survive the merge and are not base-branch drift. (src/agents/subagents/registry/subagent-registry-restore.ts:249, 5b80aec93cc9)
  • Current-main defect: Current main treats pending database inspection as a failed wake and completes its retained bookkeeping. The branch instead preserves the existing batch state and writes a future retry deadline through the existing mutation owner. (src/agents/subagents/registry/subagent-registry-lifecycle-wake.ts:507, 81fd86410e1e)
  • Retry ownership and cancellation: Activation retries retain the original database context and Gateway-owner assertion. Wake mutations continue checking cancellation, run ownership, rearm generation, and current commit custody; existing transitions preserve each child's progress and retirement metadata. (src/agents/subagents/registry/subagent-registry-restore.ts:263, 86a7573f3903)
  • Focused regression coverage: Inspected added cases for prolonged pending inspection, cancellation, confirmed inspection failure, persisted reload, independent requester recovery, hydration order, reset, and Gateway replacement. These use fake timers and existing fixtures; transport mocks are supplemental evidence, not live recovery proof. Tests were not executed during this read-only review. (src/agents/subagents/registry/subagent-registry.requester-wake-admission.test-support.ts:40, 86a7573f3903)
  • Reported validation: The captured PR body reports 262 test checks plus an isolated real Gateway WebSocket session-create/readback smoke, measured suite durations, and passing type and ownership guards. The socket smoke addresses public session composition; it does not independently demonstrate deferred recovery. (86a7573f3903)
  • Area history and routing: Current-main history identifies repeated requester-wake and registry refactors by Peter Steinberger, plus collector rollback work by Vincent Koc. GitHub commit reads verified the handles steipete and vincentkoc. Some older blobs were unavailable for blame and content-history inspection, so no source-line introduction attribution is claimed. (src/agents/subagents/registry/subagent-registry-restore.ts, 64406536043a)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@roboclaw-bot
roboclaw-bot merged commit f4bb84b into main Oct 4, 2026
208 of 212 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/investigating-why-a-pr-wasn-t-merged branch October 4, 2026 23:33
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
* fix: resume tasks after deferred startup recovery

Retain pending requester wakes through database startup and isolate failed requester cohorts without weakening ownership or cancellation checks.

Co-authored-by: steipete <[email protected]>

* fix: resume tasks after deferred startup recovery

Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: afcb2b20-cf2d-4500-af58-cad2b5562ce4

---------

Co-authored-by: steipete <[email protected]>
steipete added a commit that referenced this pull request Oct 9, 2026
Reuse the existing read-candidate owner so pending writable startup admission does not block independent recovery reads. Keep cold reads serialized with first creation and retain native custody through cleanup.

Preserve the deferred-recovery contract from #165184 after #167515. Verify raw sharing fixture aftermath without recertifying foreign edits, and count initial authority reads across cold and prepared worker lanes. Restores the eight red-main cases identified by the stability campaign without changing schema, public contracts, or sharing policy.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 10, 2026
Reuse the existing read-candidate owner so pending writable startup admission does not block independent recovery reads. Keep cold reads serialized with first creation and retain native custody through cleanup.

Preserve the deferred-recovery contract from openclaw#165184 after openclaw#167515. Verify raw sharing fixture aftermath without recertifying foreign edits, and count initial authority reads across cold and prepared worker lanes. Restores the eight red-main cases identified by the stability campaign without changing schema, public contracts, or sharing policy.
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 gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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