Skip to content

fix(agents): reconcile late requester recovery receipts - #155357

Merged
roboclaw-bot merged 1 commit into
mainfrom
fix/restart-registration-owner-20260922
Sep 22, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
fix/restart-registration-owner-20260922

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #143334

Merged companion fixture correction: #155621.

Current qualification boundary

Current head 9950e106f44f6db979a413158c96f4cf09cf48e8 retains the identical reviewed three-file patch and postimages on frozen existing-fix base 95221a8922d27d4b69d186cfde5065c0bba962b6. Normal hooks and all four human credit trailers are preserved. The separate fixture correction is already merged as 43834997528540d0fd2c5b792eb18c0dbdbb47e1.

Fresh exact-head CI passed: run 35726842329/1, 120 successful jobs, 17 skipped, zero failed, both required openclaw/ci-gate entries SUCCESS. All 23 authored regressions and relevant delivery/requester/reader siblings passed. The previously timed-out persisted-worker case passed in 2.931s on the existing fixture-isolation repair; channel contracts and their cleanup also passed. These outcomes do not explain or erase the older failures.

The requested current-context final-response/same-session-follow-up witness is complete. Native run 35729961457 tested source 9950e106 plus the identical already-landed fixture, verified composite a06e5f313dff1f589d1b8b5dca876baba2a37bcd. Exactly one final/follow-up case passed; the other three were intentionally unselected/skipped, retaining their prior branch proof rather than being claimed as fresh passes. All 60 named input postimages and all 48,347 source-manifest entries were verified. Original assertions include the initial request surviving the announcement budget, running-to-done state, one visible final, ordinary same-session follow-up, retained result and cleared wake.

Sanitized native result excerpt:

✓ keeps restored completion execution under the normal runtime budget: final 20848ms
Tests  1 passed | 3 skipped (4)
[restored-requester] cleanup {"gateways":[{"name":"gateway-restored-deadline-final","status":"fulfilled"}],"modelServers":["fulfilled"]}

The case took 20.848s; file time was 20.856s. E2E command wall 524.91s already includes 476.4s of private-QA preparation required by the native freshness owner. These are nested envelopes, not additive costs. No whole four-case, 31-stage, separate normal-build or manual 23+12 replay was added.

Wrapper/native exit was 0 at 13:04:53 UTC on September 22, 2026. Gateway and model cleanup fulfilled; the native lease stopped, owned staging/wrapper are absent, and the source overlay was restored clean after retaining all 60 postimages. The backing delegated workflow reached completed/cancelled at 13:09:47 UTC after native successful one-shot stop; that is lifecycle closure, not a failed or cancelled test. Raw native log SHA-256: 98e6d5f1ff0fe545a44c4ab73e2c7422d53e8946b0379a57b6e7788006830c3f.

This supplies the single proof item requested by the exact-head ClawSweeper review. It is real built-Gateway/worker/SQLite integration with a held loopback provider, not authenticated external-provider proof, a forced live trace of every late-read race, or final release qualification. Prior failed attempts and broader issue limitations remain preserved below. Normal native landing remains pending; no production merge or release pass is claimed.

What Problem This Solves

A requester recovery can finish the exact input while the original completion handoff is still awaiting its result. The original response can then look pending, empty, or interrupted even though recovery has already settled it.

User Impact

Eligible requester-settle handoffs recheck the exact recovery receipt before returning a retryable outcome. They do not dispatch or send the input again. Successful, ambiguous, intentional, permanent-failure, and explicit-stop outcomes keep their existing policy.

Why This Change Was Made

This is a targeted three-file replacement for the earlier broad proposal. It reuses the existing short-lived worker reader, binds the late observation to the captured requester/session/lifecycle/idempotency identity, and rechecks cancellation and caller ownership around the awaited read. An extracted helper preserves existing response classification rather than adding delivery policy.

There are no registry, transaction, schema, dependency, or worker-framework changes. Private/incognito paths and ordinary announcements do not acquire this extra recovery read. Failure to observe a receipt does not authorize a fresh requester turn.

Evidence

On corrected source 79618339483fe7224e03829f8d3788d2dcc1bb2c:

  • Canonical source-only autoreview and normal commit hooks passed; contributor credit is retained.
  • The initial narrowed revision's invalid Vitest cleanup registration, test-type errors and missing braces are corrected. All 23 intended cases and original assertions remain; both production files are unchanged by that fixture correction.
  • Exact-source native changed checks 31/31, production build, focused regressions 23/23 and real Gateway admission/SQLite/replay harness 12/12 passed. Focused regression command wall time was 25.67 seconds, including preparation.
  • The original built-Gateway E2E had 0/4 passing cases, failing at its initial loopback-request waits. Bounded investigation identified missing physical store identities in the synthetic seed; the existing production ownership guard rejects that missing provenance before announcement dispatch. The mismatch exists at the captured base and main. Original per-instance logs were unavailable, so the exact original runtime branch was not observed.
  • The separately scoped one-file fixture correction 8ec9547f692e57393bd6e18eca0bd757562d8289 stamps canonical identities, verifies their persisted round trip, and captures bounded redacted Gateway diagnostics and cleanup outcomes. On unchanged companion production source, native run 35707654516 verified composite tree 6e83cab45c872811c4df35b5edc252f4d016ae95 and all four E2E cases passed: final response, normal runtime timeout, explicit stop and bounded restored concurrency. All four Gateway/model-server cleanup records fulfilled, and the native Testbox reported stopped/completed. Cases took 61.159 seconds; command wall 623.82 seconds includes freshness-required private-QA preparation on a new host. Previous 31 checks/build/23+12 cases were not replayed.
  • Fresh exact-head CI 35703659522/1 passed the 23 regressions, delivery 323, delivery-runtime 8, requester-settle 74, reader 5, and normal types/lint/format/guards/build/security. Its aggregate is failed, not green: one separate retained-deleted-agent migration case refuses a deliberately hard-linked database at the existing maintenance guard, plus the aggregate gate. That failure lies outside this three-file diff; its existing owner fix is now included in the refreshed base, while the original failed record remains unchanged. No baseline, flakiness or patch-causality claim is made.

The E2E uses a held loopback model server, not an authenticated external provider. Controlled unit/harness checks and real built-runtime composition are distinct evidence; not every forced late-read interleaving is claimed as an independently traced live event.

Still open: normal native landing. Fresh exact-head CI and the single current-context witness passed as recorded above; older proof retains its original input boundaries. Auto-merge remains off. Full release-candidate qualification stays with the release workflow. No assertion, deadline, safety guard or required gate has been relaxed; no merge or release pass is claimed.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Sep 22, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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. labels Sep 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 22, 2026, 8:42 AM ET / 12:42 UTC (Revision 7).

ClawSweeper review

What this changes

Rechecks recovery receipts before reporting an unsettled requester handoff, reuses the existing response classification, and adds late-completion and cancellation regressions.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: current main still lacks this bounded recovery repair, and the reviewed patch has no actionable correctness findings. The broader requester-starvation report remains unresolved.

Priority: P1
Reviewed head: 9950e106f44f6db979a413158c96f4cf09cf48e8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful regression coverage and historical runtime evidence, with no actionable patch findings.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The bot-authored PR is exempt from the external-contributor proof gate. Its recorded real-Gateway loopback runs remain useful historical recovery evidence, while the explicitly retained current-context final/follow-up witness is still pending; no stored-data contract changes are introduced.
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 the external-contributor proof gate. Its recorded real-Gateway loopback runs remain useful historical recovery evidence, while the explicitly retained current-context final/follow-up witness is still pending; no stored-data contract changes are introduced.
Evidence reviewed 9 items Pinned introduction and merge scope: The introduced delta is 95221a8..9950e10. Raw test-merge parents match the pinned base followed by the exact PR head; its result changes only the same three announcement files. Base-only changes were not attributed to this PR.
Bounded reconciliation and preserved ownership: The late read requires requester-settle delivery, a captured store/session identity, and a caller-owned effects guard. Cancellation and ownership are checked around the await; session ID and lifecycle revision must still match. Successful, terminal, ambiguous, permanent-failure, private and incognito outcomes bypass reconciliation. The recovered settle classifier cannot enter the subagent text-send fallback.
Existing reader and receipt contracts: The implementation reuses the existing exact-key worker reader and recovery resolver. The caller's live guard covers store identity, prepared findings, Gateway lifetime, batch generation, requester identity and cancellation. No schema, serialized format, configuration, plugin API or dependency contract changes are introduced.
Findings None None.
Security None None.

How this fits together

Subagent completion delivery wakes the requesting agent after its children finish. This change reconciles the handoff result with an existing recovery receipt before returning delivery status to the completion owner.

flowchart TD
  A[Completed subagent batch] --> B[Requester handoff]
  B --> C{Outcome needs reconciliation?}
  C -->|No| F[Existing delivery result]
  C -->|Yes| D[Read exact recovery receipt]
  D --> E{Owner and session still current?}
  E -->|Yes| G[Classify recovered outcome]
  E -->|No| F
  G --> H[Completion owner settles batch]
Loading

Before merge

  • Complete next step (P2) - Complete or cite equivalent evidence for the PR body's retained final-response/same-session-follow-up witness in the refreshed context; exact-head CI now passes.
Agent review details

Security

None.

PR surface

Source +176, Tests +366. Total +542 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 416 240 +176
Tests 1 366 0 +366
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 782 240 +542

Review metrics

Metric Value Why it matters
Production versus regression growth Production net +176 lines; tests +366 lines Production growth supports guarded late reconciliation and a shared response classifier; the added tests cover 23 outcome and ownership cases.

Technical review

Best possible solution:

Keep receipt reconciliation within the existing delivery owner, preserving once-only execution, cancellation and exact session identity.

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

Yes, from source for the narrow race: create an exact recovery receipt while the original handoff awaits, then return a pending, empty or restart-interrupted response. Current main does not reread that receipt; this review executed no runtime tests.

Is this the best way to solve the issue?

Yes. Reusing the existing worker reader and receipt classifier addresses the observation gap without adding another recovery owner or replaying the input.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The repair addresses requester completion failures in an agent workflow with reported lost results and stalled conversations.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 the external-contributor proof gate. Its recorded real-Gateway loopback runs remain useful historical recovery evidence, while the explicitly retained current-context final/follow-up witness is still pending; no stored-data contract changes are introduced.

Evidence

What I checked:

  • Pinned introduction and merge scope: The introduced delta is 95221a8..9950e10. Raw test-merge parents match the pinned base followed by the exact PR head; its result changes only the same three announcement files. Base-only changes were not attributed to this PR. (src/agents/subagents/announce/subagent-announce-direct-delivery.ts:492, 9950e106f44f)
  • Bounded reconciliation and preserved ownership: The late read requires requester-settle delivery, a captured store/session identity, and a caller-owned effects guard. Cancellation and ownership are checked around the await; session ID and lifecycle revision must still match. Successful, terminal, ambiguous, permanent-failure, private and incognito outcomes bypass reconciliation. The recovered settle classifier cannot enter the subagent text-send fallback. (src/agents/subagents/announce/subagent-announce-direct-delivery.ts:497, 9950e106f44f)
  • Existing reader and receipt contracts: The implementation reuses the existing exact-key worker reader and recovery resolver. The caller's live guard covers store identity, prepared findings, Gateway lifetime, batch generation, requester identity and cancellation. No schema, serialized format, configuration, plugin API or dependency contract changes are introduced. (src/config/sessions/session-entry-read-runtime.ts:19, 9950e106f44f)
  • Current-main necessity: At the fetched main revision, direct delivery still classifies the original response without the added post-handoff worker read. Main retains the initial recovery lookup, which cannot observe a receipt created while that handoff is awaiting completion. The latest published release is v2026.9.5; no merged fixing PR or shipped implementation of this late-read repair was established. (src/agents/subagents/announce/subagent-announce-direct-delivery.ts:477, d2b9c87ac5ad)
  • Re-review continuity: GitHub contents reads at the previous reviewed head c6caf0f returned the same three blob identities as the current checkout: production delivery 9f020fa225611c47eaa29479fca42f0d3242456c, classifier df230685c69698fde95d38ea92171664a4ced801, and tests 506d599b467d144962e561b8552f3687188c97f1. The previous completed review retained no findings. Local comparison of that older commit was unavailable, so continuity was verified through GitHub blob identities. (9950e106f44f)
  • Historical runtime proof and remaining qualification: The captured PR body reports four passing real-Gateway/loopback-model cases on composite de1bb2854be721759b544afdba123c2ddd84aa27, including final response, runtime timeout, explicit stop and bounded restored concurrency. These remain historical proof, not current-tree execution or independently traced coverage of every late-read interleaving. The body explicitly retains one final-response/same-session-follow-up witness after changes to surrounding session consumers. The inspected E2E includes those assertions; its provenance correction is merged in test(gateway): bind restored requester fixture provenance #155621. (test/gateway-restored-requester-settle.e2e.test.ts:50, 9950e106f44f)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

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

  • Record the already-scoped final-response and same-session-follow-up witness using the merged fixture correction and current production context, or identify equivalent existing evidence.

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 (6 earlier review cycles)
  • reviewed 2026-09-22T02:20:47.134Z sha caf30eb :: blocked before merge. :: none
  • reviewed 2026-09-22T06:09:47.071Z sha 34d9cf701f60486f0d9019ad6461317968fbea17 :: needs changes before merge. :: none
  • reviewed 2026-09-22T08:23:05.669Z sha 7961833 :: needs changes before merge. :: none
  • reviewed 2026-09-22T09:50:25.546Z sha 7961833 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-22T11:15:01.521Z sha c6caf0f :: needs maintainer review before merge. :: none
  • reviewed 2026-09-22T12:16:29.978Z sha c6caf0f :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 22, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 22, 2026
@roboclaw-bot roboclaw-bot changed the title fix: recover subagent completions across requester restarts fix(agents): reconcile late requester recovery receipts Sep 22, 2026
@roboclaw-bot
roboclaw-bot force-pushed the fix/restart-registration-owner-20260922 branch from caf30eb to 34d9cf7 Compare September 22, 2026 06:02
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Sep 22, 2026
@roboclaw-bot
roboclaw-bot force-pushed the fix/restart-registration-owner-20260922 branch from 34d9cf7 to 7961833 Compare September 22, 2026 08:13
@openclaw-barnacle openclaw-barnacle Bot removed the gateway Gateway runtime label Sep 22, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Sep 22, 2026
@roboclaw-bot
roboclaw-bot force-pushed the fix/restart-registration-owner-20260922 branch from 7961833 to c6caf0f Compare September 22, 2026 11:08
Reconcile late exact requester receipts through the existing short-lived
worker reader without replaying a settled handoff. Preserve original
outcomes and keep the change limited to the three reviewed files.

Correct the Vitest callback/cleanup contract and brace the test conditions;
retain all 23 intended cases and once-only assertions.

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: steipete <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: jalehman <[email protected]>
@roboclaw-bot
roboclaw-bot force-pushed the fix/restart-registration-owner-20260922 branch from c6caf0f to 9950e10 Compare September 22, 2026 12:22
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

The sole remaining proof item for exact head 9950e106f44f6db979a413158c96f4cf09cf48e8 is now complete and documented in the PR body. CI 35726842329 passed all required gates. Native run 35729961457 executed only the existing final-response/same-session-follow-up case on verified composite a06e5f313dff1f589d1b8b5dca876baba2a37bcd: one pass, three intentional skips, fulfilled Gateway/model cleanup, wrapper exit 0, and independently reconciled host closure. All 60 input postimages / 48,347 manifest entries were verified. The body includes a short sanitized result excerpt, timing boundaries and raw log hash. No source, deadline, assertion or scope was changed to obtain this proof; no broader issue/release acceptance is claimed.

@clawsweeper

clawsweeper Bot commented Sep 22, 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:

@roboclaw-bot
roboclaw-bot merged commit 976c5bf into main Sep 22, 2026
210 checks passed
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

@roboclaw-bot
roboclaw-bot deleted the fix/restart-registration-owner-20260922 branch September 22, 2026 13:56
vincentkoc added a commit that referenced this pull request Sep 22, 2026
* commit '739e2410702e0b1ad1d17a6dac07ddc0ab6dbebb': (140 commits)
  fix(ui): pause passive polling in hidden tabs (#155617)
  improve(android): keep chat photos outside text bubbles (#155338)
  fix(ui): preserve saved project after discovery failure (#155619)
  feat: compare Kitchen Sink Gateway resource costs (#155734)
  test(gateway): arm clock-jump claim after readiness (#155748)
  chore(ui): refresh control ui locales (#155700)
  fix(ci): join archive placement fixtures before teardown (#155751)
  fix(matrix): keep bot discovery off the Gateway thread (#152122)
  fix(agents): reconcile late requester recovery receipts (#155357)
  test(gateway): guard embeddings HTTP fixture lifetimes
  fix: isolate triage fixture acquisition and cleanup (#155736)
  refactor(sessions): hydrate saved transcripts off thread (#153325)
  fix: Claude MCP turns abort before tool timeout (#155663)
  fix(goals): pause terminal failures and clarify goal states (#155694)
  fix(test): preserve watcher errors when diagnostic capture fails (#155383)
  ci: move native runtime proofs to release validation (#155606)
  fix(auth): decouple compaction from profile rotation (#155204)
  fix(agents): admit compaction outside retired plugin generations (#151232)
  perf(ui): reduce automatic session list refetches (#155705)
  test: avoid unused source repos in release input fixtures (#155733)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
)

Observe exact late requester recovery receipts before returning an eligible retryable handoff outcome. Reuse the existing short-lived worker reader and response classifier without dispatching the input again. Preserve ownership/cancellation boundaries, committed and ambiguous results, explicit stops, permanent outcomes, and private/incognito exclusions.

Keep the repair scoped to the three reviewed announce files. No registry, transaction, schema, dependency or worker-framework changes.

Validation: exact-head CI 35726842329 passed both required gates and all 23 authored regressions. Current-context native run 35729961457 passed the existing final-response/same-session-follow-up case on the explicitly bound production-plus-fixture composite, with fulfilled cleanup and verified native/host closure. Other E2E branches retain their historical proof; no authenticated external-provider or release acceptance is claimed.

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: steipete <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: jalehman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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