[PR #4651] [GUI] add --resume (STRATA_RESUME=1) to the Linux AppImage so your last model loads as Strata starts #5130

Open
opened 2026-11-07 16:32:55 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4651
Author: @o-leary
Created: 10/30/2026
Status: 🔄 Open

Base: main ← Head: gui/appimage-resume


📝 Commits (1)

  • b8920df desktop (Linux): --resume (STRATA_RESUME=1) loads the model you used last as Strata opens

📊 Changes

7 files changed (+283 additions, -21 deletions)

View changed files

📝 apps/desktop/src-tauri/src/main.rs (+1 -1)
📝 apps/desktop/src-tauri/src/supervisor.rs (+106 -15)
📝 apps/desktop/tester/README-linux.txt.in (+5 -0)
📝 apps/host/server/index.mjs (+10 -1)
📝 apps/host/server/native-control.mjs (+32 -3)
➕ apps/host/tests/appimage-resume.test.mjs (+126 -0)
📝 docs/INSTALL.md (+3 -1)

📄 Description

Problem and result

The Linux app has no way to ask for its model at launch. Closing the window stops the host and the native engine with it, so every start comes up with no model is loaded yet and the person presses Load again and waits while the weights are mapped. On a machine that runs one model all day that is the same minute, every time.

The autostart hook in the host covers only the old llama.cpp supervisor path. In the packaged app a model is loaded through the native Control path (/api/native/operations, kind load), and those instances live in memory only: on close native.close() force-unloads them and deletes the per-instance run config, so nothing is left to resume. apps/host/docs/plans/09-multiple-models.md:59 records persistence and autostart as an open decision ("Current extra design instances are session-only").

After this change: --resume, or STRATA_RESUME=1.

./Strata-0.2.8-linux-x86_64.AppImage --resume

The model you last loaded starts again with the settings it was loaded with, before anyone opens a page, and the Models screen shows the same progress card it shows for your own click. With #4582 the two switches make a launch that is ready for the rest of your machines: --lan --resume brings your model back and serves it to your other devices on your network as Strata opens.

none — no open or closed issue asks for this, and nothing in the open PR list adds a launch-time model. It is the opt-in half of the plan item quoted above (apps/host/docs/plans/09-multiple-models.md:59), one flag and one small record file, so it goes straight to a PR rather than a scope thread.

One overlap to merge: #4582 (--lan, branch gui/appimage-lan) adds an argument to parse_args here (resume_env) and there (lan_env), and both pass opts to join_running. One line each, and the shape of the two switches is the same on purpose.

Approach

  • apps/desktop/src-tauri/src/supervisor.rs: the option (Options::resume, parse_args, --resume, STRATA_RESUME=1), STRATA_RESUME=1 in the host's environment, the --help line, and the second-start question (--resume while Strata runs asks that host, it does not start a second copy).
  • apps/host/server/native-control.mjs: a load records what it asked for in ~/.strata/data/native-last-load.json (mode 0600) at the two places a load says it is ready. resumeLastLoad() replays that record through the same native operation the Models screen sends, and reports in plain words when there is no record, when the model's files are gone, when the model is no longer set up in this Strata folder, or when the engine is missing.
  • apps/host/server/index.mjs: POST /api/native/resume, and the start-up line when STRATA_RESUME is set.
  • Docs: the Linux tester README and the Linux bullet in docs/INSTALL.md.

No default path changes and nothing is downloaded: a flag was never a request to fetch tens of gigabytes. Nothing is read back unless the person asked — resumeRequested accepts the shell's words (1, on, true, yes, resume). One thing does happen on the ordinary path: a successful load writes that 0600 record file, and a load that cannot write it still loads. If you would rather have the write behind the switch too, say so: the alternative is that the first --resume after the switch is set records it, and later starts replay it.

Compatibility: Windows and macOS get no new command-line option, as with --browser — the shell code there is untouched. Nothing here needs an engine build: the diff is two .rs, two .mjs, one new test, the Linux tester README and one docs/INSTALL.md bullet; no file under src/, include/, metal/, sycl/ or serve/ changes.

Validation

Revision under test: 43699304 (this branch, on top of 870aedd9 = upstream/main). Environment for every line below: this PC, Arch Linux rolling, kernel 7.2.11-arch1-1, RTX 4070 plus RTX 3060, 125 GB RAM, Node v26.12.1, cargo 1.99.0, Python 3.14.8. The baseline comparison runs were made in a second worktree checked out at 870aedd9, which carries none of this change.

Passed:

  1. cd apps/desktop/src-tauri then cargo test supervisor::, at 43699304:

    test supervisor::tests::resume_comes_from_the_command_line_or_the_environment ... ok
    test supervisor::tests::the_resume_line_says_what_the_host_answered ... ok
    test supervisor::tests::a_session_round_trips_and_is_private ... ok
    test result: ok. 6 passed; 0 failed; 23 filtered out
    

    One environment note, because it changed on this box today: a package update removed webkit2gtk-4.1 at 12:47 on 30 Oct (/var/log/pacman.log), and cargo test supervisor:: then fails to link (rust-lld: error: unable to find library -lwebkit2gtk-4.1, and the same for -ljavascriptcoregtk-4.1). The run above used the same version's files unpacked out of this box's pacman cache (PKG_CONFIG_PATH=<dir>/usr/lib/pkgconfig LD_LIBRARY_PATH=<dir>/usr/lib, no root needed). On a box where the package is installed the plain command works.

  2. cd apps/host then node --test tests/appimage-resume.test.mjs, at 43699304: tests 6, pass 6, fail 0 — "a load remembers the model and the settings it was loaded with", "resume starts the model of the last session again, with the same settings", "a second resume while the model is loaded says so, and starts nothing", "a start with nothing recorded says what happened, and downloads nothing", "a model whose files are gone is reported: the flag is never a request to download", "nothing loads at start unless the switch is on". Control here is a fake that records what the host saved and what it was asked to start, so the test can check that the resumed engine start carries the same engine arguments as the load it replaces.

  3. The packaged host on its own (no app window), at 43699304:

    cd apps/desktop/src-tauri/target/release/bundle/appimage/Strata.AppDir/usr/lib/Strata/host
    STRATA_HOME=<scratch dir> STRATA_RESUME=1 PORT=47913 node server/index.mjs
    [strata] resume · Strata has no record of a model you loaded on this computer, so nothing started. Load one in Models, and the next start can bring it back.
    

    Nothing started and nothing downloaded, which is the expected answer with an empty scratch STRATA_HOME; no data/native-last-load.json appeared in that scratch home.

  4. The finished AppImage from this branch (dist/Strata-0.2.8-linux-x86_64.AppImage, 380,692,984 bytes, sha256 41e1650972de34b7546e4fbe204a8e0d4612a08b0283194b0519a2770aa71ee8):

    ./Strata-0.2.8-linux-x86_64.AppImage --help
    --resume     load the model you were using last, as soon as Strata opens (same as STRATA_RESUME=1)
    
    apps/desktop/scripts/repack-appimage.sh dist/Strata-0.2.8-linux-x86_64.AppImage <out> --check
    0 file(s) differ from what was staged
    

Failed:

  • cd apps/host then npm test, at 43699304: tests 1253, pass 1146, fail 2, skipped 105. The two: tests/component-updates.test.mjs — "packaged: an update job an OLDER host left running is finished when the app program file is newer than the job", actual: 'error', expected: 'done'; and tests/timeskip-real.test.mjs — "Stop ends the job and everything it started…", the revision command (a grandchild of the job) was ended too: true !== false. Neither is caused by this change: the same two files give fail 2 at 870aedd9 (node --test tests/component-updates.test.mjs tests/timeskip-real.test.mjs, both worktrees).
  • python -m unittest tests.desktop.test_tester_readme: 4 tests, 1 failure, AssertionError: 'Strata 0.2.3' not found in … — the tester README it checks names the current version (0.2.8), so the test's expectation is stale. Same single failure at 870aedd9 in the second worktree.
  • cd apps/desktop then npx tauri build --bundles appimage: the Rust release binary and the AppDir build (44-51 s), then Tauri's own AppImage step dies with failed to bundle project: No such file or directory (os error 2). This also happened when 0.2.7 was built on this box, so it is not a result of this change; the AppImage named above was finished the same way as the 0.2.7 one — linuxdeploy (git 07333c6, gtk and gstreamer plugins) plus apps/desktop/scripts/repack-appimage.sh to put the staged payloads back byte for byte.

Not run:

  • A real model resumed through Control on a desktop. The new tests drive a fake Control, and the packaged host run had no record to replay, so what stays unverified is that a resumed instance really maps its weights and answers on the page. Anyone with the AppImage from this branch and one model on disk can try it: start it once with --resume, and the model loads before the page opens.
  • The window-mode second start (--resume while Strata is already running), where only the sentence the host answers is unit-tested.
  • No Windows or macOS build: the Rust change sits behind #[cfg(target_os = "linux")] in main.rs, and the host is the same .mjs files, but I did not build or run those systems.
  • No engine backend build applies to this diff (no src/, include/, metal/, sycl/ or serve/ file is touched), and no engine was compiled or run for it.

Limits

  • The record is the last load that reported ready. Unloading a model does not clear it: --resume is an explicit ask for the model you last loaded, and loading another model replaces it.
  • A resume that fails after it started (out of memory, for example) is reported in the page's job card; the terminal has already said it is loading.
  • This takes the opt-in half of the open plan item only. It restores nothing after a crash, it does not bring back several instances, and it does not touch the llama.cpp supervisor path.

🔄 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/4651 **Author:** [@o-leary](https://github.com/o-leary) **Created:** 10/30/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `gui/appimage-resume` --- ### 📝 Commits (1) - [`b8920df`](https://github.com/Niko1221/Strata/commit/b8920df8d15c45136cd631cdac6d9614a7760d77) desktop (Linux): --resume (STRATA_RESUME=1) loads the model you used last as Strata opens ### 📊 Changes **7 files changed** (+283 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `apps/desktop/src-tauri/src/main.rs` (+1 -1) 📝 `apps/desktop/src-tauri/src/supervisor.rs` (+106 -15) 📝 `apps/desktop/tester/README-linux.txt.in` (+5 -0) 📝 `apps/host/server/index.mjs` (+10 -1) 📝 `apps/host/server/native-control.mjs` (+32 -3) ➕ `apps/host/tests/appimage-resume.test.mjs` (+126 -0) 📝 `docs/INSTALL.md` (+3 -1) </details> ### 📄 Description ## Problem and result The Linux app has no way to ask for its model at launch. Closing the window stops the host and the native engine with it, so every start comes up with `no model is loaded yet` and the person presses **Load** again and waits while the weights are mapped. On a machine that runs one model all day that is the same minute, every time. The autostart hook in the host covers only the old llama.cpp supervisor path. In the packaged app a model is loaded through the native Control path (`/api/native/operations`, kind `load`), and those instances live in memory only: on close `native.close()` force-unloads them and deletes the per-instance run config, so nothing is left to resume. `apps/host/docs/plans/09-multiple-models.md:59` records persistence and autostart as an open decision ("Current extra design instances are session-only"). After this change: `--resume`, or `STRATA_RESUME=1`. ``` ./Strata-0.2.8-linux-x86_64.AppImage --resume ``` The model you last loaded starts again with the settings it was loaded with, before anyone opens a page, and the Models screen shows the same progress card it shows for your own click. With #4582 the two switches make a launch that is ready for the rest of your machines: `--lan --resume` brings your model back and serves it to your other devices on your network as Strata opens. ## Related discussion none — no open or closed issue asks for this, and nothing in the open PR list adds a launch-time model. It is the opt-in half of the plan item quoted above (`apps/host/docs/plans/09-multiple-models.md:59`), one flag and one small record file, so it goes straight to a PR rather than a scope thread. One overlap to merge: **#4582** (`--lan`, branch `gui/appimage-lan`) adds an argument to `parse_args` here (`resume_env`) and there (`lan_env`), and both pass `opts` to `join_running`. One line each, and the shape of the two switches is the same on purpose. ## Approach - `apps/desktop/src-tauri/src/supervisor.rs`: the option (`Options::resume`, `parse_args`, `--resume`, `STRATA_RESUME=1`), `STRATA_RESUME=1` in the host's environment, the `--help` line, and the second-start question (`--resume` while Strata runs asks that host, it does not start a second copy). - `apps/host/server/native-control.mjs`: a load records what it asked for in `~/.strata/data/native-last-load.json` (mode 0600) at the two places a load says it is ready. `resumeLastLoad()` replays that record through the same native operation the Models screen sends, and reports in plain words when there is no record, when the model's files are gone, when the model is no longer set up in this Strata folder, or when the engine is missing. - `apps/host/server/index.mjs`: `POST /api/native/resume`, and the start-up line when `STRATA_RESUME` is set. - Docs: the Linux tester README and the Linux bullet in `docs/INSTALL.md`. No default path changes and nothing is downloaded: a flag was never a request to fetch tens of gigabytes. Nothing is read back unless the person asked — `resumeRequested` accepts the shell's words (1, on, true, yes, resume). One thing does happen on the ordinary path: a successful load writes that 0600 record file, and a load that cannot write it still loads. If you would rather have the write behind the switch too, say so: the alternative is that the first `--resume` after the switch is set records it, and later starts replay it. Compatibility: Windows and macOS get no new command-line option, as with `--browser` — the shell code there is untouched. Nothing here needs an engine build: the diff is two `.rs`, two `.mjs`, one new test, the Linux tester README and one `docs/INSTALL.md` bullet; no file under `src/`, `include/`, `metal/`, `sycl/` or `serve/` changes. ## Validation Revision under test: `43699304` (this branch, on top of `870aedd9` = `upstream/main`). Environment for every line below: this PC, Arch Linux rolling, kernel 7.2.11-arch1-1, RTX 4070 plus RTX 3060, 125 GB RAM, Node v26.12.1, cargo 1.99.0, Python 3.14.8. The baseline comparison runs were made in a second worktree checked out at `870aedd9`, which carries none of this change. **Passed:** 1. `cd apps/desktop/src-tauri` then `cargo test supervisor::`, at `43699304`: ``` test supervisor::tests::resume_comes_from_the_command_line_or_the_environment ... ok test supervisor::tests::the_resume_line_says_what_the_host_answered ... ok test supervisor::tests::a_session_round_trips_and_is_private ... ok test result: ok. 6 passed; 0 failed; 23 filtered out ``` One environment note, because it changed on this box today: a package update removed `webkit2gtk-4.1` at 12:47 on 30 Oct (`/var/log/pacman.log`), and `cargo test supervisor::` then fails to link (`rust-lld: error: unable to find library -lwebkit2gtk-4.1`, and the same for `-ljavascriptcoregtk-4.1`). The run above used the same version's files unpacked out of this box's pacman cache (`PKG_CONFIG_PATH=<dir>/usr/lib/pkgconfig LD_LIBRARY_PATH=<dir>/usr/lib`, no root needed). On a box where the package is installed the plain command works. 2. `cd apps/host` then `node --test tests/appimage-resume.test.mjs`, at `43699304`: `tests 6`, `pass 6`, `fail 0` — "a load remembers the model and the settings it was loaded with", "resume starts the model of the last session again, with the same settings", "a second resume while the model is loaded says so, and starts nothing", "a start with nothing recorded says what happened, and downloads nothing", "a model whose files are gone is reported: the flag is never a request to download", "nothing loads at start unless the switch is on". Control here is a fake that records what the host saved and what it was asked to start, so the test can check that the resumed engine start carries the same engine arguments as the load it replaces. 3. The packaged host on its own (no app window), at `43699304`: ``` cd apps/desktop/src-tauri/target/release/bundle/appimage/Strata.AppDir/usr/lib/Strata/host STRATA_HOME=<scratch dir> STRATA_RESUME=1 PORT=47913 node server/index.mjs [strata] resume · Strata has no record of a model you loaded on this computer, so nothing started. Load one in Models, and the next start can bring it back. ``` Nothing started and nothing downloaded, which is the expected answer with an empty scratch `STRATA_HOME`; no `data/native-last-load.json` appeared in that scratch home. 4. The finished AppImage from this branch (`dist/Strata-0.2.8-linux-x86_64.AppImage`, 380,692,984 bytes, sha256 `41e1650972de34b7546e4fbe204a8e0d4612a08b0283194b0519a2770aa71ee8`): ``` ./Strata-0.2.8-linux-x86_64.AppImage --help --resume load the model you were using last, as soon as Strata opens (same as STRATA_RESUME=1) ``` ``` apps/desktop/scripts/repack-appimage.sh dist/Strata-0.2.8-linux-x86_64.AppImage <out> --check 0 file(s) differ from what was staged ``` **Failed:** - `cd apps/host` then `npm test`, at `43699304`: `tests 1253, pass 1146, fail 2, skipped 105`. The two: `tests/component-updates.test.mjs` — "packaged: an update job an OLDER host left running is finished when the app program file is newer than the job", `actual: 'error', expected: 'done'`; and `tests/timeskip-real.test.mjs` — "Stop ends the job and everything it started…", `the revision command (a grandchild of the job) was ended too: true !== false`. Neither is caused by this change: the same two files give `fail 2` at `870aedd9` (`node --test tests/component-updates.test.mjs tests/timeskip-real.test.mjs`, both worktrees). - `python -m unittest tests.desktop.test_tester_readme`: 4 tests, 1 failure, `AssertionError: 'Strata 0.2.3' not found in …` — the tester README it checks names the current version (0.2.8), so the test's expectation is stale. Same single failure at `870aedd9` in the second worktree. - `cd apps/desktop` then `npx tauri build --bundles appimage`: the Rust release binary and the AppDir build (44-51 s), then Tauri's own AppImage step dies with `failed to bundle project: No such file or directory (os error 2)`. This also happened when 0.2.7 was built on this box, so it is not a result of this change; the AppImage named above was finished the same way as the 0.2.7 one — `linuxdeploy` (git `07333c6`, gtk and gstreamer plugins) plus `apps/desktop/scripts/repack-appimage.sh` to put the staged payloads back byte for byte. **Not run:** - A real model resumed through Control on a desktop. The new tests drive a fake Control, and the packaged host run had no record to replay, so what stays unverified is that a resumed instance really maps its weights and answers on the page. Anyone with the AppImage from this branch and one model on disk can try it: start it once with `--resume`, and the model loads before the page opens. - The window-mode second start (`--resume` while Strata is already running), where only the sentence the host answers is unit-tested. - No Windows or macOS build: the Rust change sits behind `#[cfg(target_os = "linux")]` in `main.rs`, and the host is the same `.mjs` files, but I did not build or run those systems. - No engine backend build applies to this diff (no `src/`, `include/`, `metal/`, `sycl/` or `serve/` file is touched), and no engine was compiled or run for it. ## Limits - The record is the last load that reported ready. Unloading a model does not clear it: `--resume` is an explicit ask for the model you last loaded, and loading another model replaces it. - A resume that fails after it started (out of memory, for example) is reported in the page's job card; the terminal has already said it is loading. - This takes the opt-in half of the open plan item only. It restores nothing after a crash, it does not bring back several instances, and it does not touch the llama.cpp supervisor path. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#5130
No description provided.