[Bug]: Base Model dropdown shows no selection, and is always empty when opened from the labeling tool
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 105
- Forks
- 18
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 50
Description
Description
Two independent defects in the training form's Base Model dropdown (ui/src/Components/BaseModelDropdown.jsx).
1. The selected base model is never displayed. baseModelId is read in three places in BaseModelDropdown.jsx (the componentState destructure, the options.find that computes selectedOption, and the selectedOptions prop) but it is never written anywhere in the UI. handleOptionSelect only sets initialWeightsUrl.
The submitted payload is correct, because initialWeightsUrl is what training consumes, so this is a display-only defect. But the dropdown clears itself the moment you pick something, which reads as "the selection didn't take", and reopening an existing model never re-selects its catalog entry.
2. The catalog is empty when training is launched from the labeling tool. CreateEditModelTrainingModal declares eventTypes: proptypes.array.isRequired, but only two of its four render sites pass it:
| Render site | Passes eventTypes? |
|---|---|
ProjectManagement/LayerCard.jsx |
yes |
ProjectManagement/LayerRow.jsx |
yes |
LabelingTool/RightPanel.jsx |
no |
LabelingTool/LabelingToolRightPanel.jsx |
no |
fetchModelCatalog built its query by string concatenation, so "eventTypes=" + undefined produced the literal query eventTypes=undefined. The API treats that as a real event type, matches nothing, and returns an empty catalog.
Net effect: the dropdown populates when training is started from the project page, and is always empty when started from the labeling tool.
Additional notes
Two smaller problems in the same component, worth folding into any fix:
m.value.description.substring(0, 30)throws whendescriptionis null, which is common for externally catalogued checkpoints.- The option key falls back to
"none"for every entry without amodelId, so all external catalog entries collapse onto a single React key.baseModelNameis a safe fallback since the API already rejects duplicates with a 409.
Suggested fix, which I have working locally:
- Write
baseModelIdandinitialWeightsUrltogether in one functional state update. They must be a single update becauseonFormChangespreads a capturedcomponentState, so two sequential calls drop the first write. - Resolve
baseModelIdfrom an existinginitialWeightsUrlafter the catalog loads, so editing an existing model preselects correctly. - Replace the concatenated query with
URLSearchParams, omitting absent filters entirely rather than stringifying them, and unit test it. - Separately, fix the two labeling-tool components so they pass the
eventTypesprop they are declared to require. The query builder change makes the symptom go away, but the prop is still missing and will affect anything else that reads it.
One note for anyone reproducing this locally: GetModelCatalog, PutModelCatalog and DeleteModelCatalog are currently the only routes in function_app.py hardcoded to AuthLevel.FUNCTION rather than the AUTH_LEVEL constant, so they ignore DEVELOPMENT_MODE and return 401 against the compose stack. The dropdown cannot be exercised locally until that is changed.
Steps to Reproduce
- Catalog at least one model so
GetModelCataloghas something to return. - Open a project, expand an image layer, choose Train Model, and open the Base Model dropdown. Select an entry. (Defect 1)
- Open the same training form from inside the labeling tool right-hand panel and open the Base Model dropdown. (Defect 2)
Expected Behavior
- The dropdown displays the model you selected, and reopening a model that was trained from a base model preselects that entry.
- The dropdown lists the same catalog entries regardless of whether training was launched from the project page or from the labeling tool.
Actual Behavior
- The dropdown goes blank immediately after selection, and never preselects an entry when editing an existing model.
- From the labeling tool the dropdown is always empty, because the request goes out as
GetModelCatalog?eventTypes=undefined&imagerySource=<source>.
Confirmed directly against the API with a single catalogued entry:
| Request | Response |
|---|---|
GetModelCatalog?imagerySource=Planet |
returns the model |
GetModelCatalog?imagerySource=Planet&eventTypes=Hurricane |
returns the model |
GetModelCatalog?imagerySource=Planet&eventTypes=undefined |
{"modelCatalog": []} |
Environment
- Deployment type: local
docker/docker-compose.ymlstack - HASTE commit:
d1ecf64onmain - Browser-side only; reproduced against
hastefuncapirunning in the compose stack
Logs / Stack Trace
Not a crash. The failing request, from the browser network tab:
GET /api/GetModelCatalog?eventTypes=undefined&imagerySource=Planet
200 {"modelCatalog": []}
Checklist
- I have searched existing issues and confirmed this is not a duplicate.
- I have redacted any secrets, keys, or personal data from logs above.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ui/src/Components/BaseModelDropdown.jsx, tracing handleOptionSelect, catalog loading, and fetchModelCatalog, then compare the eventTypes prop at the four listed render sites, especially LabelingTool/RightPanel.jsx and LabelingTool/LabelingToolRightPanel.jsx. Add focused coverage for query construction and verify the dropdown selection, existing-model preselection, null descriptions, external-entry keys, and labeling-tool catalog behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, frontend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100