Skip to content

fix: avoid missed SQLite allocation events in config tests - #158798

Merged
steipete merged 1 commit into
mainfrom
codex/config-snapshot-allocation-proof
Sep 26, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/config-snapshot-allocation-proof

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes intermittent config test failures when the filesystem drops watch events for SQLite snapshot directories that are created and removed before notification.

User Impact

No user-visible behavior change. Config tests retain reliable checks for avoiding snapshot allocations during ordinary reads and creating them for artifact-preserving reads.

Why This Change Was Made

Replace the filesystem watcher and polling wait with an old modification-time marker on the test-isolated staging directory. Creating and removing entries changes that marker even after cleanup. Keep the real SQLite freshness checks, synchronous snapshot-worker checks, and existing database/WAL/SHM byte-preservation coverage. No production code changes.

Evidence

  • Both existing cases failed on an unchanged main baseline. A separate macOS create/write/remove probe confirmed that fs.watch can report no events.
  • The repaired full test file passed all 17 tests, including both allocation cases and source-byte preservation.
  • Independent review completed without actionable findings.
  • The full owner file passed in its original failing shard order, including the source-byte-preservation siblings. The already-running repeat supervisor finished with 23 complete local file runs passing as additional evidence (20 standalone and 3 in the original shard order). All changed-file gates passed, including type checking, lint, and repository guards.
  • Exact-head CI passed at 089a9d409fea76642d1b1edf766733fd0fd589fe. Its Linux changed-test job ran this file: 17/17 passed in 33.95 seconds wrapper wall; the two repaired cases took 254 ms and 224 ms.
  • Measured pnpm test src/config/io.load-async.test.ts --maxWorkers=1: 17/17 passed, 86.05 seconds wall on the loaded local host; Vitest duration 74.36 seconds, with 24% in tests. The unchanged file's real worker startup and SQLite integration account for its existing cost.

Related: #158783. This separately repairs the pre-existing test failure found while validating that change.

@clawsweeper

clawsweeper Bot commented Sep 26, 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 commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 6:04 AM ET / 10:04 UTC.

ClawSweeper review

What this changes

The PR replaces filesystem watch events with a staging-directory timestamp check in the config tests for temporary SQLite snapshot allocation.

Merge readiness

✅ Ready for maintainer review

Current main still uses the flaky filesystem watcher. The related Gateway fix has merged, but it did not repair this assertion; the focused test change has no actionable finding.

Priority: P3
Reviewed head: 089a9d409fea76642d1b1edf766733fd0fd589fe

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test repair with clear baseline context, repeated reported validation, and successful exact-head CI.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This repository-admin test-only PR changes the config suite’s filesystem assertion, not a production owner. The PR reports repeated real SQLite file runs and exact-head CI success; no stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This repository-admin test-only PR changes the config suite’s filesystem assertion, not a production owner. The PR reports repeated real SQLite file runs and exact-head CI success; no stored-data contract changes.
Evidence reviewed 7 items Introduced test change: The pinned PR diff replaces the watcher and polling wait with a timestamp set before both read modes, then checks for no allocation during ordinary reads and an allocation during artifact-preserving reads.
Current main still has the watcher: The live main revision retains fs.watch in the two allocation cases, so their central flaky assertion is not yet repaired on main.
Snapshot allocation boundary: SQLite snapshot staging creates a child directory under the staging root; that directory operation is what the new timestamp assertion observes.
Findings None None.
Security None None.

How this fits together

Config loading reads deferred plugin-migration records from local SQLite. These tests check that ordinary reads avoid temporary database copies while artifact-preserving reads create them without changing source database files.

flowchart LR
A[Deferred migration records] --> B[Config read]
B --> C{Artifact-preserving read?}
C -->|No| D[Read existing SQLite]
C -->|Yes| E[Create private snapshot]
D --> F[Check staging timestamp]
E --> F
F --> G[Test result]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -10. Total -10 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 28 38 -10
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 28 38 -10

Review metrics

Metric Value Why it matters
Focused test cost 17/17 passed; 86.05 s local wall, 33.95 s CI wall The PR reports the measured file cost and attributes its existing expense to real SQLite worker startup.

Technical review

Best possible solution:

Keep the timestamp assertion as the config suite’s allocation signal, alongside its existing real SQLite, migration-freshness, and source-artifact checks.

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

No deterministic, high-confidence reproduction was established in this read-only review. Current main retains the watcher, and the PR reports failures on an unchanged baseline plus a macOS dropped-event probe.

Is this the best way to solve the issue?

Yes. A directory timestamp retains evidence of transient child creation after cleanup, while the test keeps its worker-call, migration-freshness, and source-byte checks.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This repairs intermittent test reliability without changing user-visible behavior or production code.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.

Label justifications:

  • P3: This repairs intermittent test reliability without changing user-visible behavior or production code.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.

Evidence

What I checked:

  • Introduced test change: The pinned PR diff replaces the watcher and polling wait with a timestamp set before both read modes, then checks for no allocation during ordinary reads and an allocation during artifact-preserving reads. (src/config/io.load-async.test.ts:129, 089a9d409fea)
  • Current main still has the watcher: The live main revision retains fs.watch in the two allocation cases, so their central flaky assertion is not yet repaired on main. (src/config/io.load-async.test.ts:134, 1dbbf6ce6380)
  • Snapshot allocation boundary: SQLite snapshot staging creates a child directory under the staging root; that directory operation is what the new timestamp assertion observes. (src/infra/sqlite-snapshot-staging.ts:273, 089a9d409fea)
  • Isolated test cache: The test setup assigns an isolated cache home, limiting unrelated activity in the staging root observed by this test. (test/test-env.ts:286, 089a9d409fea)
  • Related work is distinct: The related Gateway responsiveness PR is merged. Its change to this test file adds a policy-read case elsewhere and leaves the filesystem watcher in place. (src/config/io.load-async.test.ts:171, 1dbbf6ce6380)
  • Exact-head validation: The PR body reports baseline failures, 23 passing local file runs after the change, and 17 passing tests in the focused file. The cited CI run completed successfully on the exact PR head. (089a9d409fea)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Galin Iliev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 54db167 into main Sep 26, 2026
192 of 194 checks passed
@steipete
steipete deleted the codex/config-snapshot-allocation-proof branch September 26, 2026 10:09
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant