Skip to content

fix(runtimes): persist model-list requests in DB to fix multi-instance 404#1974

Open
forrestchang wants to merge 1 commit intomainfrom
agent/lambda/e842fc29
Open

fix(runtimes): persist model-list requests in DB to fix multi-instance 404#1974
forrestchang wants to merge 1 commit intomainfrom
agent/lambda/e842fc29

Conversation

@forrestchang
Copy link
Copy Markdown
Collaborator

Summary

Fixes #1958 — Model dropdown shows "No models available" when selecting agent runtime.

Root cause: The model-list discovery flow (POST create → poll GET) used an in-memory map[string]*ModelListRequest. In multi-instance deployments (hosted multica.ai), the POST could land on pod A while the subsequent poll GETs land on pod B, which returns 404 because it doesn't have the request in its memory.

Fix:

  • Move ModelListStore from in-memory to PostgreSQL (new model_list_request table)
  • All pods now share the same request state via the database
  • PopPending uses FOR UPDATE SKIP LOCKED for safe concurrent access from heartbeat handlers
  • Introduce ModelListStorer interface; DBModelListStore for production, InMemoryModelListStore for unit tests

UI improvement:

  • Model dropdown and model-picker now show "Could not discover models" on error, instead of the misleading "No models available"

Note: The LocalSkillListStore has the same in-memory pattern and may have the same issue in multi-instance deploys. Filed separately to keep this PR focused.

Test plan

  • Go build passes
  • Existing TestModelListStore_RunningRequestTimesOut passes (updated to use InMemoryModelListStore)
  • TestReportModelListResult_PreservesDefault passes
  • TypeScript typecheck passes across all packages
  • Run make check in CI
  • Verify model dropdown works in Desktop app after deploy

…-instance 404 (#1958)

The model-list discovery flow (POST create → poll GET) used an in-memory
map, so in multi-instance deployments the poll could land on a different
pod and return 404. Move the store to a database table so all pods share
the same state.

Changes:
- Add migration 068: model_list_request table with partial index
- Add sqlc queries with FOR UPDATE SKIP LOCKED for atomic PopPending
- Introduce ModelListStorer interface; DBModelListStore for production,
  InMemoryModelListStore for unit tests
- Update model-dropdown and model-picker to show "discovery failed"
  instead of misleading "No models available" on error

Co-authored-by: multica-agent <github@multica.ai>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
multica-docs Ready Ready Preview, Comment May 1, 2026 7:20am

Request Review

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.

[Bug]: Model dropdown shows "No models available" when selecting agent runtime

1 participant