Skip to content

[Bug]: OpenCode models remain cached after logout or plugin removal #4056

Description

@RespectMathias

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. Connect an OpenCode upstream provider such as GitHub, or install an OpenCode plugin that adds models.
  2. Start T3 Code and confirm those models appear.
  3. Log out of the provider or remove the plugin.
  4. Refresh or restart T3 Code.

Expected behavior

Models no longer reported by OpenCode should disappear from T3 Code.

Actual behavior

Removed models remain in the model picker and survive restarts. Clearing the OpenCode provider cache fixes it.

Root cause: OpenCode discovery correctly excludes disconnected or removed models, but mergeProviderModels in ProviderRegistry.ts always restores models missing from the refreshed snapshot. The merged result is then persisted to ~/.t3/caches/opencode.json, so the cache can never shrink.

Successful OpenCode inventory results should be authoritative. Previous models should only be retained during pending or failed probes. Cursor-specific merge behavior should remain unchanged.

Impact

Minor bug or occasional failure

Version or commit

main @ fdca154

Environment

OpenCode provider

Logs or stack traces

Screenshots, recordings, or supporting files

opencode-cli-kilo-plugin-uninstalled.png
opencode-cli-kilo-plugin-installed.png
t3-kilo-plugin-installed.png
t3-kilo-plugin-uninstalled.png

Workaround

Stop T3 Code, delete ~/.t3/caches/opencode.json, and restart. Custom OpenCode instances use their instance ID as the cache filename.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions