Skip to content

fix(sessions): align the reclamation-memory test with the archive session owner - #147028

Merged
steipete merged 1 commit into
mainfrom
steipete/upd-red-main-16-reclamation-memory-test
Sep 13, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/upd-red-main-16-reclamation-memory-test

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Refs #146760
Refs #140897

What Problem This Solves

Fixes the reclamation-memory regression test failing on main after the archive worker refactor, blocking core test types and compact CI.

User Impact

No user-visible behavior changes. Restores coverage that a real borrowed memory-cache write and guarded session deletion both settle without blocking commit authorization.

Why This Change Was Made

The test introduced in e05d8b6 (#146760) intercepted the archive worker helper. After 7ab5077 (#140897), deletion uses the retained reclamation worker and shared mutation-request owner, so the old interception never starts the overlapping memory sync and accesses a callback absent from part of the archive operation union.

Intercept the current mutation request callback with its generic contract, keep the real worker and all original assertions, and await the database owner's asynchronous worker drainage before fixture cleanup. Production code, storage semantics, baselines, and timeouts are unchanged.

Evidence

  • Red-main evidence: run 34756854341, head e93f122. check-test-types-core-2 fails with TS2322/TS2339 at test lines 44 and 50; checks-node-compact-small-1 fails at line 164 with [] instead of one fulfilled foreground write, then hits a cleanup ENOENT.
  • Before the fix, node scripts/run-vitest.mjs src/config/sessions/session-accessor.sqlite-reclamation-memory.test.ts reproduced AssertionError: expected [] to deeply equal [{ status: 'fulfilled', value: undefined }] at line 164, followed by an unhandled cleanup error.
  • After the fix, node scripts/run-vitest.mjs src/config/sessions/session-accessor.sqlite-reclamation-memory.test.ts src/config/sessions/session-accessor.sqlite-archive-session.test.ts src/config/sessions/session-accessor.sqlite-reclamation-reuse.test.ts: 3 files, 21 tests passed, no unhandled cleanup errors. Original authorization, deletion, cache-pruning, and retained-memory assertions are unchanged.
  • node scripts/check-changed.mjs: passed, including the affected state-logging core test graph, targeted lint, formatting, and repository guards.
  • Independent P1 review: no accepted/actionable findings. Test-only repair; no runtime update or migration behavior changed.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 13, 2026
@steipete
steipete marked this pull request as ready for review September 13, 2026 12:46
@clawsweeper

clawsweeper Bot commented Sep 13, 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 added P2 Normal backlog priority with limited blast radius. 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 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 8:52 AM ET / 12:52 UTC.

ClawSweeper review

What this changes

The PR updates the session-deletion and memory-write regression test to intercept the current worker request owner and await worker shutdown before fixture cleanup.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused repair: current main retains the broken test interception, and the proposed change preserves its behavioral assertions. No actionable correctness or security findings were found.

Priority: P2
Reviewed head: e4bdc1a53fab5c83bc54429e27ebfc988945bf45

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow repair with preserved behavioral assertions, appropriate cleanup, and relevant reported validation.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored test-only repair is exempt from external runtime proof; its supplied validation exercises overlapping memory writes and real reclamation workers, with 21 tests reported passing.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored test-only repair is exempt from external runtime proof; its supplied validation exercises overlapping memory writes and real reclamation workers, with 21 tests reported passing.
Evidence reviewed 7 items Current main still needs the repair: Fetched main still mocks the archive-operation helper and omits asynchronous database drainage; the proposed interception and teardown changes are absent.
Correct production interception boundary: The retained reclamation worker calls runSqliteMutationWorkerRequest, whose generic contract requires onCommitRequest. The patched test delegates to that real owner and retains assertions for foreground settlement, authorization, deletion, cache pruning, and surviving memory.
Cleanup joins the existing lifecycle owner: closeOpenClawAgentDatabasesAsync drains registered asynchronous resources before closing database handles; the retained worker's close operation awaits native exit. Neighboring archive-session tests already use this asynchronous cleanup.
Findings None None.
Security None None.

How this fits together

Session reclamation deletes archived session data through a worker while memory indexing shares the agent database. This test checks that overlapping memory writes and guarded deletion both finish without blocking commit authorization.

flowchart TD
 A[Session deletion request] --> B[Reclamation worker]
 B --> C[Mutation request owner]
 C --> D[Test overlap checkpoint]
 D --> E[Memory cache write]
 D --> F[Commit authorization]
 E --> G[Verify deletion and retained memory]
 F --> G
 G --> H[Drain workers before cleanup]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests 0. Total 0 across 1 file.

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

Review metrics

None.

Technical review

Best possible solution:

Keep the existing overlap regression attached to the shared mutation-request owner and complete native worker drainage before removing its fixtures.

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

Yes, source inspection identifies the obsolete interception that prevents the foreground write from starting, consistent with the supplied failing assertion. Tests were not rerun under this read-only review.

Is this the best way to solve the issue?

Yes, the patch moves the existing checkpoint to the active owner and uses its established drainage contract without weakening assertions or adding production seams.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs meaningful concurrency regression coverage without changing shipped runtime behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored test-only repair is exempt from external runtime proof; its supplied validation exercises overlapping memory writes and real reclamation workers, with 21 tests reported passing.

Label justifications:

  • P2: This repairs meaningful concurrency regression coverage without changing shipped runtime 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 maintainer-authored test-only repair is exempt from external runtime proof; its supplied validation exercises overlapping memory writes and real reclamation workers, with 21 tests reported passing.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit e05d8b6 adds src/config/sessions/session-accessor.sqlite-reclamation-memory.test.ts:164 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e05d8b6c9077; files: src/config/sessions/session-accessor.sqlite-reclamation-memory.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.

@vincentkoc vincentkoc self-assigned this Sep 13, 2026
@steipete
steipete merged commit d4d3d6c into main Sep 13, 2026
167 of 169 checks passed
@steipete
steipete deleted the steipete/upd-red-main-16-reclamation-memory-test branch September 13, 2026 13:03
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@vincentkoc

Copy link
Copy Markdown
Member

Supplemental exact-head verification completed for e4bdc1a53fab5c83bc54429e27ebfc988945bf45, now landed as d4d3d6c.

  • Blacksmith Testbox: 79/79 tests passed across 5 files in 243.27s, using test/vitest/vitest.runtime-config.config.ts with two workers. This covered the repaired memory fixture, both startup corpus files from the original failing shard, and the archive-session/reclamation-reuse suites together.
  • Exact-head CI also passed the repaired fixture and affected test type graph. Fresh autoreview and two independent owner/lifecycle reviews found no actionable defect; all original behavioral assertions remain, with production LOC unchanged.

Supplemental run, lease tbx_01m2ddvfn8rg5vt1n1vnvhv7jk: command exit 0, lease stopped successfully. The backing Actions lifecycle may show cancellation after a successful one-shot Testbox shutdown.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* temp/pr-145950: (101 commits)
  refactor(memory-wiki): share freshness result construction (#146935)
  improve(gateway): use metadata projection for presence (#146817)
  test(agents): reuse complete Responses model fixtures (#147015)
  fix(sessions): align the reclamation-memory test with the archive session owner (#147028)
  refactor(terminal): simplify copy-sensitive token checks (#146934)
  refactor(media): remove duplicate spaced path fallback (#146933)
  refactor(cli): reuse command-group names (#146893)
  improve(plugins): reduce JavaScript generation capture work (#146993)
  test: align plugin fixtures with current runtime contracts (#147000)
  refactor(browser): separate session tab tracking from cleanup (#146973)
  fix(tests): make systemd clock fixtures private (#146990)
  fix(linux): retire sleep guards when logind disconnects (#146046)
  refactor(matrix): share draft fallback delivery (#144840)
  fix(sessions): preserve cross-agent replies after reload (#146799)
  test(models): cover quota recovery during catalog discovery (#146708)
  fix(macos): recover browser sign-in when no browser opens (#146787)
  fix(process): prevent one-shot agents exiting while polling (#144268)
  fix(status): label the session inventory as stored (#146979)
  fix: avoid repeated background reads while loading chat (#146953)
  refactor(ui): narrow Skill Workshop proposal context (#146977)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '060e856e5f9df245d63c98990fcb47e18108c6b9': (97 commits)
  refactor(memory-wiki): share freshness result construction (#146935)
  improve(gateway): use metadata projection for presence (#146817)
  test(agents): reuse complete Responses model fixtures (#147015)
  fix(sessions): align the reclamation-memory test with the archive session owner (#147028)
  refactor(terminal): simplify copy-sensitive token checks (#146934)
  refactor(media): remove duplicate spaced path fallback (#146933)
  refactor(cli): reuse command-group names (#146893)
  improve(plugins): reduce JavaScript generation capture work (#146993)
  test: align plugin fixtures with current runtime contracts (#147000)
  refactor(browser): separate session tab tracking from cleanup (#146973)
  fix(tests): make systemd clock fixtures private (#146990)
  fix(linux): retire sleep guards when logind disconnects (#146046)
  refactor(matrix): share draft fallback delivery (#144840)
  fix(sessions): preserve cross-agent replies after reload (#146799)
  test(models): cover quota recovery during catalog discovery (#146708)
  fix(macos): recover browser sign-in when no browser opens (#146787)
  fix(process): prevent one-shot agents exiting while polling (#144268)
  fix(status): label the session inventory as stored (#146979)
  fix: avoid repeated background reads while loading chat (#146953)
  refactor(ui): narrow Skill Workshop proposal context (#146977)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* temp/pr-137049: (110 commits)
  improve: reduce GitHub OAuth maintenance work for large agent rosters (#147021)
  fix(test): avoid settings lock writer startup timeouts (#147029)
  fix(update): correct backup guidance and cover incident regressions (#147023)
  refactor(gateway): share connection lifecycle across transports (#145950)
  refactor(telegram): share HTML text escaping (#146936)
  perf(build): reduce disk use in UI performance checks (#146687)
  refactor(memory-wiki): share freshness result construction (#146935)
  improve(gateway): use metadata projection for presence (#146817)
  test(agents): reuse complete Responses model fixtures (#147015)
  fix(sessions): align the reclamation-memory test with the archive session owner (#147028)
  refactor(terminal): simplify copy-sensitive token checks (#146934)
  refactor(media): remove duplicate spaced path fallback (#146933)
  refactor(cli): reuse command-group names (#146893)
  improve(plugins): reduce JavaScript generation capture work (#146993)
  test: align plugin fixtures with current runtime contracts (#147000)
  refactor(browser): separate session tab tracking from cleanup (#146973)
  fix(tests): make systemd clock fixtures private (#146990)
  fix(linux): retire sleep guards when logind disconnects (#146046)
  refactor(matrix): share draft fallback delivery (#144840)
  fix(sessions): preserve cross-agent replies after reload (#146799)
  ...
steipete added a commit that referenced this pull request Sep 13, 2026
Include the landed reclamation-memory fixture repair from #147028. The 27 owned performance and test-infrastructure files remain identical to the reviewed candidate.
pdonizete added a commit to pdonizete/openclaw that referenced this pull request Sep 13, 2026
Brings in:
- openclaw#146949 (bc6b662) test(agents): coordinate settings lock contention
- openclaw#147028 (d4d3d6c) fix(sessions): align the reclamation-memory test with the archive session owner
- openclaw#147029 (1311b42) fix(test): avoid settings lock writer startup timeouts

Required to clear the 4 failing CI checks on PR openclaw#144507; the PR's
WhatsApp voice-note 16 kHz + WhatsApp-vendor fix is preserved
intact (main did not touch the changed lines).

Co-Authored-By: Claude Code <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

2 participants