Skip to content

fix: cleanup lifecycle test fails after shared worker reuse - #153286

Merged
steipete merged 1 commit into
mainfrom
codex/agent-cleanup-test-isolation-20260920
Sep 20, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/agent-cleanup-test-isolation-20260920

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #153150, #153159, #153194.

What Problem This Solves

The retired-agent cleanup regression can fail after earlier tests create the shared-state worker owner in the same test process.

User Impact

This repairs CI coverage for the shared agent-worker lifecycle; there is no runtime behavior change.

Why This Change Was Made

The cleanup fixture mocks its worker transport, but the nonisolated lane can retain an earlier owner's closure over the real transport. Route this stateful fixture through the existing isolated lane so its mocks and owner belong to the same module graph. All schema-ownership, cleanup, and native-boundary assertions remain unchanged.

Evidence

The original failure is retained in the Boards CI job. The original shared-shard replay reproduces the same failure locally. The unchanged fixture passes through the normal test router in the isolated lane, and all 150 existing routing/configuration controls pass. The selected tooling gate passes, including formatting, script lint, architecture guards, and dead-export checks. Independent review found no actionable P0–P2 findings.

@clawsweeper

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

@clawsweeper

clawsweeper Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 19, 2026, 8:29 PM ET / September 20, 2026, 00:29 UTC.

ClawSweeper review

What this changes

Routes the retired-agent cleanup test through the existing isolated test lane so earlier tests cannot supply its shared worker owner.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a focused, still-needed test-routing repair with no actionable correctness findings. Current main lacks the isolation entry, and the existing assertions remain intact.

Priority: P3
Reviewed head: da7a1baa5cadcff7d81c16a5395ce79e9b9d9e93

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair using established routing controls, with preserved assertions and no identified correctness or security blocker.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied maintainer-author context exempts this test-only change from external-contributor runtime proof; the body reports the relevant shared-shard failure and isolated-router success, which were not independently rerun.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied maintainer-author context exempts this test-only change from external-contributor runtime proof; the body reports the relevant shared-shard failure and isolated-router success, which were not independently rerun.
Evidence reviewed 6 items Verified introduced change: The pinned parent-to-head diff adds only the cleanup fixture to the existing forced routing list; it changes no runtime code or test assertions.
Existing isolation contract: Forced entries without fake timers enter the isolated list. The isolated configuration sets isolate:true; both ordinary unit and shared fast configurations exclude the corresponding fast-owned fixtures. Existing routing controls iterate every forced entry and verify its isolated selection.
Retained transport explains the fixture conflict: The shared-state owner retains openCleanup with its imported transport and is reused through a global singleton. The fixture mocks that transport and forbids native SQLite and Worker construction, supporting the reported cross-file mismatch.
Findings None None.
Security None None.

How this fits together

OpenClaw’s test router assigns fixtures to shared or isolated workers. This fixture checks database cleanup ownership using mocked transport, so its worker owner must belong to the same isolated test environment.

flowchart LR
  A[Cleanup test fixture] --> B[Test router]
  B --> C[Forced isolation entry]
  C --> D[Isolated worker]
  D --> E[Mocked cleanup transport]
  E --> F[Schema and cleanup assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +1. Total +1 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 1 0 +1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 1 0 +1

Review metrics

None.

Technical review

Best possible solution:

Keep the fixture’s transport mocks and cleanup assertions together in the existing isolated lane without changing production singleton ownership.

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

Yes at the source-mechanism level: an earlier shared owner can retain the real transport before this fixture installs mocks. The reported original-order replay was not independently executed in this read-only review.

Is this the best way to solve the issue?

Yes. The existing isolated lane addresses the fixture’s module and singleton lifetime mismatch while preserving its assertions and production behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a narrow test-isolation repair with no product 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 narrow test-isolation repair with no product 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:

  • Verified introduced change: The pinned parent-to-head diff adds only the cleanup fixture to the existing forced routing list; it changes no runtime code or test assertions. (test/vitest/vitest.unit-fast-paths.mjs:143, da7a1baa5cad)
  • Existing isolation contract: Forced entries without fake timers enter the isolated list. The isolated configuration sets isolate:true; both ordinary unit and shared fast configurations exclude the corresponding fast-owned fixtures. Existing routing controls iterate every forced entry and verify its isolated selection. (test/vitest/vitest.unit-fast-paths.mjs:653, da7a1baa5cad)
  • Retained transport explains the fixture conflict: The shared-state owner retains openCleanup with its imported transport and is reused through a global singleton. The fixture mocks that transport and forbids native SQLite and Worker construction, supporting the reported cross-file mismatch. (src/state/openclaw-state-worker-store.ts:347, da7a1baa5cad)
  • Current-main and release comparison: Fetched main has the same cleanup fixture but lacks the proposed routing entry. The fixture is absent from the v2026.9.5 tree, so this is a follow-up to newer main development rather than a verified shipped fix. (test/vitest/vitest.unit-fast-paths.mjs:143, 2fc994b9672f)
  • Merged feature history: GitHub verifies refactor(state): share the agent database worker lifecycle #153150 as merged at d22782a. Comparing that commit with its raw recorded parent shows the cleanup fixture was added there; this establishes prior merged-area involvement for routing. (src/state/openclaw-agent-execution-cleanup.test.ts:73, d22782a7f093)
  • Validation evidence and inspection limits: The captured PR body reports original-order shared-shard reproduction, successful isolated routing, and 150 passing routing/configuration controls. GitHub confirms the linked original job failed, but its log download redirected to a host blocked by this review environment. These execution claims were not independently replayed; read-only diff checks passed and the checkout remained clean. (da7a1baa5cad)

Likely related people:

  • Peter Steinberger: Raw commit d22782a adds src/state/openclaw-agent-execution-cleanup.test.ts:73 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d22782a7f093; files: src/state/openclaw-agent-execution-cleanup.test.ts)

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.

