Repository navigation
perf(sqlite): stop reserializing shared admission maps - #172886
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesThis PR sends SQLite admission deltas through worker replies and retained carriers while avoiding repeated transfers of unchanged shared buffers. Example: A Gateway retains 5,000 admission records while creating additional workers.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness⛔ Needs changes before merge - 1 item remains This PR addresses useful SQLite serialization overhead, but an undefined slot reference breaks admitted worker dispatch and must be repaired before merge. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe SQLite broker transfers database validation facts between the Gateway, direct workers, and retained native-worker carriers; workers consume those facts while existing owners separately authorize database operations. flowchart TD
Gateway --> Broker
Broker --> Registry
Registry --> DirectWorker
Registry --> Carrier
Carrier --> ChildWorker
DirectWorker --> SQLite
ChildWorker --> SQLite
Technical reviewBest possible solution: Keep the delta optimization and pass the actual dispatch slot into the admission helper so its cursor binding and reset callback use the correct owner. Do we have a high-confidence way to reproduce the issue? Source confirms the repeated full-map transport paths, while the reported native crash remains unproven; exact-head CI independently demonstrates the introduced undefined-slot failure. Is this the best way to solve the issue? Extending the existing per-receiver cursor and merging deltas in retained carriers is a coherent performance repair, but the admission helper must receive its slot before this implementation can work. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8e9038d23129. Provenance checked
TestingProof path: none. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +139. Total +139 across 12 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 15, 2026, 3:36 AM ET / 07:36 UTC. |
|
CI is red only in |
* perf(sqlite): stop reserializing shared admission maps * fix(sqlite): bind admission cursor to dispatch slot
What Problem This Solves
SQLite admission exchange still serialized Maps holding SharedArrayBuffers on every worker operation in the host reply, and retained native-worker carriers resent their complete admission environment on every child creation. This keeps V8's shared-buffer serializer under sustained pressure during worker churn; it matches the shape of a production SIGSEGV.
Change
The 12-file production change is +185/-46 lines. The state is required by the retained-carrier contract: a carrier may start descendants after its own Worker inherited the environment, so it needs an ordered cursor and local projection to pass current admission facts once at each child start.
Evidence and measurement
An isolated Node 26.10.0 synthetic stress harness used 5,000 admission records, 16 rotating workers, and a target rate of 200 messages/s while SharedArrayBuffers were created, replaced, retired, and workers exited:
The native SIGSEGV did not reproduce in these bounded runs. The pre-change throughput collapse does reproduce the dangerous serializer pressure. The change is 2.72x faster than the current-main message shape and sustains the requested 200 messages/s rate.
Proof
oxfmt --threads=1: passed.oxlint: passed.git diff --check: passed.readFilewithSymbol(Symbol.dispose) is not a function; PR CI provides the full gates.