Skip to content

[Bug]: OpenCode picker drops configured models after a cold project folder settles on built-ins only #41545

Done

Description

@Parideboy

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Define custom providers in the global OpenCode config (~/.config/opencode/opencode.json), enough that OpenCode takes a moment to load them. Here: 6 configured providers plus 2 built-in ones, 398 models in total.
  2. Leave Server URL blank so T3 Code spawns its own OpenCode 2 server.
  3. Open a thread whose folder OpenCode has not loaded yet (any folder right after the managed server starts) and open the model picker on the OpenCode tab.

Expected behavior

The picker lists the configured models, the same ones Settings → Providers → OpenCode shows.

Actual behavior

The full list shows for a moment, then the picker drops to the built-in opencode/… models only. If those are hidden in the provider's model preferences, it shows "No models found". orchestrator_capabilities reports the same partial list for that thread, and delegate_task rejects the configured models.

OpenCode loads a cold location in steps. Measured against a fresh opencode serve (2.4.0) on Windows, polling GET /api/provider?directory=… in a loop:

Time after the first read Providers Models
~100 ms 0 0
~400 ms to ~800–1600 ms 2 (built-in) 100
after the location's model.updated event 8 398

snapshotForCwd reads the location's catalog through readSettledOpenCode2Catalog, which accepts the first two identical reads 250 ms apart. The built-in step lasts longer than that, so two reads agree on it and the partial catalog is accepted as settled. workspaceModelsFor then replaces the machine catalog with it, because it differs from the machine models.

#35049 fixed the empty first read (#15994), but a partial step that holds still for over 250 ms still passes as settled.

OpenCode reports when the step ends: it emits model.updated for the location once the configured providers are loaded. The event names the project location that contains the folder, as GET /api/location reports it (for a folder with no repository of its own, its parent root), not the folder T3 Code asked about.

Impact

Major degradation or frequent failure

Version or commit

T3 Code 0.1.12-nightly.20261123.5138; the same code is on main at f2ec853f.

Environment

Windows 11 x64, desktop app, OpenCode 2.4.0, managed server (no serverUrl).

Logs or stack traces

event stream on a fresh server while the catalog loads (abridged):
[461 ms]  project.updated   location C:\Users\<user>
[477 ms]  GET /api/model -> 0 models
[957 ms]  GET /api/model -> 100 models
[1138 ms] config.updated
[1367 ms] provider.updated
[1381 ms] model.updated
[1447 ms] GET /api/model -> 398 models

Workaround

Point Settings → Providers → OpenCode → Server URL at an OpenCode server that is already running (for example opencode service), so locations are warm before T3 Code reads them.

Activity

  1. juliusmarminge commented on Nov 23, 2026

    @juliusmarminge
    Member

    Fixed by #41626, now on main: After opening a cold project folder, its configured OpenCode models now appear automatically when OpenCode emits model.updated, correcting the built-in-only catalog in the picker and the server inventory used by orchestrator_capabilities and delegate_task.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions