fix(workspace): recreate missing registered worktrees - #2776
Closed
harshitsinghbhandari wants to merge 1 commit into
Closed
fix(workspace): recreate missing registered worktrees#2776harshitsinghbhandari wants to merge 1 commit into
harshitsinghbhandari wants to merge 1 commit into
Conversation
Collaborator
Author
|
Closing in favour of a single consolidated PR. The fix here is still correct and still needed. It is being folded, approach intact, into one PR alongside the tmux server cwd pin and a retried pane-cwd verification, since all of them are the same #2775 failure surface. Will cross-link that PR here. |
Collaborator
Author
|
Consolidated PR is up: #3098 |
harshitsinghbhandari
added a commit
to harshitsinghbhandari/agent-orchestrator
that referenced
this pull request
Jul 26, 2026
Consolidates the tmux poisoned-cwd spawn failure fix (issue Untrivial-ai#2775 family). - execRunner.Run now pins cmd.Dir to os.TempDir(), so the tmux CLI's first invocation (which auto-starts the persistent tmux server) never inherits a daemon cwd that a later Squirrel/ShipIt auto-update can delete. - verifyPaneWorkingDirectory now retries up to 5 times, 50ms apart, honoring ctx cancellation via select. Measured live: #{pane_current_path} sampled immediately after new-session was stale, and the same probe sampled 50ms later was already correct, because buildLaunchCommand's cd '<workspace>' || exit; guard only corrects the pane once its shell actually runs. The prior single-shot check lost that race every time and turned a spawn that was going to succeed into a hard failure. Reuses the existing sameDirectory helper rather than adding a parallel one. - gitworktree: a registered worktree whose directory no longer exists on disk (registration and DB row survive, directory does not) is now detected via worktreeDirMissing, its stale git registration pruned, and a fresh worktree materialized before the runtime launches, in both the Create-reuse and Restore paths. - session service toAPIError maps the new ports.ErrRuntimeWorkspaceCwdMismatch sentinel to a typed WORKSPACE_CWD_MISMATCH apierr naming both the observed and wanted paths, instead of falling through to an opaque 500. Supersedes Untrivial-ai#2984 and Untrivial-ai#2776 (both authored by this contributor, being closed in favor of this PR). Credits Untrivial-ai#3027, which independently reached the same cmd.Dir pin plus a retry loop. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2775
Summary
Tests