Before submitting
Area
apps/desktop
Steps to reproduce
- Create a project action and enable Run automatically on worktree creation.
- Use a command with an obvious side effect, for example:
mkdir -p /tmp/t3code-wt-debug && printf '%s\n' "$(date -Is) cwd=$(pwd)" >> /tmp/t3code-wt-debug/runs.log
- Create a fresh new thread.
- Switch the environment from Local to New worktree.
- Send the first message.
Expected behavior
The action should execute once in the newly created worktree.
For the example above, /tmp/t3code-wt-debug/runs.log should be created.
Actual behavior
- The worktree is created.
- The thread continues normally in the new worktree.
- The terminal opens, but the setup action command does not run.
- No side effects from the action are observed.
Likely cause
This looks like a race between the setup-action launcher and the terminal drawer.
The setup-action path opens a PTY for the new worktree, but the terminal drawer appears to reopen the same terminal using stale pre-worktree thread state. Server-side, TerminalManager.open() resets the terminal session when cwd or env changes, which likely wipes the just-opened PTY before the setup command survives.
Impact
Major degradation or frequent failure
Version or commit
main @ a60daa1
Before submitting
Area
apps/desktop
Steps to reproduce
mkdir -p /tmp/t3code-wt-debug && printf '%s\n' "$(date -Is) cwd=$(pwd)" >> /tmp/t3code-wt-debug/runs.logExpected behavior
The action should execute once in the newly created worktree.
For the example above,
/tmp/t3code-wt-debug/runs.logshould be created.Actual behavior
Likely cause
This looks like a race between the setup-action launcher and the terminal drawer.
The setup-action path opens a PTY for the new worktree, but the terminal drawer appears to reopen the same terminal using stale pre-worktree thread state. Server-side,
TerminalManager.open()resets the terminal session whencwdor env changes, which likely wipes the just-opened PTY before the setup command survives.Impact
Major degradation or frequent failure
Version or commit
main @ a60daa1