fix(runtimes): persist model-list requests in DB to fix multi-instance 404#1974
Open
forrestchang wants to merge 1 commit intomainfrom
Open
fix(runtimes): persist model-list requests in DB to fix multi-instance 404#1974forrestchang wants to merge 1 commit intomainfrom
forrestchang wants to merge 1 commit intomainfrom
Conversation
…-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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
ModelListStorefrom in-memory to PostgreSQL (newmodel_list_requesttable)PopPendingusesFOR UPDATE SKIP LOCKEDfor safe concurrent access from heartbeat handlersModelListStorerinterface;DBModelListStorefor production,InMemoryModelListStorefor unit testsUI improvement:
Note: The
LocalSkillListStorehas the same in-memory pattern and may have the same issue in multi-instance deploys. Filed separately to keep this PR focused.Test plan
TestModelListStore_RunningRequestTimesOutpasses (updated to useInMemoryModelListStore)TestReportModelListResult_PreservesDefaultpassesmake checkin CI