Conversation
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
|
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 |
Issue for this PR
Closes #39655
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 registers the server's working directory as an open project on connect
(once
sync.data.path.directoryis known), skipping the user's home dir andthe filesystem root, which the file finder cannot index. The project then
appears in the sidebar with its sessions, without a manual "Add project" step.
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.
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