mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #5056] [TUI] Tuning fails with 401 "missing or wrong API key" when STRATA_API_KEY is set (env var overrides the key tuning generates) #2346
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2346
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @k-ichiro09 on GitHub (Nov 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5056
Area
Launch / Tuning
Desktop app, Terminal or source?
Terminal (Windows, installed with
strata update)Strata version
Engine 0.1.56 (windows-x86_64-cuda-cuda13), Control 0.1.56
(updated with
strata updateon 2026-11-03)Graphics card, memory and system
Reproduction status
Always. It fails on every
strata launch --preset "NVFP4 256K" --retunewhile
STRATA_API_KEYis set, and succeeds once the variable is removed.What happened
strata launch --preset "NVFP4 256K"starts and serves normally, but thetuning step always fails:
Only tuning is affected; normal serving works.
The cause was a Windows user environment variable
STRATA_API_KEYthat Ihad set as the shared client key for several presets. After removing it,
tuning ran normally.
Setup
api_keySTRATA_API_KEYset to my shared keyWhat did not help
strata launch --show-key --preset ...) equalto the
api_keyin the preset JSON--no-api-keyand"api_key": "none"strata updateto 0.1.56Cause (from reading serve/server.py in 0.1.56)
ap.add_argument("--api-key", default=os.environ.get("STRATA_API_KEY", ""), ...)raw_key = a.api_key or cfg.get("api_key", "")When
STRATA_API_KEYis set, it is used instead of theapi_keyin theconfig. Tuning generates a new random key for its temporary worker, but the
worker ends up using the environment key, so the key tuning sends does not
match and the worker answers 401. This explains why
--no-api-keyand"api_key": "none"(both config-level values) had no effect either.This is my reading of the code. I did not trace how tuning hands the
generated key to the worker, so that part may differ.
Why this is easy to hit
The docs use
STRATA_API_KEYon both sides: the server reads it as theenvironment form of
--api-key, and the Terminal docs and the Codex CLIexample use it as the variable that holds the client's key (e.g.
env_key = "STRATA_API_KEY"). Setting it once for client use thereforealso changes what the server accepts.
Related
STRATA_API_KEYmust not override the keyin the run config, and that the packaged Control path deletes the variable
from the server's environment. Tuning seems not to do the same.
Suggested fix
STRATA_API_KEYfrom the environment of the worker that tuningstarts (as Control already does), or pass the generated key explicitly
as
--api-key, which wins over the environment.STRATA_API_KEYis set, say so in the@github-actions[bot] commented on GitHub (Nov 3, 2026):
Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:
Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment
/reopen.Details: CONTRIBUTING.md
@github-actions[bot] commented on GitHub (Nov 3, 2026):
Thanks, this follows the format now.
@Niko1221 commented on GitHub (Nov 5, 2026):
Hello k-ichiro09,
Thank you. In Strata 0.2.11 the tuning worker is started without
STRATA_API_KEY, so the key tuning generates is the one the server uses, and the 401 is gone. The key is not put on the command line. A quick tune with a different key set in the environment ran without the 401 in our test. If tuning still answers 401 on 0.2.11, please tell us where the variable is set (system, shell or a profile).The Strata project