Skip to content

fix: stop two windows taking one terminal session from each other - #87

Merged
LukeGus merged 1 commit into
Termix-SSH:dev-1.4.1from
ZacharyZcR:fix/session-takeover-loop
Nov 16, 2026
Merged

LukeGus merged 1 commit into
Termix-SSH:dev-1.4.1from
ZacharyZcR:fix/session-takeover-loop

Conversation

@ZacharyZcR

Copy link
Copy Markdown
Member

Fixes Termix-SSH/Termix#1850

Open tabs sync across devices, so a second browser opens the same terminal tab with the same tabInstanceId. The server hands the live session to the newest socket and sends sessionTakenOver to the old one. The old window then called connectToHost right away and took the session back, the other window did the same, and the two kept taking it from each other.

A window that gets sessionTakenOver now stops there. It shows "This session was opened in another window or tab." with the usual Retry button, doesn't reconnect on its own, and closes its socket so it can no longer write into a session another window owns. Retry takes the session back on purpose. The server already keeps the session when that old socket closes, because another owner is attached.

This doesn't show one session in both windows at once, which is what the reporter expected. That needs a decision on shared size and input, so it's left for later.

Test: tests/frontend/terminal/session-taken-over.test.ts runs the message branch and checks it doesn't reconnect. It fails without the change.

@termix-triage-bot

Copy link
Copy Markdown

AI review | Looks safe to merge

The PR fixes a reconnection loop where multiple browser tabs fighting for the same terminal session would continuously steal it from each other. The change stops the displaced tab from auto-reconnecting, shows a clear error message, and closes the socket, which is safe and correctly addresses the reported bug.

Reviewed 10d51b1. AI can be wrong, a maintainer still decides. Comment /termix review to run it again.

@LukeGus LukeGus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@LukeGus
LukeGus merged commit dcdacf3 into Termix-SSH:dev-1.4.1 Nov 16, 2026
4 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.

2 participants