You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to surface manually created git worktrees in the workspace list? #18414
I'm using the experimental workspaces feature (OPENCODE_EXPERIMENTAL_WORKSPACES=true) and I love it for managing parallel work streams. However, I ran into an issue with my workflow and I'm not sure if I'm doing something wrong or if this is a missing feature.
The problem: When I manually create a git worktree outside of opencode (e.g. git worktree add ../my-feature), it doesn't show up in the workspace list in the web UI. Only worktrees created through the "New workspace" button appear.
I sometimes create worktrees manually because I want control over the branch name and directory location, or I'm setting up a worktree from an existing remote branch. Is there a way to register these with opencode after the fact, or is the expectation that all worktrees should be created through the UI?
What I found in the code: The workspace list is driven by the sandboxes array in ProjectTable. This only gets populated when a worktree is created through the API (Worktree.createFromInfo() → Project.addSandbox()). There's no mechanism to discover worktrees that exist in git but aren't registered in the DB — so manual worktrees are invisible.
Some ideas for potential fixes:
Auto-discover on list — when Project.sandboxes() is called, also run git worktree list --porcelain, parse the paths, and auto-register missing ones via addSandbox().
Merge git state at the API layer — have GET /experimental/worktree merge git worktree list results with the DB sandboxes.
Manual registration endpoint — expose something like POST /experimental/worktree/register so users can bring external worktrees into opencode explicitly.
My questions:
Is the current behavior intentional — i.e., are workspaces meant to only be managed through opencode?
Is anyone else using a workflow that involves manually created worktrees?
Would a discovery/sync mechanism be welcome, or would it cause issues with the workspace lifecycle (bootstrap, start scripts, etc.)?
Possibly related:#10060, #13343 — though those are about different aspects of the worktree/workspace UX.
No issue template was used. This issue appears to be a question or feature request, but it doesn't follow the Question template (missing the required Question field) nor the Feature Request template (missing the verification checkbox, and the title should start with [FEATURE]:). Please pick the appropriate template and resubmit or edit the issue to match it.
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of or closely related to existing issues. Please check:
Activity
github-actions commentedon Mar 20, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Questionfield) nor the Feature Request template (missing the verification checkbox, and the title should start with[FEATURE]:). Please pick the appropriate template and resubmit or edit the issue to match it.Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of or closely related to existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Mar 20, 2026
Thanks for updating the issue! It now follows the Question template with clear, substantive content. The compliance flag has been removed.
Cellule commentedon Mar 20, 2026
I'm using this script now to create a sandbox in opencode from my worktrees that are missing
Details
dzianisv commentedon Mar 29, 2026
I fixed this downstream in my fork and merged it to
main.References:
dzianisv/opencode#89e5d02d8a89014ea36b1e81a0fad34aee4f9838cd6338e0b406c90a330a84725dfcdbef1d8221430eFix summary:
git worktree list --porcelainValidation on the fork package:
cd packages/opencode && bun testcd packages/opencode && bun typecheckrekram1-node commentedon Jun 23, 2026
Automated: closing question issues.
GitHub Issues are for bug reports and feature requests only — questions / support are no longer tracked here.
If this is a bug or feature request, please open a new issue with the appropriate template.