Repository navigation
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #38992: fix(app): adopt the server directory when no project is open Why it's related: This PR addresses the same problem — handling the server's working directory when no project is currently open. Both PRs appear to be tackling the empty sidebar issue in fresh |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Thanks for this fix — it solves the empty web UI and is needed, but it only fixes the frontend. Please also consider reopening the two closed PRs that fix the deeper server issue:
The text interface already follows this policy — Container repro:
This PR #41138 makes the browser show the server's folder without manual steps (great), but the server is still on |
|
Somebody please merge this in, the web UI is presently useless for anyone who doesn't put their projects directly in their user home directory. |
|
sorry for missing the review. Will get on it now. |
On connecting to a server, open its working directory as a project so that a fresh `opencode web`/`serve` started in a folder surfaces that folder and its sessions in the UI, instead of an empty "Add project" screen. The web nav and session list are driven by the app's local open-projects store (keyed on worktree), not the server `/project` table. Previously nothing appeared until the user manually typed the folder path into the picker — a common first-run confusion that recurs across anomalyco#39655, anomalyco#39040, anomalyco#27837 and others. Skip the user's home directory and the filesystem root, which the file finder cannot index and would otherwise render as empty projects. Fixes anomalyco#39655
Opening the server directory on every connect re-opened it after the user closed it and pushed it to the top of an existing list. Move the logic into createServerProjects.adopt, which skips non-empty lists and recently closed directories. Guards follow anomalyco#38992. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
e8465bd to
48b222e
Compare
|
@ZipiDan thanks for testing this and for the Podman repro. I looked at both closed PRs before deciding what to do here:
Also, contributors can't reopen PRs someone else closed. That's up to the maintainers or the original authors. @Hona @Brendonovich (CODEOWNERS for |
…ver directory pathKey keeps "C:/" for a drive root, so the "/" check let it through. Desktop sidecars are started by the app rather than from a project folder, so their cwd is never a project. Move the path check into adoptable() so it is unit tested. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
adopt() reads the project list, so the effect re-ran whenever it changed and re-adopted the server directory when the user closed their last project. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Issue for this PR
Closes #37096
Related: #39655 (the empty sidebar part; a server started in the home dir is
intentionally not adopted, and the empty "Open Project" picker is #39434).
Type of change
What does this PR do?
A fresh
opencode web/servestarted in a folder showed an empty UI (noprojects in the sidebar, "Nothing here yet") even though the backend returns
projects and sessions. The web sidebar and session list are driven by the
app's local open-projects store (keyed on worktree), not the server
/projecttable, so until the user manually typed the folder path into the (empty)
picker, nothing appeared.
This adopts the server's working directory as an open project on connect
(once
sync.data.path.directoryis known), via a newcreateServerProjects.adopt. Adoption is deliberately narrow:reordered or added to;
/,C:\), which thefile finder cannot index and would otherwise appear empty;
from a project folder;
The first two guards follow #38992 (closed by the cleanup bot), which fixed the
same symptom in the same place.
How did you verify your code works?
bun), started the server in aclean scratch folder, and loaded the UI in a fresh browser context (no
persisted state): the launch folder appeared as a project with a new session.
in a fresh profile and checked again after reload: empty storage adopts the
folder; a recently closed folder stays closed; an existing project list is
left untouched; closing the last open project mid-session does not re-adopt
the folder.
server.test.tsforadopt(empty list, existing list,closed folder, per-server scope) and
adoptable(home,/,C:\, empty):17 pass.
bun run test:unitinpackages/app: 728 pass, 1 fail(
i18n/desktop-native.test.ts, fails identically ondev).bun typecheckinpackages/apppasses.Screenshots / recordings
Before: empty sidebar, "Nothing here yet"; after: the server's working
directory (
ocdemo) shown as a project with a session. (I can attach the PNGto the issue if needed.)
Checklist