[PR #4111] [CLOSED] [GUI] the App Host's source-checkout mode no longer passes an empty STRATA_API_KEY #4902

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4111
Author: @demetree
Created: 10/25/2026
Status: ❌ Closed

Base: main ← Head: fix-app-source-key


📝 Commits (1)

  • ec91003 host: the source-checkout server gets no STRATA_API_KEY instead of an empty one

📊 Changes

2 files changed (+38 additions, -1 deletions)

View changed files

📝 apps/host/server/native-control.mjs (+7 -1)
➕ apps/host/tests/source-server-env.test.mjs (+31 -0)

📄 Description

Fixes #3851.

Problem

From a source checkout, loading a model in the app always ends with Engine stopped (exit 2), and the app's log says
[strata] an API key was given but it is empty: set a key, or leave it out.

The host started the server with STRATA_API_KEY set to the empty string. serve/server.py reads that variable as
the default for --api-key and refuses a key that is present but empty (the #213 rule), before it reads the config. So
the model never loads.

Result

The variable is removed from the child environment instead, so the run config's own key is used. With this change the
same load starts the engine: 262,144-token context, 12,288 experts filled (23.42 GiB VRAM), and the app's own benchmark
returned 200 tokens at 60.2 tok/s on an Arc Pro B70. (One measurement on one machine, not a benchmark.)

Approach

The environment is built by sourceServerEnvironment(), exported from native-control.mjs and used at the spawn, so
the rule can be tested without starting a server. It keeps the process environment, sets the three Python UTF-8
variables, and deletes STRATA_API_KEY.

This is what strata_control already does on the packaged path (control-runtime.mjs deletes the variable), so the two
paths now agree. The intent of the empty string was right - the run config carries the instance's key, and an inherited
variable must not override it - but an empty string is refused rather than read as "no key".

Validation

Passed

  • node --test apps/host/tests/source-server-env.test.mjs - 4 tests: an inherited key is removed (not blanked), the
    UTF-8 settings and the rest of the environment are kept, the input environment is not mutated, and a process without
    the variable gets the same result.
  • node --check apps/host/server/native-control.mjs.

Not run

  • The full apps/host suite (npm test): the change is one environment builder and its test, and the branch was
    worked on in a worktree without node_modules.
  • The app UI end to end on this branch. The failure and the fix were observed on the same machine on the pre-0.2.6
    tree: Engine stopped (exit 2) with the message above, then a successful start once the variable was deleted.

Limits

  • Only the source-checkout path changes; the installed app uses Control's environment and never hit this.
  • The refusal it works around is the server's #213 rule, which is deliberate; this does not weaken it.

🔄 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/4111 **Author:** [@demetree](https://github.com/demetree) **Created:** 10/25/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-app-source-key` --- ### 📝 Commits (1) - [`ec91003`](https://github.com/Niko1221/Strata/commit/ec910032658d3b070b1b0ecafc1a920fdcf5b6f7) host: the source-checkout server gets no STRATA_API_KEY instead of an empty one ### 📊 Changes **2 files changed** (+38 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `apps/host/server/native-control.mjs` (+7 -1) ➕ `apps/host/tests/source-server-env.test.mjs` (+31 -0) </details> ### 📄 Description Fixes #3851. ### Problem From a source checkout, loading a model in the app always ends with `Engine stopped (exit 2)`, and the app's log says `[strata] an API key was given but it is empty: set a key, or leave it out`. The host started the server with `STRATA_API_KEY` set to the **empty string**. `serve/server.py` reads that variable as the default for `--api-key` and refuses a key that is present but empty (the #213 rule), before it reads the config. So the model never loads. ### Result The variable is removed from the child environment instead, so the run config's own key is used. With this change the same load starts the engine: 262,144-token context, 12,288 experts filled (23.42 GiB VRAM), and the app's own benchmark returned 200 tokens at 60.2 tok/s on an Arc Pro B70. (One measurement on one machine, not a benchmark.) ### Approach The environment is built by `sourceServerEnvironment()`, exported from `native-control.mjs` and used at the spawn, so the rule can be tested without starting a server. It keeps the process environment, sets the three Python UTF-8 variables, and deletes `STRATA_API_KEY`. This is what `strata_control` already does on the packaged path (`control-runtime.mjs` deletes the variable), so the two paths now agree. The intent of the empty string was right - the run config carries the instance's key, and an inherited variable must not override it - but an empty string is refused rather than read as "no key". ### Validation **Passed** - `node --test apps/host/tests/source-server-env.test.mjs` - 4 tests: an inherited key is removed (not blanked), the UTF-8 settings and the rest of the environment are kept, the input environment is not mutated, and a process without the variable gets the same result. - `node --check apps/host/server/native-control.mjs`. **Not run** - The full `apps/host` suite (`npm test`): the change is one environment builder and its test, and the branch was worked on in a worktree without `node_modules`. - The app UI end to end on this branch. The failure and the fix were observed on the same machine on the pre-0.2.6 tree: `Engine stopped (exit 2)` with the message above, then a successful start once the variable was deleted. ### Limits - Only the source-checkout path changes; the installed app uses Control's environment and never hit this. - The refusal it works around is the server's #213 rule, which is deliberate; this does not weaken it. --- <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:13 +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#4902
No description provided.