Skip to content

fix(ci): join archive placement fixtures before teardown - #155751

Merged
vincentkoc merged 1 commit into
mainfrom
fix/ci-archive-placement-drain-20260922
Sep 22, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/ci-archive-placement-drain-20260922

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Gateway archive-placement tests can fail before observing the runtime drain and leave an archive request running into fixture teardown.

User Impact

No user-visible behavior changes. This repairs the CI fixture lifecycle while preserving its archive, placement identity, and drain-release checks.

Why This Change Was Made

The active/failed identity cases used the default one-second polling window to observe an asynchronous request. If that assertion failed, teardown could close the session databases while the request was still running. The adjacent exact-active cloud-reclaim case also held a request without unconditional release and join.

All three cases now race the expected phase notification against archive completion, then release the held phase and await the archive request in finally. Early completion or rejection fails visibly. All 24 test cases and their existing assertions remain; no timeout increase, retry, or production change is introduced. Test delta: 53 additions, 27 deletions.

Evidence

  • Original CI run, failed producer: both active/failed identity cases missed the drain-start assertion; the job also reported two unhandled Session history database read was revoked errors. Its 40-file group finished with 588 passing tests and two failures. The exact prerequisite that delayed drain entry has not been established.
  • Native validation run: focused fixture 24/24 passed; formatting, targeted lint, and the Gateway server test type graph passed. The original 40-file group returned 589 passed, 1 failed, with all 24 archive-placement cases passing again and no unhandled errors. The remaining failure was src/gateway/server.agent.gateway-server-agent-auth-refresh.test.ts:318, “aborts one affected waiter without cancelling shared auth publication”: active root-work count expected 2, received 3. The third root is unexplained; this is not an overall green result or proof of causal independence.
  • The native run executed base cf32d5a527d75b44dfa23a57ab1c6cde919ebe2f with staged tree dfd8f08c597be6f5bf127a14e8b2da233048654f. Signed commit 3637083eb13523c88e3e8015ee91f87a7d4bfb0f was verified to have exactly that tree. A fresh P0–P2 source review of the signed commit found no actionable findings. Production delta: 0.
  • Validation used Linux, Node 24.19.0, pnpm 12.4.0, Vitest 5.0.0, two test workers, and no retries. The native runner had 4 CPUs/16.56 GB versus the original job's 8 CPUs/33.23 GB. The original group's file selection and configuration were preserved; execution order was not forced, and the original job's two preceding packed groups were not replayed. Per-phase caches were separate, but native worker compiler outputs were reused, so neither globally cold execution nor equivalent cache state is claimed. The original failed merge also contained the watcher change; this proof isolates the fixture on its original base. All managed children were joined, source restored, the remote worktree removed, and the owned lease stopped.

Timing evidence, with each measurement boundary kept distinct:

Execution Recorded duration and result
Original failed hosted 40-file group 402.44s Vitest; 404.66s shard; 904s packed step; 966s whole producer. Active/failed identity cases failed at 1,749/1,962ms. No whole-fixture duration was retained.
Native candidate, focused fixture 24 passed; 44.22s Vitest; 45.76s shard; 47.088s child / 47.138s managed wrapper.
Native candidate, original 40-file group 589 passed / 1 auth-refresh failure; 336.95s Vitest; 339.01s shard; 340.652s managed wrapper.
Current hosted fixture 24 passed; 80.30s Vitest; 149s whole job. Exact-active reclaim: 1,002ms; active/failed identity changes during drain: 1,353/1,368ms.

There is no matched before/after whole-file benchmark and no speedup claim. Resources, cache state and source groups differ; the current hosted fixture ran with 2 CPUs/8.22 GB and did not select auth-refresh. Current exact-head CI completed successfully at 3637083eb13523c88e3e8015ee91f87a7d4bfb0f: 25 successful jobs, 20 skipped, no failures. These measurements address the timing-evidence request without treating unlike durations as equivalent.

Related: the failure surfaced in the watcher coverage PR's CI; this change is isolated to the archive fixture.

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

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review September 22, 2026 13:39
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 22, 2026
@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 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 22, 2026, 9:47 AM ET / 13:47 UTC.

