GeezerVison is showing github.com — fix(server): run windowed snapshots on the SQLite reader by ScottN-PV · Pull Request #21869 · pingdotgg/t3code
Conversation
ScottN-PV
commented
Oct 19, 2026
•
edited by juliusmarminge
Loading
Uh oh!
There was an error while loading. Please reload this page.
Problem
Opening a thread reads its bounded snapshot inside a writer transaction, so a long snapshot blocks thread creation, message dispatch, and other database writes. A file-backed WAL reproduction fails on main when another connection holds the writer.
Change
Route the entire bounded snapshot transaction through the existing SQLite reader helper. Anchor lookup, fork-parent projections, and snapshot sequence stay in one consistent transaction. Preserve the contributor’s implementation and regression test from this PR; the updated branch also includes current main.
Scope and approval
Fixes #21840
GitCafe: https://git.cafe/pingdotgg/t3code/issues/21840
Triaged bug via the automated issue flow. Accepted bug. Scope is bounded snapshot reader routing; query indexing and other projection reads are separate work.
Verification
- Red at 9f597f2058:
windowed snapshots return committed data while the writer is held fails with “snapshot must return while another connection holds the writer”; the cause is SQLite writer lock contention.
- Green at 247703a96b: server
vp test run src/orchestration-v2/ProjectionStore.test.ts src/orchestration-v2/ThreadSearch.test.ts passes 37 tests; shared vp test run src/nodeSqliteClient.test.ts passes 16 tests.
- Both focused commands rerun after merging the contributor commit and main at b16843cb8d: 53 tests pass. Its tree equals the green-tested tree.
- Scoped format, lint, and server typecheck pass. Two independent reviewers report no findings.
- Before/after runtime transcript: isolated Linux dev server, real browser, same seeded stopped threads; authenticated bounded snapshot returns HTTP 200 on both revisions. The snapshot transaction changes from
writer on main to reader with the fix.
Runtime excerpt (both enclosing bounded requests succeeded):
before 8d3b061121: sql.transaction db.connection=writer durationMs=13.297433 exit=Success
after b16843cb8d: sql.transaction db.connection=reader durationMs=32.628450 exit=Success
This server-only change has an empty visual fixture matrix. No render paths or wire contracts changed. The reporter’s 10 GB cold-cache latency was not reproduced; no latency improvement is claimed.
Model: GPT-6.1-Sol and Claude Opus 5.5. Harness: Codex and Claude Code.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Approved at b0493ba
Macroscope's review found this PR approvable — This is a small, self-contained SQLite concurrency bug fix that reuses the existing reader transaction mechanism and adds a regression test for writer contention. Its runtime impact is limited to routing existing windowed snapshots to the reader when available, with the established writer fallback preserved.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Oct 19, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
abc3c733-8f87-4463-96be-d5734ccd51bf
📥 Commits
-
Reviewing files that changed from the base of the PR and between b0493ba0411c0f8600be4dbb352dab49b639d812 and 135b85c.
📒 Files selected for processing: 2
-
apps/server/src/orchestration-v2/ProjectionStore.test.ts
apps/server/src/orchestration-v2/ProjectionStore.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
-
getThreadSnapshotWindow now uses Node SQLite’s read-only operator. A live SQLite test verifies that the snapshot succeeds during a writer transaction and uses the reader connection.
Changes: Snapshot reader connection
| Layer / File(s) |
Summary |
Read snapshots through a reader connection apps/server/src/orchestration-v2/ProjectionStore.ts, apps/server/src/orchestration-v2/ProjectionStore.test.ts |
getThreadSnapshotWindow applies NodeSqliteClient.readOnly. A live test holds a writer lock, reads the 76-row snapshot, checks the thread identity and title, and verifies the "reader" connection trace. |
Priority: ⬆️ High
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: t3dotgg
Merge Risk: ⚪ Minimal · up to 135b8
-
The snapshot change is mergeable after normal checks; no actionable issue remains in the supplied evidence.
Security architecture risk: ⚪ Minimal · up to b0493
-
The change preserves the snapshot transaction and response contract while avoiding writer contention when a reader is available. No introduced security weakness was identified. Slow snapshots can still delay other work sharing the reader.
Retained concerns
No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- inferred — The changed execution path remains within the configured SQLite database and the same thread and fork-parent projection queries. It changes connection selection, not the requested data scope; the comparison shows no added credentials, service access or caller-controlled routing authority.
Resilience and Maintainability Implications
- observed — Transaction acquisition makes permit waiting interruptible and registers release under an uninterruptible cleanup boundary. Existing shared-client tests cover reader failure/restart and interrupted startup recovery; the new projection test itself covers successful reading under writer contention, not those recovery cases.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title follows conventional commit form and names the main change: windowed thread snapshot reads now run on the SQLite reader connection instead of the writer. It matches the raw summary, which sh… |
| Linked Issues check |
 |
