Repository navigation
Conversation
…tand store and budget for mixed rings M1: running-terminal-close-confirm, plugin-panels, and plugin-language-packs now install the same tracker as useAppStore — one depth counter and capture budget, since a cascade can cross stores and per-store counters would each idle under the threshold. The module header states the scope so an absent breadcrumb stays readable: raw useSyncExternalStore subscriptions and pure React-state rings remain uncovered. M2: the depth-40 margin claim was one-directional — commits reach React's limit no later than writes, so a mixed ring (store write + component-state hop per cycle) threw before write 40 and captured nothing. Threshold is now 25: (1+k)*(T-1) <= 50 tolerates k=1 non-store commit per store write.
…gn capture inside the floor A routine bulk tab close (8-12 tabs, >=2 writes each) crosses the 25-write threshold in one flush; under first-capture-wins its stack occupied the single coalesced ring slot for 10s, so a REAL #185-bound ring seconds later recorded nothing and the crash blamed the bystander bulk close. Inside a capture floor window, a burst now earns a capture only by running strictly deeper than everything already recorded there (its stack is taken live at that crossing), and every captured burst is upgraded at burst end with its final depth - the discriminator between a benign batch (ends near the threshold) and a true ring (runs toward React's limit of 50). Repeating storms still cost one stack per window and one ring slot per 30s; the below-threshold path stays allocation- and Error-free.
|
Closing — largely overtaken. 225 commits behind main, and #16153 (merged) already retired the dead end this instrumentation was built to solve: Independent review also found the instrumentation would not do its job as written: the capture floor is backwards — a #185 ring's write depth is bounded by React's ~50-commit limit while benign bulk writes are unbounded, so routine work suppresses the capture that matters — and it floods at ≥50 writes/flush (60 stack captures/s, ~740 KB/s to main, 2.2 ms/s main CPU) for zero extra evidence, which is exactly the #185 regime. Original work by @brennanb2025; the rebase and the review notes are preserved here if it is revisited. |
Original work by @brennanb2025. All three commits cherry-picked with authorship intact; I added nothing to them.
Description
Orca's #orca-crashes channel has a standing cluster of React #185 ("Maximum update depth exceeded") crashes at
boundary_id=terminal.workbench(×6) andboundary_id=page.activity(×2) in 1.4.184/1.4.185. During this week's triage, two independent investigations failed to reproduce or root-cause either one, and both concluded independently that the cluster cannot be closed by reasoning alone — the missing evidence is which store slice is writing on every commit before the nested-update limit trips. That is exactly whatorigin/react185-driver-instrumentationwas built to capture, and it was never landed.This branch rebases it onto current
main.What is verified
maindespite the source branch being 157 commits behind.store-write-chain-telemetry+ wiring + cross-store wiring + renderer-breadcrumb suites: 38 passed (38).tsc --noEmiton bothconfig/tsconfig.node.jsonandconfig/tsconfig.web.json: exit 0.Why it is a draft: blocking findings
Four adversarial review loops (fresh reviewer each). It did not converge.
1. The capture floor is backwards — it would systematically miss the crash it exists to catch. (blocker)
The "deepest burst wins" rule assumes a #185 ring produces the deepest write chain. It doesn't: a ring's write depth is bounded by React's ~50-commit limit, while benign same-flush bulk writes are unbounded. So a routine bulk operation raises the bar and silently suppresses the capture for the ring that actually crashes.
2. Measured capture/IPC amplification that switches on exactly in the crash regime. (perf, measured)
Steady-state cost is genuinely fine — +2.6 ns/write in a burst, +27.4 ns/write isolated, zero added allocation, no effect on the selector fan-out benchmark. But a storm sweep found a cliff:
At ≥50 writes/flush that is 60 stack captures/s inside the React commit phase (1.1 ms/s), ~740 KB/s structured-cloned renderer→main, and 2.2 ms/s of main-process CPU sanitizing — for zero additional evidence, because 30 s name-coalescing keeps one slot and the newest payload wins. ≥50 writes/flush is the #185 regime. It floods hardest precisely when the app is already dying.
3. In shipped builds the captured stack is largely unreadable. (major)
Vite's default esbuild minify renames function declarations, no
keepNamesor sourcemap is configured, and the crash sanitizer then stripsfile:line:col— so only object-property frames survive. The evidence is weakest in exactly the builds users run.4. A storm can leave the report with zero write-chain evidence. (blocker)
Opting the write-chain crumb into 30 s name-coalescing means that once the owned ring slot is evicted,
resolvePendingCoalescedBreadcrumbdrops the pending payload rather than materializing it, discarding the newest, deepest, stack-bearing capture. The module's soundness contract — "absence of the breadcrumb rules out zustand-write-driven rings" — depends on that not happening, so absence currently cannot be trusted.5. Always-on with no gate or kill switch, and on the web/paired client
crashReports.recordBreadcrumbis() => {}, so that renderer pays the wrapper and every 40-framenew Error().stackcapture and can never emit evidence. (minor)6. The repo's own guard does not cover this.
npm run check:zustand-selector-fanoutbuilds a rawcreateStorefromzustand/vanillaand never importsinstallSharedStoreWriteChainTelemetry, so it passing is not evidence the always-onsetStatewrapper is safe. (minor)What I deliberately did not do
Review loops 2–4 produced eight remediation commits attempting to fix the above. I discarded them: they introduced a regression against
origin/mainaffecting every coalesced breadcrumb (orphan views stealing snapshot budget thatisCoalescedCrumbStillInEvidencestill assumed was available), and crept intocrash-breadcrumb-store.ts, creating both a textual conflict and a semantic incompatibility with #15709 — the synthesized orphan view carried noorigin, reintroducing the cross-renderer attribution bug that PR exists to fix.This branch is therefore Brennan's original three commits, unmodified, rebased and verified. The remediation attempts are recoverable from the workflow transcript if wanted, but they made it worse.
Suggested path
Findings 1 and 4 are policy bugs, not plumbing bugs — the capture criterion is wrong, independent of how it is wired. Worth deciding the criterion first (bound-aware rather than depth-ranked, and don't coalesce the payload that carries the stack), then rewiring. Finding 3 is cheap and independent:
keepNamesfor the renderer build would make every future captured stack readable regardless of what else changes.Related: #15709 (crash breadcrumb attribution), which is a prerequisite for trusting any breadcrumb-based evidence, including this one.