Skip to content

fix(core): await initial plugin readiness before serving catalog reads - #40070

Open
zhang17-24 wants to merge 1 commit into
anomalyco:devfrom
zhang17-24:fix/36117-catalog-readiness
Open

fix(core): await initial plugin readiness before serving catalog reads#40070
zhang17-24 wants to merge 1 commit into
anomalyco:devfrom
zhang17-24:fix/36117-catalog-readiness

Conversation

@zhang17-24

Copy link
Copy Markdown

Issue for this PR

Closes #36117

Type of change

  • Bug fix

What does this PR do?

Cold-start catalog reads returned a successful but partial snapshot while initial catalog-producing plugins were still activating, so a client bootstrapping during that window saw incomplete providers/models as authoritative state.

PluginV2 now exposes a one-shot initial-readiness barrier (flush/sealInitial): the internal loader seals it once boot has finished, including externally configured plugins which now finish loading before boot completes. The provider.list, provider.get, and model.list handlers await the barrier before reading the catalog, returning 503 ServiceUnavailableError when readiness cannot complete within a bounded period (10s).

How did you verify your code works?

  • bun test test/plugin.test.ts (core) — 5 pass, incl. 2 new flush tests
  • bun test test/server/httpapi-catalog-readiness.test.ts (opencode) — new cold-start regression, pass
  • bun run typecheck (core, server) — pass
  • biome check — clean

Screenshots / recordings

N/A (not a UI change)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Cold-start catalog reads returned a successful but partial snapshot while
initial catalog-producing plugins were still activating, so a client
bootstrap during that window saw incomplete providers/models as
authoritative state.

PluginV2 now exposes a one-shot initial-readiness barrier: the loader
seals it once boot (including externally configured plugins) has
finished, and provider/model read handlers await it before reading the
catalog, returning 503 ServiceUnavailableError when readiness cannot
complete within a bounded period.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(server): await catalog readiness for model and provider reads

1 participant