fix(adopt): key adopted targets by location, not just socket and name

Session 0 in two containers, or one name on this machine and on an ssh host
with the same uid, shared a (socket, name) pair, so opening one returned the
other's tab and its row read "Go to tab". foreignTargetKey() is now the one
key, built from the location, the host identity, the socket and the name, and
both the one-wrapper check and adoptedBy read it.

Both also read live sessions instead of mux records, which only exist once the
first attach starts the pane. An in-flight mark closes the rest of that window:
the route awaits the registries and the layout lock before the session lands in
the map. Docker targets are keyed per engine for the same reason, or a second
daemon's container of one name was never scanned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-11-06 03:03:05 +01:00
1 parent 57b2dcc466
commit a0e21109b2
6 files changed
+230 -41

No files matched your search

+3
View File
@@ -11,6 +11,7 @@ import type {
SessionStatus,
SessionRemote,
} from '../../src/types.js';
import type { SessionAdopt } from '../../src/types/session.js';
import type { GitFetchStatus } from '../../src/git-fetch.js';
/**
@@ -33,6 +34,8 @@ export class MockSession extends EventEmitter {
* boolean and the tests only ever need to set it.
*/
isAdopted: boolean = false;
/** Mirrors `Session.adopt`, the record the one-wrapper-per-target check keys on. */
adopt?: SessionAdopt;
/** Mirrors Session.attachmentHistory (the attachment panel's source of truth). */
attachmentHistory: SessionAttachmentHistoryItem[] = [];
/** Mirrors Session.getAttachmentHistoryForPersist(). */