Repository navigation
Description
Write using OX Alpha.
OX Alpha를 통해 작성함.
Description
Sessions created from the shell side (TUI, opencode run, or agents) never appear in the web UI Home. The Home page renders an empty Projects sidebar (only "Add project") and "Nothing here yet — Create a session to get started", even though everything is fine on the server side:
GET /api/session?limit=5000&order=desc→ 200 with all sessions (verified with 30+)GET /project→ 200 with the projectsopencode session list(CLI) lists them all- the SQLite store (
~/.local/share/opencode/opencode.db) contains them
The web app itself fetches both endpoints at boot (confirmed via network log in headless Chromium) and still renders nothing.
Root cause
The web Home renders its project list exclusively from a browser-localStorage registry, not from any server state:
// localStorage["opencode.global.dat:server"]
{
"list": [],
"projects": { "local": [ { "worktree": "/workspace", "expanded": true } ] },
"lastProject": { "local": "/workspace" },
"recentlyClosed": {}
}- On a fresh browser profile this key does not exist → empty sidebar + empty recent sessions, no matter what exists server-side.
- The only way to populate it is clicking Add project and opening the directory through the web once. It then persists — but per browser profile, not per machine or user.
- Sessions created by the CLI/TUI in a project that was never opened through the web are therefore invisible in the web UI indefinitely.
What it is NOT (each verified)
- Not a server-side data problem — the client receives the full session list and drops it at render time.
- Not related to the directory the server was started in — the app doesn't even call
/api/locationat boot; server cwd is irrelevant. - Not a relative/absolute path resolution issue —
/api/sessionreturns every session with itslocation.directory; the client just doesn't use them for the Home list. - Not fixed in v1.18.23 — checked the release notes (Core/TUI fixes only).
- Deep-linking
/session/<id>does not help: that path is handled by the REST API and returns raw session JSON instead of the SPA route. - Clearing localStorage makes it worse (it deletes registered projects; it does not trigger any re-discovery).
Additional gotcha for anyone patching around this
The app ships a strict CSP: script-src 'self' 'wasm-unsafe-eval' 'sha256-…'. Inline <script> injection into index.html is silently blocked — a workaround must serve its script as an external same-origin file.
OpenCode version
1.18.22 (npm package opencode-ai@1.18.22; the served web bundle self-reports 1.18.21). Latest release 1.18.23 checked — no relevant web changes.
Steps to reproduce
- Start
opencode serve(oropencode web). - Create sessions from the CLI/TUI in one or more directories (e.g.
/workspace,/tmp/project-a). - Open the web UI in a fresh browser profile.
- → Projects sidebar: empty (only "Add project"); Recent sessions: "Nothing here yet".
- DevTools network log shows
GET /api/session?limit=5000&order=desc → 200 (N sessions)andGET /project → 200— data arrives, UI ignores it. - Click "Add project" → pick one of the directories → all its shell sessions appear instantly; the
opencode.global.dat:serverkey appears in localStorage and survives reload (per profile).
Workaround (deployed and verified)
A tiny zero-dependency reverse proxy that injects a same-origin "seeder" script into the served index.html. Before the app boots, the seeder reads /api/session + /project, computes every directory that has sessions (plus non-global project worktrees), and merges missing entries into the localStorage registry — idempotent, and it keeps picking up newly created shell project directories on later loads.
Result on a fresh profile: all projects containing shell sessions appear in the sidebar, and all their sessions are listed and clickable without any manual step. Verified with headless Chromium (fresh profile): reload-persistent, session open works, no console errors.
Code (proxy + launcher): https://gist.github.com/tak2-08/017e32bc7c5429a9229d258eef09849b
opencode-web # proxy on :46000 → opencode serve on :46017
opencode-web 8080 # custom UI portSuggested upstream fix (any of)
- Home could union the localStorage registry with projects that actually have sessions (
/project∪ sessionlocation.directory), or - provide a "show all projects with sessions" toggle, or
- persist the project registry server-side so it isn't tied to each browser profile.
Operating System
Debian bookworm-based Docker container, linux/arm64 (headless; web tested in Chromium).
Plugins
None.
한국어 요약 (Korean summary)
현상 (Description)
쉘 쪽(TUI, opencode run, 에이전트)에서 만든 세션이 웹 UI 홈에 절대 나타나지 않음. Projects 사이드바는 비어 있고("Add project"만 표시), 최근 세션 영역에는 "Nothing here yet"이 렌더링됨. 그러나 서버 쪽 데이터는 전부 정상:
GET /api/session→ 세션 전체 반환 (30개 이상 확인)GET /project→ 프로젝트 반환- CLI
opencode session list→ 전부 표시 - SQLite(
~/.local/share/opencode/opencode.db)에도 정상 저장
웹 앱은 부팅 시 두 엔드포인트를 직접 받아옴(헤드리스 Chromium 네트워크 로그로 확인) — 그러면서도 렌더링하지 않음.
근본 원인 (Root cause)
웹 홈의 프로젝트 목록은 서버 상태가 아니라 브라우저 localStorage 등록부만 렌더링함:
// localStorage["opencode.global.dat:server"]
{ "projects": { "local": [ { "worktree": "/workspace", "expanded": true } ] }, ... }- 신규 브라우저 프로필에는 이 키가 없음 → 서버에 무엇이 있든 빈 화면.
- 채우는 유일한 방법은 웹에서 Add project로 디렉터리를 직접 여는 것. 이후 프로필 단위로만 유지됨(머신/사용자 단위 아님).
- 따라서 웹에서 한 번도 열지 않은 프로젝트의 쉘 세션은 웹에서 영원히 안 보임.
사실 확인 (각각 검증 완료)
- 서버 데이터 문제 아님 — 클라이언트가 전체 목록을 받아놓고 렌더링에서 버림.
- 서버 실행 디렉터리와 무관 — 앱은 부팅 때
/api/location조차 호출하지 않음. - 상대/절대 경로 분석 문제 아님 —
/api/session이location.directory포함 전체를 반환. - v1.18.23에서도 미수정(릴리즈 노트 확인).
/session/<id>직접 접근은 SPA 라우트가 아니라 REST API가 JSON으로 응답.- localStorage 삭제는 역효과(등록된 프로젝트가 지워질 뿐 재탐색 없음).
패치 시도자를 위한 주의점
웹은 엄격한 CSP(script-src 'self' 'sha256-…')를 사용 → index.html에 인라인 <script> 주입은 무음 차단됨. 우회 구현은 반드시 same-origin 외부 스크립트로 제공해야 함.
재현 절차 (Steps to reproduce)
opencode serve실행.- CLI/TUI로 여러 디렉터리(예:
/workspace,/tmp/project-a)에서 세션 생성. - 새 브라우저 프로필로 웹 UI 접속.
- → Projects 비어 있음, Recent sessions "Nothing here yet".
- 네트워크 탭에는
GET /api/session → 200 (N개),GET /project → 200이 정상 도착. - "Add project"로 해당 디렉터리를 열면 쉘 세션이 즉시 표시되고, localStorage 키가 생겨 새로고침 후에도 유지(프로필 단위).
임시 해결 (적용·검증 완료)
의존성 없는 리버스 프록시가 index.html에 same-origin "시더" 스크립트를 주입. 앱 부팅 전에 /api/session + /project를 읽어 세션이 존재하는 디렉터리(및 non-global 프로젝트 worktree)를 등록부에 병합 — 멱등하며, 이후 새로 만들어지는 쉘 프로젝트 디렉터리도 자동 반영.
새 프로필 기준 결과: 쉘 세션이 있는 모든 프로젝트가 사이드바에 표시되고, 세션 클릭 열기까지 수동 작업 없이 동작. 헤드리스 Chromium 신규 프로필에서 새로고침 유지·세션 오픈·콘솔 에러 없음 확인.
코드(프록시 + 런처): https://gist.github.com/tak2-08/017e32bc7c5429a9229d258eef09849b
opencode-web # 프록시 :46000 → opencode serve :46017
opencode-web 8080 # UI 포트 변경상위 수정 제안 (Suggested upstream fix)
- 홈에서 (localStorage 등록부) ∪ (실제 세션이 있는 프로젝트 =
/project∪ 세션의location.directory)를 표시하거나 - "세션 있는 프로젝트 모두 보기" 설정 제공 또는
- 프로젝트 등록부를 서버 측에 저장해 브라우저 프로필 종속성 제거.
환경 (Operating System)
Debian bookworm 기반 Docker 컨테이너, linux/arm64(헤드리스; 웹은 Chromium으로 테스트).
플러그인 (Plugins)
없음.
Activity
github-actions commentedon Aug 25, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Aug 25, 2026
Thank you for updating the issue. Unfortunately, it is still not compliant.
What still needs to be fixed:
The issue still contains an explicit note at the top stating it was "investigated and written by OX Alpha running inside OpenCode" — an AI agent. The content itself (including a full Korean translation and extensive AI-style prose) confirms this. AI-generated issue content is not acceptable per our guidelines.
Please rewrite this issue in your own words, describing what you personally observed and reproduced. A concise, human-written description of the bug is preferred over a long AI-generated writeup.
If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Aug 25, 2026
Thank you for editing the issue. Unfortunately, it is still not compliant.
What still needs to be fixed:
The issue still contains the explicit note stating it was "investigated and written by OX Alpha running inside OpenCode" — an AI agent. The full AI-generated content (including the complete Korean translation duplicating the entire issue) remains unchanged.
AI-generated issue content is not acceptable per our guidelines. Please rewrite this issue in your own words, describing what you personally observed and reproduced. A concise, human-written description is all we need — you don't need to include a full bilingual duplicate of the content.
If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Aug 25, 2026
Thank you for editing the issue. Unfortunately, it is still not compliant.
What still needs to be fixed:
The issue still contains the explicit disclosure at the top that it was "investigated and written by OX Alpha running inside OpenCode" — an AI agent. The full AI-generated content (including the complete Korean translation duplicating the entire issue) also remains unchanged.
AI-generated issue content is not acceptable per our guidelines. Please rewrite this issue in your own words, describing what you personally observed and reproduced. A short, human-written description is all that is needed — no bilingual duplicate is required.
If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Aug 25, 2026
Thanks for updating the issue! Everything looks good now — the bug report includes a clear description, root cause analysis, steps to reproduce, system info, and a verified workaround. The
needs:compliancelabel has been removed.Santo911ec commentedon Sep 7, 2026
Confirmo mismo root cause desde escenario remoto/Tailscale (relacionado a #47834):
Desktop 1.18.18 + CLI 1.17.8, Tailscale 1.102.3 (santo.tail83adec.ts.net 100.94.213.114). Mobile conectado por http://100.94.213.114:4100 (visor proxy a \opencode serve --hostname 0.0.0.0 --port 4098 --cors *\ con \XDG_STATE_HOME\ del Desktop).
\GET /session?limit=500\ (con y sin \projectID) siempre devuelve solo \global\ (131/283 en mi DB: global 131, scalerev 115, Karppaty 25, RCI 5). Sesiones de proyectos no-global como \ses_fdae59752ffelp4p6tAnCqSDEl\ (Karppaty/app, 'Inicializar API, web y repositorio Git') y \ses_f87d77c05ffepRwSy2Ieenc6zY\ (RCI, 'Phase 1 architecture planning') existen vía \GET /session/\ pero nunca aparecen en el listado global.
La web y la app móvil muestran \Aún no hay nada\ aunque \GET /api/project\ y \GET /api/session\ responden 200. En el móvil \DEV/\⊞\ no abren el selector.
Aporto que por Tailscale el bug se reproduce igual y que el workaround del proxy seeder de este issue funciona también para exponer todas las sesiones (usé un visor custom en :4100 que lee \opencode.db\ directo y ya veo las 283).
Si #47834 se considera duplicado, lo cierro y dejo el seguimiento aquí.
YouFoundJK commentedon Sep 10, 2026
This does fix my issues as well #48311. Closing that now as its a duplicate of this!
Mattheinrichs commentedon Sep 21, 2026
Flagging a related but distinct fix: #46520 (1 file) addresses sessions that belong to the
globalproject (created outside a git repo) being dropped from the Home list, because their directory never matches the global worktree/.That is not the client-side-registry problem this issue is about — but if part of what you're seeing is sessions existing on disk and still not showing, #46520 may cover that slice. As usual here: a 👍 on the PR is what keeps it from being auto-closed at the one-month mark.
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