Directly linked issue #21840 requires snapshot reads to avoid holding the SQLite writer. The supplied PR evidence states that getThreadSnapshotWindow runs anchor lookup, projection reads, fork-paren… |
| Out of Scope Changes check |
 |
The whole-PR summary identifies one production change in ProjectionStore.ts and one focused regression test in ProjectionStore.test.ts. The production change implements the reader routing for #218… |
| Description check |
 |
The description includes all required sections: Problem, Change, Scope and approval, and Verification. It links the triaged issue and approval, explains the implementation, documents focused test resu… |
Full details: Title check
-
Explanation
The title follows conventional commit form and names the main change: windowed thread snapshot reads now run on the SQLite reader connection instead of the writer. It matches the raw summary, which shows the ProjectionStore.ts read path switched to NodeSqliteClient.readOnly, and the PR objectives, which describe the same change.
Full details: Linked Issues check
-
Explanation
Directly linked issue #21840 requires snapshot reads to avoid holding the SQLite writer. The supplied PR evidence states that getThreadSnapshotWindow runs anchor lookup, projection reads, fork-parent reads, and MAX(sequence) through NodeSqliteClient.readOnly. The reviewed test holds BEGIN IMMEDIATE on another connection and verifies committed snapshot data and db.connection: reader. Calls inside a write transaction and reader fallback remain supported. The separate index-only cold-open suggestion is assigned to #21193 and is not required by #21840 for this PR.
Full details: Out of Scope Changes check
-
Explanation
The whole-PR summary identifies one production change in ProjectionStore.ts and one focused regression test in ProjectionStore.test.ts. The production change implements the reader routing for #21840. The test verifies WAL concurrency and reader selection for that behavior. No unrelated production behavior or unrelated test scope is shown.
Full details: Description check
-
Explanation
The description includes all required sections: Problem, Change, Scope and approval, and Verification. It links the triaged issue and approval, explains the implementation, documents focused test results and limitations, and identifies the models and harness used.
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…t for 3 minutes (pingdotgg#22903)
On desktop, an abandoned browser sign-in blocked every T3 Connect sign-in for 3 minutes. A new attempt now replaces the stale Clerk flow, and a Cancel bar resets the sheet. Takeover of pingdotgg#22708.
Co-authored-by: steve-ai-vibe <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failing regression test for pingdotgg#21840. getThreadSnapshotWindow runs in a
writer transaction, so a held writer makes the snapshot fail with
"database is locked" instead of reading the committed thread.
Test taken unchanged from pingdotgg#21869 by ScottN-PV.
Co-Authored-By: ScottN-PV <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…riter
getThreadSnapshotWindow ran its reads in a writer transaction, so a held
writer made opening a thread fail with "database is locked". Run the
transaction on the reader with NodeSqliteClient.readOnly, as ShellStream
and ThreadSearch already do. The snapshot only reads, and inside an open
write transaction the reads still use the writer.
Fixes pingdotgg#21840. Implementation from pingdotgg#21869 by ScottN-PV.
Co-Authored-By: ScottN-PV <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 22, 2026
|
Closing: current main already covers this as of 6ed47b538c. If you still see it on a build that includes that commit, reply and we'll reopen.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
bugfix
Fix PR opened by an issue lead; enters the PR loop
size:XXL
1,000+ changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|