Skip to content

fix(agents): resume interrupted tasks after gateway restarts - #138394

Merged
fuller-stack-dev merged 1 commit into
mainfrom
openclaw/restart-safe-task-recovery
Sep 5, 2026
Merged

fuller-stack-dev merged 1 commit into
mainfrom
openclaw/restart-safe-task-recovery

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

After a hard Gateway process restart, an interrupted delegated task could remain abandoned until an operator manually prompted the session. A hard kill cannot write the normal abort marker, so recovery skipped a session still recorded as running. When recovery did create a successor, the subagent owner and canonical task were persisted separately; a failure between those writes could leave the successor active while the task and its mirrored TaskFlow stayed failed.

Fixes #137991.

Why This Change Was Made

  • Treat a retired running session with no live run/admission as the interrupted owner a hard kill could not mark.
  • Revalidate the exact predecessor, session, lifecycle, task, and backing generation at the existing shared-state owner.
  • Commit predecessor retirement, successor ownership, and canonical task reactivation in one synchronous transaction on the existing SQLite handle, then publish registry/task/TaskFlow memory only after commit.
  • Preserve the existing bounded live-successor persistence retry, but retry the whole atomic commit instead of writing a partial registry state.
  • Confirm successful automatic resumption to the original requester with a stable idempotency key before releasing completion monitoring. Failed or suppressed delivery remains durable debt for a bounded retry window, then releases terminal cleanup.

The material persistence design was explicitly accepted in issue #137991. This adds no schema, migration, configuration, scheduler, controller, retention, security-policy, or protocol surface.

Direct dependency inspection used Codex 8e6a44b428e31f91b21edc97904fcdf4f0931ade: thread/resume and turn/start remain distinct app-server requests (codex-rs/app-server-protocol/src/protocol/common.rs:524-535,982-986), while running-thread resume attaches the connection and reports active-turn state (codex-rs/app-server/src/request_processors/thread_lifecycle.rs:568-703). The repair therefore stays in OpenClaw's recovery/orchestration owners; it does not add or change a Codex protocol.

Production/tooling delta: +1,028/-426 (net +602). Test/support delta: +1,835/-264 (net +1,571). The production growth is the automatic hard-kill recovery capability, the atomic cross-owner commit boundary, and the requester confirmation path; the previous split writer and obsolete task-detail mutation path are removed.

User Impact

Interrupted managed subagent work now resumes automatically after a Gateway restart without a manual prompt. The original conversation receives a resumption confirmation after recovery has actually dispatched and adopted the successor. That confirmation is distinct from the later task-completion reply.

Failed persistence cannot publish half of the ownership transfer, late predecessor terminal events cannot overwrite a live successor, and a second restart does not duplicate the recovered turn or its external tool effects.

Evidence

Regression: red on the split writer

node scripts/run-vitest.mjs src/agents/subagents/registry/subagent-registry-task-replacement.test.ts -t 'task activation persistence rejects'
1 failed, 4 skipped

The injected canonical task activation failure still returned replacement success, persisted the successor, and left the task/TaskFlow terminal.

Green

node scripts/run-vitest.mjs src/agents/subagents/registry/subagent-control.publication.test.ts src/agents/subagents/registry/subagent-control.recovery.test.ts src/agents/subagents/registry/subagent-delivery-state.test.ts src/agents/subagents/registry/subagent-registry-lifecycle.test.ts src/agents/subagents/registry/subagent-registry-restart-recovery.test.ts src/agents/subagents/registry/subagent-registry-restart-recovery-helpers.test.ts src/agents/subagents/registry/subagent-registry-task-replacement.test.ts src/agents/subagents/registry/subagent-registry-sweeper-recovery.test.ts src/agents/subagents/spawn/subagent-spawn-cleanup.test.ts src/gateway/session-subagent-reactivation.test.ts src/gateway/server-methods/sessions.send-followup-status.test.ts src/gateway/server-instance-runtime.test.ts
320 passed

node scripts/run-vitest.mjs src/gateway/session-subagent-reactivation.test.ts
7 passed

node scripts/check-changed.mjs --staged
passed: formatting, architecture, all TypeScript graphs, dead exports, core/extension lint, schema v15, database-first storage, runtime-cycle, webhook, and pairing guards

.agents/skills/autoreview/scripts/autoreview --mode uncommitted --base 05a236c7afbcf1956e40642d4f1777af4a378da3 --max-priority P2
scoped-clean; no accepted/actionable findings

Autoreview findings resolved before publication include failed confirmation delivery blocking settlement, legacy task identity across chained recovery, incoherent observer publication, undurable accepted-run ownership, and the completed-session replacement race. The final P1 regression proves a losing accepted run is terminated while an already-canonical successor remains live.

Isolated hard-restart proof

node scripts/run-vitest.mjs extensions/qa-lab/src/plugin-subagent-self-yield-followup.e2e.test.ts -t 'rearms a failed task projection during automatic process-restart recovery'
1 passed

Ephemeral Gateway + QA channel + mock provider verdict:

{
  "status": "pass",
  "originalGeneration": 1,
  "recoveredGeneration": 2,
  "restoredStatus": "succeeded",
  "recoveryRequests": 1,
  "operatorPromptRequired": false,
  "resumptionConfirmations": 1,
  "completionReplies": 1,
  "toolCallsBeforeRestart": { "exec": 1, "wait": 1 },
  "toolCallsAfterRestart": { "exec": 1, "wait": 1 }
}

The proof passed on exact head a7df9c6b06f134250123febce2457caeb183c957. It hard-kills the first Gateway, verifies automatic successor adoption with the same requester/child session identities, waits for the resumption confirmation before releasing provider completion, restarts the Gateway again, observes a full recovery sweep, and verifies no duplicate recovery request, reply, or tool call.

Related merged owners inspected: #136780, #137606, and #137851.

@clawsweeper

clawsweeper Bot commented Sep 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.

@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review September 4, 2026 16:19
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling extensions: qa-lab size: XL maintainer Maintainer-authored PR labels Sep 4, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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 Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 4, 2026, 7:00 PM ET / 23:00 UTC.

ClawSweeper review

What this changes

Restores interrupted delegated work after Gateway restarts, atomically reactivates its task and mirrored flow, sends a resumption notice, and prevents predecessor events from overwriting successor status.

Merge readiness

⛔ Blocked before merge - 9 items remain

Keep open: the underlying task-state defect remains on inspected main and v2026.9.1, and the related merged PRs do not supersede this repair. The owner-level repair has substantial supporting evidence, but three introduced defects remain, including the previously raised final-delivery fence.

Priority: P1
Reviewed head: 098e06cdd5755280521639ab6d6bf33dd7927de0

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Substantial recovery work and meaningful real-flow evidence are held back by concrete authority, receipt-settlement and cleanup defects.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied isolated Gateway/SQLite/QA-channel SIGKILL run supports automatic successor recovery and task/flow continuity, but does not exercise owner replacement during awaited outbound preparation or rejection at final transport dispatch. Preserve that valid recovery evidence and add allowed/stale-owner delivery and replay observations. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied isolated Gateway/SQLite/QA-channel SIGKILL run supports automatic successor recovery and task/flow continuity, but does not exercise owner replacement during awaited outbound preparation or rejection at final transport dispatch. Preserve that valid recovery evidence and add allowed/stale-owner delivery and replay observations. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 14 items Pinned introduction and merge ownership: The reviewed checkout is the original head 098e06c; its introduced delta is against parent 05a236c. The raw test-merge record has exactly pinned base d329e61 followed by that head. Comparing the merge against its first parent preserves the notice-fence and cleanup changes; the reviewed resumption helper also has identical head/test-merge blobs. Findings do not rely on endpoint drift.
Current main still leaves terminal task status unchanged: The canonical backing updater finds the task associated with its mirrored flow but updates only detail. It does not reactivate a failed task or clear predecessor terminal metadata, so the central successor/task-state problem remains.
Release behavior: The provided release snapshot identifies v2026.9.1; its inspected backing updater has the same detail-only behavior. This is not a main-only implementation awaiting release.
Findings 3 actionable findings [P1] [P1] Fence recovery notices at the final platform send
[P2] [P2] Match notice IDs to their completion-retention namespace
[P2] [P2] Terminate cleanup when the accepted run has already ended
Security Needs attention Retired recovery authority can still emit a notice: The captured owner predicate is checked before asynchronous outbound preparation, not at the final transport effect. A replaced owner can therefore cause recipient-visible I/O after revocation; this is an operational-authority violation, not demonstrated cross-account access.

How this fits together

The subagent registry tracks delegated child runs and recovers unfinished work when the Gateway restarts. Recovery updates operator-visible task and flow status, resumes execution, and sends notices through the shared outbound delivery queue.

flowchart TD
  A[Gateway restart or follow-up] --> B[Saved child run and session]
  B --> C{Current recovery owner?}
  C -->|Yes| D[Commit successor, task and flow]
  C -->|No| H[Reject stale work]
  D --> E[Resume child execution]
  D --> F[Queue recovery notice]
  F --> G[Recipient and delivery receipt]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied isolated Gateway/SQLite/QA-channel SIGKILL run supports automatic successor recovery and task/flow continuity, but does not exercise owner replacement during awaited outbound preparation or rejection at final transport dispatch. Preserve that valid recovery evidence and add allowed/stale-owner delivery and replay observations. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • [P1] Fence recovery notices at the final platform send (P1) - The new subagent resumption path supplies a revocable isCurrent, but this check runs only before sendMessage. Channel resolution, durable admission and send-marker persistence can await afterward; replacing the recovery owner during those waits still allows the stale notice to reach its recipient. The outbound API already exposes onPlatformSendDispatch for this exact final-effect check. Enforce the current owner and Gateway instance there, keep replay owner-fenced, and cover revocation while delivery is held rather than only an initially false predicate.
  • [P2] Match notice IDs to their completion-retention namespace (P2) - This newly introduced ID starts with subagent-recovery:, while sendRecoveryNotice always supplies retention with idPrefix: "main-session-restart-recovery:". Durable admission preserves the ID, and completion explicitly rejects mismatched producer prefixes. Consequently, even a successful queued notice fails acknowledgment and is retained as unresolved post-send state instead of receiving its bounded completion receipt. Use a matching producer namespace and test the actual completion record and replay behavior, not only the visible message.
  • [P2] Terminate cleanup when the accepted run has already ended (P2) - The new cleanup call omits expectedSessionId and expectedLifecycleRevision. If the accepted execution finishes or errors before cleanup, chat.abort legitimately returns aborted: false with no run IDs. The helper then attempts guarded session deletion, which always returns failed without those identifiers, and its retry loop has no stopping predicate. The handler therefore keeps issuing abort requests and never propagates the original replacement error. Use run/lifecycle-scoped termination with a terminal already-ended or replaced outcome; do not solve this by deleting a durable follow-up conversation.
  • Resolve security concern: Retired recovery authority can still emit a notice - The captured owner predicate is checked before asynchronous outbound preparation, not at the final transport effect. A replaced owner can therefore cause recipient-visible I/O after revocation; this is an operational-authority violation, not demonstrated cross-account access.
  • Resolve merge risk (P1) - Recovery ownership can be revoked during outbound preparation while the retired run's notice still reaches the recipient.
  • Resolve merge risk (P1) - A sent subagent resumption notice cannot obtain its configured bounded completion receipt, leaving unresolved post-send custody instead of reliable replay settlement.
  • Resolve merge risk (P1) - A rejected follow-up whose execution has already ended can retain an unbounded cleanup loop and repeated Gateway abort traffic.
  • Complete next step (P2) - Enforce current-owner authority at final delivery and replay, align notice IDs with bounded receipt retention, and make rejected-follow-up cleanup terminate safely; add focused regressions and allowed/stale-owner transport proof.

Findings

  • [P1] [P1] Fence recovery notices at the final platform send — src/gateway/server-instance-runtime.ts:183-185
  • [P2] [P2] Match notice IDs to their completion-retention namespace — src/agents/subagents/registry/subagent-registry-restart-recovery-session.ts:99-106
  • [P2] [P2] Terminate cleanup when the accepted run has already ended — src/gateway/server-methods/sessions-messaging.ts:260-264
  • [medium] Retired recovery authority can still emit a notice — src/gateway/server-instance-runtime.ts:183
Agent review details

Security

Needs attention: New recovery notices can outlive their owner's authority at external I/O; no unrelated dependency, permission or supply-chain change was found.

PR surface

Source +556, Tests +1468, Other +1. Total +2025 across 44 files.

View PR surface stats
Area Files Added Removed Net
Source 29 978 422 +556
Tests 14 1728 260 +1468
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 44 2707 682 +2025

Review metrics

Metric Value Why it matters
Production versus test delta Production +978/-422 (net +556); tests/support/benchmark +1729/-260 (net +1469) Production growth supplies crash-orphan recovery, atomic ownership transfer and durable notice debt; moved helpers cancel out of the net delta.
Atomic replacement boundary 3 durable record types coordinated in 1 transaction The successor registry row, canonical task and mirrored flow must commit and become observable coherently.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #137991
Summary: This PR is the candidate repair for successor task-state recovery; the related merged changes address adjacent settlement, wake-delivery and guidance problems.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Complete the delivery and cleanup contracts (recommended)
    Preserve the atomic recovery work while fixing final-send owner validation, producer-matched completion receipts, and terminal cleanup, then prove valid delivery and stale-owner rejection through the production boundary.

Technical review

Best possible solution:

Keep recovery in the existing registry, with atomic task/flow publication, final-send authority, valid bounded receipts, and terminating run-scoped cleanup; the previously missing crash-orphan and cross-record commit contracts justify production growth.

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

Yes, there is a high-confidence source path: accepted successor replacement on inspected main updates backing detail without rearming the failed task, and the supplied real-registry/SQLite regressions exercise that mismatch; this review did not execute them.

Is this the best way to solve the issue?

No, not yet: atomic replacement is the correct owner boundary, but notification delivery and rejected-follow-up cleanup violate existing downstream contracts.

Full review comments:

  • [P1] [P1] Fence recovery notices at the final platform send — src/gateway/server-instance-runtime.ts:183-185
    The new subagent resumption path supplies a revocable isCurrent, but this check runs only before sendMessage. Channel resolution, durable admission and send-marker persistence can await afterward; replacing the recovery owner during those waits still allows the stale notice to reach its recipient. The outbound API already exposes onPlatformSendDispatch for this exact final-effect check. Enforce the current owner and Gateway instance there, keep replay owner-fenced, and cover revocation while delivery is held rather than only an initially false predicate.
    Confidence: 0.98
  • [P2] [P2] Match notice IDs to their completion-retention namespace — src/agents/subagents/registry/subagent-registry-restart-recovery-session.ts:99-106
    This newly introduced ID starts with subagent-recovery:, while sendRecoveryNotice always supplies retention with idPrefix: "main-session-restart-recovery:". Durable admission preserves the ID, and completion explicitly rejects mismatched producer prefixes. Consequently, even a successful queued notice fails acknowledgment and is retained as unresolved post-send state instead of receiving its bounded completion receipt. Use a matching producer namespace and test the actual completion record and replay behavior, not only the visible message.
    Confidence: 0.99
  • [P2] [P2] Terminate cleanup when the accepted run has already ended — src/gateway/server-methods/sessions-messaging.ts:260-264
    The new cleanup call omits expectedSessionId and expectedLifecycleRevision. If the accepted execution finishes or errors before cleanup, chat.abort legitimately returns aborted: false with no run IDs. The helper then attempts guarded session deletion, which always returns failed without those identifiers, and its retry loop has no stopping predicate. The handler therefore keeps issuing abort requests and never propagates the original replacement error. Use run/lifecycle-scoped termination with a terminal already-ended or replaced outcome; do not solve this by deleting a durable follow-up conversation.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6c63f6710637.

Labels

Label changes:

  • add merge-risk: 🚨 availability: The introduced rejected-follow-up cleanup can retry indefinitely when the accepted run has already ended.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied isolated Gateway/SQLite/QA-channel SIGKILL run supports automatic successor recovery and task/flow continuity, but does not exercise owner replacement during awaited outbound preparation or rejection at final transport dispatch. Preserve that valid recovery evidence and add allowed/stale-owner delivery and replay observations. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 📣 needs proof.

Label justifications:

  • P1: This repairs an existing delegated-task restart workflow that can leave active successor work represented as failed.
  • merge-risk: 🚨 message-delivery: New resumption notices use a delivery ID incompatible with their completion-retention namespace, preventing durable acknowledgment.
  • merge-risk: 🚨 security-boundary: The new revocable recovery-owner predicate is not enforced at recipient-visible I/O after awaited outbound preparation.
  • merge-risk: 🚨 availability: The introduced rejected-follow-up cleanup can retry indefinitely when the accepted run has already ended.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied isolated Gateway/SQLite/QA-channel SIGKILL run supports automatic successor recovery and task/flow continuity, but does not exercise owner replacement during awaited outbound preparation or rejection at final transport dispatch. Preserve that valid recovery evidence and add allowed/stale-owner delivery and replay observations. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [medium] Retired recovery authority can still emit a notice — src/gateway/server-instance-runtime.ts:183
    The captured owner predicate is checked before asynchronous outbound preparation, not at the final transport effect. A replaced owner can therefore cause recipient-visible I/O after revocation; this is an operational-authority violation, not demonstrated cross-account access.
    Confidence: 0.98

What I checked:

  • Pinned introduction and merge ownership: The reviewed checkout is the original head 098e06c; its introduced delta is against parent 05a236c. The raw test-merge record has exactly pinned base d329e61 followed by that head. Comparing the merge against its first parent preserves the notice-fence and cleanup changes; the reviewed resumption helper also has identical head/test-merge blobs. Findings do not rely on endpoint drift. (4b4fda4c7142)
  • Current main still leaves terminal task status unchanged: The canonical backing updater finds the task associated with its mirrored flow but updates only detail. It does not reactivate a failed task or clear predecessor terminal metadata, so the central successor/task-state problem remains. (src/tasks/task-backing-authority-write.ts:25, 6c63f6710637)
  • Release behavior: The provided release snapshot identifies v2026.9.1; its inspected backing updater has the same detail-only behavior. This is not a main-only implementation awaiting release. (src/tasks/task-backing-authority-write.ts:25, ad6fe23aecb9)
  • Canonical atomic replacement and sibling coverage: The new replacement owner rereads authoritative source, task and flow records inside one synchronous transaction, writes their successor state together, and publishes memory before deferred observers. The real-registry/SQLite replacement tests cover persisted rearming, write-failure rollback, observer coherence and late predecessor terminal events. The lifecycle changes preserve separate ACP handling rather than applying subagent ownership rules indiscriminately. (src/agents/subagents/registry/subagent-registry-replacement-store.ts:80, 098e06cdd575)
  • Final-effect authority remains unchecked: The new predicate check precedes sendMessage. That callee awaits configuration/channel preparation and durable delivery work; its existing onPlatformSendDispatch contract at src/infra/outbound/message.ts:130 is forwarded to the final send boundary, including after awaited send-marker persistence at src/infra/outbound/deliver-queue-execute.ts:290. Recovery notices do not supply that hook. The added runtime test only starts with isCurrent already false, so it does not exercise revocation during preparation. (src/gateway/server-instance-runtime.ts:183, 098e06cdd575)
  • Rejected follow-up cleanup has no terminal exit: The introduced call omits both frozen session identifiers. terminateAcceptedCollectorRun retries until exact abort or guarded deletion succeeds; deletion immediately returns failed without those identifiers. A run that has already ended legitimately produces aborted:false with no run IDs at src/gateway/server-methods/chat-abort-handler.ts:304. Existing abort and cleanup tests cover these contracts, while the new follow-up test mocks termination as immediately resolved. (src/gateway/server-methods/sessions-messaging.ts:261, 098e06cdd575)

Likely related people:

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

Rank-up moves

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

  • Enforce final-send and replay ownership, then demonstrate valid delivery and stale-owner rejection through the production transport boundary.
  • Align resumption-notice IDs and retention, and verify a completed receipt survives reopening without another notice.
  • Replace the nonterminating cleanup path and cover an already-ended accepted run using the real cleanup contract.

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.

History

Review history (5 earlier review cycles)
  • reviewed 2026-09-04T16:38:52.352Z sha fbf72ad :: blocked before merge. :: [P1] Persist the mirrored flow in the replacement transaction
  • reviewed 2026-09-04T19:55:53.017Z sha 15117d0 :: blocked before merge. :: [P1] Fence the resumption notice with the live successor owner
  • reviewed 2026-09-04T21:40:07.991Z sha ac2228d :: blocked before merge. :: [P1] Fence replayed resumption notices with the current owner
  • reviewed 2026-09-04T21:53:11.492Z sha 429b9e4 :: blocked before merge. :: [P1] Fence recovery notices at final outbound delivery
  • reviewed 2026-09-04T22:11:28.854Z sha a17e7f497e0a38b98ac4ee1c2f9b25ff59feac51 :: blocked before merge. :: [P1] Fence recovery notices at final outbound delivery

