Skip to content

test(recovery): await final exhaustion reconciliation - #155007

Closed
roboclaw-bot wants to merge 2 commits into
mainfrom
roboclaw/await-recovery-exhaustion-20260921
Closed

roboclaw-bot wants to merge 2 commits into
mainfrom
roboclaw/await-recovery-exhaustion-20260921

Conversation

@roboclaw-bot

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

Copy link
Copy Markdown
Collaborator

Related: #154829

What Problem This Solves

Fixes two startup-recovery tests reading final state before exhaustion reconciliation finishes, while removing the resulting growth from their oversized test file.

User Impact

No production behavior changes. The tests wait for real admitted recovery and join it before teardown. Runtime, schema, authority, retry budgets, timeouts, test routing and ratchet thresholds are unchanged.

Why This Change Was Made

A coherent sibling test harness owns the two exhaustion cases and their transparent admission observer. It joins every final-target promise—not merely startup admission or the first target—and preserves all original assertions, distinct physical stores and the fresh-row sentinel.

The original file registers both cases at their previous position, with unchanged names and ordering, and passes its existing fixtures and mocked runtime. The harness returns its cleanup callback to the parent’s existing try/finally teardown, preserving database cleanup even if stopping rejects. Cancellation still unwinds a pending environment scope. The sibling is not independently discovered as another test file.

Evidence

Signed forward head 0ae7901 preserves the tested tree ef53c1cb27d934e60d50f13786c3d4591990df49 and extends the existing published head 1a9576c. The original PR base remains 2559f8f.

Forward local head: e1d537d00086fd0d683e9093909b4cec6c7b24af
Tree: ef53c1cb27d934e60d50f13786c3d4591990df49
Exact published parent: 1a9576cb5962a9bd6f4599417f35df8ef44d1ea6
Original PR base for both ratchets: 2559f8f7cc9f1b2f74910915265ccd15d9d6606d

Composite delta from that original base: two test-only files, +225/-109. The original file shrinks (+18/-109); the new coherent harness has 207 physical lines. No assertion/coverage trimming, formatting compression, suppressions or budget exceptions.

Check Result Wall time
Line-cap growth ratchet against original base Exit 0; no new violations or over-cap growth 0.39s; staged 0.40s
Max-lines suppression / OPENCLAW count against original base Exit 0; 800 existing suppressions, 491/491 environment names 9.84s; staged 10.12s
Extracted controlled 1.5s admission delay + cancellation/environment diagnostic Exit 0; 3 selected diagnostics passed 32.25s, including cold worker preparation
Uninstrumented focused cases Exit 0; 2 passed / 216 outside filter 17.71s; cases 752ms / 952ms
Full affected test file Exit 0; all 218 cases passed 90.95s
Admission/root-work owner siblings Exit 0; 50 tests / 3 files 16.42s
Owning agents-other transitive type graph Exit 0; includes the private harness through its sole consumer 27.93s
Scoped lint / formatting / diff check Exit 0 / 0 / 0 36.79s / 0.06s / 0.01s
Fresh independent P2 review of corrected proposed index Exit 0; scoped-clean, no actionable findings 41.32s

A static extraction audit also confirms identical registration sequence/names and all four original matcher assertions in each case. The full file is expensive because its existing 218-case recovery coverage is preserved; extraction adds no tests, process boots or worker routing.

Retained failures and limits: the previous inline repair failed line-cap (6045 → 6097 counted lines); that omission is now addressed against the original base, not only the new parent. An initial review correctly flagged the still-old index while the working tree contained the extraction. Both validated files were staged, both staged ratchets passed, and the actual proposed index received a fresh clean P2 review.

The earlier original-red comparison (two expected failures, 35.36s) is reused as historical evidence. Controlled delay and cleanup proof were rerun after extraction; all instrumentation was removed and both source hashes restored before final proof/review/commit. This proves the polling vulnerability, not the historical hosted slowdown’s exact cause.

Local Node26.8.2 differs from hosted24.19.0. No full original54-file green or hosted CI claim: the parent’s prior full-plan replay stopped on independently identified loopback npm E502/secret-egress refusals and was not repeated or bypassed. An over-broad type selection was cancelled; its task-owned stale lock was recovered only after documented owner/descendant settlement checks, then the sole consumer’s transitive graph passed. All original receipts remain retained.

Exact-published-head hosted CI, current review and native landing remain required; no hosted-green or release qualification claim is made.

Worked on by

Work sessions


View the OpenClaw team session

Replace one-second state polling in the two final-startup exhaustion tests with the existing root-admission completion boundary. Join every final-target recovery promise before retaining the original row, charge, reservation, call-count, fresh-row and distinct-store assertions. Stop and join recovery before fixture teardown, including cancellation before final reconciliation begins.

