Skip to content

OpenCode harness reports Signed out while OpenCode is signed in: the isolated database never receives the user's credentials #781

Open

Description

@AliRezaei-Code

Summary

The OpenCode harness reports Signed out and its catalog collapses to the anonymous free models, even though opencode itself is signed in to several providers. Running the suggested repair does not help.

Environment

  • orx 0.2.21 (macOS desktop app)
  • OpenCode 2.0.32 (~/.opencode/bin/opencode)
  • 13 stored credentials in OpenCode: OpenCode Go, OpenCode Console, Anthropic, OpenAI, Google, Cerebras, GitHub Copilot, OpenRouter

What happens

GET /api/harnesses reports:

{ "id": "opencode", "authenticated": false, "authState": "ready", "agentReady": true,
  "models": ["opencode/big-pickle", "opencode/deepseek-v4.1-flash-free", ...] }

9 models, every one of them opencode/*-free. The Settings page shows the amber Signed out badge, and the model picker has no paid model from any connected provider.

Cause

orx runs OpenCode against an isolated database (OPENCODE_DB=…/agents/opencode/opencode.db) so sessions never touch the user's own history. But OpenCode does not follow OPENCODE_DB for credentials — they live in the credential table of the user's own database:

$ opencode auth list                     # 13 entries
$ OPENCODE_DB=…/agents/opencode/opencode.db opencode auth list   # the same 13 entries

$ sqlite3 ~/.local/share/opencode/opencode.db "select count(*) from credential;"
13
$ sqlite3 ~/.local/share/openresearch/agents/opencode/opencode.db "select count(*) from credential;"
0

So the server orx spawns has no credential to report: /api/integration has no connections, authenticated is false, and only the free models are selectable.

The remedy the app suggests — OPENCODE_DB=… opencode auth login, which is also what the Sign in button runs — writes back to the user's own database, so the isolated one stays empty. That is why running it appears to do nothing.

Proposed fix

Copy the credential tables (credential, account, account_state, control_account) from the user's database into the isolated one before OpenCode is started, one-way and additively. Opening PR with tests and a measurement against a real installation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions