Repository navigation
fix(contextmd): keep serving reads off the writer connection - #340
Conversation
|
What: Independent Sol review found no blocking findings on Verdict and identityNO BLOCKING FINDINGS. No supported actionable defect or required source correction in the inspected scope. Reviewed independently by codex / gpt-6.1-sol, high reasoning effort; I did not author this PR. This is a code review, not a repeated design panel or merge authorization.
Inspected scope and cleared concerns
Regression oracle and inspected proofThe new three cases use a real disk/WAL persistence layer, a cold reader, the real serving method and real auth-session repository. The writer latch is signalled only inside Read the raw red and green logs: all three baseline cases fail expected 200 / actual 204, while all three fixed cases pass. Their SHA-256 values match dispatch exactly:
Inspected and hash-verified the final focused log: 142 passed, no failures/skips, covering Evidence identity clarification, cleared: the dispatch manifest digest Proof limitsThe archived sanitized live rows are consistent with deadline cuts before completed selection and a later successful pointer. They do not identify the historic 23:44 queue stage or lock holder. Current load is not retroactive timing proof. The independent Zen/Go provider cause remains outside this patch. No deployed repair, fresh native consumption, natural compaction, twelve-cell fleet acceptance, or resolution of chromeria#239 is claimed. At the last forge inspection, CI still had Test/Test Server 6 running; the parent owns fresh final admission. Requirements and who asked: User and contextmd#34 dispatcher require an independent exact-head Sol review of the existing first-input repair, with auth/scope/cold-reader/test-oracle scrutiny and an ordered findings comment then review status; reliable knowledge discovery supports Promachos. |
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. |
|
What: Independent Grok review of VerdictNo blocking findings. Context Inspected scope
Cleared
Proof limits
Elon record
|
What: ContextMD serving reads use the existing WAL reader so a writer transaction cannot consume the first-input pointer's deadline.
Why: Authentication and projection reads inherited the main writer connection even though this work only reads the main database.
So what: Obtain independent Sol/Grok reviews and green checks, then the dispatcher may merge; the planner's next build must be retested on rocky before claiming live acceptance.
This repairs the existing serving owner for toolboxmd/contextmd#34 and relates to #239. A deterministic isolated reproduction holds the writer transaction with
Deferredlatches, without sleeps, polling, or live load. Claude, Codex, and OpenCode each return 204 after the 950 ms work allowance on the baseline; the same first-input requests return 200 using the already configured reader. Both the 1,200 ms moment deadline and the 8,000-byte run budget are preserved.The change marks only
ContextmdServing.momentwith the existingNodeSqliteClient.readOnly. Its supplied authorization effect and all projection queries use the reader; the separate synchronouscontextmd.sqliteconnection still owns claims, accounting, settlement, and logs. No encompassing SQL transaction or snapshot is added. Other service methods keep their existing connection and scope. The new tests start a cold reader, use the real auth-session repository lookup, verify exact pointer charges and same-epoch nonrepeat while the writer remains held, then commit a revocation and verify the next request returns 401.Verified live facts from build
9f46c833b1: rocky m28142/43, m28145/46, m28152 and m28153 are deadline cuts with no candidates or pointer charges; m28155 succeeds at 791 ms with a 236-byte pointer. Cavallo m585/588/593 completes in 9/8/57 ms. Both hosts have identical tiny registered stores and no session-start files. The queueing mechanism is reproduced, and current source/load supports it, but the exact 23:44 queue stage is unknown because the relevant traces rotated away. This PR does not claim those historical stages were directly timed or the live cells repaired. OpenCode's Zen versus Go selection is a separate diagnosed cause and has no source/config change here.Validation on
f6a8872d1bd13c1caaf169fb6c23c92602fdfaa1:vp test run apps/server/src/contextmd/ContextmdServing.test.ts -t 'serves the first'fails all three cases with expected 200 / actual 204 when the routing marker is absent.vp test run apps/server/src/contextmd/ContextmdServing.test.ts apps/server/src/contextmd/ContextmdRoute.test.ts apps/server/src/contextmd/GreatLibrary.test.ts packages/shared/src/nodeSqliteClient.test.ts: 142 pass, 0 fail, 0 skip.tsc-rs --noEmit -p apps/server/tsconfig.json: exit 0.vp lint, formatting check, andscripts/fork-check.sh --base 8d11fe1261f0dfd74f58a1b1ae8ad7e400905fcb: exit 0.Source/test logs remain outside the repository. No live database writes, credentials, browser use, installation, service restart, or deployment. No package version change applies to this fork. Website impact: none, because this is an existing backend serving repair. Ships contextmd#34; no Chromeria map part exists for this serving owner.
Upstream first: inspected
pingdotgg/t3codemain742c229957b69a0cc5a1379dff6c66b595854057, which has noapps/server/src/contextmdowner, and searched its Issues and PRs for ContextMD and serving timeout fixes. No matching owner/fix to port; broad timeout matches concern other services. #239 has no assignee or open matching PR, with its last prior update on 2026-10-13. No competing writer was found.Requirements and who asked: The user and #34 dispatcher require causal diagnosis, a failing-first existing-owner fix, unchanged serving/byte limits, and a frozen PR for independent exact-head Sol/Grok review. This restores stored-knowledge discovery supporting Promachos.
Deleted: Limit enlargement, new connections/services/timers, provider edits, Library/persona/preferences edits, live load, installation, and deployment.
Bottleneck: Read-only work waits for the shared writer lock; the existing WAL reader already provides isolation from that lock.
Checked myself: Exact running artifact digests and read-only serving rows on both hosts; identical store sizes and session-start configuration; current serving/auth/SQL routing and all production composition paths; cold-reader red/green tests, revocation/claim/accounting assertions, 142 focused tests, server typecheck, targeted lint/format, and the fork gate.
Detailed serving diagnosis, production composition audit, raw-log identities and exact handoff: toolboxmd/contextmd#34 (comment)
Implemented with gpt-6.1-sol in the Codex harness.