Keep runtime behavior, schemas, authority, test routing and timeouts unchanged. A temporary controlled 1.5-second startup-admission delay reproduces both original assertions and passes with this fixture repair; diagnostic source was removed and hash-restored before final proof. Focused tests, an eight-file original-plan subset, admission siblings, scoped types/lint/format and independent P2 review pass locally. Node26 proof does not establish the historical hosted Node24 slowdown cause or a full original-shard pass.

Related: #154829

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

clawsweeper Bot commented Sep 21, 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: S maintainer Maintainer-authored PR labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 1:53 PM ET / 17:53 UTC (Revision 3).

ClawSweeper review

What this changes

The PR moves two startup-recovery tests into a shared harness that waits for final reconciliation and joins recovery before fixture cleanup.

Merge readiness

✅ Ready for maintainer review

The prior extraction concern is resolved, and no actionable correctness defect was found. Current main still uses the vulnerable polling assertions, so this remains a useful, focused test repair.

Priority: P3
Reviewed head: 0ae79014d11039b1755638154a6a512845a60512

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test repair with preserved assertions, appropriate completion ownership, and reported validation addressing the prior review.
Proof confidence 🌊 off-meta tidepool Not applicable: The contributor runtime-proof gate does not apply to this bot-authored test repair; the supplied evidence covers the changed fixture's delayed reconciliation and cancellation behavior, with production recovery unchanged.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The contributor runtime-proof gate does not apply to this bot-authored test repair; the supplied evidence covers the changed fixture's delayed reconciliation and cancellation behavior, with production recovery unchanged.
Evidence reviewed 7 items Introduced change and source identity: The pinned merge-base-to-head diff changes only the recovery test and its new harness. The checked-out tree is ef53c1cb27d934e60d50f13786c3d4591990df49, matching the tested tree identified in the supplied PR body; production code is unchanged.
Completion boundary matches the scheduler: The scheduler synchronously maps the complete exhausted-target batch into independent admissions before awaiting all outcomes. The harness transparently forwards admission arguments, collects those actual promises, joins every target, and checks target count and fulfillment before inspecting rows.
Cleanup and coverage retained: Both original cases retain their state, charge, reservation, call-count, fresh-row and distinct-store assertions. The harness shares an idempotent stop promise, rejects a pending start waiter on cancellation, and restores its admission spy after recovery stops. Parent teardown invokes this cleanup before removing database fixtures, with existing cleanup preserved in finally.
Findings None None.
Security None None.

How this fits together

Startup recovery resumes interrupted agent sessions and records failure when their retry budget is exhausted. These tests exercise that scheduler against isolated session stores and inspect the resulting records.

flowchart TD
  A[Interrupted session fixtures] --> B[Startup recovery scheduler]
  B --> C[Final retry exhausts budget]
  C --> D[Reconcile each affected store]
  D --> E[Test harness awaits all targets]
  E --> F[Assert final session records]
  F --> G[Stop recovery and clean fixtures]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +116. Total +116 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 225 109 +116
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 225 109 +116

Review metrics

Metric Value Why it matters
Reported validation cost 218 cases in 90.95 seconds; focused cases in 17.71 seconds The PR records the existing suite's cost and preserves its coverage without adding separately discovered tests.

Technical review

Best possible solution:

Keep these exhaustion assertions synchronized with actual recovery completion while preserving the existing scheduler, test registration, and fixture lifecycle.

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

Yes, for the test race: current main polls asynchronous final reconciliation with a one-second deadline, and the PR reports a controlled 1.5-second delay reproducing both failures. This review did not execute that reproduction or establish the historical hosted slowdown's cause.

Is this the best way to solve the issue?

Yes. Observing and joining the existing admission promises fixes the synchronization boundary without increasing timeouts, weakening assertions, or adding a production testing API.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This repairs test synchronization and teardown without changing production behavior.
  • 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 contributor runtime-proof gate does not apply to this bot-authored test repair; the supplied evidence covers the changed fixture's delayed reconciliation and cancellation behavior, with production recovery unchanged.

Evidence

