Skip to content

chore(terminal): retire unsupported React #185 parking hypothesis - #14653

Closed
brennanb2025 wants to merge 6 commits into
mainfrom
brennanb2025/crash-react185-cold-park-storm
Closed

brennanb2025 wants to merge 6 commits into
mainfrom
brennanb2025/crash-react185-cold-park-storm

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Status: close this PR

Final-readiness review disproved the causal path this PR claimed. The branch now has zero net diff against origin/main; commit b69c5656bc removes the speculative implementation, the watcher-state oracle, and its reliability-gate registration. This PR should close rather than merge.

Production causal trace

canWatcherCoverParkedTerminalTab(worktreeId, tab, isPtyEligible) has these real inputs:

  • worktreeId, tab.id, and tab.ptyId.
  • Pane candidates selected from capturedPanesByTabId, or the fallback derived from terminalLayoutsByTabId plus the keys of runtimePaneTitlesByTabId.
  • Candidate count, each candidate PTY identity, leaf UUID validity, and park-restorability under the current SSH and paired-runtime policy.
  • The eligibility function: ordinary parking uses remote/SSH identity plus authoritative provider snapshots; cold activation passes the stricter host-aware snapshot eligibility.
  • settings.terminalSshViewParking, paired-runtime capability state from runtimeStatusByEnvironmentId, and terminal-provider snapshot capability state.

The writers do not form the reported feedback cycle:

  • TerminalPane unmount writes capturedPanesByTabId once from the live PaneManager. Tab/worktree retirement and pruning delete captures. Watcher start and dispose do not write captures.
  • Mounted PaneManager persistence, hydration, split/focus/layout changes, PTY binding, remint, and detach write terminalLayoutsByTabId. A parked watcher can change layout only when a PTY actually exits and a split leaf collapses; ordinary watcher start, title restore, and disposal do not change layout.
  • Pane and watcher title paths write or clear runtimePaneTitlesByTabId. Coverage ignores title values. Title keys can select a reusable paneId, but paneId is not tested by the coverage Boolean.
  • PTY connection, hydration, remint/reconnect, and close paths can write tab PTY identity. Watcher ownership itself does not. Watcher PTY-exit handling is driven by an external process exit, not a start/dispose transition.
  • SSH settings, paired-runtime capabilities, and provider snapshot capabilities are external policy/inventory inputs. Pane mount, pane unmount, watcher start, and watcher dispose do not write them.

Most importantly, the production parent boundary prevents the oracle sequence. Terminal excludes activation-deferred IDs from backgroundMountTabIds; TerminalPaneOverlayLayer applies that mount filter before it checks the parked set. Therefore a false coverage verdict does not reveal or mount the deferred TerminalOverlaySlot, so the pane-mount title writer used by the test cannot run. A real reveal goes through revealActivationDeferredTabs, which adds the tab to the parent mount restriction and removes it from the deferred set in the same one-way transition.

StrictMode may replay watcher setup and cleanup, and title writes may cause renders, but coverage does not read watcher ownership and its truth does not alternate. There is no commit-synchronous path from watcher start/dispose through these inputs back to park/reveal that can reach React error #185.

Why the prior oracle was invalid

The deleted storm test defined coverage as !watcherEntries.has(tab.id). Production has no equivalent read. It also omitted the parent backgroundMountTabIds restriction, so its always-available deferred slot mounted whenever the mocked verdict flipped. Mount/write counters were non-vacuous only because the always-mounted active tab could satisfy them; they did not prove a deferred pane crossed the real reveal owner.

An investigative production-predicate probe kept coverage true across actual watcher registration, runtime-title slot changes, watcher disposal, and unmount capture. It was not retained because it documents the absence of the claimed bug rather than a product regression contract.

Final changes

  • Removed the monotonic deferred-handoff implementation and selector extraction.
  • Removed the unsupported React fix: improve scrollbar and file explorer scroll behavior #185 storm oracle and mocked rejection assertion.
  • Removed the inaccurate reliability registration.
  • Restored every changed production and test file byte-for-byte to origin/main.

No crash fix remains, and this PR does not claim to resolve the field reports. Those reports need a fresh root-cause investigation from their actual breadcrumbs and teardown path.

Verification

All commands ran sequentially, one file at a time, with --config config/vitest.config.ts --no-file-parallelism:

Suite Result
terminal-parked-tab-watchers.test.ts 50/50 during the causal probe
use-parked-terminal-watcher-synchronization.react185.test.tsx 3/3 final state
use-terminal-tab-cold-parking.test.ts 11/11 final state
background-terminal-worktree-mount.test.ts 24/24 final state
check-reliability-gates.test.mjs 24/24 final state

Electron QA was not run, per the final-readiness task. The branch has no net product diff to validate.

Scope and compatibility

Because the branch is restored to origin/main, there is no change to output ownership, data retention, StrictMode behavior, split or legacy layouts, SSH/remote/folder workspaces, platform behavior, performance, wire compatibility, persistence, or mobile.

Author

  • X / Twitter: @BrennanKB5

@coderabbitai

coderabbitai Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Terminal cold parking now uses a shared selector for rendered parked tabs. Watcher synchronization filters deferred tabs that lack coverage and reports failed handoffs. Terminal surfaces forward the failure callback and reveal affected tabs. New React 18.5 regression tests cover deferral, coverage, portals, policy changes, paired-runtime changes, and capability flapping. Reliability-gate configuration registers the tests and their coverage metadata.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description explains why to close the PR, but it omits most required template sections and conflicts with the stated implementation objective. Use the repository template and align the description with the current diff, including ELI5, changes, rationale, issue, visual proof, testing, review, and checklist details.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title refers to the React #185 terminal parking work, but it does not clearly summarize the implementation changes in the provided diff.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/renderer/src/components/terminal-pane/terminal-rendered-park-verdict.ts (1)

1-9: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

The header calls the module pure, but the selector writes to the latch during render.

selectRenderedParkedTerminalTabIds runs inside a useMemo, and latchDeferredParkCoverage inserts into args.deferredParkCoverageLatch. The write is idempotent per material key, so StrictMode double invocation is safe, but the module is not pure. Reword the header to state that the selector owns a documented render-phase memo write into the caller's latch. Accurate wording here prevents a future change from assuming it is safe to call this selector speculatively.

src/renderer/src/components/terminal-pane/terminal-cold-park-reveal-storm.react185.test.tsx (1)

324-331: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Storm statistics print on every run in both harnesses. Each site calls console.info unconditionally before the assertions, so passing runs emit diagnostics into CI output. Attach the statistics to the assertion message, or print them only when an assertion is about to fail.

  • src/renderer/src/components/terminal-pane/terminal-cold-park-reveal-storm.react185.test.tsx#L324-L331: gate the [reveal-storm stats] block on thrown !== null or move the counters into the expect messages.
  • src/renderer/src/components/terminal-pane/terminal-cold-park-reveal-storm.react185.test.tsx#L550-L559: gate the [runtime-flap stats] block the same way.
  • src/renderer/src/components/terminal-pane/terminal-cold-park-reveal-storm.ack-contract.react185.test.tsx#L354-L363: gate the [reveal-storm A/B stats] block the same way.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 607711a7-263d-4519-9ea2-64a5077a1440

📥 Commits

Reviewing files that changed from the base of the PR and between 78d5920 and d0eccc7.

📒 Files selected for processing (6)
  • src/renderer/src/components/terminal-pane/terminal-activation-deferred-park-latch.test.ts
  • src/renderer/src/components/terminal-pane/terminal-activation-deferred-park-latch.ts
  • src/renderer/src/components/terminal-pane/terminal-cold-park-reveal-storm.ack-contract.react185.test.tsx
  • src/renderer/src/components/terminal-pane/terminal-cold-park-reveal-storm.react185.test.tsx
  • src/renderer/src/components/terminal-pane/terminal-rendered-park-verdict.ts
  • src/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.ts

@brennanb2025
brennanb2025 force-pushed the brennanb2025/crash-react185-cold-park-storm branch 2 times, most recently from 9da3236 to b609c76 Compare August 15, 2026 06:11
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Exact-final-head Electron QA @ b609c76af0

Launched this worktree's Orca via REMOTE_DEBUGGING_PORT=9333 node config/scripts/run-electron-vite-dev.mjs (isolated profile) and attached with Playwright CDP (playwright-cli attach --cdp=http://127.0.0.1:9333). Identity: Orca: brennanb2025/crash-react185-cold-park-storm / qa-14653-park-latch.

Scenario: add a two-worktree fixture repo, open Terminal 1–5 on main, type echo QA14653-BEFORE, switch to qa-park-reveal (park), switch back (reveal), type echo QA14653-AFTER, then one more park/reveal cycle.

Observed: terminal workbench stayed mounted (tabs 1–5 + live prompt). Both echo markers painted immediately. No React error boundary, no white teardown, no #185 / max-update-depth in the renderer console.

02-after-park-reveal.png

@brennanb2025 brennanb2025 changed the title fix(terminal): latch the activation-deferred park verdict per material identity fix(terminal): make deferred watcher handoff monotonic Aug 15, 2026
… reveal storm

Crash cluster 05ed75b1/996b4cc2/fe2b1a30 (1.4.180/1.4.182). The
activation-deferred park clause re-asks canWatcherCoverParkedTerminalTab at
render time, and the flip-burst pin only subtracts from the cold-park
candidate set, so coverage feedback through watcher-mutated state loops
park -> title write -> unpark -> title write until React throws #185.

Two files, currently FAILING by design (the fix is not written yet):
- reveal-storm: trips #185 on main; two neutralization controls pass, and a
  paired-runtime flapping case reproduces the field churn signature
  (window-trigger crumb, no pin, remount thrash, no crash).
- ack-contract A/B: same storm against both watcher contracts; fails on main
  via the legacy path, passes on nwparker/react185-structural-fix.
…l identity

The rendered parked-set memo re-asked canWatcherCoverParkedTerminalTab on
every render for activation-deferred tabs, and that predicate reads state
the park/reveal lifecycle itself rewrites (pane captures, layouts, runtime
titles). A park unmount could therefore flip the verdict that caused it,
and the flip-burst pin never reaches this clause — it only subtracts from
the cold-park candidate set — so the loop ran to React #185
(terminal.workbench crash cluster 05ed75b1/996b4cc2/fe2b1a30).

Break the feedback edge instead of damping its frequency: evaluate
coverage once per material identity (pty id, generation, restore policy)
and hold that verdict while the tab stays deferred. No pane mount/unmount
can write any latch input, so the verdict cannot oscillate; pty re-mints,
generation bumps, SSH-parking setting changes, and paired-runtime
capability changes still re-open it, and reveal (leaving the deferred set)
clears the latch entirely.

The rendered-verdict selection moves to terminal-rendered-park-verdict.ts
(pure function of committed inputs) to keep the hook under the max-lines
budget. Cold-park and force-park lanes are untouched; the existing
withhold damping and flip telemetry still govern the cold-set lane.

Repro gate: terminal-cold-park-reveal-storm.react185.test.tsx goes
RED (Maximum update depth exceeded) to GREEN with this change alone; both
neutralization controls and the paired-runtime flapping case stay green.
…atch

Adversarial review mutation testing found four surviving mutants in the
latch integration seam (the latch unit tests and both storm repros stayed
green through all of them):

- evaluateCoverage hardcoded true: an uncoverable deferred tab was silently
  claimed by watchers (the zero-watcher-darkness direction the coverage
  gate exists for). New: 'keeps an uncoverable deferred tab out of watcher
  ownership'.
- portal guard dropped from the extracted deferred clause. New: 'never
  claims a portal-hosted deferred tab for watchers'.
- restore policy hardcoded in the hook (and the two new memo deps dropped):
  the SSH kill switch and paired-capability re-key edges were unproven
  end-to-end. New: 're-opens the latched verdict on restore-policy changes
  and settles' — also demonstrates each re-key settles in one evaluation.
- prune wiring removed from the hook: a stale FALSE surviving a reveal ->
  re-defer cycle would strand the re-deferred tab unmounted and unwatched.
  New: 're-evaluates fresh when a revealed tab is deferred again'.

Also resets settings/runtimeStatusByEnvironmentId in beforeEach so the new
policy-change case cannot leak state into the runtime-flap case.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/crash-react185-cold-park-storm branch from b609c76 to 16d1b4d Compare August 15, 2026 06:24

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c5d4c806-1b88-460e-914f-0c4b3769c9c0

📥 Commits

Reviewing files that changed from the base of the PR and between d0eccc7 and 16d1b4d.

📒 Files selected for processing (8)
  • config/reliability-gates.jsonc
  • src/renderer/src/components/Terminal.tsx
  • src/renderer/src/components/terminal-pane/TerminalPaneOverlayLayer.tsx
  • src/renderer/src/components/terminal-pane/terminal-cold-park-reveal-storm.react185.test.tsx
  • src/renderer/src/components/terminal-pane/terminal-rendered-park-verdict.ts
  • src/renderer/src/components/terminal-pane/use-parked-terminal-watcher-synchronization.react185.test.tsx
  • src/renderer/src/components/terminal-pane/use-parked-terminal-watcher-synchronization.ts
  • src/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/renderer/src/components/terminal-pane/terminal-cold-park-reveal-storm.react185.test.tsx
  • src/renderer/src/components/terminal-pane/terminal-rendered-park-verdict.ts
  • src/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.ts

Comment thread config/reliability-gates.jsonc Resolved
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Exact-final-head Electron QA @ 16d1b4d681

Launched this worktree's Orca via REMOTE_DEBUGGING_PORT=9334 node config/scripts/run-electron-vite-dev.mjs (isolated profile, renderer :5175) and attached with Playwright CDP (playwright-cli attach --cdp=http://127.0.0.1:9334). Identity: Orca: brennanb2025/crash-react185-cold-park-storm / qa-14653-park-latch.

Scenario: add a two-worktree fixture repo, open Terminal 1–5 on main, type echo QA14653-BEFORE, switch to qa-park-reveal (park), switch back (reveal), type echo QA14653-AFTER, then one more park/reveal cycle.

Observed: terminal workbench stayed mounted (tabs 1–5 + live prompt). Both echo markers painted immediately. No React error boundary, no white teardown, no #185 / max-update-depth in the renderer console.

02-after-park-reveal.png

@brennanb2025 brennanb2025 changed the title fix(terminal): make deferred watcher handoff monotonic chore(terminal): retire unsupported React #185 parking hypothesis Aug 15, 2026
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing: this branch has zero net diff against main and there is nothing left to merge.

The merge-gate review disproved the causal path this PR claimed, and the implementation, its oracle, and the reliability-gate registration were all reverted (b69c565). Two independent reasons:

  1. The reproduction defined pane coverage as "no watcher entry exists for this tab". The production predicate canWatcherCoverParkedTerminalTab never reads watcher ownership — it tests pane count, per-pane PTY identity, leaf-id validity, and park-restorability under the current SSH/paired-runtime policy. The test mocked a condition with no production equivalent.
  2. Independently, the loop cannot close in production: Terminal excludes activation-deferred ids from backgroundMountTabIds, and TerminalPaneOverlayLayer applies that mount filter before the parked-set check — so a flipped verdict never mounts the deferred slot, and the pane-mount title write the test relied on cannot run.

Consequence: the React #185 terminal.workbench cluster (reports 05ed75b1, 996b4cc2, fe2b1a30) is not fixed and not explained, and returns to the unexplained set. Nothing from this PR shipped, so a recurrence is not a regression from anything released. Those reports need a fresh root-cause investigation from their actual breadcrumbs and teardown path.

Corrections have been posted on the three affected crash reports and in the sweep summary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant