Skip to content

test(matrix): join account-state Doctor fixture cleanup - #155679

Merged
vincentkoc merged 3 commits into
mainfrom
fix/ci-matrix-doctor-fixture-lifetime-20260922
Sep 22, 2026
Merged

vincentkoc merged 3 commits into
mainfrom
fix/ci-matrix-doctor-fixture-lifetime-20260922

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

The Matrix account-state Doctor test deletes its temporary state in afterEach, before the CLI helper's onTestFinished hook joins its child. A failed or timed-out case can therefore remove inputs while admitted work still uses them. Synchronous database resets also do not join the cached async database owner.

User Impact

Makes this test own its complete fixture lifetime and preserve failure diagnostics. Matrix behavior, stored data, schemas, configuration, and the Doctor child's 120-second deadline are unchanged.

Why This Change Was Made

Use the existing fixture lifetime for the complete async case, including post-CLI database assertions. Await the canonical async Matrix store reset before Doctor, before reopening, and at final cleanup; remove the root only after the body and verified cleanup settle. Preserve both the original failure and cleanup failure when they occur together.

Expose the existing lifetime and enclosing-timeout helpers through the private test-env seam. The canonical outer envelope is 132 seconds, reserving setup/diagnostic/cleanup time around the unchanged 120-second child budget.

Executable production: +0/-0. Tests and private test support: +124/-86 across two files.

Evidence

Current candidate acce3e8787432d5a1210a9b97abe9de5efab1bcd uses sequential cleanup after capturing the body outcome, preserving both original errors and the caught cleanup error as the aggregate cause. Formatting, focused repository-config lint and independent P0–P2 source review pass. Final-candidate native qualification passed all 102 cases: three lifetime/error controls followed by the original 11-file/two-worker Matrix group (99 cases), with no skips, failures, or retries. The account-state case took 51.867 seconds; the original group took 100.99 seconds in Vitest and 104.398 seconds under its managed runner. The control group took 63.94 seconds in Vitest and 67.486 seconds under its managed runner. All managed work joined, all 48,293 source paths were restored and verified, and the owned lease stopped with fresh completed status. This final-candidate run used Linux x64/Node 24.19.0, four CPUs and 16.56 GB. The original input list and worker count were preserved; actual scheduler order and preceding controls remain distinct from the historical failure. The completed exact-head ClawSweeper review reports no findings or remaining moves. Current-head CI, attempt 1, completed successfully: 119 jobs passed, 18 were skipped, and none failed. The aggregate gate passed; actual preflight merge faa6cf0d22ec67e49f6dcc84ff113489a881af6b contains this exact head and both reviewed blobs. No hosted case-level Matrix mapping is inferred from compact shard names.

At the preceding head bb6a17a4b14648d1a2d74dbdaa194bfeb77c9460, native qualification verified:

  • The actual old fixture fails the held-body retention control: its root is deleted before release. No Doctor child is started in this negative control.
  • Three candidate controls pass: retain inputs through body, child, post-CLI assertions and final async reset; retain the root/claim after reset rejection; preserve both primary and cleanup errors. The positive control executes the real Doctor child and original assertions.
  • Seven selected shared child/lifetime regressions pass; 26 unrelated sibling cases are filtered out.
  • After removing every temporary control, the original 11-file/two-worker Matrix group passes all 99 cases. The account-state case takes 42.316 seconds; the group takes 84.93 seconds in Vitest and 87.958 seconds under its managed runner.
  • All managed children joined, all 48,293 source paths were restored and verified, and the owned lease stopped successfully. The linked containing workflow can show cancelled after lease shutdown; the retained managed-command receipts own these test results.

The proof used Linux x64/Node 24.19.0, four CPUs and 16.56 GB, versus the failing job's two CPUs/8.22 GB. Original group inputs and worker count were preserved; observed scheduler order differed and the group followed the control runs. No-output retries were disabled for this proof; case and child deadlines were preserved.

This proves the fixture ownership defect and repair. It does not identify the slow phase behind the historical 120-second failure or claim a performance fix. The old-fixture counterexample and seven shared regressions above remain attributed to the preceding head.