ClawSweeper review

What this changes

The PR makes three session-archive test cases release their held work and await request completion before fixture teardown, replacing polling with an explicit drain notification.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this is a focused fixture-lifecycle repair still needed on current main. No introduced correctness or security defect was found; the maintainer-authored PR is also protected from automatic closure.

Priority: P2
Reviewed head: 3637083eb13523c88e3e8015ee91f87a7d4bfb0f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-supported lifecycle repair with preserved assertions and candid validation limits; required timing reporting remains.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored fixture-only repair is exempt from external-contributor runtime proof; reported focused validation exercises the changed test lifecycle, with wider-run limitations explicitly disclosed. 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: This MEMBER-authored fixture-only repair is exempt from external-contributor runtime proof; reported focused validation exercises the changed test lifecycle, with wider-run limitations explicitly disclosed. No stored-data contract changes.
Evidence reviewed 7 items Pinned introduced change: The merge-base-to-head diff changes only the existing archive-placement fixture. Both affected blocks release their gate and await the archive promise in finally; existing result, identity, release, and archive-metadata assertions remain.
Request completion covers handler cleanup: directSessionReq awaits the registered handler and pending session-change events before returning. Joining that promise therefore precedes fixture database closure; the new pattern also matches adjacent existing lifecycle tests.
Current-main necessity: The fetched main revision retains the unguarded reclaim wait and polling-based drain observation. Comparing its fixture with the pinned head produces the same focused repair.
Findings None None.
Security None None.

How this fits together

Gateway session-archive tests exercise the session request handler with controlled worker drain and reclaim operations. Their fixture must finish those requests before closing the session databases.

flowchart TD
 A[Archive test request] --> B[Session request handler]
 B --> C[Controlled drain or reclaim]
 C --> D[Phase notification and assertions]
 D --> E[Release and await request]
 E --> F[Close fixture databases]
Loading

Before merge

  • Complete next step (P2) - Record before/after fixture wall times and available CI duration in the PR evidence to satisfy the repository's test-cost reporting requirement.
Agent review details

Security

None.

PR surface

Tests +26. Total +26 across 1 file.

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

Review metrics

None.

Technical review

Best possible solution:

Keep phase-driven synchronization and unconditional request joins in the existing fixture while preserving its archive-ordering and placement-identity checks.

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

Yes, source establishes that a failed phase assertion can exit the old test without releasing or joining its pending request before database teardown. The original timing-dependent drain delay was not reproduced in this read-only review.

Is this the best way to solve the issue?

Yes, explicit phase notification and finally-based release/join repair the fixture owner without weakening assertions, extending timeouts, or changing production behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs a concrete asynchronous test-fixture leak with limited scope and no production behavior change.
  • 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: This MEMBER-authored fixture-only repair is exempt from external-contributor runtime proof; reported focused validation exercises the changed test lifecycle, with wider-run limitations explicitly disclosed. No stored-data contract changes.

