[PR #3817] [CLOSED] [GUI] the app's start wait follows the model's size, inside the ceiling the installed Control actually takes (#3459 #4191) #4792

Closed
opened 2026-11-07 15:39:05 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3817
Author: @miketgv
Created: 10/23/2026
Status: ❌ Closed

Base: main ← Head: start-wait-env


📝 Commits (4)

  • febdbe5 GUI: the start wait follows the model's size, as strata launch does, and never asks an older Control for more than it takes (#3459 #4191)
  • ecc469c GUI: ask the installed Control for the start wait it actually takes, and let the CLI take the runtime's ceiling (#3459 #4191)
  • ef077ad control: the operation record takes a long start wait too, and the tests walk the whole CLI path (#3459 #4191)
  • 3c58162 GUI: ask for the longer wait only when all three of a Control's ceilings agree (#3459 #4191)

📊 Changes

5 files changed (+186 additions, -9 deletions)

View changed files

📝 apps/host/server/native-control.mjs (+51 -2)
📝 apps/host/tests/packaged-control.test.mjs (+59 -3)
📝 strata_control/journal.py (+7 -2)
📝 strata_control/management.py (+6 -2)
📝 tests/terminal/test_runtime.py (+63 -0)

📄 Description

Problem and result

In the app, a start waits a flat 300 s for any model. On a slow disk a big model needs longer, so the load ends with
startup_wait_expired while the engine goes on reading and would have come up. #4191 reports it at about 180 GB and says
that editing 300 to 600 in apps/host/server/native-control.mjs fixed it on 0.2.1, but needs several files changed now;
#3459 is the same stop on Windows 11 after the tuning stage (RTX 5060 Ti, 56 GB). Both are still open. #4191 asks for the
parameter to be raised in advance so it does not have to be edited at every update.

main solved the Terminal's own side of this in 27cbbfe6 (#3949): MAX_START_WAIT to 1800 s and a wait that follows the
model's size. This branch is the same rule for the app, with no new setting and nothing for anyone to set.

A local build of the first commit showed that the app could not use the new ceiling yet. Loading a big model in the app
said: Start wait must be finite seconds in 0..600. Control validates a start wait twice, and 27cbbfe6 raised only one of
the two ceilings:

path who calls it ceiling after 27cbbfe6
runtime.start(wait=…) strata launch (Runner, calls it directly) MAX_START_WAIT = 1800 ✔
strata runtime start --wait … → management.runtime_action the app, and anyone at a terminal _seconds(…, 0, 600, …) = 600 ✘

strata runtime start --wait checks the wait three times before the engine is reached, and 27cbbfe6 raised only the
runtime's own:

# layer who uses it ceiling after 27cbbfe6 symptom
1 management.runtime_action the app, and anyone at a terminal _seconds(…, 0, 600, …) = 600 start wait must be finite seconds in 0..600
2 journal._validate_direct_intent written before the start runs {"wait_s": (0, 600)} = 600 direct runtime intent has an invalid timeout
3 runtime.start strata launch (calls it directly) MAX_START_WAIT = 1800 ✔ —

Both of the first two refuse the wait before the engine is reached, so a wait of 601 s or more was impossible through the CLI
on every released Control — checked on this repo's v0.2.5/v0.2.7 (Control 0.1.52, and 0.1.49.2 installed on the test PC),
where the runtime already says 1800 while both gates still say 600:

$ strata runtime start --profile zz --wait 600  --output json  →  profile 'zz' is not saved   (accepted)
$ strata runtime start --profile zz --wait 601  --output json  →  start wait must be finite seconds in 0..600
$ strata runtime start --profile zz --wait 1720 --output json  →  direct runtime intent has an invalid timeout   (gate 2, after gate 1 was fixed)

So 27cbbfe6 fixed the Terminal by calling the runtime directly, and left the CLI — the app's path — at 600 s in two places. An
earlier version of this branch gated on control.version instead; that gate was wrong for the same reason (0.1.50, 0.1.51 and
0.1.52 all refuse more than 600 s through the CLI), and is replaced here by reading the Control.

Approach

Control — both gates take their ceiling from the runtime they hand the wait to, instead of repeating a number that has
already fallen out of step (runtime.MAX_START_WAIT):

  • management.runtime_action, for start and for restart's startup wait (which runtime.restart already accepts up to
    MAX_START_WAIT, so the CLI was the only thing still refusing it).
  • journal._validate_direct_intent, for runtime.start and for a restart's startup_wait_s. stop and verify keep their
    own 600 s, which is what runtime.stop and runtime.verify take.

The default stays 300 s and every wait at or below 600 s behaves exactly as before; a Control whose runtime refuses a long wait
still refuses it, one layer later.

App (apps/host/server/native-control.mjs):

  • startWaitFor(config, entry, model) sizes the wait from the model in 27cbbfe6's shape: ten minutes, about eight more
    seconds per GB above 40 GB, at most what this Control accepts. The size comes from the installed model's bytes on disk, else
    from the catalog's download figure (both already reach the host); a model nobody can size keeps the 300 s it always had.
  • The ceiling is read from the Control this app found, not guessed from its version. Because the wait is bounded in three
    places, the app asks for more than 600 s only when that Control's own sources hand both of the first two gates to the
    runtime's ceiling, and then takes the figure from its runtime.py. A Control that raised only one of them — which is exactly
    what every released Control does today, and what this branch did halfway through its own history — keeps the 600 s it takes.
    So it changes nothing for anyone on a released build and uses the longer wait as soon as a fixed Control is installed: no
    version table to keep in step, and no load that fails because the app asked for more than its Control accepts. This is the
    same kind of source-read the app already does for the settings fields and for /v1/responses. Anything it cannot read, or a
    line that still spells out 600, falls back to 600 s.
  • A config's engine_ready_s is now a floor the app never shortens, instead of a figure clamped to 600 s. Where the start then
    waits longer than the server's own engine wait (900 s), the launch's copy of the config gets engine_ready_s above it — what
    Runner.build_config does. Without this the two cannot work together: the server ends the engine when its own wait runs out,
    so a start that waits longer than the server waits for nothing. It is only ever raised, so setup's 3600 s for
    DeepSeek V4.1-Flash stays as written, and the installed config file is untouched.

No new variable and nothing for anyone to set, which is what 27cbbfe6 asked for when it declined the STRATA_ENGINE_READY_S
route.

One thing this does not change, on purpose: Control's start wait is not only patience. The owner host gives the model the
same budget to prove it is ready (probe_deadline comes from --startup-wait) and stops it if it readies late, so the app
cannot simply ignore an expired wait and keep polling — raising the wait it passes down is the only real lever. The app's outer
five-minute health loop runs only after Control reports ready, and is left alone.

Validation

Passed:

  • The whole path, for real. A saved profile started with --wait 1720 on the staged Control passed all three gates and
    reached the engine spawn (state: failed … server_exited from the deliberately dummy exe, after owner_id/child_pid were
    assigned). The same command before these two commits stopped at gate 1 and then gate 2, before any process was started.
  • python -m unittest tests.terminal.test_runtime.StartWaitLimit: 4 cases. One walks management → journal → runtime.start
    with only the engine faked, at 300/600/601/1800 s, and names the wait that failed to arrive; one pins each kind's ceiling on the
    record; two keep the runtime's own limits. Reverting the journal change fails three of them with the quoted message, and
    reverting management.py fails the chain test — which is how the second gate was missed the first time: the earlier CLI test
    faked runtime.start and so stopped at the first gate.
  • tests.terminal.test_recipes, test_bench, test_calibration: 44 tests OK, plus the full test_runtime module.
  • npm test in apps/host: 1227 tests, 1120 pass, 2 fail — the same two that fail on upstream/main at 5e8a4cca in this
    checkout ("an update job an OLDER host left running…" and "Stop ends the job and everything it started…").
  • tests.terminal.test_runtime also reports 3 errors in test_foreground_jsonl_emits_ready_and_stop_without_human_stdout
    (_queue.Empty in a subprocess-signal case). Pre-existing: identical with these changes stashed.
  • The four Control shapes (no ceiling / runtime only / CLI only / all three) are driven as fixtures. The probe was also run
    against real folders: this repo and the staged 0.1.52 component → 1800 s; the installed 0.1.49.2 component → 600 s; and the
    released v0.2.5/v0.2.7 sources taken straight from git, which carry MAX_START_WAIT = 1800 with both gates at 600 → the
    app asks them for 600 s, which is what they take.
  • Rebuilt the Linux AppImage and extracted it: bundled native-control.mjs byte-identical to the committed file, all three
    Control gates patched, the app's probe reading both markers, and its bundled Control answering --wait 300/600/1720/1800
    past every validator. A 148 GB model asks 1464 s where the Control takes it and 600 s where it does not; a 20 GB
    model keeps the 300 s it always had.

Not run:

  • No engine file is touched, so no CUDA/HIP/SYCL/Metal build was needed.
  • Not tested on a Mac or Windows package, and not against a real 148 GB load end to end: that needs a Control with both gates
    fixed, which no released Control has. Until then the app keeps asking 600 s, so this branch changes nothing for anyone on a
    released build — which is also why the two Control fixes need to land for the app change to do anything at all.

Limits

  • The two layers land in different artefacts: the app ships in the installer, the Control validator in the Control component.
    An app with this change is harmless on an old Control (it reads 600 s and behaves as today) and only takes the longer wait
    once a Control with the CLI fix is installed. If you would rather keep them apart, the Control commit is self-contained and
    can be split into its own pull request.
  • Reading the ceiling from the installed Control's source is a capability probe of the same kind the app already makes. A
    Control that validates the start wait in a shape neither pattern matches falls back to 600 s: today's behaviour, never a
    broken load.
  • verify wait and stop wait (600 s in both layers) were left alone: they agree with each other and no model load is
    bounded by them.

🔄 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/3817 **Author:** [@miketgv](https://github.com/miketgv) **Created:** 10/23/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `start-wait-env` --- ### 📝 Commits (4) - [`febdbe5`](https://github.com/Niko1221/Strata/commit/febdbe5fb372f5a1b34cd9819b86a3208d9e742a) GUI: the start wait follows the model's size, as `strata launch` does, and never asks an older Control for more than it takes (#3459 #4191) - [`ecc469c`](https://github.com/Niko1221/Strata/commit/ecc469ccbf3e5c8e8e96955edd86ec00a9afb671) GUI: ask the installed Control for the start wait it actually takes, and let the CLI take the runtime's ceiling (#3459 #4191) - [`ef077ad`](https://github.com/Niko1221/Strata/commit/ef077ad082fb71a1d7dd186ee06d3f149023e19b) control: the operation record takes a long start wait too, and the tests walk the whole CLI path (#3459 #4191) - [`3c58162`](https://github.com/Niko1221/Strata/commit/3c5816258d0e389c7574b2455fe3a635f67db3c3) GUI: ask for the longer wait only when all three of a Control's ceilings agree (#3459 #4191) ### 📊 Changes **5 files changed** (+186 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `apps/host/server/native-control.mjs` (+51 -2) 📝 `apps/host/tests/packaged-control.test.mjs` (+59 -3) 📝 `strata_control/journal.py` (+7 -2) 📝 `strata_control/management.py` (+6 -2) 📝 `tests/terminal/test_runtime.py` (+63 -0) </details> ### 📄 Description ## Problem and result In the app, a start waits a flat **300 s** for any model. On a slow disk a big model needs longer, so the load ends with `startup_wait_expired` while the engine goes on reading and would have come up. #4191 reports it at about 180 GB and says that editing `300` to `600` in `apps/host/server/native-control.mjs` fixed it on 0.2.1, but needs several files changed now; #3459 is the same stop on Windows 11 after the tuning stage (RTX 5060 Ti, 56 GB). Both are still open. #4191 asks for the parameter to be raised in advance so it does not have to be edited at every update. `main` solved the Terminal's own side of this in `27cbbfe6` (#3949): `MAX_START_WAIT` to 1800 s and a wait that follows the model's size. This branch is the same rule for the app, with no new setting and nothing for anyone to set. **A local build of the first commit showed that the app could not use the new ceiling yet.** Loading a big model in the app said: `Start wait must be finite seconds in 0..600`. Control validates a start wait twice, and `27cbbfe6` raised only one of the two ceilings: | path | who calls it | ceiling after `27cbbfe6` | |---|---|---| | `runtime.start(wait=…)` | `strata launch` (`Runner`, calls it directly) | `MAX_START_WAIT` = **1800** ✔ | | `strata runtime start --wait …` → `management.runtime_action` | **the app**, and anyone at a terminal | `_seconds(…, 0, 600, …)` = **600** ✘ | `strata runtime start --wait` checks the wait **three times** before the engine is reached, and `27cbbfe6` raised only the runtime's own: | # | layer | who uses it | ceiling after `27cbbfe6` | symptom | |---|---|---|---|---| | 1 | `management.runtime_action` | the app, and anyone at a terminal | `_seconds(…, 0, 600, …)` = **600** | `start wait must be finite seconds in 0..600` | | 2 | `journal._validate_direct_intent` | written before the start runs | `{"wait_s": (0, 600)}` = **600** | `direct runtime intent has an invalid timeout` | | 3 | `runtime.start` | `strata launch` (calls it directly) | `MAX_START_WAIT` = **1800** ✔ | — | Both of the first two refuse the wait **before the engine is reached**, so a wait of 601 s or more was impossible through the CLI on **every released Control** — checked on this repo's `v0.2.5`/`v0.2.7` (Control 0.1.52, and 0.1.49.2 installed on the test PC), where the runtime already says 1800 while both gates still say 600: ``` $ strata runtime start --profile zz --wait 600 --output json → profile 'zz' is not saved (accepted) $ strata runtime start --profile zz --wait 601 --output json → start wait must be finite seconds in 0..600 $ strata runtime start --profile zz --wait 1720 --output json → direct runtime intent has an invalid timeout (gate 2, after gate 1 was fixed) ``` So `27cbbfe6` fixed the Terminal by calling the runtime directly, and left the CLI — the app's path — at 600 s in two places. An earlier version of this branch gated on `control.version` instead; that gate was wrong for the same reason (0.1.50, 0.1.51 and 0.1.52 all refuse more than 600 s through the CLI), and is replaced here by reading the Control. ## Approach **Control** — both gates take their ceiling from the runtime they hand the wait to, instead of repeating a number that has already fallen out of step (`runtime.MAX_START_WAIT`): - `management.runtime_action`, for `start` and for `restart`'s `startup wait` (which `runtime.restart` already accepts up to `MAX_START_WAIT`, so the CLI was the only thing still refusing it). - `journal._validate_direct_intent`, for `runtime.start` and for a restart's `startup_wait_s`. `stop` and `verify` keep their own 600 s, which is what `runtime.stop` and `runtime.verify` take. The default stays 300 s and every wait at or below 600 s behaves exactly as before; a Control whose runtime refuses a long wait still refuses it, one layer later. **App** (`apps/host/server/native-control.mjs`): - `startWaitFor(config, entry, model)` sizes the wait from the model in `27cbbfe6`'s shape: ten minutes, about eight more seconds per GB above 40 GB, at most what this Control accepts. The size comes from the installed model's bytes on disk, else from the catalog's download figure (both already reach the host); a model nobody can size keeps the 300 s it always had. - The ceiling is **read from the Control this app found**, not guessed from its version. Because the wait is bounded in three places, the app asks for more than 600 s only when that Control's own sources hand **both** of the first two gates to the runtime's ceiling, and then takes the figure from its `runtime.py`. A Control that raised only one of them — which is exactly what every released Control does today, and what this branch did halfway through its own history — keeps the 600 s it takes. So it changes nothing for anyone on a released build and uses the longer wait as soon as a fixed Control is installed: no version table to keep in step, and no load that fails because the app asked for more than its Control accepts. This is the same kind of source-read the app already does for the settings fields and for `/v1/responses`. Anything it cannot read, or a line that still spells out 600, falls back to 600 s. - A config's `engine_ready_s` is now a floor the app never shortens, instead of a figure clamped to 600 s. Where the start then waits longer than the server's own engine wait (900 s), the launch's copy of the config gets `engine_ready_s` above it — what `Runner.build_config` does. Without this the two cannot work together: the server ends the engine when its own wait runs out, so a start that waits longer than the server waits for nothing. It is only ever raised, so setup's 3600 s for DeepSeek V4.1-Flash stays as written, and the installed config file is untouched. No new variable and nothing for anyone to set, which is what `27cbbfe6` asked for when it declined the `STRATA_ENGINE_READY_S` route. One thing this does **not** change, on purpose: Control's start wait is not only patience. The owner host gives the model the same budget to prove it is ready (`probe_deadline` comes from `--startup-wait`) and stops it if it readies late, so the app cannot simply ignore an expired wait and keep polling — raising the wait it passes down is the only real lever. The app's outer five-minute health loop runs only after Control reports ready, and is left alone. ## Validation Passed: - **The whole path, for real.** A saved profile started with `--wait 1720` on the staged Control passed all three gates and reached the engine spawn (`state: failed … server_exited` from the deliberately dummy exe, after `owner_id`/`child_pid` were assigned). The same command before these two commits stopped at gate 1 and then gate 2, before any process was started. - `python -m unittest tests.terminal.test_runtime.StartWaitLimit`: 4 cases. One walks `management` → `journal` → `runtime.start` with only the engine faked, at 300/600/601/1800 s, and names the wait that failed to arrive; one pins each kind's ceiling on the record; two keep the runtime's own limits. **Reverting the journal change fails three of them with the quoted message**, and reverting `management.py` fails the chain test — which is how the second gate was missed the first time: the earlier CLI test faked `runtime.start` and so stopped at the first gate. - `tests.terminal.test_recipes`, `test_bench`, `test_calibration`: 44 tests OK, plus the full `test_runtime` module. - `npm test` in `apps/host`: 1227 tests, 1120 pass, **2 fail** — the same two that fail on `upstream/main` at `5e8a4cca` in this checkout (*"an update job an OLDER host left running…"* and *"Stop ends the job and everything it started…"*). - `tests.terminal.test_runtime` also reports 3 errors in `test_foreground_jsonl_emits_ready_and_stop_without_human_stdout` (`_queue.Empty` in a subprocess-signal case). **Pre-existing**: identical with these changes stashed. - The four Control shapes (no ceiling / runtime only / CLI only / all three) are driven as fixtures. The probe was also run against real folders: this repo and the staged 0.1.52 component → 1800 s; the installed 0.1.49.2 component → 600 s; and the released `v0.2.5`/`v0.2.7` sources taken straight from git, which carry `MAX_START_WAIT = 1800` with both gates at 600 → the app asks them for **600 s**, which is what they take. - Rebuilt the Linux AppImage and extracted it: bundled `native-control.mjs` byte-identical to the committed file, all three Control gates patched, the app's probe reading both markers, and its bundled Control answering `--wait 300/600/1720/1800` past every validator. A 148 GB model asks **1464 s** where the Control takes it and **600 s** where it does not; a 20 GB model keeps the 300 s it always had. Not run: - No engine file is touched, so no CUDA/HIP/SYCL/Metal build was needed. - Not tested on a Mac or Windows package, and not against a real 148 GB load end to end: that needs a Control with both gates fixed, which no released Control has. Until then the app keeps asking 600 s, so this branch changes nothing for anyone on a released build — which is also why the two Control fixes need to land for the app change to do anything at all. ## Limits - The two layers land in different artefacts: the app ships in the installer, the Control validator in the Control component. An app with this change is harmless on an old Control (it reads 600 s and behaves as today) and only takes the longer wait once a Control with the CLI fix is installed. If you would rather keep them apart, the Control commit is self-contained and can be split into its own pull request. - Reading the ceiling from the installed Control's source is a capability probe of the same kind the app already makes. A Control that validates the start wait in a shape neither pattern matches falls back to 600 s: today's behaviour, never a broken load. - `verify wait` and `stop wait` (600 s in both layers) were left alone: they agree with each other and no model load is bounded by them. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:39:05 +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#4792
No description provided.