steipete added a commit that referenced this pull request Sep 20, 2026
Move ordinary persistent Board mutations onto the canonical agent worker while preserving revisions, grants, physical targets, and host notifications. Keep protected reads in the same FIFO and retain the caller's async context when invoking consumers.

Preserve known committed results through cleanup failures, invalidate unknown outcomes without replay, and retain Windows environment lookup semantics. Bootstrap, admission, reads, and incognito remain native.

Related: #153159, #153150, #153286
@steipete
steipete merged commit 044f78e into main Sep 20, 2026
183 checks passed
@steipete
steipete deleted the codex/agent-cleanup-test-isolation-20260920 branch September 20, 2026 01:15
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 20, 2026
Reuse the isolated cleanup fixture from #153286 and the held-terminal-write private completion fixture from #153226. Retain the curator cleanup await. The combined 36-case proof, targeted types/lint, and independent review pass; production is unchanged.
steipete added a commit that referenced this pull request Sep 20, 2026
Merge current main after the hosted PendingFailure run exposed the retired
agent cleanup fixture's shared-module isolation failure. Preserve the exact
qualified six-file pending-failure patch and all canonical worker dispatch.
The cleanup repair is canonical main ancestry from #153286.
steipete added a commit that referenced this pull request Sep 20, 2026
Move ordinary persistent Board mutations onto the canonical agent worker while preserving revisions, grants, physical targets, and host notifications. Keep protected reads in the same FIFO and retain the caller's async context when invoking consumers.

Preserve known committed results through cleanup failures, invalidate unknown outcomes without replay, and retain Windows environment lookup semantics. Bootstrap, admission, reads, and incognito remain native.

Related: #153159, #153150, #153286
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 20, 2026
steipete added a commit that referenced this pull request Sep 20, 2026
* fix: drain delivery queue maintenance during shutdown

* test: isolate retired agent cleanup transport fixture (#153286)

* test(outbound): clean up ACK fixtures with their owner
steipete added a commit that referenced this pull request Sep 20, 2026
…read (#152319)

* refactor(skills): move usage and curator status SQL off the caller thread

* fix(skills): preserve worker errors and await usage test persistence

* fix: drain delivery queue maintenance during shutdown

* fix: keep Workshop event reads off the Gateway request thread

* test: isolate retired agent cleanup transport fixture (#153286)

* test(gateway): align curator checks with canonical lifecycle fixtures

Reuse the isolated cleanup fixture from #153286 and the held-terminal-write private completion fixture from #153226. Retain the curator cleanup await. The combined 36-case proof, targeted types/lint, and independent review pass; production is unchanged.

* test(outbound): clean up ACK fixtures with their owner

* test(outbound): clean up ACK fixtures with their captured owner

Carry the exact reviewed cleanup line from #153367, now covered by main #153296. Preserve the negative null and undefined ownership assertions. The postimage matches the canonical reviewed fixture and all four focused cases pass.

* test: join Doctor database cleanup before snapshots

* refactor(skills): consolidate workshop worker dispatch
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 21, 2026
* fix: drain delivery queue maintenance during shutdown

* test: isolate retired agent cleanup transport fixture (openclaw#153286)

* test(outbound): clean up ACK fixtures with their owner
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 21, 2026
…read (openclaw#152319)

* refactor(skills): move usage and curator status SQL off the caller thread

* fix(skills): preserve worker errors and await usage test persistence

* fix: drain delivery queue maintenance during shutdown

* fix: keep Workshop event reads off the Gateway request thread

* test: isolate retired agent cleanup transport fixture (openclaw#153286)

* test(gateway): align curator checks with canonical lifecycle fixtures

Reuse the isolated cleanup fixture from openclaw#153286 and the held-terminal-write private completion fixture from openclaw#153226. Retain the curator cleanup await. The combined 36-case proof, targeted types/lint, and independent review pass; production is unchanged.

* test(outbound): clean up ACK fixtures with their owner

* test(outbound): clean up ACK fixtures with their captured owner

Carry the exact reviewed cleanup line from openclaw#153367, now covered by main openclaw#153296. Preserve the negative null and undefined ownership assertions. The postimage matches the canonical reviewed fixture and all four focused cases pass.

* test: join Doctor database cleanup before snapshots

* refactor(skills): consolidate workshop worker dispatch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant