Skip to content

ACP: first session/new per process omits the built-in opencode provider from configOptions #52729

Closed

Description

@klonuo

Description

In a fresh opencode acp process, the first session/new returns a configOptions.model list that omits the built-in opencode provider. A second session/new in the same process returns the complete list. The same models are present in opencode models from the start.

Plugins

No response

OpenCode version

2.0.22

Steps to reproduce

initialize            { protocolVersion: 1, clientCapabilities: { fs: {...} }, clientInfo: {...} }
session/new  #1       { cwd: "<abs>", mcpServers: [] }
   -> configOptions[model].options: 771 entries, 0 start with "opencode/"
session/new  #2       { cwd: "<abs>", mcpServers: [] }   (same process, nothing else called)
   -> configOptions[model].options: 744 entries, 9 start with "opencode/"

Observed deterministically across repeated fresh processes:

new #1 -> n=771 opencode=0 current=openrouter/unbiased/pareto-26.10-preview
new #2 -> n=744 opencode=9 current=openrouter/unbiased/pareto-26.10-preview

What is not the cause (tested)

  • Not a wait/startup-race that another second fixes: sleeping 0/1/2/3/5/8s after initialize and before the first session/new always yields opencode=0.
  • Not model selection per se: re-setting model to the current value (openrouter/unbiased/pareto-…) returns opencode=0; setting configId: "mode" returns opencode=0.
  • Forcing the provider works: session/set_config_option(configId="model", value="opencode/…") returns the complete list (9 opencode/*) because resolving a model from that provider loads it.
  • session/resume as the first call is also incomplete: resuming a session whose saved model is opencode/big-pickle returns currentValue=opencode/big-pickle but only 771 options, 0 opencode/.

Expected

The first session/new (and session/resume) in a process should return the same complete configOptions as later calls and as opencode models.

Actual

The first session snapshot is built before the built-in opencode provider is registered; creating a session then triggers its load, so subsequent sessions include it.

Likely cause

In packages/opencode/src/acp/service.ts, newSession() builds configOptions from loadDirectorySnapshot() → sdk.config.providers({ directory }). On the first request the built-in opencode provider is not yet present in that map (its registration appears to happen as a side effect of session creation/provider resolution). defaultModelFromConfig() therefore can't prefer it either, and falls back to the globally sorted best model. Later sessions see the now-registered provider.

Screenshot and/or share link

No response

Operating System

Windows

Terminal

No response

Activity

  1. github-actions commented on Oct 2, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    • #50236: ACP session/new omitted configured providers/models from its catalog while provider registration was pending.
  2. klonuo commented on Oct 2, 2026

    @klonuo
    Author

    It is same issue, but that obviously didn't fix it and it is closed

  3. nexxeln commented on Oct 6, 2026

    @nexxeln
    Contributor

    Fixed by #53358 on v2. The ACP catalog now waits for a cold location's plugins to finish loading before its first read, so the first session/new lists the opencode provider models along with the rest. It ships in the next release.

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

Metadata

Metadata

Assignees

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