[PR #4317] [CLOSED] [TUI] a saved preset's lower-case model tag reaches setup as its key (Fix #4209) #5003

Closed
opened 2026-11-07 16:31:57 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4317
Author: @XiaoBinGan
Created: 10/27/2026
Status: ❌ Closed

Base: main ← Head: fix/preset-model-tag


📝 Commits (1)

  • 2f9f877 Fix #4209: a saved preset's lower-case model tag reaches setup as its key

📊 Changes

2 files changed (+36 additions, -0 deletions)

View changed files

📝 strata_cli/launch/runner.py (+4 -0)
📝 tests/terminal/test_launch.py (+32 -0)

📄 Description

Problem and result

Starting a saved preset with any choice that differs from the installed config (--vision off, --kv,
--context) reruns setup.py, which then stops:

strata: The model could not be installed. Run it again: finished steps are skipped.
setup.py: error: argument --model: invalid choice: 'iq3_xxs' (choose from 'Q2_0', 'IQ2_XS', 'IQ3_XXS', ...)

Two halves disagree about a model's name. strata_cli/launch/settings.py writes the choice into the preset
as a lower-case tag (--model iq3_xxs), LaunchRunner.setup_args() forwards it unchanged, and
setup.py's --model choices are the MODELS table's own keys, which are case-sensitive. Typing
--model iq3_xxs on the command line works, because cmd.py normalises it through Catalog.resolve();
the preset path never reaches that.

After this change the preset path uses the same resolver, so setup_args() carries --model IQ3_XXS and the
re-run installs instead of stopping.

Related discussion: #4209 — the report, including the setup log line and the two lines it points at.

Approach

def setup_args(self) -> list[str]:
    cat, s = self.catalog, self.s
    fam, model = s.family, s.model
    try:                     # a saved preset keeps the lower-case tag ("iq3_xxs", #4209), while setup's
        fam, model = cat.resolve(str(model), None if fam is None else str(fam))    # --model takes its key
    except ValueError:       # an unknown name is setup's to report, in its own words
        pass
  • Catalog.resolve() is the resolver the command line already uses, so a preset and a typed command now
    agree. It also normalises the family when a family-free name is ambiguous.
  • A name that cannot be resolved is left exactly as it was, so setup still reports it with its own message
    and its own "did you mean" list. Nothing is refused here that was not refused before.
  • No other argument changes: the list this method builds is otherwise byte-identical (the tests below check
    the neighbours).

Validation

Passed: py -m pytest tests/terminal/test_launch.py -q (Python 3.11.16, from a source checkout):
5 failed, 110 passed, 1 skipped. The five failures are pre-existing on this Windows checkout: with
strata_cli/launch/runner.py reverted, the same file is 6 failed, 109 passed, 1 skipped — the sixth is
the new test, and it fails with the reported symptom:

>       self.assertEqual(args[args.index("--model") + 1], "IQ3_XXS")
E       AssertionError: 'iq3_xxs' != 'IQ3_XXS'
tests\terminal\test_launch.py:354: AssertionError

Passed: the new cases: a lower-case tag for qwen (iq3_xxs → IQ3_XXS), coder (iq1_m → IQ1_M),
gyro (gyro-s → Gyro-S), a name already in the table's spelling (IQ3_S) and the family the preset
carries; and an unknown name (not-a-model) still reaching setup unchanged.

Failed: none of the new cases.

Not run: a real preset start on Windows as in the report: that needs a model installed on this host and a
GPU the checkout can drive, and the report already shows the failure. I did not repeat the end-to-end start
and am not claiming I did.

Not run: pytest tests/terminal as a whole: only the file this change touches and its neighbours were run
(test_launch.py), plus the other suites listed in #4314/#4315 work, which do not import this method.

Limits

  • Only the preset/choices path is fixed. A preset whose model was saved under a name the catalog no longer
    offers still reaches setup, which reports it, as before.
  • The family is resolved too, so a preset saved with an ambiguous name now carries the family the resolver
    picks rather than the family as saved. That is the same answer the command line gives for the same name.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4317 **Author:** [@XiaoBinGan](https://github.com/XiaoBinGan) **Created:** 10/27/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/preset-model-tag` --- ### 📝 Commits (1) - [`2f9f877`](https://github.com/Niko1221/Strata/commit/2f9f877108d2c90f1a8ef2d30cd030866de88f0b) Fix #4209: a saved preset's lower-case model tag reaches setup as its key ### 📊 Changes **2 files changed** (+36 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `strata_cli/launch/runner.py` (+4 -0) 📝 `tests/terminal/test_launch.py` (+32 -0) </details> ### 📄 Description ## Problem and result Starting a saved preset with any choice that differs from the installed config (`--vision off`, `--kv`, `--context`) reruns `setup.py`, which then stops: ```text strata: The model could not be installed. Run it again: finished steps are skipped. setup.py: error: argument --model: invalid choice: 'iq3_xxs' (choose from 'Q2_0', 'IQ2_XS', 'IQ3_XXS', ...) ``` Two halves disagree about a model's name. `strata_cli/launch/settings.py` writes the choice into the preset as a lower-case tag (`--model iq3_xxs`), `LaunchRunner.setup_args()` forwards it unchanged, and `setup.py`'s `--model` choices are the `MODELS` table's own keys, which are case-sensitive. Typing `--model iq3_xxs` on the command line works, because `cmd.py` normalises it through `Catalog.resolve()`; the preset path never reaches that. After this change the preset path uses the same resolver, so `setup_args()` carries `--model IQ3_XXS` and the re-run installs instead of stopping. Related discussion: #4209 — the report, including the setup log line and the two lines it points at. ## Approach ```python def setup_args(self) -> list[str]: cat, s = self.catalog, self.s fam, model = s.family, s.model try: # a saved preset keeps the lower-case tag ("iq3_xxs", #4209), while setup's fam, model = cat.resolve(str(model), None if fam is None else str(fam)) # --model takes its key except ValueError: # an unknown name is setup's to report, in its own words pass ``` - `Catalog.resolve()` is the resolver the command line already uses, so a preset and a typed command now agree. It also normalises the family when a family-free name is ambiguous. - A name that cannot be resolved is left exactly as it was, so setup still reports it with its own message and its own "did you mean" list. Nothing is refused here that was not refused before. - No other argument changes: the list this method builds is otherwise byte-identical (the tests below check the neighbours). ## Validation **Passed:** `py -m pytest tests/terminal/test_launch.py -q` (Python 3.11.16, from a source checkout): **5 failed, 110 passed, 1 skipped**. The five failures are pre-existing on this Windows checkout: with `strata_cli/launch/runner.py` reverted, the same file is **6 failed, 109 passed, 1 skipped** — the sixth is the new test, and it fails with the reported symptom: ```text > self.assertEqual(args[args.index("--model") + 1], "IQ3_XXS") E AssertionError: 'iq3_xxs' != 'IQ3_XXS' tests\terminal\test_launch.py:354: AssertionError ``` **Passed:** the new cases: a lower-case tag for `qwen` (`iq3_xxs` → `IQ3_XXS`), `coder` (`iq1_m` → `IQ1_M`), `gyro` (`gyro-s` → `Gyro-S`), a name already in the table's spelling (`IQ3_S`) and the family the preset carries; and an unknown name (`not-a-model`) still reaching setup unchanged. **Failed:** none of the new cases. **Not run:** a real preset start on Windows as in the report: that needs a model installed on this host and a GPU the checkout can drive, and the report already shows the failure. I did not repeat the end-to-end start and am not claiming I did. **Not run:** `pytest tests/terminal` as a whole: only the file this change touches and its neighbours were run (`test_launch.py`), plus the other suites listed in #4314/#4315 work, which do not import this method. ## Limits - Only the preset/choices path is fixed. A preset whose model was saved under a name the catalog no longer offers still reaches setup, which reports it, as before. - The family is resolved too, so a preset saved with an ambiguous name now carries the family the resolver picks rather than the family as saved. That is the same answer the command line gives for the same name. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:31:57 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5003
No description provided.