Repository navigation
fix(app): keep the new-session screen on its own side in Work - #263
Merged
Merged
Conversation
The composer's project picker read the full server list, so a draft opened from the Work tab listed the local machine's projects under a "Local Server" heading beside the sandbox's own — and picking one started the session on the local machine, outside any sandbox, with nothing on screen to say so. It now reads the servers on the same side as the draft's own server, so Work offers only the sandboxes' projects and Code only everything else. The side comes from the draft's server rather than the sidebar's selected side, because a draft route mounts its own server and the two are not guaranteed to agree. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adding a project to a sandbox means giving it a folder from this computer. The picker's Add project ran upstream's directory picker against the server it is pointed at, which for a sandbox is the guest's own filesystem — nothing the user has ever put a project in. On Work it now opens the mounts dialog the sidebar's add button already opens, labelled "Mount project" like every other route to it. Both call sites, plus the Work empty-state prompt, share one hook rather than repeating the lazy import. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A workspace is a git worktree the session's server checks out, rooted at the server's own data dir. Inside a sandbox that is the guest's disk: not one of the host folders the sandbox mounts, so the work happens where the user's editor cannot see it, and a reset takes it along. The chip meanwhile said "Local" under a monitor icon. Work now falls through to the plain branch chip, the same branch a project that is not in git already takes. Code is untouched, and the bar stays gated on the non-prod channel as before. Co-Authored-By: Claude Opus 5 (1M context) <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.
Three fixes to the new-session screen when it is reached through the Work
tab. All of them are the same underlying miss: that screen did not know which
side it was on.
1. The project picker offered every server's projects
Opened from Work it listed the local machine's projects under a "Local Server"
heading beside the sandbox's own — and picking one started the session on the
local machine, outside any sandbox, with nothing on screen to say so.
createPromptProjectControlsindexedserver.listin four places (the groupedproject list, the two server lookups behind select/add, and the
serverfieldthe controls hand back). All four now read one memo:
The side comes from the draft's own server (
serverSDK().server) ratherthan
useWorkspaceSide(), because a draft route mounts its own server(
ResolvedDraftRouteinapp.tsx) and the sidebar's side is not guaranteed toagree with it.
With one server on the side the picker takes the same single-server branch Code
has always taken — no group headings, no server submenu — which is the correct
shape for a machine with one sandbox.
2. "Add project" browsed the inside of the sandbox
Adding a project to a sandbox means giving it a folder from this computer.
The menu entry ran upstream's directory picker against the server it is pointed
at, which for a sandbox is the guest's own filesystem — nothing the user has
ever put a project in.
On Work it now opens the mounts dialog the Work sidebar's add button already
opens, labelled Mount project like every other route to it
(
sandbox.server.mounts).PromptProjectControlsgains an optionalmountflag for the label; the three call sites (sidebar button, sidebar empty-state
prompt, this picker) share one
useSandboxMountDialog()hook instead ofrepeating the lazy import.
3. The "Local" workspace chip is now Code-only
That chip creates a git worktree on the server the session runs on —
Global.Path.data/worktree/<projectID>inpackages/opencode/src/worktree/index.ts. In a sandbox that is the guest's owndata dir, which is not one of the host folders the sandbox mounts
(
packages/codev-sandbox/src/mounts.ts): the work happens where your editorcannot see it, and a reset re-clones the guest disk and takes it along. The
chip meanwhile read "Local" / "Local repository" under a monitor icon.
showWorkspaceBargainssideForServer(serverSDK().server) === "code". Workfalls through to the plain branch chip, the same branch a non-git project
already takes.
newSessionWorktree()already returned"main"whenever the baris hidden, and
"main"insubmit.tsmeans "leavesessionDirectoryalone" —it does not redirect a session to the project root.
Worth recording for whoever reopens this: a guest worktree cannot be made
usable from the host by moving the checkout, because a worktree's
.gitfileholds an absolute path back to
<repo>/.git/worktrees/<name>and that path is/mnt/<name>in the guest and the real path on the host. Andgit worktree addruns with
cwd= the mounted host repo either way, so it registers the worktreein the user's real
.gitno matter where the checkout goes. The DIVERGENCES rowcarries the full reasoning and the three storage designs that were costed.
Notes
DIVERGENCES.mdgains two rows (all four touched app files are upstream's);CHANGELOG.mdgains three Unreleased entries under Sandbox. Fork-only new file:packages/app/src/sandbox/mount-dialog.tsx.Testing
bun typecheckinpackages/appbun run test:unit(702 pass) andbun run test:browser(101 pass) inpackages/appNot driven in the desktop app: the Work side cannot be exercised from the web
e2e harness (that build has no sandbox platform, so
effectiveSidecollapses itto Code).
🤖 Generated with Claude Code