@fuller-stack-dev
fuller-stack-dev force-pushed the openclaw/restart-safe-task-recovery branch from fbf72ad to 15117d0 Compare September 4, 2026 19:46
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Sep 4, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Updated head 15117d03cbc9472647489929a22d3b1f5d52367b addresses the prior ClawSweeper rank-up moves and the first hosted-CI failures.

  • The successor, canonical task, and derived task-mirrored flow now commit in one synchronous shared-state transaction. Fault regressions reject each write boundary and reload SQLite to verify that no partial owner/task/flow state survives.
  • Raced predecessor success/cancellation remains terminal; only failed, timed-out, or lost projections reactivate.
  • Accepted runs that lose completed-session replacement ownership are terminated; an already-canonical successor is preserved.
  • The exact isolated hard-restart proof reports operatorPromptRequired: false, one automatic recovery request, one resumption confirmation, one later completion reply, and no duplicate tool effects after a second restart.

Fresh local gates on this head: 270 owner/recovery tests, 7 completed-session reactivation tests, full check-changed --staged, and P0-P2 autoreview scoped-clean.

@clawsweeper re-review

@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 4, 2026
@fuller-stack-dev
fuller-stack-dev force-pushed the openclaw/restart-safe-task-recovery branch from 15117d0 to ac2228d Compare September 4, 2026 21:30
@fuller-stack-dev

fuller-stack-dev commented Sep 4, 2026 •

Copy link
Copy Markdown
Member Author

Exact head a7df9c6b06f134250123febce2457caeb183c957 addresses the latest ClawSweeper rank-up moves and hosted-CI findings.

  • The successor, canonical task, and derived task-mirrored flow now commit in one synchronous shared-state transaction. Fault regressions reject each write boundary and reload SQLite to verify that no partial owner/task/flow state survives.
  • Raced predecessor success/cancellation remains terminal; only failed, timed-out, or lost projections reactivate.
  • Accepted runs that lose completed-session replacement ownership are terminated; an already-canonical successor is preserved.
  • Recovery notices use the normal outbound owner fence immediately before platform I/O. The held-send regression proves owner retirement emits no message; a successful send records a completed delivery owner and an idempotent replay emits no duplicate.
  • Durable-session cleanup aborts only the exact accepted run, never deletes on a Gateway error, ambiguous response, or already-ended miss.
  • Failed or suppressed resumption delivery remains durable notice debt. The first notice attempt precedes completion monitoring; terminal cleanup stays ordered for a bounded retry window and then resumes instead of wedging forever.
  • The exact isolated hard-restart proof reports operatorPromptRequired: false, one automatic recovery request, one resumption confirmation before one later completion reply, and no duplicate tool effects after a second restart.

Fresh local gates on this head: 320 owner/recovery tests, full check-changed --staged, P0-P2 autoreview scoped-clean, and the isolated hard-restart proof passed on the exact SHA.

Final landing receipts:

@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. label Sep 4, 2026
@fuller-stack-dev
fuller-stack-dev force-pushed the openclaw/restart-safe-task-recovery branch from ac2228d to 429b9e4 Compare September 4, 2026 21:45
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 4, 2026
@fuller-stack-dev
fuller-stack-dev force-pushed the openclaw/restart-safe-task-recovery branch from 429b9e4 to a17e7f4 Compare September 4, 2026 22:02
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot removed the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Sep 4, 2026
@clawsweeper clawsweeper Bot added the rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. label Sep 4, 2026
@fuller-stack-dev
fuller-stack-dev force-pushed the openclaw/restart-safe-task-recovery branch from a17e7f4 to 098e06c Compare September 4, 2026 22:45
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. 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 Sep 4, 2026
@fuller-stack-dev
fuller-stack-dev force-pushed the openclaw/restart-safe-task-recovery branch from 098e06c to a7df9c6 Compare September 5, 2026 00:20
@fuller-stack-dev
fuller-stack-dev merged commit 333e43c into main Sep 5, 2026
183 of 184 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the openclaw/restart-safe-task-recovery branch September 5, 2026 00:38
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 5, 2026
…#138785)

Follow up on #138394: route successor activity through the canonical task identity, reject stale predecessor activity, stop cleanup after Gateway retirement, and fence notice settlement after awaited delivery. Simplify atomic publication and document hard-kill recovery. The acceptance-receipt persistence cut point is tracked separately in #138783.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
…openclaw#138785)

Follow up on openclaw#138394: route successor activity through the canonical task identity, reject stale predecessor activity, stop cleanup after Gateway retirement, and fence notice settlement after awaited delivery. Simplify atomic publication and document hard-kill recovery. The acceptance-receipt persistence cut point is tracked separately in openclaw#138783.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: qa-lab gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Resumed subagent task remains failed after run replacement

1 participant