anomalyco / anomalyco/opencode

bug(core): empty git repos share the same "global" project ID, causing sessions to leak across unrelated directories

Open
#39,773 1 comment 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Jul 31, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

When opencode runs inside a Git repository that has no commits and no remote, project resolution falls back to project_id = "global" for ALL such repos. This causes session.list to return sessions from completely unrelated directories.

For example, repos at:
/home/user/testing (empty repo)
/home/user/projeto-a (empty repo)
/home/user/Área de trabalho/teste_Engram (empty repo)

all get project_id = "global". When you open /sessions in any of them, you see sessions from all of them mixed together because listByProject filters only by project_id, not by directory.

Expected: each directory/repo should have its own project identity (or at least sessions should be scoped by directory when project_id is global).

Plugins

No response

OpenCode version

1.18.10

Steps to reproduce
  1. mkdir -p /tmp/repo-a /tmp/repo-b
  2. cd /tmp/repo-a && git init && opencode # starts TUI
  3. In another terminal: cd /tmp/repo-b && git init && opencode
  4. Create a session in repo-a (e.g. "session from A")
  5. Create a session in repo-b (e.g. "session from B")
  6. In either TUI, type /sessions
    → Both "session from A" and "session from B" appear
Screenshot and/or share link

No response

Operating System

Fedora Linux 44 (KDE Plasma Desktop Edition) x86_64

Terminal

Konsole

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.