Skip to content

fix(remote): preserve local file tab order - #13233

Open
innocarpe wants to merge 2 commits into
stablyai:mainfrom
innocarpe:fix/remote-file-tab-insertion-order
Open

fix(remote): preserve local file tab order#13233
innocarpe wants to merge 2 commits into
stablyai:mainfrom
innocarpe:fix/remote-file-tab-insertion-order

Conversation

@innocarpe

Copy link
Copy Markdown
Contributor

Description

Remote file tabs opened from terminal output now preserve their local file-tab positions when the remote tab snapshot is reconciled.
The sync layer stops treating host-owned remote layout data as authoritative for local file tabs that were opened on the client.

Focused fix

  • In scope: preserve local file-tab insertion order during remote session-tab synchronization.
  • Out of scope (explicit): changing general tab-group ordering or remote host layout persistence.

Preserves

  • Remote terminal and agent tabs continue to follow the host snapshot.
  • Existing file-tab reuse and activation behavior are unchanged.

Evidence

  • Test: pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/runtime/web-session-tabs-sync.test.ts
  • Regression: the test keeps an existing local file-tab position across a remote snapshot update.

User-regression-tradeoffs

  • A local file tab may intentionally differ from the host's file-tab ordering so the user's client-side insertion choice is not overwritten.

Fixes #13055

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 56b7f299-b546-4c81-9c26-548b85a04c1e

📥 Commits

Reviewing files that changed from the base of the PR and between d7fbcf5 and 3f71a3f.

📒 Files selected for processing (2)
  • src/renderer/src/runtime/web-session-tabs-sync.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/runtime/web-session-tabs-sync.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync.ts

📝 Walkthrough

Walkthrough

Mirrored host tab ordering now merges host-defined positions with the current local group order. Local non-mirrored tabs retain their positions. Invalid and duplicate IDs are removed, and remaining host tabs are appended. Group construction uses the merged order. Tests cover local tab preservation and stale mirrored tab filtering.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the fix and test evidence but omits required template sections for screenshots, testing checkboxes, AI review, security audit, and notes. Add the required template headings and complete the testing, cross-platform review, security audit, screenshots, and notes sections.
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.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: preserving local file-tab order during remote synchronization.
Linked Issues check ✅ Passed The synchronization changes and regression tests address issue #13055 by preserving local file-tab positions while retaining host ordering for mirrored tabs.
Out of Scope Changes check ✅ Passed The changes are limited to remote tab-order reconciliation and regression tests, with no unrelated functional changes identified.

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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 898f8b9a-c88f-45d6-81a1-9a6bd4d9df4a

📥 Commits

Reviewing files that changed from the base of the PR and between 6da7b8e and d7fbcf5.

📒 Files selected for processing (2)
  • src/renderer/src/runtime/web-session-tabs-sync.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync.ts

Comment thread src/renderer/src/runtime/web-session-tabs-sync.ts
@innocarpe
innocarpe force-pushed the fix/remote-file-tab-insertion-order branch from d7fbcf5 to 3f71a3f Compare August 9, 2026 01:21
@innocarpe

innocarpe commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Sync update (3f71a3f7dc)

Addressed review: invalid stale mirrored tab-order IDs are skipped before consuming host order, so local file-tab slots stay in place before live mirrored tabs.

Regression and validation:

  • vitest run --config config/vitest.config.ts src/renderer/src/runtime/web-session-tabs-sync.test.ts -> 65 passed
  • oxfmt --check src/renderer/src/runtime/web-session-tabs-sync.ts src/renderer/src/runtime/web-session-tabs-sync.test.ts -> passed
  • oxlint src/renderer/src/runtime/web-session-tabs-sync.ts src/renderer/src/runtime/web-session-tabs-sync.test.ts --deny-warnings -> passed

Commit: 3f71a3f7dcbc40d9147c1786790bd21650372ad3

@AmethystLiang AmethystLiang added the P1 High priority: bug or day-to-day user frustration label Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High priority: bug or day-to-day user frustration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Remote server Cmd-clicked files are inserted as the first tab

3 participants