Repository navigation
fix(plugins): avoid blocking discovery on lazy state snapshots - #176291
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
@clawsweeper re-review Please review current head |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR makes asynchronous plugin discovery await lazy snapshot preparation instead of blocking the event loop. Example: Doctor lint runs a selected report that first needs bundled-plugin discovery policy.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored PR open: it addresses a blocking lazy-snapshot read still present on main, and no concrete introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherDoctor and asynchronous config loading prepare plugin metadata through bundled discovery, which reads machine-owned policy from a retained private shared-state snapshot. flowchart TD
A[Doctor or config loading] --> B[Async plugin discovery]
B --> C[Shared-state snapshot owner]
C --> D[Existing snapshot worker]
D --> E[Private database bytes]
E --> F[Prepared discovery policy]
Technical reviewBest possible solution: Use the existing snapshot owner's asynchronous preparation while retaining synchronous consumers, shared identity, admission checks, and cleanup. Do we have a high-confidence way to reproduce the issue? Source traces asynchronous discovery through the synchronous accessor into the lazy snapshot owner's blocking wait loop; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch is a focused repair using existing preparation and lifetime owners, with no competing snapshot path or unnecessary production machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ee6b1db4ebcf. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +24, Tests +65. Total +89 across 4 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 18, 2026, 1:18 PM ET / 17:18 UTC. |
…law#176291) * fix(plugins): avoid blocking discovery on lazy state snapshots * test(plugins): preserve async snapshot rejection contract * fix(plugins): satisfy snapshot lint contracts
What Problem This Solves
Fixes event-loop stalls when asynchronous plugin discovery first accesses a lazy shared-state snapshot during Doctor inspection.
User Impact
Discovery allows other event-loop work to progress while the existing snapshot worker prepares private database bytes. This change does not establish lower total Doctor runtime or remove the separate writable snapshot acquisition.
Why This Change Was Made
The async preparation path called the synchronous snapshot accessor, whose lazy materialization services the worker through a blocking wait loop. The state-read owner now exposes an async accessor that awaits the same preparation, retains its lifetime, rechecks admission and cancellation, and returns the same snapshot identity. Discovery preserves typed admission failures from rejected preparation promises.
Production changes add 24 net lines for the async lifetime boundary and shared error translation; synchronous consumers keep their existing path. No schema, configuration, runtime-version, or source-database mutation changes.
Follow-up: writable Doctor inspection still reacquires live database bytes. Removing its repeated full-file comparison requires a retained private database-and-WAL fork with independent writable lifetime and active-WAL isolation proof.
Evidence
git diff --checkand pinnedoxfmtformatting: passed.1641d7c4599715f8badfc5aae1072ffed89a3cdb: runtime test lanes, production/test types, lint, guards, PostgreSQL conformance and the aggregate gate passed. The packaged build job was skipped; no separate packaged build is claimed.