Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Session import offers T3 sandbox chats when the base folder is a symlink or Codex files them under an outside project #42019

Closedmatthewcosier(GitHub profile, opens in a new tab) opened this issue 0 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

Two ways T3's own sandbox chats reach the external session import list (AgentSessionScanner):

  1. Symlinked base folder. Put T3's base folder behind a symlink (macOS /var -> /private/var is enough: run TMPDIR=/var/tmp vp test run src/project/AgentSessionScanner.test.ts -t "excludes sandboxes reached through a symlink into the worktrees dir" in apps/server). Run a chat in a T3 worktree or scratch folder, then open external session import.
  2. Codex project reassignment. Run a Codex chat inside a T3 sandbox and let Codex file it under one of its own projects outside T3. projectCwd moves chats from excluded folders (such as Codex's scratch folder) to their Codex project root, and T3's folders count as excluded folders, so the sandbox chat is filed under that outside project.

Expected behavior

Chats that ran inside T3's base folder or worktrees are never offered for import, however the path is spelled, and every real project chat main offers today is still offered.

Actual behavior

  1. The scanner resolves each candidate folder to its real path, then compares it with the configured (unresolved) base and worktrees paths. Behind a symlink they never match, so sandboxes are offered. The existing test above fails on macOS for this reason.
  2. Sandbox chats that Codex filed under an outside project are offered under that project.

Impact

Minor bug or occasional failure

Version or commit

main at b1c83e180

Environment

macOS (APFS); any OS where T3's base folder is reached through a symlink.

Logs or stack traces

FAIL  src/project/AgentSessionScanner.test.ts > AgentSessionScanner > scan > excludes sandboxes reached through a symlink into the worktrees dir
AssertionError: expected [ { …(7) } ] to deeply equal []

Workaround

None known.

Notes for a fix

Resolving the base and worktrees folders to real paths at scanner start and checking both spellings fixes case 1, and skipping projectCwd reassignment for T3-managed folders fixes case 2. We tried that and found these cases a fix has to keep working, each verified against main:

  • A chat whose recorded folder is a symlink inside T3's scratch folder pointing to a real project: main counts it once and offers it once; a fix must not offer it twice.
  • A Codex chat started in Codex's own scratch folder and filed under an outside project that Codex recorded through a link inside T3's folder (with a symlinked base): main counts and offers it; a fix must not hide it.
  • A project saved through a symlink under T3's real base that points outside: main counts and imports its chats; a fix must not count it and then import none.
  • Resolving links per chat is slow on a broken link or slow mount (one lookup per chat); a fix should resolve each assigned root once per scan.

Other spellings and layouts a full fix may need: case variants of T3's folders on case-insensitive volumes (folding case over the whole path wrongly hides a sibling project on a case-sensitive parent); NFD accents and /System/Volumes/Data/... spellings on macOS; custom worktree locations, current and previous (only baseDir, worktreesDir and /.t3/worktrees/ are checked); a single sandbox bind-mounted elsewhere (its Git gitdir backlink still identifies it); Windows shares that report file ID 0, where a device and inode check needs a case-insensitive path fallback; retargeting the base or worktrees symlink while the server runs; a symlink inside ~/Downloads pointing to a T3 sandbox; a literal backslash in a POSIX folder name (normalizeForWorktreeMatch turns \ into / on every platform).

  1. tanstack-source added labelsbug

  2. juliusmarminge closed this

Sign in to join this conversation.