Skip to content

fix(tmux): stable server cwd and pane cwd verify retries#3027

Open
AllBeingsFuture wants to merge 1 commit into
AgentWrapper:mainfrom
AllBeingsFuture:ao/agent-orchestrator-24/fix-tmux-stable-cwd
Open

fix(tmux): stable server cwd and pane cwd verify retries#3027
AllBeingsFuture wants to merge 1 commit into
AgentWrapper:mainfrom
AllBeingsFuture:ao/agent-orchestrator-24/fix-tmux-stable-cwd

Conversation

@AllBeingsFuture

Copy link
Copy Markdown

Problem

The daemon's first tmux CLI call auto-starts a persistent tmux server that inherits the process cwd for its lifetime. When the desktop app is started from a Squirrel/ShipIt staging path or app bundle that a later auto-update deletes, new-session -c <workspace> can fall back to that doomed server cwd and strand panes in a deleted directory (class of #2775 / related #2984). Pane cwd verification also failed immediately, which could race a still-applying launch-command cd.

Solution

  • Run every tmux CLI invocation with cmd.Dir = os.TempDir() so the auto-started server is pinned to a stable path that outlives app updates.
  • Retry pane-cwd verification up to 5 times (50ms apart) before failing.
  • Surface a clearer error when the session still lands outside the wanted workspace.

Tests

  • go test ./internal/adapters/runtime/tmux/ -count=1
  • Updated TestCreateDestroysAndReturnsErrorWhenPaneCWDDoesNotMatch for the retry sequence.

Notes

Independence

Can merge independently of the workspace stale-prune and httpd forced-shutdown fixes.

Run the tmux CLI from os.TempDir so the auto-started server is not
pinned to a ShipIt/app-bundle cwd that disappears after updates (AgentWrapper#2775).

Retry pane-cwd verification briefly before failing, and surface a
clearer error when new-session -c falls back to the server cwd.
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.

1 participant