Skip to content

fix(tests): restore session race coverage on Node 26 - #148182

Merged
steipete merged 1 commit into
mainfrom
codex/sqlite-race-fixtures-0914
Sep 14, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/sqlite-race-fixtures-0914

Conversation

@steipete

@steipete steipete commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Session SQLite race fixtures miss concurrent writes when the reader uses native all(), leaving existing assertions failing on Node 26.

User Impact

No user-visible change. This restores archive, cold-read, and transcript fallback coverage without changing production code or assertions.

Why This Change Was Made

The existing fixture hooks now invoke their peer-write callback after a successful native all() read, preserving native results, exceptions, snapshot lifetime, and callback ordering.

Evidence

  • Both complete files pass without an overlay on main 37f2b34992ff plus this exact patch: 41/41 on Node 24.19.0 and 41/41 on Node 26.8.2, with no filtering. The shared counter from merged improve(gateway): reduce publication receipt fetches #148144 is committed in that base. This satisfies the requested integration proof.
  • The original code reproduces the missed races. Earlier failed runs and temporary-counter proof remain preserved; the new runs resolve the dependency gap.
  • All 20 original selected checks passed. Their evidence and the clean independent source review are reused for the unchanged patch after source assessment of current context; the new 20-command plan was inspected, not rerun. A prior log-enrichment encoding error excluded runtime logs from the review packet; those receipts were inspected separately.

Exact published-head CI passed. These hosted results and the current-main integration runs are separate evidence; native maintainer validation and landing gates still apply.

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check could not safely complete for this revision.

ClawSweeper will not retry this unchanged revision.

Next step: No contributor action is requested. Maintainers should inspect the linked workflow run.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 14, 2026 10:36
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 14, 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 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 14, 2026, 6:55 AM ET / 10:55 UTC.

ClawSweeper review

What this changes

Updates two SQLite test fixtures to inject concurrent writes after native all() reads, restoring session race coverage on newer Node versions without changing production behavior or assertions.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: this is a focused, still-needed repair to existing race coverage, with no introduced correctness findings. Current main lacks the hooks, and the protected maintainer context rules out automatic closure.

Priority: P2
Reviewed head: d1edfdb15a9b8de422f91219435ffee609c6c450

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused fixture repair with preserved assertions and no concrete defects; validation depends on the disclosed companion change.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a maintainer-authored, test-only repair, so external-contributor runtime proof is not required. Reported Node 24/26 fixture passes exercise the relevant SQLite boundaries but include the explicitly disclosed counter overlay.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a maintainer-authored, test-only repair, so external-contributor runtime proof is not required. Reported Node 24/26 fixture passes exercise the relevant SQLite boundaries but include the explicitly disclosed counter overlay.
Evidence reviewed 8 items Introduced scope and current-main necessity: The pinned introduction contains only the two fixture changes. Comparing fetched main with the head shows the same missing all() hooks; this is not an attribution of unrelated base drift.
Production execution path: The adapter selects native all() on Node 26.6+ and retains iterate() on older supported runtimes. The fixtures previously omitted the native all() interception.
Race invariants remain enforced: The complete cold-read fixture uses a real second SQLite connection, commits once, verifies that the concurrent write occurred, and checks snapshot results and subsequent archive visibility. The new wrapper invokes the existing callback only after a successful native read.
Findings None None.
Security None None.

How this fits together

Session readers retrieve identities and transcripts from SQLite while other connections can update or archive them. These fixtures inject concurrent writes at the read boundary to verify snapshot consistency and fallback validation.

flowchart TD
  A[Session read request] --> B[SQLite query adapter]
  B --> C[Native all or iterate read]
  C --> D[Test fixture callback]
  D --> E[Concurrent connection commits]
  E --> F[Snapshot and fallback assertions]
Loading

Before merge

  • Resolve merge risk (P1) - The reported complete-file passes used an unmerged shared-counter overlay, so they do not establish that the standalone pinned head passes those files on Node 26.
  • Complete next step (P2) - Land the shared-counter correction from improve(gateway): reduce publication receipt fetches #148144, then validate both fixture files on Node 24 and Node 26 without the overlay before merging.
Agent review details

Security

None.

PR surface

Tests +21. Total +21 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 42 21 +21
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 42 21 +21

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep concurrent-write injection at the native statement boundary for both read paths while preserving the existing snapshot, fallback-validation, and event-order assertions.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep concurrent-write injection at the native statement boundary for both read paths while preserving the existing snapshot, fallback-validation, and event-order assertions.

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

Yes, from source: Node 26.6+ selects all(), bypassing the original fixture hooks and their required concurrent commits. No tests were executed during this read-only review.

Is this the best way to solve the issue?

Yes. Extending the existing private hooks preserves real SQLite execution and existing assertions without introducing production seams or duplicating the shared counter's responsibility.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: Restores meaningful session concurrency regression coverage on a supported Node runtime without changing production behavior.
  • 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: The supplied repository state identifies a maintainer-authored, test-only repair, so external-contributor runtime proof is not required. Reported Node 24/26 fixture passes exercise the relevant SQLite boundaries but include the explicitly disclosed counter overlay.

Label justifications:

  • P2: Restores meaningful session concurrency regression coverage on a supported Node runtime without changing production behavior.
  • 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: The supplied repository state identifies a maintainer-authored, test-only repair, so external-contributor runtime proof is not required. Reported Node 24/26 fixture passes exercise the relevant SQLite boundaries but include the explicitly disclosed counter overlay.

Evidence

What I checked:

  • Introduced scope and current-main necessity: The pinned introduction contains only the two fixture changes. Comparing fetched main with the head shows the same missing all() hooks; this is not an attribution of unrelated base drift. (src/config/sessions/session-accessor.readonly.test.ts:772, d1edfdb15a9b)
  • Production execution path: The adapter selects native all() on Node 26.6+ and retains iterate() on older supported runtimes. The fixtures previously omitted the native all() interception. (src/infra/kysely-sync.ts:98, d1edfdb15a9b)
  • Race invariants remain enforced: The complete cold-read fixture uses a real second SQLite connection, commits once, verifies that the concurrent write occurred, and checks snapshot results and subsequent archive visibility. The new wrapper invokes the existing callback only after a successful native read. (src/config/sessions/session-accessor.sqlite-cold-read.test.ts:151, d1edfdb15a9b)
  • Declared dependency remains open: improve(gateway): reduce publication receipt fetches #148144 remains open at 7abc6a640784078ebdb8783f780f1debea3d690e. Its shared-counter change adds all() observation; fetched main still lacks that correction. The supplied PR body explicitly says its 41-test passes on each Node version used this dependency as an overlay. (test/helpers/sqlite-statement-execution-counter.ts:56, 7abc6a640784)
  • Native dependency contract: Both fixtures directly import node:sqlite. Node v26.8.2 documents all() as executing the statement and returning all result rows, supporting placement of the callback after its successful return. (doc/api/sqlite.md:1081)
  • Area history and routing: Current-main history includes repeated session-reader work by Peter Steinberger. GitHub commit metadata identifies steipete as the author of the adapter's all() selection change; this establishes relevant prior work beyond authorship of this PR. (src/infra/kysely-sync.ts:100, a9bc6386225a)

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.

  • After the shared-counter correction lands, validate both complete fixture files on Node 24 and Node 26 without a temporary overlay.

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 44f2919 into main Sep 14, 2026
172 checks passed
@steipete
steipete deleted the codex/sqlite-race-fixtures-0914 branch September 14, 2026 13:59
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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