Skip to content

fix(control): resolve single session when Claude accounts share folders by symlink (#350) - #376

Merged
kombuchapunk merged 4 commits into
mainfrom
fix/bug-350-linked-homes
Dec 4, 2026
Merged

kombuchapunk merged 4 commits into
mainfrom
fix/bug-350-linked-homes

Conversation

@kombuchapunk

Copy link
Copy Markdown
Collaborator

Rebases #351 cleanly onto main (preserving @fominfo's original commits and DCO sign-off) and adds hardening from QA stress-testing:

  • Snapshots liveRecords once per account in resolveHome / oneThroughLinks to eliminate TOCTOU race and duplicate disk scan
  • Detects whole-configDir symlinks via lstatSync(path.resolve(p)).isSymbolicLink() (and fails safe on error)
  • Uses junction for directory symlinks in Windows tests and guards Unix-only ELOOP/file-symlink cases cleanly
  • Adds conformance vectors in conformance/control-homes.json and daemon inbox/cancel()/other_home/no_record tests at 100% coverage

QA verified (Claude Opus 5.5): PASS (0 blockers, 0 high, 9 adversarial stress tests passed, 4,901 tests at 100% coverage).

Closes #350
Supersedes #351

fominfo and others added 4 commits December 3, 2026 15:35
Accounts that link projects/ and sessions/ to one config dir each find the same transcript and the same live record, so resolveHome counted every one of them live and refused ambiguous_home. Where every live copy is one file on disk and every live record one registry file, take that session, filed under the account whose own folders hold it. Two files, two processes, or nothing live still refuses (spec/CONTROL.md section 6.1).

Fixes #350

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ilya Fomin <2030645+fominfo@users.noreply.github.com>
…lane too

The inbox lane looks the live record up across every account, and with
sessions/ linked each account read the same registry file, so liveRecord
found one row per account and returned null: no_record, and the message
went to a fork instead of the live window. liveRecords now keeps one row
per real registry file, named for the account the session was resolved
to, so a second process in another account still refuses and other_home
still compares the right accounts. A daemon test writes through linked
homes into the inbox; spec section 6.1 covers the all-links case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ilya Fomin <2030645+fominfo@users.noreply.github.com>
… branch

- Add conformance/control-homes.json covering CONTROL.md §6.1 Homes (single,
  missing, one-live, ambiguous, linked-to-owner, all-links fallback, cold
  linked, and linked projects with two live registries), driven by
  packages/core/test/claude-live-record.test.ts.
- Cover the all-links fallback branch in oneThroughLinks and mark the two
  TOCTOU catch fallbacks in realOf/linkedFolder with v8 ignore so 100%
  coverage holds.
- Compare prefer with path.resolve in liveRecords to match vetInbox, and list
  sessionpipe alongside sessionpipe-core in the changeset.

Signed-off-by: kombuchapunk <35040017+kombuchapunk@users.noreply.github.com>
…nd edge-case coverage

- Capture liveRecords once in resolveHome and pass the snapshot into
  oneThroughLinks to avoid double disk scans and eliminate the TOCTOU race
  where a second account's registry row vanishes between the two reads.
- Check lstatSync(path.resolve(p)) on configDir itself (not only projects/
  and sessions/) so a whole-config-dir symlink prefers the real owner, and
  treat lstatSync errors as non-owning rather than owning.
- Use NTFS junctions on win32 in packages/core/test/claude-live-record.test.ts
  so linked-home and conformance tests run cross-platform without elevation;
  guard Unix-only file-symlink and ELOOP cycle tests with it.runIf(unix).
- Expand conformance/control-homes.json (and document it in conformance/README.md)
  plus unit/daemon tests covering dangling symlinks, ELOOP cycles, split-ownership
  and whole-dir links, two real transcripts with linked sessions/, two live
  processes in shared sessions/, all-links daemon inbox delivery, no_record /
  other_home refusals, and cancel() with linked homes.

Signed-off-by: kombuchapunk <35040017+kombuchapunk@users.noreply.github.com>
@kombuchapunk
kombuchapunk merged commit cece8e1 into main Dec 4, 2026
30 of 31 checks passed
@kombuchapunk
kombuchapunk deleted the fix/bug-350-linked-homes branch December 4, 2026 00:17
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.

Control: ambiguous_home refuses every message when Claude accounts share their folders by symlink

2 participants