fix(app): show server-known projects in project lists - #47208
Open
weiconghe wants to merge 1 commit into
Open
Conversation
Projects known to the server but never opened through the UI (agent-created or CLI-registered directories) now appear after the user-opened ones in the home project panel and session sidebar, newest first, capped at 10. Autoselect and 'add project' keep reading the persisted store so known-only entries never trigger auto-opening or skip persistence.
weiconghe
force-pushed
the
fix/app-sidebar-known-projects
branch
from
September 4, 2026 04:15
4bf228e to
3f80f0e
Compare
Contributor
Author
|
The For what it's worth, I did search before opening: no open PR references #43072, and a keyword search over open PRs ( |
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.
Issue for this PR
Closes #43072
Type of change
What does this PR do?
The project list in the home panel and the session sidebar is fed exclusively by a locally persisted store (
Persist.global("server"), i.e.opencode.global.dat), and the only thing that ever writes to it iscreateServerProjects.open()when a project is opened through the UI. The server-side project list (/project, fetched once at startup byloadProjectsQueryinpackages/app/src/context/global-sync/bootstrap.ts) goes intoglobalStore.projectand is never merged into either list. So a project the agent creates during a chat — or any directory the CLI has registered — never shows up in the app, even after a restart; the only workaround is adding the folder manually through the project picker.This makes it look like the agent failed to create the project (that is exactly how the issue reporter experienced it), and it makes every CLI-known project invisible in the desktop/web app.
The fix appends server-known projects that were never opened after the user-opened ones, newest first, capped at 10 so a long CLI history can't flood the list:
knownProjectWorktrees()inpackages/app/src/context/server.tsx— pure helper: filters outglobaland empty worktrees, dedupes against opened projects viapathKey(soD:\xandD:/xmatch), sorts bytime.updateddescending, caps at 10.projectsListinpackages/app/src/context/global.tsx(home panel) andenrichedinpackages/app/src/context/layout.tsx(sidebar / page logic) now union the appended entries through the existingenrich(), so icons and metadata resolve the same way as for opened projects. The union is render-only — the persisted store still contains only user-opened projects.Two existing behaviors are intentionally kept on the raw store so the appended entries can't change their semantics:
packages/app/src/pages/layout.tsx) readsserver.projects.list()instead of the unioned list, otherwise a fresh install with server-known projects would auto-open one of them instead of restoring the last opened project.ctx.projects.opened(pre-union list), so explicitly adding a directory that is already server-known still persists it to the store.This follows the same direction as #41018, which made opening a project from home register it; this covers the projects nobody has opened yet.
How did you verify your code works?
bun run test:unitinpackages/app: 729 pass / 0 fail, including 5 new tests forknownProjectWorktrees(union order, cross-separator dedupe, cap,global/empty filtering, empty inputs).opencode serve(1.18.21, 13 projects registered in the local DB) plusbun devinpackages/appand a fresh browser profile:GET /projectreturns 13 projects;enrich().tsgo -btypecheck cannot run on my Windows checkout for pre-existing reasons:packages/app/src/custom-elements.d.tsis a symlink in the repo, and the Windows checkout materialized it as a 33-byte text file, so a cleandevcheckout already fails with TS1128 before any of my changes. CI will run the typecheck on Linux. I did not run the browser e2e suite locally.Screenshots / recordings
Before (13 server-known projects, panel empty):
After (same server, fresh profile, panel lists the capped known projects):
Checklist