mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 09:39:25 +00:00
* perf(sessions): reduce disk-pressure reclamation overhead
Reuse a sweep-owned reclamation Worker while preserving each victim transaction and live authority. Keep archive-only workers off the lifecycle import graph, join before final physical accounting, and preserve current physical-store ownership and per-request worker diagnostics.
Focused integration tests, compiled dependency-boundary regression, changed checks, normal build, and independent P0 review passed. Earlier matched-workload checkpoints reduced cleanup from 51.446s to 22.436s, but strict timing and SCALE gates remain unpassed; fresh integrated-head stress proof is still required.
* refactor(sessions): keep reclamation contracts acyclic
Move shared plan and result types into the existing lifecycle-types owner so the Worker no longer imports its runtime caller. Preserve exact type shapes and runtime behavior. Both cycle checks, focused tests, bootstrap regression, strict build/declarations, and independent P0 review pass.
* fix(sessions): preserve current admission during sweep worker reuse
Refresh the disk-pressure cleanup optimization in #140897 against current SQLite ownership. Keep per-victim retained claims, authorization and publication ordering while reusing one Worker per sweep. Bind each request to its own async context and preserve the original authority error during cleanup.
Focused owner, archive and combined regression tests, classified checks, full build and independent P0 review passed. Full stress acceptance remains blocked by missing original harness inputs; this commit does not claim landing readiness.
* test(gateway): align reclamation probe with worker bootstrap
Use the current bootstrap database options in the real SQLite validation preload. Both Gateway admission cases failed before this fixture correction and pass afterward, preserving revocation, same-store progress, native checks and lease cleanup assertions.
* fix(sessions): preserve cold mutation lifetimes during sweep reuse
Integrate the disk-pressure performance follow-up #140897 with cold storage from #145172. Share request admission and authorization while keeping cold mutations one-shot through cleanup and native exit, and retaining one validated reclamation Worker per sweep. Keep restore preparation, synchronous commit checks, publication ordering and final physical accounting intact.
Remove inherited dead UI exports and obsolete styles, exercise configuration through its real menu entrypoint, reuse picker test setup, and consolidate duplicate lifecycle notification construction. Preserve the 720-root and file-size limits without suppressions.
Focused cold/reclamation/Gateway tests, reset and UI coverage, classified checks, full build and independent P0 review passed. Full stress acceptance remains pending the separately reviewed replacement rig.
* test(auto-reply): incorporate canonical thinking test split
Apply the unchanged test-only split from upstream 9ab6ba866c (#145632) to repair the preexisting 1006-line CI failure on the retention candidate. No production behavior changes. Focused 83 tests, scoped lint and formatting pass; independent full-candidate P0 review is clean. Stress acceptance remains outstanding.
* refactor(sessions): clarify reclamation cleanup handling
* test: drain retained database workers before fixture cleanup
* test: preserve fixture state through retained worker drainage
* test: adapt archive bootstrap proof to tsdown handle
* test(sessions): drain archive fixture resources before removal
* test(gateway): drain the captured shared-state fixture owner
* fix(gateway): yield to I/O between startup phases
Retain the complete shutdown graph and lifecycle before yielding. Let queued I/O and close requests run before core runtime startup, and reject canceled startup before it can continue.
* perf(sessions): trim archive worker database bootstrap
Archive materialization and publication use fresh read-only connections, so avoid loading the writable database runtime to search an isolate-local cache that cannot contain parent handles. Share missing-table adaptation with cached readers while preserving validation, native close, and one-shot Worker exit ordering.
Verify the emitted archive bootstrap excludes the writable database module even when built with the parent session-store SDK entry. Preserve archive bytes, failure recovery, and borrowed/fresh reader behavior through focused tests.
* perf(sessions): skip artifact preparation without file candidates
Use the existing file inventory to avoid resolving every session path when no eligible transcript artifact can be removed, and avoid prompt projection without prompt blobs. Preserve the existing removal rules and validate with the stale-temp regression and 77 artifact/disk-budget cases.
* perf(state): keep startup agent integrity scans off the main thread
Run the full startup integrity and foreign-key scan against the already-owned
private agent snapshot through the existing integrity child. Retain the snapshot
and parent reader through native child close, then perform the unchanged schema
and migration checks. Preserve fresh admission before the migration lease and
before writes, source artifact neutrality, and original-path diagnostics.
Keep shared-state scans on their existing connection for the narrow legacy
Workshop-index admission. Move the unchanged schema-preflight error class to
its existing messages owner while preserving its public export. Update the
sole direct native integrity fixture for the diagnostic label.
Two real startup regressions fail on the original main-thread scan and pass
afterward, including a real foreign-key violation. 107 focused cases across
six files, selected repository checks, and independent review through P2 pass.
The integrated build and whole-Gateway stress limits remain required; this
commit does not claim a stress or runtime-update acceptance result.
* perf(sessions): reuse scoped archive workers during cleanup
Keep archive execution within cleanup and deletion scopes while closing fresh readers and files for every operation. Preserve per-victim commits and publication, and drain native work on failure or retirement.
Narrow singleton reference hydration through the existing parser without a reference cache. Align cold-handle and fixture cleanup proof with their canonical lifecycle owners.
* refactor(sessions): isolate archive contracts from execution
Move shared archive types into a leaf contract and migrate internal callers to remove the type-only import cycle without changing runtime behavior.
Model cold handles through canonical cache eviction in lifecycle fixtures and await native drainage before fixture cleanup.
* perf(sessions): yield between cleanup phases
Avoid loading the full session store when ordinary cleanup does not use the repair snapshot. Reuse canonical entries already read within the maintenance transaction when writing archive metadata, preserving the original previous entry and all writer guards.
Yield outside transactions before lifecycle application and the following snapshot so cleanup preparation, atomic writes, and queued responses do not combine into one long event-loop pause. Repair options, archive ordering, metadata, and transaction atomicity remain unchanged.
The original large workload recorded a 664.79 ms gap; a separate CPU profile identified the repeated store load and maintenance transaction as dominant costs. The focused 66-test suite, static checks, and independent P0-P2 review pass. Fresh compiled responsiveness and published-updater acceptance remain required for this source.
19 lines
673 B
TypeScript
19 lines
673 B
TypeScript
// Extension test setup installs extension-specific mocks and cleanup.
|
|
import { afterAll, beforeEach, vi } from "vitest";
|
|
import { installSharedTestSetup } from "./setup.shared.js";
|
|
|
|
const testEnv = installSharedTestSetup({ loadProfileEnv: false });
|
|
|
|
beforeEach(() => {
|
|
vi.useRealTimers();
|
|
});
|
|
|
|
afterAll(async () => {
|
|
const { drainAgentDatabaseResources } = await vi.importActual<
|
|
typeof import("../src/state/openclaw-agent-db-resources.js")
|
|
>("../src/state/openclaw-agent-db-resources.js");
|
|
// File-owned homes must survive until retained Worker leases have been released.
|
|
await drainAgentDatabaseResources({}, async () => {
|
|
testEnv.cleanup();
|
|
});
|
|
});
|