[RFC] Add worktree-aware directory switcher - #8450
Conversation
e27dc7c to
038910b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e27dc7c6f9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
038910b to
a1928e8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 901ed0e99c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
901ed0e to
452ed70
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 452ed708e0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Add a version counter ref so that out-of-order IPC responses from listRecentDirs/listGitWorktreeDirs are discarded when a newer refresh has already been started. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: goose <goose@aaif.dev> Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
39ac580 to
68bf21e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 68bf21e9a1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| useEffect(() => { | ||
| if (!isMenuOpen) { | ||
| return; | ||
| } | ||
|
|
||
| const newDir = result.filePaths[0]; | ||
| void refreshMenuData(); |
There was a problem hiding this comment.
Clear stale worktree options when opening the switcher
worktreeDirs is rendered immediately from component state, but this effect only refreshes data asynchronously after the menu opens and does nothing while closed. If workingDir changes between openings, the previous repo’s worktree entries remain visible and clickable until refreshMenuData() finishes, so a fast click can switch the user to an unrelated directory. Reset or hide worktree options until the fetch for the current workingDir completes.
Useful? React with 👍 / 👎.
Co-authored-by: goose <goose@aaif.dev> Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
|
This pull request has been automatically marked as stale because it has not had recent activity for 23 days. What happens next?
Thank you for your contribution! 🚀 |
…ework Signed-off-by: Douwe Osinga <douwe@squareup.com> # Conflicts: # crates/goose/src/providers/chatgpt_codex.rs # crates/goose/src/providers/init.rs # ui/desktop/src/i18n/messages/en.json
Addresses Codex review comment: when workingDir changes between menu openings, previous entries were briefly visible until the async refresh completed. Now we clear state immediately before fetching. Signed-off-by: Douwe Osinga <douwe@squareup.com>
|
I merged I also addressed the remaining Codex review comment about stale worktree/recent entries being visible when the menu opens after a All checks pass: |
DOsinga
left a comment
There was a problem hiding this comment.
LGTM — the worktree-aware directory switcher is well-implemented, uses existing patterns (dropdown-menu component, i18n, loadRecentDirs), and the stale-state issues from Codex review are now addressed.
|
One thing: commit |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69beb34713
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| const newDir = result.filePaths[0]; | ||
| void refreshMenuData(); |
There was a problem hiding this comment.
Reset directory lists before opening the dropdown
The menu can render stale worktreeDirs/recentDirs for one frame when reopened because the reset/fetch is deferred to useEffect after isMenuOpen becomes true. If workingDir changed while closed (or an earlier fetch completed after close), users briefly see and can select entries from the previous repo before refreshMenuData() clears them, which can switch to the wrong directory. Clear/hide menu data synchronously in the onOpenChange open path (or invalidate on close) so stale items are never interactive.
Useful? React with 👍 / 👎.
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com> Signed-off-by: Douwe Osinga <douwe@squareup.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: goose <goose@aaif.dev> Co-authored-by: Douwe Osinga <douwe@squareup.com>
Summary
Why
Working on multiple branches and tasks at the same time is much smoother when each task lives in its own Git worktree. Right now, switching the Goose desktop app between those worktrees is slower than it needs to be because the only path is reopening a directory picker or creating separate windows manually.
This RFC proposes a lightweight in-app worktree toggle so users can jump between related worktrees directly from the chat input, similar to the workflow Claude supports. The goal is to make parallel task switching faster and more discoverable without changing the broader session model.
Test plan
source bin/activate-hermit && cd ui/desktop && pnpm run typechecksource bin/activate-hermit && cd ui/desktop && pnpm run lint:check