GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(server): route projection reads through the reader connection by juliusmarminge · Pull Request #23867 · pingdotgg/t3code Conversation
Member
ProblemPure projection reads use the writer connection, so MCP thread listing can fail while another connection holds a SQLite write transaction. On current main, holding ChangeRoute the five projection reads through the existing Scope and approvalFixes #23687 Triaged bug via the automated issue flow: #23687. Verification
Evidence: sanitized runtime transcript. Real dev server used an isolated, seeded 55.6 MB database; the browser paired and loaded successfully. The same MCP request was made while an external write transaction remained open until the response:
Server-only change; the capture matrix is empty. No rendering or client-contract changes require screenshots or recordings. The reporter's 25.5 GB macOS workload was not replicated; the connection-routing and lock-contention defect was reproduced on Linux with the real server. Models: GPT-6.1-Sol and Claude Opus 5.5, through Codex and Claude harnesses in T3 Code.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsRed test for #23687: getThreadRecords, getShellSnapshot, getThreadShell, getRecoveryThreadIds and getSettlementCandidates acquire the writer. Co-Authored-By: Claude Opus 5.5 <[email protected]> getThreadRecords, getShellSnapshot, getThreadShell, getRecoveryThreadIds and getSettlementCandidates are pure reads but acquired the writer, so they queued behind any open BEGIN IMMEDIATE. Wrap each in NodeSqliteClient.readOnly; inside an open write transaction they still use the writer. Fixes #23687. Implementation taken from #23689. Co-Authored-By: Victor I <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
| Check name | Status | Explanation |
|---|---|---|
| Title check | The title "fix(server): route projection reads through the reader connection" matches the main change. The raw summary shows five projection-store read methods now use NodeSqliteClient.readOnly, which… | |
| Description check | The description follows the template and covers the problem, change, scope and approval, and verification. The Problem section explains that pure projection reads use the writer connection, which make… | |
| Linked Issues check | Issue #23687 asks that five pure ProjectionStore reads use the reader connection instead of the writer. The diff at head (versus merge base 2c8bdf6) applies NodeSqliteClient.readOnly to all five: g… |
|
| Out of Scope Changes check | The whole-PR changes touch apps/server/src/orchestration-v2/ProjectionStore.ts and its test file, ProjectionStore.test.ts. The ProjectionStore.ts diff adds one import of NodeSqliteClient and wraps onl… |
Explanation
The title "fix(server): route projection reads through the reader connection" matches the main change. The raw summary shows five projection-store read methods now use NodeSqliteClient.readOnly, which is the reader connection. The title is a conventional commit with a clear scope and a specific action. It does not cover the multi-query snapshot handling or the write-transaction exception, and that detail is not required.
Explanation
The description follows the template and covers the problem, change, scope and approval, and verification. The Problem section explains that pure projection reads use the writer connection, which makes MCP thread listing fail under write contention, and it gives reproduction data. The Change section names the five reads, the NodeSqliteClient.readOnly helper, and the snapshot and writer-transaction exceptions. Scope links issue #23687 and the reused prepared work in #23689. Verification gives the failing and passing regression results, the scoped test command with its counts, lint and typecheck results, and before and after runtime evidence. It also states that the 25.5 GB macOS workload was not replicated and that no screenshots are needed. The Scope section does not explicitly state maintainer approval of the direction, and the template asks for that when it is a bug fix linked to an automated triage flow. This gap is minor, so the check passes.
Explanation
Issue #23687 asks that five pure ProjectionStore reads use the reader connection instead of the writer. The diff at head (versus merge base 2c8bdf6) applies NodeSqliteClient.readOnly to all five: getRecoveryThreadIds (startup recovery query), getThreadRecords (readCanonicalProjection inside sql.withTransaction, used by MCP readThread), getSettlementCandidates (auto-settlement sweep), getShellSnapshot (thread list), and getThreadShell (single shell row). The helper is defined in packages/shared/src/nodeSqliteClient.ts and is unchanged by this PR. Its documented behavior matches the issue: reads run on the reader worker, and reads inside an open write transaction keep the writer. Each read keeps its existing transaction and error mapping. The issue's requirement that writer-bound reads remain on the writer is preserved by readOnly's design. The regression test file ProjectionStore.test.ts is changed at head, but its diff could not be read in this review. The PR description reports five regression cases that failed on main and pass with the fix. The code change alone establishes the routing requirement. Runtime evidence in the PR description is author-reported and was not independently verified here.
Explanation
The whole-PR changes touch apps/server/src/orchestration-v2/ProjectionStore.ts and its test file, ProjectionStore.test.ts. The ProjectionStore.ts diff adds one import of NodeSqliteClient and wraps only the five named reads with NodeSqliteClient.readOnly. The surrounding error mapping and decoding remain unchanged. No unrelated read, write, or schema logic changed in the inspected diff. The test file change is supporting verification for the same five reads, per the raw summary. Its diff could not be read, so its exact contents are not verified here, but it is not a demonstrated unrelated change.
Comment @coderabbitai help to get the list of available commands.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for taking this up, and for crediting me — glad it landed somewhere useful. Two things from my side, both optional. 1. A companion test that isn't in this PR. The five cases here assert that the read runs on the reader connection. The case that actually matters in production is one step stronger: the read has to finish while a writer is holding the write lock. That is one file and one commit, and it passes on your head unchanged:
The writer holds its transaction open for the whole read, so the overlap is guaranteed by construction rather than by timing. With the lock held, the read completes on the reader in ~13 ms and the same read on the writer cannot acquire a connection at all: 2. A typecheck trap, in case you port anything else of mine. My version of the routing test needed twelve typecheck fixes, and the reason they went unnoticed locally is worth passing on: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Note 🤖 Claude Opus 5.5 responding on behalf of Theo Closing: this is covered by #23902, which landed. Reopen if a needed part is still missing. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[Bug]: the other ProjectionStore reads take the write lock instead of the reader connection
There was an error while loading. Please reload this page.