You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #4925 (review: #4925 (comment)). These items are out of scope for that PR.
Lease scope from a lossless session identity
The leased-profile scope hash in packages/remote/src/remote-connection-state.ts (around line 454) hashes the session as UTF-8. Lone surrogates such as U+D800 and U+D801 both encode as U+FFFD, so two sessions derive the same run and client IDs. The second open then gets the first session's lease ID back (src/cli/commands/connection-lease-transaction.ts, packages/daemon/src/resources/lease-registry.ts) and can release it on disconnect.
Derive new leased-profile scopes from a lossless session identity (for example UTF-16LE).
Keep the stored scope when the exact owning session loads its record.
Prevent new sessions from deriving an old lossy scope.
Cross-process serialization of legacy record migration
#4925 moves a legacy record to its owner's canonical path with a hard link and then an unlink. No lock covers this.
Serialize owner checks, retirement and claims of any legacy pathname while it can still alias the destination of another session.
The report identifies concrete existing behavior where UTF-8 session hashing collides for lone surrogates, causing lease ID reuse/release, and notes a missing lock for legacy record migration. It includes file locations and actionable follow-up tasks.
From fix(remote): give each session its own saved-connection file #4925 (comment): when default.json is unparseable but the active-session pointer is healthy, consider letting read-only unnamed commands (connection status) fall through to the pointer with a warning, instead of refusing. Mutations should still refuse.
Follow-ups from #4925 (a session literally named .active-session whose full record sits at the pointer path; the collision predates #4925):
Unnamed disconnect of a legacy .active-session record: after the checked hard link, atomically replace the full record at the pointer path with a pointer to the same owner, and let owner-checked pointer cleanup remove it after teardown (remote-connection-state.ts:794).
Failed save that retires a full record from the active path: replace it with a pointer to its verified owner, and overwrite that pointer with the new selection only after the new session record is committed (remote-connection-state.ts:384, 831, 392).
Activity
apex-sentinel-staging commentedon Nov 22, 2026
Apex Sentinel · Issue review
Suggested label:
bugThe report identifies concrete existing behavior where UTF-8 session hashing collides for lone surrogates, causing lease ID reuse/release, and notes a missing lock for legacy record migration. It includes file locations and actionable follow-up tasks.
Required sections
thymikee commentedon Nov 22, 2026
disconnect --forcethat removes an unreadable or unparseable saved connection file the caller names (from fix(remote): give each session its own saved-connection file #4925 (comment)). Today the recovery is manual removal, which the refusal's hint names.thymikee commentedon Nov 22, 2026
More follow-ups from #4925 (comment):
resolveRemoteConnectionDefaults, the connect preflight, and the ended-lease rewrite.linkSyncon volumes without hard links during legacy migration.connection_record_owner_unknowninstead of a raw errno when the directory is read-only and the session's own file is unreadable.thymikee commentedon Nov 22, 2026
default.jsonis unparseable but the active-session pointer is healthy, consider letting read-only unnamed commands (connection status) fall through to the pointer with a warning, instead of refusing. Mutations should still refuse.thymikee commentedon Nov 22, 2026
Follow-ups from #4925 (a session literally named
.active-sessionwhose full record sits at the pointer path; the collision predates #4925):.active-sessionrecord: after the checked hard link, atomically replace the full record at the pointer path with a pointer to the same owner, and let owner-checked pointer cleanup remove it after teardown (remote-connection-state.ts:794).remote-connection-state.ts:384, 831, 392).