Skip to content

test(state): reuse current agent database fixture - #118677

Merged
steipete merged 1 commit into
mainfrom
codex/perf-large8-node-plugin
Aug 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/perf-large8-node-plugin

Conversation

@steipete

@steipete steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • reuse one closed, validated current-schema agent database template across drift and repair tests
  • preserve real database mutation, production reopen/repair/rejection, integrity, foreign-key, and ownership checks
  • keep initialization, migration, WAL/locking, permissions, subprocess, registry/lease, read-only, metadata, and unrelated corruption coverage on fresh databases

Performance

Direct AWS Crabbox full unit-src comparison on the same lease:

  • baseline: 339 files, 4,155 tests, 116.57s Vitest wall
  • patched: 339 files, 4,155 tests, 105.90s Vitest wall
  • improvement: 10.67s (9.2%)

The first patched run exposed a zero-length WAL sidecar. The final helper checkpoints and closes the template, rejects nonempty WAL content, removes closed sidecars, and then verifies integrity, foreign keys, schema version, and the exact owner before reuse.

Proof

  • node scripts/run-vitest.mjs src/state/openclaw-agent-db.test.ts
    • 96 passed, 4 skipped, 19.34s
  • git diff --check
  • autoreview clean: no accepted/actionable findings

The changed-check remote router could not allocate a configured backend; PR CI is the broader gate.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 3, 2026
@steipete steipete self-assigned this Aug 3, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 9:34 AM ET / 13:34 UTC.

ClawSweeper review

What this changes

Reuses a validated per-worker agent SQLite database template for selected schema-drift and repair tests while retaining fresh-database coverage for initialization and lifecycle cases.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this focused test-performance refactor open for the assigned maintainer and exact-head CI. The branch reuses a closed, integrity-checked current-schema agent database only in test setup, and review found no introduced correctness or security defect.

Priority: P3
Reviewed head: 61bc9e1b72d3aaa9fa3fd1012878b3503b5ebc5c
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test-only optimization with concrete runtime-test evidence and explicit SQLite fixture validation.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body provides an after-change AWS Crabbox full-suite comparison plus focused terminal test output; this test-only change does not need visual proof.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides an after-change AWS Crabbox full-suite comparison plus focused terminal test output; this test-only change does not need visual proof.
Evidence reviewed 5 items Validated reusable fixture: The branch creates the worker database through the production opener, checkpoints and closes it, removes closed sidecars, then verifies integrity, foreign keys, schema version, and the expected agent before caching the template path.
Drift tests still exercise production behavior: Each selected drift test copies the validated fixture into a new state directory before opening it through the production agent-database runtime, preserving real reopen, repair, and rejection coverage.
Runtime contract checked: Current main validates the persisted schema owner and integrity before schema mutation, then configures the connection and registers the opened agent database; the fixture targets that same established owner boundary.
Findings None None.
Security None None.

How this fits together

OpenClaw stores agent-scoped runtime state in per-agent SQLite databases. These tests create controlled database drift, then exercise the production opener's validation, repair, quarantine, and ownership checks against those files.

flowchart LR
  A[Fresh test state directory] --> B[Validated agent database template]
  B --> C[Per-test database copy]
  C --> D[Injected schema drift]
  D --> E[Production agent database opener]
  E --> F[Repair or rejection assertions]
  E --> G[SQLite integrity and owner checks]
Loading

Decision needed

Question Recommendation
Should this maintainer-labeled test-performance refactor merge once the remaining exact-head CI checks complete? Merge after CI: Merge the focused fixture reuse if the in-progress exact-head checks pass, preserving the existing fresh-database tests for initialization and lifecycle coverage.

Why: The patch is narrowly scoped and source review found no defect, but the protected maintainer label requires explicit maintainer handling rather than automated cleanup.

Before merge

  • Complete next step (P2) - No repair is indicated; the remaining action is maintainer approval after exact-head CI completes because the PR carries the protected maintainer label.
Agent review details

Security

None.

PR surface

Tests +40. Total +40 across 1 file.

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

Review metrics

Metric Value Why it matters
Production versus test LOC production +0, tests +40 The entire 86-added/46-removed diff is confined to a test file, so it does not expand the shipped runtime surface.

Stored data model

Persistent data-model change detected: serialized state: src/state/openclaw-agent-db.test.ts, unknown-data-model-change: src/state/openclaw-agent-db.test.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Land the focused test-only fixture reuse after the remaining exact-head checks are green, retaining the explicit checkpoint, sidecar cleanup, and validation guardrails that preserve isolation.

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

Not applicable: this PR optimizes test setup rather than reporting a user-facing defect. The PR body supplies a direct full-suite timing comparison and a focused test result, but this read-only review did not execute tests.

Is this the best way to solve the issue?

Yes. Reusing a validated closed database keeps the selected drift tests on the real production reopen path while avoiding repeated initialization; the untouched tests continue to cover fresh-database lifecycle behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1acc64b28a18.

Labels

Label changes:

  • add P3: This is a low-risk test-suite performance and fixture-isolation cleanup with no reported user-facing regression.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an after-change AWS Crabbox full-suite comparison plus focused terminal test output; this test-only change does not need visual proof.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides an after-change AWS Crabbox full-suite comparison plus focused terminal test output; this test-only change does not need visual proof.

Label justifications:

  • P3: This is a low-risk test-suite performance and fixture-isolation cleanup with no reported user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides an after-change AWS Crabbox full-suite comparison plus focused terminal test output; this test-only change does not need visual proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an after-change AWS Crabbox full-suite comparison plus focused terminal test output; this test-only change does not need visual proof.