@vincentkoc vincentkoc self-assigned this Sep 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: matrix Channel integration: matrix size: M maintainer Maintainer-authored PR labels Sep 22, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@vincentkoc
vincentkoc marked this pull request as ready for review September 22, 2026 10:59
@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.

@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 7:09 AM ET / 11:09 UTC (Revision 2).

ClawSweeper review

What this changes

The Matrix Doctor migration test now waits for its full body and asynchronous database cleanup before deleting temporary files, preserves combined failures, and reuses shared test-lifetime helpers.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fixture-lifecycle repair that current main does not contain. No introduced correctness or security defect was found; the maintainer-authored PR should proceed through normal review and CI.

Priority: P3
Reviewed head: acce3e8787432d5a1210a9b97abe9de5efab1bcd

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair using established helpers, preserving existing assertions and failure diagnostics, with no actionable source finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored test repair. The captured qualification exercises the Doctor fixture at the preceding head; current-head execution was not independently verified here. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored test repair. The captured qualification exercises the Doctor fixture at the preceding head; current-head execution was not independently verified here. No stored-data contract changes.
Evidence reviewed 7 items Introduced change: The pinned merge-base-to-head diff changes only the Matrix migration test and repository-local test exports. Migration assertions, fixture hashes, child arguments, and the 120-second child deadline are preserved.
Still necessary on current main: The fetched main revision still uses the automatic temporary-directory tracker and synchronous store resets, without enclosing the complete body in the fixture lifetime. This repair is therefore not already implemented there.
Existing cleanup owner: The shared lifetime drains admitted promises before removal and retains roots when verified cleanup rejects or a nested error reports unjoined work. The Matrix reset awaits the asynchronous database close before clearing test stores.
Findings None None.
Security None None.

How this fits together

The Matrix migration test loads an older account database, runs OpenClaw Doctor, and checks database preservation and subsequent writes. Its fixture lifetime controls when temporary inputs can safely be removed.

flowchart TD
 A[Older account database fixture] --> B[Fixture lifetime]
 B --> C[Doctor child process]
 C --> D[Migration and reopen assertions]
 D --> E[Await database cleanup]
 E --> F{Cleanup verified}
 F -->|Yes| G[Remove temporary files]
 F -->|No| H[Retain files and report failures]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +4, Tests +34. Total +38 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 1 +4
Tests 1 119 85 +34
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 124 86 +38

Review metrics

Metric Value Why it matters
Timeout envelope 120-second child deadline retained; 132-second enclosing test deadline The shared helper reserves diagnostic and cleanup time without extending the Doctor child's execution budget.

Technical review

Best possible solution:

Keep temporary inputs owned until the complete test and database shutdown settle, while retaining original diagnostics when cleanup cannot be verified.

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

Yes, source establishes the fixture-lifetime gap: current main can delete temporary inputs during teardown without joining the entire asynchronous body. This review did not execute the failure or reproduce the historical 120-second timeout.

Is this the best way to solve the issue?

Yes, reusing the existing lifetime owner and canonical asynchronous Matrix reset is a narrow repair that preserves the migration checks and child deadline.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is a bounded test-fixture reliability repair with no shipped runtime behavior change.
  • 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 external-contributor proof gate does not apply to this MEMBER-authored test repair. The captured qualification exercises the Doctor fixture at the preceding head; current-head execution was not independently verified here. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-22T11:03:01.634Z sha bb6a17a :: needs maintainer review before merge. :: none

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@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:

@vincentkoc
vincentkoc merged commit 007ba10 into main Sep 22, 2026
210 of 211 checks passed
@vincentkoc
vincentkoc deleted the fix/ci-matrix-doctor-fixture-lifetime-20260922 branch September 22, 2026 11:28
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
)

* fix(test): join Matrix Doctor fixture cleanup

* fix(test): retain Matrix fixture failure diagnostics

* test(matrix): preserve cleanup errors without unsafe finally
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: matrix Channel integration: matrix 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