Skip to content

fix(mobile): keep closed terminal tabs from reappearing after quick closes - #31711

Merged
nwparker merged 1 commit into
stablyai:mainfrom
nwparker:nwparker/mobile-monkey-legacy-terminal-close
Oct 22, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
nwparker:nwparker/mobile-monkey-legacy-terminal-close

Conversation

@nwparker

@nwparker nwparker commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Close two terminal tabs quickly. If the computer finishes the requests in a different order, one closed tab can reappear on your phone. This fix removes each tab from the current list when its close succeeds, so both tabs stay closed.

What Changed

  • Use the current terminal list when each close result arrives.
  • Keep newer terminal names and other changes made while the close was pending.
  • Avoid switching you away from a terminal you selected after tapping Close.

Why

Closing one tab should not bring another tab back or undo a more recent selection.

Linked Issue

Maintainer-discovered regression. Bounded GitHub symptom and exact-file searches found no exact duplicate. Related #31365 changes per-device recency and #11240 preserves this fallback; this fixes stale array reconciliation.

Visual Proof

Captured with the visual-proof skill. Before uses base 15246eb4a45; after uses this PR's standalone commit eec57ce96fa. The scenario passed asserted capture runs 3 times per version before representative screenshots were selected. The captures were visually inspected.

Evidence scope: production-hook harness. Explicitly labeled custom HTML rendering of real hook output with deterministic transport; not the native app or production terminal renderer. Captures both pending closes completing without resurrecting a tab. Tab list is diagnostic HTML.

01-before.png 02-after.png
01-before.png 02-after.png

The hook/transport boundary harnesses are labeled in the captures. These are browser evidence where stated; they do not establish native keyboard, gesture, permission dialog, safe-area or real-network behavior. Full code regressions cover additional cases described above.

Testing

  • Regression tests added or updated.
  • Full native device verification for every race.
ORCA_BACKGROUND_LAUNCH=1 pnpm --dir mobile test src/session/use-mobile-session-close-actions.test.tsx

The combined mobile change set passed 410 suites / 3,626 tests, production typecheck, the tests-typecheck ratchet, formatting, the changed-code quality gate, and the mobile-web build/asset verifier on macOS. These aggregate results are not a claim that the entire suite was rerun on this isolated branch. PR CI validates the branch against current main.

Synchronization review

Keep the close RPC asynchronous (await sessionTerminalClose.request). After acceptance, filtering the current terminal list and updating its ref must happen synchronously before publishing React state, so two completions in the same frame cannot each overwrite the other with a captured list. This performs no blocking I/O. Regressions cover both close-acknowledgement orders, newer terminal metadata, and an intervening selection change.

Review

Merge risk: Low. A small change to updating the terminal list after a successful close; the close request still runs in the background.

Previously reviewed by a separate agent team; reported issues were fixed and checked again.

Agent skill upstream boundary

  • Not applicable; this change copies no upstream skill-installer implementation.

Notes

Existing RPC methods and wire compatibility are retained. Review considered desktop host changes, remote execution authority, folder workspaces, and native/web consumers. Native simulator follow-up was limited after the three owned simulators became stuck shutting down; no unrelated simulator/process was reset.

Checklist

  • Focused change with a root-cause explanation.
  • Automated regression coverage and independent review.
  • Before/after proof attached with exact evidence scope.
  • Cross-platform and remote compatibility considered.
  • Required PR CI checks have passed.

… state

Concurrent close replies filter captured terminal arrays and resurrect an already closed terminal. Reconcile the current collection synchronously and respect newer selection and metadata.
@nwparker
nwparker marked this pull request as ready for review October 21, 2026 23:34
@coderabbitai

coderabbitai Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

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 4 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
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5214fd42-fc9f-47d5-8fa3-72baed834e84
📥 Commits

Reviewing files that changed from the base of the PR and between 10d4104 and eec57ce.

📒 Files selected for processing: 2
  • mobile/src/session/use-mobile-session-close-actions.test.tsx
  • mobile/src/session/use-mobile-session-close-actions.ts
  • 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.

@nwparker
nwparker merged commit 7a8974b into stablyai:main Oct 22, 2026
43 checks passed
@nwparker nwparker changed the title fix(mobile): reconcile concurrent legacy terminal closes with current state fix(mobile): keep closed terminal tabs from reappearing after quick closes Oct 22, 2026
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