Repository navigation
fix(sqlite): release caller memory after worker opening - #173643
Conversation
The retained client dispatch added by 0d73885 read cleanupAccess through the complete opening options, keeping completed caller authority callbacks and their async context alive for the client lifetime. Capture the cleanup capability alongside maintenanceScope so the client keeps its live cleanup authority without retaining the opening request. All existing admission, maintenance, lease cleanup and database behavior is preserved; schemas, update/Doctor behavior and stored bytes are unchanged. The unchanged real-owner retention regression passes 4/4 on the culprit's parent and fails both opening cases on the culprit and current main. With this fix it passes 4/4; maintenance and native cleanup siblings pass 3/3. Core types, scoped lint/boundary lint, formatting and P2 review pass.
|
🦞👀 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 maintainer review before merge. What this changesThe SQLite worker client captures its cleanup capability directly so it can release the completed opening caller. Example: A request carrying a 1 MiB prompt opens a reusable SQLite worker.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a concrete caller-retention regression still present on current main, and no introduced correctness defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe SQLite broker turns opening requests into reusable worker clients, dispatches database operations, and coordinates admission and native cleanup. flowchart LR
A[Opening request] --> B[SQLite broker]
B --> C[Reusable client]
C --> D[Operation admission]
D --> E[SQLite worker]
F[Cleanup capability] --> D
Technical reviewBest possible solution: Use the direct cleanup-capability capture to release completed opening callers while preserving worker reuse and live cleanup checks. Do we have a high-confidence way to reproduce the issue? Source inspection establishes the retained dispatch-to-options-to-caller path on fetched main, and the PR reports an unchanged forced-GC regression failing before and passing after the fix; no code was executed during this review. Is this the best way to solve the issue? The patch repairs the producer's capture directly, follows the existing retention design, and preserves the same cleanup object, admission checks, maintenance selection, and cleanup lifecycle. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8ab860a75c9e. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0. Total 0 across 1 file. Added test files: 0. View PR surface stats
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, 10:13 PM ET / October 16, 2026, 02:13 UTC. |
|
Merged via squash auto-merge.
|
) The retained client dispatch added by bbd1a30 read cleanupAccess through the complete opening options, keeping completed caller authority callbacks and their async context alive for the client lifetime. Capture the cleanup capability alongside maintenanceScope so the client keeps its live cleanup authority without retaining the opening request. All existing admission, maintenance, lease cleanup and database behavior is preserved; schemas, update/Doctor behavior and stored bytes are unchanged. The unchanged real-owner retention regression passes 4/4 on the culprit's parent and fails both opening cases on the culprit and current main. With this fix it passes 4/4; maintenance and native cleanup siblings pass 3/3. Core types, scoped lint/boundary lint, formatting and P2 review pass.
What Problem This Solves
A retained SQLite worker client keeps its completed opening caller and authority snapshot alive for the client's lifetime. This repairs the two opening-retention failures on main.
User Impact
Completed request memory can be collected while the same SQLite worker remains reusable. There are no schema, stored-data, permission, configuration or update/Doctor behavior changes; the cleanup authority introduced by
0d73885432fbremains active.Why This Change Was Made
The retained dispatch callback accessed
options.cleanupAccess, capturing the entire opening-options object and its caller callbacks. Capture only the cleanup capability beside the existing maintenance scope. The existing native-owner retention test is the regression; its assertions and GC probe are unchanged.Evidence
0d73885432fb^: the retention file passes 4/4. Current main fails both opening cases alone. An ordered replay of the introducing revision reports the same two failures, with 778 files passing and eight existing skipped files.pnpm test ... --maxWorkers=1completes all three owning configurations successfully.Release-note context: fix completed caller memory remaining retained after SQLite worker opening. This is bounded first-opener retention, not a claim about sustained Gateway heap growth.