Repository navigation
test(agents): reuse worktree state database fixture - #118550
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 2:57 AM ET / 06:57 UTC. ClawSweeper reviewWhat this changesThe PR reuses one suite-scoped SQLite state database for managed-worktree service tests while retaining a fresh Git repository and filesystem root for every test case. Merge readinessKeep this PR open for normal maintainer merge handling. It is a narrow, current test-fixture performance change, is not present on current Priority: P3 Review scores
Verification
How this fits togetherManaged-worktree service tests create temporary Git repositories and persist worktree metadata, run leases, and provisioned-file chunks in OpenClaw’s shared SQLite state database. The fixture sets up a service for each case, then must remove that case’s registry rows and worktree files before the next case runs. flowchart LR
A[Per-test Git repository] --> C[Managed worktree service]
B[Suite SQLite state database] --> C
C --> D[Worktree registry row]
D --> E[Lease and provisioned rows]
E --> F[Per-test registry cleanup]
F --> G[Managed worktree files removed]
G --> H[Next isolated test case]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +10. Total +10 across 1 file. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the suite-scoped fixture after the clean merge result and required checks are refreshed, preserving the canonical registry cleanup calls and per-case Git/filesystem isolation. Do we have a high-confidence way to reproduce the issue? Not applicable: the change targets test-fixture startup cost and isolation, and the PR body supplies focused before/after test-run evidence rather than a user-facing defect report. Is this the best way to solve the issue? Yes. Reusing the process-lifetime state database matches the production ownership model while using the existing registry helpers to remove worktree rows, leases, and provisioned chunks between isolated cases. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4281e90012fe. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Co-authored-by: Peter Steinberger <[email protected]>
Summary
Root cause
Production keeps the shared state database open for the process lifetime, but this suite created a new
OPENCLAW_STATE_DIRand physically reopened the full state database for nearly every one of its 48 cases. Each cold open repeated database validation, pragmas, and schema setup before the test could exercise the worktree behavior it owned.The Git fixture was already suite-templated and reflinked. Reusing the process-owned SQLite fixture is therefore the owner-aligned simplification: Git repositories remain isolated per case, while shared state now follows the production lifecycle.
Coverage and isolation
Performance
Paired focused runs on the same ready dependency install at base
4b3d0b37be5eb07608b315ecb35453d0df39ec0c:In the profiled compact-large-7 environment, this file was the agents-support critical tail at 92.43s. The focused reduction clears the lane's updated 10s execution target without changing sharding or concurrency.
Proof
git diff --check: cleanorigin/main: cleanCore test typechecking reaches two pre-existing errors outside this change in
packages/terminal-core/src/ansi.tsandui/src/app-session-route-paths.ts; it reports no changed-file errors.