Skip to content

fix(terminal): reject creates for durably closed tab identities - #32190

Merged
nwparker merged 2 commits into
mainfrom
nwparker/closed-tab-admission
Oct 24, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/closed-tab-admission

Conversation

@nwparker

@nwparker nwparker commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​175 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​174
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​109 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​106

A sleeping paired desktop can replay terminal.create with the identity of a tab the host explicitly closed, causing a fresh empty shell to start under the retired tab ID. The shipped Store admission path now checks existing durable close records before starting the PTY. A close recorded in a legacy runtime spill partition also blocks the replay. The runtime returns the existing tab_not_found absence message used by paired host-session operations. An older viewer may still surface that refusal until its own stale pane is reconciled; this patch prevents host spawning and does not claim client-side cleanup.

The layout ownership rollout stays off. This reuses the existing SQLite close records and their expiry policy; unseen IDs, missing-PTY recovery without a tab-close record, splits and live mustExist reconnects retain their existing paths. Related to #21341; this does not claim to resolve every scenario in that issue or replace direct SSH boot hydration work in #22334.

Validation: 100 tests pass across 11 focused files; node typecheck, changed-code quality and reliability manifest checks pass. With both production changes reverted, the same new SQLite close/reload/registered-RPC oracle fails both stale-ID cases while its three valid controls pass; restoring the changes passes all five. The stale requests perform zero controller spawns and zero inventory reads.

Reliability invariant/gate: terminal-lifecycle.closed-tab-create-admission (experimental): an unexpired host close record must reject a stale create before the controller starts a process. Existing terminal-topology refusal spans retain tab_closed diagnostics. Admission adds one constant-time map lookup per existing host partition, with no polling, process enumeration or network work.

Coverage limits: tests use a real SQLite Store and registered RPC handler with a synthetic controller and fixture workspace resolver on macOS. No actual PTY, network RPC socket, desktop sleep/wake or peer convergence was launched. Linux, Windows, WSL, SSH, mobile and folder-workspace physical journeys remain explicit gate gaps. Handle-based close and rendered close delivery are covered by adjacent suites rather than this new cold-reload oracle. Existing close records still expire after 30 days or their per-partition cap of 500.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 02d28481-e918-4b30-9448-4e46a207138a
Commits

Reviewing files that changed from the base of the PR and between bfba3ff and d600489.

Files selected for processing: 5
  • config/reliability-gates.jsonc
  • src/main/persistence/terminal-topology/terminal-topology-commit.ts
  • src/main/runtime/orca-runtime-terminal-create-replay-after-close.test.ts
  • src/main/runtime/runtime-pane-admission.ts
  • src/main/runtime/terminal-create-closed-tab-durability.test.ts

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 60e83251-d88b-4cbd-a9b4-fef4a6f8f879
📥 Commits

Reviewing files that changed from the base of the PR and between 52e413e and bfba3ff.

📒 Files selected for processing: 5
  • config/reliability-gates.jsonc
  • src/main/persistence/terminal-topology/terminal-topology-commit.ts
  • src/main/runtime/orca-runtime-terminal-create-replay-after-close.test.ts
  • src/main/runtime/runtime-pane-admission.ts
  • src/main/runtime/terminal-create-closed-tab-durability.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Walkthrough

Pane admission now checks known host sessions for a closed-tab tombstone matching the requested tab ID and workspace. A match prevents persistence, and runtime admission reports tab_not_found. Added tests cover restart behavior for closed, unseen, unclosed, and expired-record identities.

Priority: Normal

Merge Risk: Minimal · up to bfba3

The change is mergeable after normal checks; the supplied evidence identifies no actionable risk to terminal creation.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the problem, implementation, behavior, testing, limitations, and related issues. However, it does not follow the repository template structure and omits or leaves unclear the … Add the required template sections and complete each applicable item. Include N/A with a reason for Visual Proof if no visual or interaction change exists. State the linked issue in the required format, complete the Testing and Checklist …
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: rejecting terminal creates for durably closed tab identities.
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.
Full details: Description check

Explanation

The description explains the problem, implementation, behavior, testing, limitations, and related issues. However, it does not follow the repository template structure and omits or leaves unclear the required Visual Proof, Testing checkboxes, Review, Agent skill upstream boundary, Notes, and Checklist sections. It also uses “Related to #21341” instead of the template’s explicit issue-link format.

Resolution

Add the required template sections and complete each applicable item. Include N/A with a reason for Visual Proof if no visual or interaction change exists. State the linked issue in the required format, complete the Testing and Checklist checkboxes, address Review, Agent skill upstream boundary, Notes, and AI Disclosure as applicable, and preserve the existing detailed validation and coverage limitations.

Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

# Conflicts:
#	config/reliability-gates.jsonc
@nwparker

Copy link
Copy Markdown
Contributor Author

Maintainer refresh: merged current main (2a20d2d). The only conflict was in config/reliability-gates.jsonc, where both new gate entries were kept. No code changes. Local: 191 terminal-topology/closed-tab tests pass, the reliability-gate manifest check passes (152 gates), and oxlint is clean.

@nwparker
nwparker merged commit 1e341b6 into main Oct 24, 2026
52 checks passed
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