[TUI] A leftover run config marks a model installed: the list checks the file name, not the files

Abierto Apto para principiantes
#6,240 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 5 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
83/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
cli

Línea de trabajo

Empieza por strata_cli/launch/catalog.py, especialmente por installed_config() y installed_configs(), y luego compara sus comprobaciones con strata_control.models.inspect_components() y strata_control.discovery.footprint(). Añade o adapta las dos pruebas propuestas para una configuración con archivos faltantes y otra con pesos presentes, usando los fixtures de la suite. El trabajo estará terminado cuando las pantallas de inicio y strata models list coincidan sobre si un modelo está instalado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Environment

  • Strata Terminal 0.1.62 (build 0.1.62, commit 64524fb9fc82), Windows 11 Pro 26300, CUDA 13 engine
  • Model: unsloth UD-IQ3_XXS (Qwen3.8-Flash-Next), served on port 8081

What happens

strata launch opens the guided screens. The model list marks nine models as (installed).
Only one of them is actually on this computer. The other eight have no weights, no pack, no
draft layer — their files were deleted or their data folder was moved, but their run configs
survived in %LOCALAPPDATA%\Strata\install\.

strata models list disagrees with the screens in the same build, which is the clearest sign
one of the two is wrong:

$ strata models list
deepseek-v4.1-flash-ista-das-coder  retired  DeepSeek-V4.1-Flash ISTA-DAS Coder
gyro-gyro-s              missing_or_invalid  qwen3.8-flash-next-gyro-gyro-s
iq3_s                    missing_or_invalid  qwen3.8-flash-next-iq3_s
iq3_xxs                  missing_or_invalid  qwen3.8-flash-next-iq3_xxs
qwen36-ud-q4_k_xl        missing_or_invalid  qwen3.6-35b-a3b-ud-q4_k_xl
swift-iq3_xxs            missing_or_invalid  swift-1.5-iq3_xxs
unsloth-ud-iq1_m         missing_or_invalid  qwen3.8-flash-next-unsloth-ud-iq1_m
unsloth-ud-iq3_xxs       present             qwen3.8-flash-next-unsloth-ud-iq3_xxs
unsloth-ud-q2_0          missing_or_invalid  qwen3.8-flash-next-unsloth-ud-q2_0
unsloth-ud-q2_k_xl       missing_or_invalid  qwen3.8-flash-next-unsloth-ud-q2_k_xl

The screens say installed for all nine; this command says installed for one.

The result is a contradictory UI: the row says (installed), and the Folder step for the same
model then says its files are gone and quotes a download size. Nothing blocks, but the list
is not usable for deciding what is on disk.

Why

strata_cli/launch/screens.py:457 prints the (installed) tag from r.installed, and
strata_cli/launch/catalog.py:449 sets it from a file name:

installed=bool(size.get("installed")) or self.installed_config(str(size["id"])) is not None,

installed_config() (catalog.py:658) only asks whether the config file exists:

def installed_config(self, tag: str) -> Path | None:
    name = f"strata-{tag.lower()}.json"
    for folder in [self.root, *[p.path for p in self.places if p.path != self.root]]:
        p = folder / name
        if p.is_file():
            return p
    return None

The model's files are never looked at. Everything else in the plugin already knows how to check
them: strata_control.models.inspect_components() (used by strata models list) and
strata_control.discovery.footprint(cfg, path).missing() both read the run config and test
each path.

Repro (standalone, read-only, no GPU, no model files)

Save as repro_installed_badge.py, run with the Terminal's own Python, passing the control
folder (or drop the argument and put the script inside it):

"C:\Users\%USERNAME%\AppData\Local\Strata\components\control\0.1.62\python\python.exe" repro_installed_badge.py "C:\Users\%USERNAME%\AppData\Local\Strata\components\control\0.1.62"
"""A leftover run config marks a model "installed", though its files are gone."""
from __future__ import annotations

import json
import sys
import tempfile
from pathlib import Path

CONTROL = Path(sys.argv[1]) if len(sys.argv) > 1 else Path(__file__).resolve().parent
sys.path.insert(0, str(CONTROL))

from strata_cli.launch.catalog import Catalog  # noqa: E402


def main() -> int:
    tmp = Path(tempfile.mkdtemp(prefix="strata-installed-"))

    # A run config naming a weights file that is not on disk: what a model whose
    # files were deleted (or whose data folder moved) leaves behind.
    missing_weights = tmp / "gone.gguf"
    (tmp / "strata-iq3_s.json").write_text(json.dumps({
        "exe": "engine.exe",
        "tokenizer": "tokenizer.model",
        "model_name": "qwen3.8-flash-next-iq3_s",
        "args": ["--model", str(missing_weights), "--max-context", "65536"],
    }), encoding="utf-8")

    catalog = Catalog(root=tmp)
    found = catalog.installed_config("iq3_s")

    print(f"weights on disk:  {missing_weights.exists()}")
    print(f"installed_config: {found}")
    if found is not None:
        print("\nBUG: the launch screens mark this model '(installed)' from the file name alone.")
        return 1
    print("\nOK: a config without its files is not treated as installed.")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())

At 0.1.62 that prints weights on disk: False and still returns the config path, exit 1.

Test for the suite

def test_a_run_config_without_its_files_is_not_installed(tmp_path):
    """A leftover run config must not mark a model installed (screens.py `r.installed`)."""
    from strata_cli.launch.catalog import Catalog

    (tmp_path / "strata-iq3_s.json").write_text(json.dumps({
        "exe": "engine.exe",
        "tokenizer": "tokenizer.model",
        "args": ["--model", str(tmp_path / "gone.gguf"), "--max-context", "65536"],
    }), encoding="utf-8")

    catalog = Catalog(root=tmp_path)
    assert catalog.installed_config("iq3_s") is None


def test_a_run_config_with_its_files_is_installed(tmp_path):
    """The other half: the same config, weights present, stays installed."""
    from strata_cli.launch.catalog import Catalog

    weights = tmp_path / "model.gguf"
    weights.write_bytes(b"GGUF")
    (tmp_path / "strata-iq3_s.json").write_text(json.dumps({
        "exe": "engine.exe",
        "tokenizer": "tokenizer.model",
        "args": ["--model", str(weights), "--max-context", "65536"],
    }), encoding="utf-8")

    catalog = Catalog(root=tmp_path)
    assert catalog.installed_config("iq3_s") is not None

The first test is red at 0.1.62 and green once installed_config checks the config's footprint.
The second keeps a fix from turning into "no model is ever installed". Please adjust the
Catalog(...) construction to whatever the suite's fixtures already use.

Suggested fix

In Catalog.installed_config(), after finding the file, confirm the paths it names are there
before returning it:

from strata_control import discovery
try:
    cfg = json.loads(p.read_text(encoding="utf-8-sig"))
except (OSError, ValueError):
    return None
if discovery.footprint(cfg, p).missing():
    return None
return p

missing() covers weights, the pack, the draft layer and the picture reader, and reports a
helper that is gone as missing too — if only helpers matter for the badge, discovery.Footprint
could grow an weights_only check. rows() already calls apply_disk(), which stats the model
folder, so the extra reads are on a handful of configs, once per list build.

The same name-only test is used by catalog.py:638 installed_configs(); whatever the fix, both
should agree with strata_control.models.inspect_components() so the screens and
strata models list cannot disagree again.

Related

  • #6108 (closed) — /v1/models could not read the downloaded list when no model was installed.
    Same area, opposite symptom.
  • #4511 — the GUI showing a false "not installed" for models that are there. Both come from the
    list and the inspector disagreeing about what "installed" means.
Lenguaje dominante
C++
Estrellas
11.6k
Forks
1k
Merge medio
18 d 13 h
PR fusionados (30 d)
4

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Niko1221/Strata

Todos los issues de Niko1221/Strata

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.