Label justifications:

  • P2: This repairs a concrete asynchronous test-fixture leak with limited scope and no production 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: This MEMBER-authored fixture-only repair is exempt from external-contributor runtime proof; reported focused validation exercises the changed test lifecycle, with wider-run limitations explicitly disclosed. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: The merge-base-to-head diff changes only the existing archive-placement fixture. Both affected blocks release their gate and await the archive promise in finally; existing result, identity, release, and archive-metadata assertions remain. (src/gateway/server.sessions.archive-worker-placement.test.ts:327, 3637083eb135)
  • Request completion covers handler cleanup: directSessionReq awaits the registered handler and pending session-change events before returning. Joining that promise therefore precedes fixture database closure; the new pattern also matches adjacent existing lifecycle tests. (src/gateway/test/server-sessions.test-helpers.ts, 3637083eb135)
  • Current-main necessity: The fetched main revision retains the unguarded reclaim wait and polling-based drain observation. Comparing its fixture with the pinned head produces the same focused repair. (src/gateway/server.sessions.archive-worker-placement.test.ts:469, 7eb4829ab8dd)
  • Latest-release comparison: The v2026.9.5 fixture also contains the direct reclaimStarted wait and vi.waitFor drain assertion, so that release does not contain this lifecycle repair. (src/gateway/server.sessions.archive-worker-placement.test.ts:467, ec9c1a13db89)
  • Reported validation and its limits: The captured PR body reports 24/24 focused cases passing and all archive-placement cases passing in the wider group, with no unhandled errors. It explicitly records the remaining auth-refresh root-work-count failure, differing execution conditions, and unknown original drain delay. These are contributor-reported results, not tests executed during this read-only review. The linked validation workflow's API status is cancelled, so its overall status is not a green validation result. (3637083eb135)
  • Area history and routing: Current-main file history identifies repeated archive-lifecycle work by Peter Steinberger. GitHub commit metadata identifies steipete and shows the recent change adding awaited database closure at the fixture's teardown. Some older local history objects were unavailable; no causal introduction claim relies on them. (src/gateway/server.sessions.archive-worker-placement.test.ts:36, c768bd125a14)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add before/after fixture timings and available CI duration to the PR evidence, as required by Gateway testing policy.

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 merged commit 05804bc into main Sep 22, 2026
179 checks passed
@vincentkoc
vincentkoc deleted the fix/ci-archive-placement-drain-20260922 branch September 22, 2026 13:57
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 22, 2026
Reuse the landed fixture fix from 05804bc (#155751). Wait for
actual drain and reclaim entry, then release and join held archive
requests before teardown. Preserve ownership assertions and deadlines.

Co-authored-by: Vincent Koc <[email protected]>
steipete added a commit that referenced this pull request Sep 22, 2026
Preserve one-shot automatic SQLite exit cleanup and explicit recovery of retained worker custody. Include the reviewed checkout fixture single post-handler publication and current main's canonical archive-placement repair from #155751.
vincentkoc added a commit that referenced this pull request Sep 22, 2026
* commit '739e2410702e0b1ad1d17a6dac07ddc0ab6dbebb': (140 commits)
  fix(ui): pause passive polling in hidden tabs (#155617)
  improve(android): keep chat photos outside text bubbles (#155338)
  fix(ui): preserve saved project after discovery failure (#155619)
  feat: compare Kitchen Sink Gateway resource costs (#155734)
  test(gateway): arm clock-jump claim after readiness (#155748)
  chore(ui): refresh control ui locales (#155700)
  fix(ci): join archive placement fixtures before teardown (#155751)
  fix(matrix): keep bot discovery off the Gateway thread (#152122)
  fix(agents): reconcile late requester recovery receipts (#155357)
  test(gateway): guard embeddings HTTP fixture lifetimes
  fix: isolate triage fixture acquisition and cleanup (#155736)
  refactor(sessions): hydrate saved transcripts off thread (#153325)
  fix: Claude MCP turns abort before tool timeout (#155663)
  fix(goals): pause terminal failures and clarify goal states (#155694)
  fix(test): preserve watcher errors when diagnostic capture fails (#155383)
  ci: move native runtime proofs to release validation (#155606)
  fix(auth): decouple compaction from profile rotation (#155204)
  fix(agents): admit compaction outside retired plugin generations (#151232)
  perf(ui): reduce automatic session list refetches (#155705)
  test: avoid unused source repos in release input fixtures (#155733)
  ...
steipete added a commit that referenced this pull request Sep 22, 2026
Archive lifecycle assertions polled for abort and batch-drain callbacks while directSessionReq was still preparing projection and history-worker state. On a polling failure, synthetic gates and RPCs could remain unsettled while fixture teardown revoked their readers.

Install abort and drain checkpoints before dispatch, race them against RPC settlement, and release held synthetic work before joining the affected requests in cleanup. Preserve the cancellation, concurrency, generation, release-order and durable-state assertions. The intermediate one-second observation polls are intentionally removed; existing test-case and RPC timeouts remain unchanged. Keep the landed persistence-error repair and #155751's worker-placement repair intact.

All 17 lifecycle cases passed on main 0a5b538 with the updated transcript hydration runtime in 87.462 seconds of cold command wall time. This exercises actual RPC preparation, SQLite/history workers and lifecycle ordering; cold compilation accounts for substantial setup cost. Fresh scoped P2 review found no actionable issues. Reuse the byte-identical fixture's previously passing formatting, lint, type and guard checks. No production code or test cases were added, and no whole-prefix replay or speedup claim is made.
steipete added a commit that referenced this pull request Sep 22, 2026
* fix(sessions): stop repeated failed worker exit cleanup

Use one-shot process-exit cleanup for retained reclamation workers and the
canonical validation pool. A rejected asynchronous close previously kept its
beforeExit listener, so each drained event loop repeated the same cleanup and
could prevent CLI and QA commands from exiting.

Keep failed database resource ownership and explicit close retries intact.
The existing native-worker tests cover failed idle memory-pressure cleanup,
repeated pressure, one exit cleanup attempt, and explicit receipt recovery.
Exit simulations dispatch only still-registered handlers.

Validation: 51 focused worker tests pass on current main, including pressure
and custody composition. Both exit-event regressions fail with the original
listeners. Independent autoreview found no actionable issues.

* fix(sessions): preserve recovery when stopping repeated exit cleanup

* fix(sessions): reconcile exit cleanup with current main

Preserve one-shot automatic SQLite exit cleanup and explicit recovery of retained worker custody. Include the reviewed checkout fixture single post-handler publication and current main's canonical archive-placement repair from #155751.

* test(ci): integrate canonical fixture repairs

Merge current main with the memory candidate synchronization fix from #155745 and archive lifecycle request settlement from 94b9c47. Preserve the reviewed six-file SQLite exit cleanup and checkout fixture delta without further source changes.

Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
Archive lifecycle assertions polled for abort and batch-drain callbacks while directSessionReq was still preparing projection and history-worker state. On a polling failure, synthetic gates and RPCs could remain unsettled while fixture teardown revoked their readers.

Install abort and drain checkpoints before dispatch, race them against RPC settlement, and release held synthetic work before joining the affected requests in cleanup. Preserve the cancellation, concurrency, generation, release-order and durable-state assertions. The intermediate one-second observation polls are intentionally removed; existing test-case and RPC timeouts remain unchanged. Keep the landed persistence-error repair and openclaw#155751's worker-placement repair intact.

All 17 lifecycle cases passed on main cff7347 with the updated transcript hydration runtime in 87.462 seconds of cold command wall time. This exercises actual RPC preparation, SQLite/history workers and lifecycle ordering; cold compilation accounts for substantial setup cost. Fresh scoped P2 review found no actionable issues. Reuse the byte-identical fixture's previously passing formatting, lint, type and guard checks. No production code or test cases were added, and no whole-prefix replay or speedup claim is made.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
)

* fix(sessions): stop repeated failed worker exit cleanup

Use one-shot process-exit cleanup for retained reclamation workers and the
canonical validation pool. A rejected asynchronous close previously kept its
beforeExit listener, so each drained event loop repeated the same cleanup and
could prevent CLI and QA commands from exiting.

Keep failed database resource ownership and explicit close retries intact.
The existing native-worker tests cover failed idle memory-pressure cleanup,
repeated pressure, one exit cleanup attempt, and explicit receipt recovery.
Exit simulations dispatch only still-registered handlers.

Validation: 51 focused worker tests pass on current main, including pressure
and custody composition. Both exit-event regressions fail with the original
listeners. Independent autoreview found no actionable issues.

* fix(sessions): preserve recovery when stopping repeated exit cleanup

* fix(sessions): reconcile exit cleanup with current main

Preserve one-shot automatic SQLite exit cleanup and explicit recovery of retained worker custody. Include the reviewed checkout fixture single post-handler publication and current main's canonical archive-placement repair from openclaw#155751.

* test(ci): integrate canonical fixture repairs

Merge current main with the memory candidate synchronization fix from openclaw#155745 and archive lifecycle request settlement from 5f027d8. Preserve the reviewed six-file SQLite exit cleanup and checkout fixture delta without further source changes.

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime 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: S 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