What I checked:

  • Introduced change and source identity: The pinned merge-base-to-head diff changes only the recovery test and its new harness. The checked-out tree is ef53c1cb27d934e60d50f13786c3d4591990df49, matching the tested tree identified in the supplied PR body; production code is unchanged. (src/agents/main-session-recovery/main-session-startup-exhaustion.test-harness.ts:25, 0ae79014d110)
  • Completion boundary matches the scheduler: The scheduler synchronously maps the complete exhausted-target batch into independent admissions before awaiting all outcomes. The harness transparently forwards admission arguments, collects those actual promises, joins every target, and checks target count and fulfillment before inspecting rows. (src/agents/main-session-recovery/main-session-restart-recovery-runtime.ts:297, 0ae79014d110)
  • Cleanup and coverage retained: Both original cases retain their state, charge, reservation, call-count, fresh-row and distinct-store assertions. The harness shares an idempotent stop promise, rejects a pending start waiter on cancellation, and restores its admission spy after recovery stops. Parent teardown invokes this cleanup before removing database fixtures, with existing cleanup preserved in finally. (src/agents/main-session-recovery/main-session-restart-recovery.test.ts:236, 0ae79014d110)
  • Still needed on current main: The affected test blob is identical at the introduction base and fetched main: ad6cf716b365e5f2257d60b4f255225986ab7956. Current main still polls these final-state assertions through waitForFast, whose timeout is one second. The reviewed repair is therefore not already present on main; no shipped fixing PR was established. (src/agents/main-session-recovery/main-session-restart-recovery.test.ts:4609, 6d65c8b7f229)
  • Prior review follow-up addressed: The supplied previous review requested coherent extraction, retained exhaustion and cancellation contracts, and renewed ratchet/test checks. The current harness implements that extraction. The captured body reports passing original-base ratchets, controlled-delay/cancellation diagnostics, all 218 affected tests, and 50 sibling tests; it explicitly leaves the historical hosted slowdown cause unproven. These are contributor-reported results, not tests executed during this review. (0ae79014d110)
  • Existing owner pattern and routing: Current-main history and the GitHub commit patch identify steipete's adjacent admission-test repair using the same real admission completion boundary. This supports routing to that area contributor without attributing the original defect. (src/agents/main-session-recovery/main-session-restart-recovery-admission.test.ts:259, f914e0f5f86c)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-21T16:52:09.708Z sha 1a9576c :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-21T17:15:47.883Z sha 1a9576c :: needs changes before merge. :: none

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Sep 21, 2026
Move the two final-startup exhaustion cases and their admission-completion fixture into a coherent sibling test harness. Keep registration at the original position with unchanged case names, all original assertions, shared parent fixtures, and the same database-worker routing. Return the recovery cleanup callback to the parent try/finally teardown so all admitted targets join before stores close, including timeout and cancellation paths.

This forward commit extends the exact signed draft head 1a9576c. Measure line-cap and max-lines ratchets against original PR base2559f8f7cc9f1b2f74910915265ccd15d9d6606d; no ratchet, baseline, formatting compression, runtime or timeout exceptions. Preserve original red evidence and rerun extracted controlled-delay/cleanup, focused/full-file, sibling, static and independent P2 proof.

Co-authored-by: steipete <[email protected]>
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 21, 2026 17:46
roboclaw-bot added a commit that referenced this pull request Sep 21, 2026
Move only the suspended-exhaustion scenario into the existing broker-backed
admission suite. Observe the real reconciliation attempt and stop it while
admission remains suspended; preserve durable state and dispatch assertions.
Wait for actual approval publication and task-lane completion in the hosted
lifecycle fixture instead of polling worker-backed state.

Keep the startup fix landed in #155006. Leave the exec/plugin agent-runtime
cases to active #154977 and the two other exhaustion cases to #155007.
This narrows our bot-owned repair without modifying those owners' PRs.
No production changes, deadline increases, retries, or guard weakening.

Final three-file proof: 231 tests pass in109.01s; full changed checks pass.
Fresh canonical Codex autoreview through P3 is scoped-clean. The original
suspended-case failure was reproduced with controlled worker lookup delay;
prior admission proof includes20 repeated suite runs. Temporary delay
instrumentation is not retained. Earlier broader-head CI is historical only.

Co-authored-by: VACInc <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Closing this supporting repair as superseded by #154995 (5406706) and #155028 (5fbcdaa), both verified on main.

The existing recovery fixture now waits for committed failure state in every physical target, handles cancellation/read failures, and joins stop before teardown. Both exhaustion cases retain their final-state, charge/reservation and fresh-row assertions; the suspended-admission case now lives with its broker-backed owner. Keeping this separate admission observer/harness would duplicate that ownership.

This PR’s corrected source, passing CI and review remain preserved, but it was not merged: native admission rejected a conflict before dispatch. No merge request was sent, and its operation lock was recovered only after checking process custody. Related Doctor PR #154829 remains open; this closure does not supersede that production fix. No branch was rewritten or deleted.

@RomneyDa
RomneyDa deleted the roboclaw/await-recovery-exhaustion-20260921 branch October 22, 2026 00:25
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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