Repository navigation
fix(workspace): release completed mutation captures - #185354
Conversation
Clear finished admission observers and ended workspace payloads while preserving committed facts for lost-reply recovery. Cover retained-handle GC and failure-path port lifetimes.
|
🦞👀 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 changesThis PR releases completed workspace mutation captures and admission callbacks while preserving committed facts for recovery. Example: Retain finished admission handles after 1,000 stale-revision workspace writes with 1,000-path checkpoints.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR fixes a concrete retention path still present on current main; no actionable correctness or security findings were identified. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway workspace store submits mutations through lease-bound SQLite worker admissions; native commit receipts support publication and lost-reply recovery before completed operations release their captures. flowchart LR
A[Workspace caller] --> B[Local workspace store]
B --> C[Lease-bound admission]
C --> D[SQLite worker]
D --> E[Commit receipts]
E --> B
B --> F[Recovery and acknowledgement]
F --> G[Release completed captures]
Technical reviewBest possible solution: Release payload and callback references at the existing completion boundaries while retaining committed evidence until recovery consumers finish. Do we have a high-confidence way to reproduce the issue? The base source retains publication callbacks and their workspace captures through finished admission handles, and the PR reports a matching red-on-base real-worker reproduction; this read-only review executed no target code. Is this the best way to solve the issue? The patch repairs the existing lifecycle owners directly, preserves recovery evidence and failed-lease cleanup, and adds no competing storage or execution path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b3fa02e99b72. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +23, Tests +45, Docs +6, Other +319. Total +393 across 5 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 26, 2026, 11:04 PM ET / October 27, 2026, 03:04 UTC. |
Clear finished admission observers and ended workspace payloads while preserving committed facts for lost-reply recovery. Cover retained-handle GC and failure-path port lifetimes.
Related: #185256
What Problem This Solves
Completed workspace writes can keep large mutation payloads and prior rows reachable when a caller retains their finished admission handle, including after failed writes.
User Impact
Releases completed workspace payloads and publication callbacks while preserving native write settlement, authority checks, and recovery when a committed write loses its reply. This is bounded retention cleanup; it does not establish the root of a production memory-growth incident.
Why This Change Was Made
Finished admissions retained their commit observers, request observer, and database authority. Workspace observer and execution closures shared captured mutation inputs; ended store custody also left its current row reachable. Clear those references at their existing lifecycle boundaries and keep only the native receipt sequence needed for duplicate detection.
Committed/settlement facts deliberately remain available: the broker finishes admission before resolving or rejecting its caller, and production recovery consumers read those facts afterward. Removing them here would lose known committed outcomes. Workspace receipts contain only an ID/revision (or deletion result), not the large workspace payload. A broader receipt-consumer migration is outside this bounded cleanup.
Runtime source grows by 23 lines to end payload/callback lifetimes explicitly while retaining receipt recovery and failed-lease cleanup. The existing harness grows by 319 lines for fault injection and retention/port measurements; no production test seam, dependency, config option, schema change, or shared perf README change is introduced.
Evidence
Baseline owner sources are pinned to
ce503a58dad3b06cfba1cc357bab3e5a0435f024; candidate source hashes match the pushed head after rebase. Both use the same real-worker harness and synthetic fixtures.Acceptance: after each settled failure batch, live admission ports return to their warmed baseline; released scopes retain no mutation payloads or prior rows. Even deliberately retained finished admissions must release those captures. Accepted writes interrupted by cancellation, reply loss, or caller abandonment must remain recoverable without replay.
e603fabce6db7c5728fb5399c0af9e4fe03e2f79, including the required CI gate. Changed-file formatting and lint passed.The existing standalone harness now exercises failures through the real store/worker boundary, tracks close events for unreferenced ports, and uses forced GC/WeakRefs plus a MessagePort heap census. No production load or state mutation is used. Whole-Gateway stress is omitted under the authorized fast-path policy.