[PR #683] [CLOSED] setup: a re-run of setup carries over the hand-edited config blocks (#629) #2763

Closed
opened 2026-11-04 02:02:56 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/683
Author: @hireymage
Created: 10/3/2026
Status: ❌ Closed

Base: main ← Head: fix-setup-config-preserve


📝 Commits (2)

  • cd74b39 setup: a re-run of setup carries over the hand-edited config blocks (#629)
  • a5f9a90 docs: say that a re-run of setup keeps hand-edited blocks (#629)

📊 Changes

3 files changed (+159 additions, -0 deletions)

View changed files

📝 docs/DETAILS.md (+4 -0)
📝 setup.py (+60 -0)
📝 tools/test_setup_choices.py (+95 -0)

📄 Description

What was broken (#629)

A fresh re-run of setup — START-HERE.bat --yes --family qwen --model IQ3_S --gpus 0,1 --context 131072, or answering the setup questions again to change the context length or the size — regenerated strata-<model>.json from scratch and quietly dropped everything the generator does not write itself:

  • the hand-edited sampling, mcp_servers and mcp blocks that DETAILS.md documents in the same file;
  • hand-set keys inside vision (cuda_device from the #408 workflow) and inside env (the STRATA_* values from DETAILS.md's table).

The install was fine afterwards: the engine ran. What was lost was visible only later — MCP tools gone, sampling back to defaults, and no message anywhere explaining the loss.

What it does now

setup.py regenerates the config the same way, then reads the earlier strata-<model>.json (whole-or-nothing, atomic-write semantics per #459) and carries over:

  • hand-authored top-level blocks — anything outside the keys setup's generator can write — verbatim, and names them: [ok] carried over from the earlier strata-q2_0.json: mcp; mcp_servers; sampling;
  • inside env and vision, only the hand keys survive: cuda_device, backend, STRATA_SPLIT_OWN and friends; what setup recomputes per install (exe, mmproj, max_tokens, the HIPBLASLt tuning table, STRATA_RESIDENT_PIN) is regenerated;
  • what the generator owns is not carried — host, api_key, backend, the engine args — because this run's choices decide those (and secrets are never carried over);
  • engine flags the new args dropped are warned about, not merged: [!] this run's engine args do not carry the earlier config's flags: --my-tuning (add them back by hand if you meant them). A flags list is not merged by hand; a re-run that drops --vram-reserve-mib or --my-flag says so instead of inventing an argument order;
  • a block this run drops is warned about too: a re-run without --vision that leaves an old vision block behind prints [!] this run drops the earlier config's vision block ....

An unreadable or missing earlier file means a plain fresh install, exactly as before.

Tests

tools/test_setup_choices.py gains ConfigPreserve (8 tests, python -m unittest tools.test_setup_choices), riding the golden install() harness (no GPU, no network, mocked PC) so the real setup.main() path is covered, including the seeded strata-q2_0.json before the re-run:

  • the three documented blocks are carried verbatim and named;
  • cuda_device/backend/STRATA_SPLIT_OWN survive; the generator's own keys are regenerated (max_tokens, its own env values);
  • host/api_key/backend are never carried, and nothing hand-set lost → no warning;
  • dropped flags warned, args not merged;
  • a dropped vision block warned;
  • no earlier file / corrupt earlier file → unchanged fresh install.

Plus an end-to-end golden-harness run confirming the carried config, and one sentence in docs/DETAILS.md next to the mcp_servers documentation:

A re-run of setup keeps blocks like these (and other keys it does not write itself) and says so in its output; it rewrites only the settings the choices it asks for decide.

Notes

  • Only the fresh-construction write_config site in setup.main() can wipe the file (every other site loads the config and mutates it), so the carry-over hooks in exactly one place — the one write_config call that builds cfg from scratch.
  • The golden byte-for-byte baseline (tools/test_setup_golden.json) is untouched: a first install (no earlier file) produces the same config as before. The golden tests fail identically on clean upstream/main without this change (46 failures, pre-existing on main, unrelated).

🔄 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/683 **Author:** [@hireymage](https://github.com/hireymage) **Created:** 10/3/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-setup-config-preserve` --- ### 📝 Commits (2) - [`cd74b39`](https://github.com/Niko1221/Strata/commit/cd74b396e5561a376409ac89a3d710db5c28329b) setup: a re-run of setup carries over the hand-edited config blocks (#629) - [`a5f9a90`](https://github.com/Niko1221/Strata/commit/a5f9a90a79469588b12af45378c8fb16a5a8c0ec) docs: say that a re-run of setup keeps hand-edited blocks (#629) ### 📊 Changes **3 files changed** (+159 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+4 -0) 📝 `setup.py` (+60 -0) 📝 `tools/test_setup_choices.py` (+95 -0) </details> ### 📄 Description ## What was broken (#629) A fresh re-run of setup — `START-HERE.bat --yes --family qwen --model IQ3_S --gpus 0,1 --context 131072`, or answering the setup questions again to change the context length or the size — regenerated `strata-<model>.json` from scratch and quietly dropped everything the generator does not write itself: - the hand-edited `sampling`, `mcp_servers` and `mcp` blocks that [DETAILS.md](docs/DETAILS.md) documents in the same file; - hand-set keys inside `vision` (`cuda_device` from the #408 workflow) and inside `env` (the `STRATA_*` values from DETAILS.md's table). The install was fine afterwards: the engine ran. What was lost was visible only later — MCP tools gone, sampling back to defaults, and no message anywhere explaining the loss. ## What it does now `setup.py` regenerates the config the same way, then reads the earlier `strata-<model>.json` (whole-or-nothing, atomic-write semantics per #459) and carries over: - **hand-authored top-level blocks** — anything outside the keys setup's generator can write — verbatim, and names them: `[ok] carried over from the earlier strata-q2_0.json: mcp; mcp_servers; sampling`; - **inside `env` and `vision`, only the hand keys survive**: `cuda_device`, `backend`, `STRATA_SPLIT_OWN` and friends; what setup recomputes per install (`exe`, `mmproj`, `max_tokens`, the HIPBLASLt tuning table, `STRATA_RESIDENT_PIN`) is regenerated; - **what the generator owns is not carried** — `host`, `api_key`, `backend`, the engine args — because this run's choices decide those (and secrets are never carried over); - **engine flags the new args dropped are warned about, not merged**: `[!] this run's engine args do not carry the earlier config's flags: --my-tuning (add them back by hand if you meant them)`. A flags list is not merged by hand; a re-run that drops `--vram-reserve-mib` or `--my-flag` says so instead of inventing an argument order; - **a block this run drops is warned about too**: a re-run without `--vision` that leaves an old `vision` block behind prints `[!] this run drops the earlier config's vision block ...`. An unreadable or missing earlier file means a plain fresh install, exactly as before. ## Tests `tools/test_setup_choices.py` gains `ConfigPreserve` (8 tests, `python -m unittest tools.test_setup_choices`), riding the golden `install()` harness (no GPU, no network, mocked PC) so the real `setup.main()` path is covered, including the seeded `strata-q2_0.json` before the re-run: - the three documented blocks are carried verbatim and named; - `cuda_device`/`backend`/`STRATA_SPLIT_OWN` survive; the generator's own keys are regenerated (`max_tokens`, its own env values); - `host`/`api_key`/`backend` are never carried, and nothing hand-set lost → no warning; - dropped flags warned, args not merged; - a dropped `vision` block warned; - no earlier file / corrupt earlier file → unchanged fresh install. Plus an end-to-end golden-harness run confirming the carried config, and one sentence in `docs/DETAILS.md` next to the `mcp_servers` documentation: > A re-run of setup keeps blocks like these (and other keys it does not write itself) and says so in its output; it rewrites only the settings the choices it asks for decide. ## Notes - Only the fresh-construction `write_config` site in `setup.main()` can wipe the file (every other site loads the config and mutates it), so the carry-over hooks in exactly one place — the one `write_config` call that builds `cfg` from scratch. - The golden byte-for-byte baseline (`tools/test_setup_golden.json`) is untouched: a first install (no earlier file) produces the same config as before. The golden tests fail identically on clean `upstream/main` without this change (46 failures, pre-existing on `main`, unrelated). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:02:56 +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#2763
No description provided.