Evidence

What I checked:

  • Validated reusable fixture: The branch creates the worker database through the production opener, checkpoints and closes it, removes closed sidecars, then verifies integrity, foreign keys, schema version, and the expected agent before caching the template path. (src/state/openclaw-agent-db.test.ts:104, 61bc9e1b72d3)
  • Drift tests still exercise production behavior: Each selected drift test copies the validated fixture into a new state directory before opening it through the production agent-database runtime, preserving real reopen, repair, and rejection coverage. (src/state/openclaw-agent-db.test.ts:152, 61bc9e1b72d3)
  • Runtime contract checked: Current main validates the persisted schema owner and integrity before schema mutation, then configures the connection and registers the opened agent database; the fixture targets that same established owner boundary. (src/state/openclaw-agent-db.ts:213, 1acc64b28a18)
  • Feature history: The immediately preceding main test change is by joshavant, while recent state-database history includes Peter Steinberger and Vincent Koc on schema, verifier, and lifecycle work; the new fixture code is attributable to the proposed commit. (src/state/openclaw-agent-db.test.ts:71, 61bc9e1b72d3)
  • Current-main and release status: The proposed commit is not an ancestor of current main and is not contained in a release tag, so this work remains an active unmerged PR rather than an implemented-on-main cleanup candidate. (src/state/openclaw-agent-db.test.ts:104, 61bc9e1b72d3)

Likely related people:

  • steipete: Recent current-main history includes agent-database schema and repair work, and the proposed fixture follows that established test surface. (role: recent state-database contributor; confidence: high; commits: 8978ef44f302, 61bc9e1b72d3; files: src/state/openclaw-agent-db.test.ts, src/state/openclaw-agent-db.ts)
  • joshavant: The parent commit for this PR is the latest main change to the central test file and established the immediately preceding test context. (role: recent test-surface contributor; confidence: high; commits: a37c5acc2823; files: src/state/openclaw-agent-db.test.ts)
  • Vincent Koc: Recent current-main history shows repeated work on SQLite statement-cache, invalid-database, and compatibility behavior exercised by this test suite. (role: adjacent SQLite lifecycle contributor; confidence: medium; commits: 6b324386b5f8, f288589166e0; files: src/state/openclaw-agent-db.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
steipete merged commit cad499d into main Aug 3, 2026
128 of 134 checks passed
@steipete
steipete deleted the codex/perf-large8-node-plugin branch August 3, 2026 13:43
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 3, 2026
* origin/main: (57 commits)
  fix(media): fall back when providers return empty output (#118660)
  fix(nextcloud-talk): allow bounded parallel room deliveries (#118692)
  test(state): reuse current agent database fixture (#118677)
  fix(scripts): bound check-file-utils git lookup (#111582)
  fix(slack): scope interactive conversation bindings safely (#118662)
  fix(agents): avoid false compaction after mid-turn precheck (#117963)
  fix(ui): show original filename on chat history attachment cards instead of managed UUID suffix (#118628)
  fix(whatsapp): preserve terminal retry exhaustion lifecycle (#118659)
  fix(doctor): audit every agent workspace (#111840)
  fix(release): skip unavailable Buzz on frozen candidates (#118670)
  fix(ui): surface onboarding and pairing clipboard failures (#118651)
  fix(config): stop plugin schemas rejecting the channel key core writes (#117992)
  test(memory): isolate wiki plugin fixtures (#118654)
  fix(line): clear default access token when removing account (#118055)
  feat: enable rich setup controls in custodian chat (#114631)
  test(ui): reuse responsive browser fixtures (#118655)
  chore(tui): stabilize queued-turn admission in Gateway PTY test (#118638)
  fix(xai): classify exhausted credits as billing (#118615)
  fix(otel): fail closed when configured TLS material is invalid (#118648)
  fix(cli): preserve gateway request errors in health JSON (#118645)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
* origin/main: (57 commits)
  fix(media): fall back when providers return empty output (openclaw#118660)
  fix(nextcloud-talk): allow bounded parallel room deliveries (openclaw#118692)
  test(state): reuse current agent database fixture (openclaw#118677)
  fix(scripts): bound check-file-utils git lookup (openclaw#111582)
  fix(slack): scope interactive conversation bindings safely (openclaw#118662)
  fix(agents): avoid false compaction after mid-turn precheck (openclaw#117963)
  fix(ui): show original filename on chat history attachment cards instead of managed UUID suffix (openclaw#118628)
  fix(whatsapp): preserve terminal retry exhaustion lifecycle (openclaw#118659)
  fix(doctor): audit every agent workspace (openclaw#111840)
  fix(release): skip unavailable Buzz on frozen candidates (openclaw#118670)
  fix(ui): surface onboarding and pairing clipboard failures (openclaw#118651)
  fix(config): stop plugin schemas rejecting the channel key core writes (openclaw#117992)
  test(memory): isolate wiki plugin fixtures (openclaw#118654)
  fix(line): clear default access token when removing account (openclaw#118055)
  feat: enable rich setup controls in custodian chat (openclaw#114631)
  test(ui): reuse responsive browser fixtures (openclaw#118655)
  chore(tui): stabilize queued-turn admission in Gateway PTY test (openclaw#118638)
  fix(xai): classify exhausted credits as billing (openclaw#118615)
  fix(otel): fail closed when configured TLS material is invalid (openclaw#118648)
  fix(cli): preserve gateway request errors in health JSON (openclaw#118645)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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