-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Summary
Detect threads whose recorded worktree path has been removed before we resume them or start turns in that workspace.
Today a thread can still be resumed and rebound even if its cwd no longer exists on disk. The failure only shows up later when Codex tries to execute commands in that missing directory.
Related: #10
Repro
- Resume a thread whose
cwdpoints at a Codex-managed worktree. - Remove that worktree directory on disk.
- Run
/codex_resume <thread>or continue using an existing binding for that thread. - Ask Codex to do something that requires shell execution in the missing workspace.
Observed
- Resume/bind appears to succeed.
- Status/bound summary still shows the stale worktree path.
- Shell or git operations later fail because the directory no longer exists.
Expected
- The plugin should detect that the thread's recorded worktree path no longer exists before resuming or starting a turn in it.
- The user should get a clear recovery message instead of discovering the problem only after tool failures.
Findings
/codex_resumebinds the selected thread usingselection.thread.projectKey/workspaceDirwith no filesystem existence check first. Seesrc/controller.ts:1048.startTurnacceptsworkspaceDirand passes it directly into the App Server client without validating that the directory exists. Seesrc/controller.ts:1641.- The App Server client uses that workspace path as
cwdwhen starting a new thread, and otherwise resumes the thread and starts the turn without any plugin-sidecwdverification. Seesrc/client.ts:3334. - The existing worktree badge helper already touches the filesystem indirectly via
git -C <cwd> status, but it swallows failures and returnsundefined, so a missing worktree is not surfaced as a distinct stale state. Seesrc/controller.ts:3113.
Proposed Scope
- Detect missing
cwdpaths before binding/resuming a thread or starting a turn. - Treat missing worktree directories as a first-class stale-thread condition, not as a generic later tool failure.
- Surface the condition in at least one of:
- resume picker UI
/codex_status- bound conversation summary / error reply
- Offer a clear recovery path, likely one of:
- detach and choose another thread
- rebind to a valid workspace
- create a fresh worktree later under the broader worktree lifecycle work
Acceptance
- Resuming a thread whose recorded worktree directory has been deleted does not silently proceed into later shell failures.
- The user gets a clear explanation that the stored worktree path is gone.
- Tests cover the stale-worktree detection path.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Inbox