Skip to content

fix(tests): drain shared database workers before fixture cleanup - #148734

Merged
steipete merged 1 commit into
mainfrom
codex/kv-admission-family-20260915
Sep 15, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/kv-admission-family-20260915

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Memory Wiki and Teams fixtures could remove their temporary state directories or reset native stores before shared database workers finished closing. Both fixtures appeared in CI failures reporting that state database read admission changed during initial worker publication.

User Impact

No user-visible runtime change. The tests now finish shared database cleanup before discarding their isolated state; production admission checks and public reset contracts are unchanged.

Why This Change Was Made

Await the existing shared database close owner before resets and directory removal. The Teams consent-card fixture keeps its original state environment in place through cleanup and restores it in a nested finally block.

Related: #148623, #148679. The missing joined cleanup is source-proven; the original logs do not establish which identity or generation changed, so this does not claim a diagnosed inode collision.

Evidence

  • Five existing ordinary controls passed: small Teams write/read, delete, missing delete, consent-card persistence, and public keyed-store read/write/delete/reopen behavior.
  • The canonical two-file changed checks passed, including extension test types, targeted lint, formatting, and boundary/dead-export guards.
  • Independent P2 review passed with no accepted findings. Assertions, payloads, and deadlines are unchanged.

The Memory Wiki migration and Teams bulk/corrupt-data scenarios were not replayed locally; Memory Wiki cleanup ordering was checked against its nested harness lifecycle and covered by source review and type checks. Exact-head CI passed at 2b4d0bba3bcf818395204c66244fd2b96ac3e829: CI run.

@clawsweeper

clawsweeper Bot commented Sep 15, 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 channel: msteams Channel integration: msteams extensions: memory-wiki size: XS maintainer Maintainer-authored PR labels Sep 15, 2026
@steipete
steipete marked this pull request as ready for review September 15, 2026 03:29
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 11:52 PM ET / September 15, 2026, 03:52 UTC (Revision 2).

ClawSweeper review

What this changes

The PR makes Memory Wiki and Microsoft Teams tests await shared database shutdown before discarding fixtures, preserving the Teams state environment through cleanup.

Merge readiness

✅ Ready for maintainer review

This remains a useful, narrowly scoped fixture repair that current main lacks. No actionable introduced defect was found, and the reviewed head passed CI.

Priority: P3
Reviewed head: 2b4d0bba3bcf818395204c66244fd2b96ac3e829

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair reuses the correct lifecycle owner, preserves coverage, and has successful CI on the reviewed head.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this maintainer-authored test-only PR; reviewed-head CI supports the fixture repair, with local scenario gaps explicitly disclosed.
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 maintainer-authored test-only PR; reviewed-head CI supports the fixture repair, with local scenario gaps explicitly disclosed.
Evidence reviewed 7 items Introduced scope: The host-verified merge-base delta contains only the two fixture changes. The verified test merge preserves base-only work; no production admission, schema, dependency, or workflow change belongs to this PR.
Memory Wiki teardown ordering: The nested suite awaits shared shutdown before resetting stores. Its outer harness subsequently clears the compiled cache and removes temporary workspaces; existing migration assertions remain intact.
Teams cleanup and environment restoration: The shared cleanup function awaits shutdown before directory removal. The consent-card test invokes cleanup in its finally block and restores OPENCLAW_STATE_DIR in a nested finally, including when cleanup rejects.
Findings None None.
Security None None.

How this fits together

These plugin tests exercise SQLite-backed state using temporary directories. Their teardown must finish shared database worker activity before resetting stores or deleting those directories.

flowchart TD
 A[Plugin test operations] --> B[Shared database workers]
 B --> C[Await database shutdown]
 C --> D[Reset test stores]
 C --> E[Remove temporary directories]
 E --> F[Restore Teams environment]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +4. Total +4 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 12 8 +4
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 12 8 +4

Review metrics

None.

Technical review

Best possible solution:

Keep fixture teardown on the existing asynchronous shutdown owner while preserving production admission checks and test assertions.

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

Yes for the missing teardown join: current source removes fixtures or resets native stores without awaiting registered workers. The precise admission failures reported in CI were not reproduced, and their identity-generation cause remains unproven.

Is this the best way to solve the issue?

Yes. Awaiting the existing shutdown owner repairs the lifecycle ordering without weakening assertions, increasing deadlines, or changing production reset contracts.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a bounded test-fixture lifecycle repair with no user-visible runtime change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Label justifications:

  • P3: This is a bounded test-fixture lifecycle repair with no user-visible runtime change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Evidence

What I checked:

  • Introduced scope: The host-verified merge-base delta contains only the two fixture changes. The verified test merge preserves base-only work; no production admission, schema, dependency, or workflow change belongs to this PR. (2b4d0bba3bcf)
  • Memory Wiki teardown ordering: The nested suite awaits shared shutdown before resetting stores. Its outer harness subsequently clears the compiled cache and removes temporary workspaces; existing migration assertions remain intact. (extensions/memory-wiki/doctor-contract-api.test.ts:82, 2b4d0bba3bcf)
  • Teams cleanup and environment restoration: The shared cleanup function awaits shutdown before directory removal. The consent-card test invokes cleanup in its finally block and restores OPENCLAW_STATE_DIR in a nested finally, including when cleanup rejects. (extensions/msteams/src/pending-uploads-fs.test.ts:44, 2b4d0bba3bcf)
  • Existing shutdown owner: The existing async close delegates to the shared lifecycle, which awaits registered resource closure before retiring native handles. The synchronous test reset does not provide that join. The imported helper already exists in the first-party testing entrypoint; no plugin API expansion is introduced. (src/state/openclaw-state-db-cache.ts:587, 2b4d0bba3bcf)
  • Current-main and release comparison: Inspection of both fixtures at fetched main found neither async cleanup join. The Teams fixture at v2026.9.4 also removes directories without that join. No merged replacement was established; the supplied related PRs remain separate open work. (extensions/msteams/src/pending-uploads-fs.test.ts:43, 740b1f14fdba)
  • Verified CI and bounded proof claims: GitHub confirms https://github.com/openclaw/openclaw/actions/runs/34925206243 completed successfully on the reviewed head; the changed-extension job and CI gate succeeded. The captured PR body separately reports five passing controls and explicitly discloses that Memory Wiki migration and Teams bulk/corrupt-data scenarios were not replayed locally. No tests were executed during this read-only review. (2b4d0bba3bcf)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • rohit-jsfreaky: 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-15T03:36:11.987Z sha 2b4d0bb :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 28c232b into main Sep 15, 2026
163 checks passed
@steipete
steipete deleted the codex/kv-admission-family-20260915 branch September 15, 2026 04:00
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 15, 2026
vincentkoc added a commit that referenced this pull request Sep 15, 2026
Join plugin publication and index settlement under the owning lifecycle. Route database-backed authority fixtures through the existing forked owner.

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Source-commit: 28c232b
Upstream-PR: #148734
vincentkoc added a commit that referenced this pull request Sep 15, 2026
Join plugin publication and index settlement under the owning lifecycle. Route database-backed authority fixtures through the existing forked owner.

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Source-commit: 28c232b
Upstream-PR: #148734
vincentkoc added a commit that referenced this pull request Sep 15, 2026
Join plugin publication and index settlement under the owning lifecycle. Route database-backed authority fixtures through the existing forked owner.

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Source-commit: 28c232b
Upstream-PR: #148734
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: msteams Channel integration: msteams extensions: memory-wiki maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant