Skip to content

server: /api/model and /api/provider return an empty catalog while a Location reboots after idle eviction #51701

Open

Description

@depler

Description

After a Location is evicted for inactivity and lazily rebooted, GET /api/model and GET /api/provider return 200 OK with an empty catalog for a short window, before the Location's plugin providers finish registering. The response is indistinguishable from a genuinely empty catalog, so clients consume it as authoritative.

Concrete impact: grinev/opencode-telegram-bot#257 treats the empty snapshot as "model has no image capability" and silently drops an incoming Telegram photo, even though the model supports images. Same class as #36117 (service-restart path) and #35556 (initial empty plugin generation); this report is the idle-eviction trigger with an external SDK client.

Plugins

  • opencode-cmd-provider 2.1.9 (provider commandcode)
  • tps-counter@git+https://github.com/depler/opencode-tps-counter.git

OpenCode version

2.0.18 (opencode serve --service --port 49374, managed service, npm release install)

Steps to reproduce

  1. Run a managed v2 server with at least one plugin provider (opencode-cmd-provider).

  2. Leave a Location idle for more than 60 minutes so it is evicted (sweep runs every minute):

    location services evicted  directory=/opt
    location services evicted  directory=/root
    
  3. Immediately issue the first Location-scoped read, e.g. GET /api/model (or GET /api/provider).

  4. Observe a 200 OK with an empty/partial catalog: {"data": []} (or providers present with zero models).

  5. Poll a few seconds later and observe the correct catalog once the plugin providers register.

Screenshot and/or share link

n/a

Operating System

Ubuntu 24.04, Linux 6.8.0-139-generic (x86_64)

Terminal

n/a — headless systemd service; the client is a Telegram bot using the bundled SDK.

Additional context

Server timeline (MSK = UTC+3, 2026-09-27):

19:20:22.193  location services evicted  directory=/opt
19:20:22.438  location services evicted  directory=/root
19:21:02.915  location services booted   directory=/opt   durationMs=256
19:21:04.386  location services booted   directory=/root  durationMs=1271
19:21:04.396  client GET /api/model -> empty
19:21:07.828  event provider.updated     directory=/root   <- models registered only here

The read returned ~10 ms after location services booted for /root, i.e. ~3.4 s before the plugin's models were registered.

Expected: model/provider reads should not present intermediate initialization state as authoritative — either await catalog readiness (as proposed in #36117) or expose readiness (e.g. 503 / Retry-After, or a ready marker) so a client can distinguish "not ready yet" from "no models".

Eviction cadence observed on this host today: 10:29:50, 12:06:56, 14:02:25, 16:20:22 — each after roughly an hour without activity for that Location.

Activity

  1. added
    needs:complianceThis means the issue will auto-close after 2 hours.
    and removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Sep 27, 2026
  2. github-actions commented on Sep 27, 2026

    @github-actions
    Contributor

    Thanks for updating the issue with the required description and helpful reproduction and system details!

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