Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
🚧 Files skipped from review as they are similar to previous changes (9)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe terminal activation path now resolves runtime environments and holds restored pty-less rows that could spawn host terminals. Holds use worktree- and connection-scoped session-tab evidence, bounded timers, and mount restrictions. Unit and render tests cover activation, exclusions, reconnects, stale evidence, timeouts, and lifecycle behavior. Background mount requests now target explicit tab IDs. Session-tab RPC paths share a 15-second timeout constant. A reliability gate documents the behavior and validation criteria. Merge Risk: ⚪ Minimal · up to This localized renderer change prevents restored terminal rows from spawning shells before host state is known, with targeted and broad checks reported as passing; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description clearly explains the problem, mount policy, scope, verification results, and known tradeoffs. However, it omits the required Visual Proof section or an explicit N/A explanation, and it does not provide the required Linked Issue entry in the template format. Resolution Add the required Linked Issue section with a Full details: Docstring CoverageExplanation Docstring coverage is 40.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 52 functions across 18 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
9451bf5 to
79c4393
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
config/reliability-gates.jsonc (1)
3-3: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUpdate
updatedAtto cover the newest recorded evidence.The new gate
terminal-session.restored-spawn-holdrecords evidence runs dated2026-08-21, butupdatedAtstays at2026-08-20. SetupdatedAtto the latest change date so the manifest freshness stamp matches its content.📝 Proposed fix
- "updatedAt": "2026-08-20", + "updatedAt": "2026-08-21",
🧹 Nitpick comments (2)
src/renderer/src/components/terminal/restored-terminal-spawn-hold.test.ts (1)
189-207: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a case for a partial release.
The suite covers a full release through
environmentId: nulland through the deadline. It does not cover the re-filter path atrestored-terminal-spawn-hold.tsLines 211-223, where one held row stops being holdable while others stay held.That path is the only producer of a non-empty
releasedTabIdsalongside a non-emptyheldTabIds. Callers usereleasedTabIdsto re-allow mounting. If that difference regresses, the affected row stays unmounted for the rest of the hold.💚 Proposed test
+ it('reports only the row it let go while the rest stay held', () => { + const holdByWorktreeId = new Map<string, RestoredSpawnHoldEntry>() + plan({ holdByWorktreeId }) + const partial = plan({ + holdByWorktreeId, + isColdActivationPass: false, + nowMs: 2_000, + immediateTabIds: new Set(['row-1']) + }) + expect([...partial.heldTabIds]).toEqual(['row-2']) + expect([...partial.releasedTabIds]).toEqual(['row-1']) + })src/renderer/src/runtime/web-session-tabs-sync.ts (1)
576-585: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueShorten the two doc blocks.
Both blocks run ten lines and restate the decision logic in prose. Keep the non-obvious rule (a rejection settles only when the store already holds an equal-or-newer accepted view) and drop the walkthrough.
As per coding guidelines: "Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code."
Also applies to: 3661-3670
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: da9eecf7-d0d2-45d1-8a03-d2b3fb1bf1d6
📒 Files selected for processing (7)
config/reliability-gates.jsoncsrc/renderer/src/components/Terminal.tsxsrc/renderer/src/components/terminal/restored-terminal-spawn-hold.render.test.tsxsrc/renderer/src/components/terminal/restored-terminal-spawn-hold.test.tssrc/renderer/src/components/terminal/restored-terminal-spawn-hold.tssrc/renderer/src/lib/wake-sleeping-agents-in-background.tssrc/renderer/src/runtime/web-session-tabs-sync.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
…A-4953) Opening a paired-runtime workspace mounted every persisted terminal row before the first authoritative session.tabs snapshot for the current connection. A row with no pty left anywhere can never be watcher-covered (terminal-parked-tab-watchers requires a non-null ptyId), so cold activation mounted it immediately and pty-connection took its FRESH SPAWN branch -- one new remote shell per restored row. Hold that class -- non-mirrored rows with no ptyId and no surviving layout-leaf pty -- until the host answers for the worktree, reading the canonical evidence merged #15644 already owns: host-session-mirror-hydration's generation-scoped latch, settled only from landed web-session-tabs store patches, plus the store's runtime connection generation. No parallel answer bookkeeping. The hold epoch is the host, not just the number: generations count per environment, so it carries environmentId too and a workspace that moves hosts starts a fresh window and inherits no verdict -- still under the same ceiling, still never re-holding a mounted row. Never held: the active tab, group actives (unified-tab id mapped to its terminal entityId), activity portals, pendingStartupByTabId rows, live tabs, and anything an earlier pass already mounted (no retroactive unmount). Local, SSH and folder workspaces resolve no environment and are never held. Unlike the resume/spawn gate, this one releases into *mounting*, where failing open is safe, so it is bounded: a 20s per-connection window (session.tabs RPC timeout + 5s) and a 60s ceiling across reconnects. A blank workspace cannot wedge. The allowed/deferred sets keep their identity while membership is unchanged; a settled hold runs on every render, and a fresh Set each time is a new prop identity for the memoized worktree surface tree. Also closes two untargeted background-mount paths that fanned the same rows into host spawns: the bootstrap mount in useIpcEvents now requests the surface only, and wake-sleeping-agents no longer falls back to a whole-worktree mount for a passive record whose tab id cannot be resolved. Registers the invariant as terminal-session.restored-spawn-hold in config/reliability-gates.jsonc (experimental/partial, macOS-only evidence).
79c4393 to
7a696c6
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
#40289 fixes the dead-tab respawn wave from #39166 without depending on this PR. Saved tabs that have no PTY anywhere wait until they are shown, on local, SSH and paired workspaces. This PR's separate concern still stands: holding rows on a paired host until its first |
|
Thanks @Jinwoo-H for this work and for the careful diagnosis of the restored-terminal spawn storm, and thanks to Revofusion for the original report in #15624. The core problem is now fixed on main by #40289: when a worktree opens, saved tabs with no live PTY are held until the user opens them, and the visible and active tabs still start immediately. Your mount-policy design (never holding the active, group-active, pending-startup or activity-portal tabs, and mounting once a PTY binds) shaped that approach. This branch has drifted a long way from main, so I'm closing it in favor of #40289. If the paired-host gating before the first |
Summary
STA-4953 was reported and diagnosed by Revofusion in #15624.
Opening a paired-runtime workspace could mount restored PTY-less terminal rows before the current connection received an authoritative
session.tabsanswer. Every affected mount took the fresh-spawn path and created a new host shell.Now that #15644 is merged, this PR consumes its canonical, generation-scoped
hasHostSessionMirrorHydratedevidence. It does not add another answer or connection latch. This PR owns only the mount policy.Mount policy
Setidentities stable when membership is unchanged, avoiding memoized worktree-surface rerenders.tabIds: [], so it mounts only the surface. Do not whole-worktree mount an unparseable sleeping record that no pane matcher can consume.Red-first evidence
Terminalseam: restored PTY-less rows mounted before host evidence and reached the fresh-spawn class.applyRestoredTerminalSpawnHoldcall removed, all 21 rendered scenarios fail; with it restored, all 21 pass.Setidentity tests.Verification
pnpm run typecheck:webpnpm run check:code-quality:changedpnpm run check:react-doctor:changedpnpm run check:reliability-gatesgit diff --check, formatting, raw control-byte scan, and binary diff scanKnown tradeoffs and gaps
terminal.createcalls, nor Linux, Windows, or live SSH execution for this gate.