NetLogo / NetLogo/Netlogo-LLM-Extension

bug: model override registry leaks across model directories

Open
#29 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Scala
Stars
1
Forks
0
Avg merge
3d 1h
Merged PRs (30d)
4

Description

Problem

ModelRegistry keeps override state in a mutable global map and does not clear provider overrides when a later model directory has no override file. This makes custom model registries sticky across unrelated NetLogo models in the same JVM session.

Current behavior

  • ModelRegistry.loadOverride(modelDir) merges override models into the shared providers map.
  • If the next model directory has no models-override.yaml, the method returns None and leaves the prior merged state intact.
  • There is no reset-to-bundled step when switching models or loading config from a directory without overrides.

Why this matters

This can leak one model’s custom registry into another model that never opted into it:

  • llm:list-models can show stale custom models
  • llm:set-model validation can succeed for models that should not exist in the current model directory
  • cross-model testing in one NetLogo session becomes non-deterministic

Affected code

  • src/main/providers/ModelRegistry.scala
  • src/main/config/ModelRegistryLoader.scala
  • src/main/LLMExtension.scala (load-config and list-models paths)

Suggested fix directions

  1. Separate bundled registry state from active override state.
  2. Recompute the effective registry from bundled + current-directory override each time the model directory changes.
  3. Explicitly clear overrides when no override file exists in the current directory.
  4. Add regression coverage for: model A with override -> model B without override -> llm:list-models must revert to bundled models.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing ModelRegistry.loadOverride in src/main/providers/ModelRegistry.scala and how ModelRegistryLoader.scala and LLMExtension.scala handle load-config and list-models. Compare the bundled and active provider state when moving from a model directory with models-override.yaml to one without it. Done means overrides no longer leak and regression coverage verifies that llm:list-models returns bundled models for the second directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.