Skip to content

environment: refuse malformed settings by name at startup, and report the profile groups (#2370) - #2405

Merged
ashhart merged 5 commits into
mainfrom
lead/env-refusals
Nov 7, 2026
Merged

ashhart merged 5 commits into
mainfrom
lead/env-refusals

Conversation

@ashhart

@ashhart ashhart commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Part of #2370.

A malformed setting in the environment used to be read leniently, or ignored, deep inside an engine. This makes the native server refuse it by name at startup, before any checkpoint or driver work.

What changes

  • Named refusals at startup (platform/environment.zig, server/main.zig, server/engines.zig): a malformed value stops the server with the variable's name, the text it was given (escaped), and the forms it accepts. Flags keep their precedence. Valid values, whitespace, caps, clamping and a disabled feature's precedence behave as before, and an empty or whitespace-only value still means unset, as on main. The documented lenient forms stay lenient: graph-cache 0/off, slot-resume 0, the page switches, and the presence-based slide modes.
  • One CUDA device-ordinal parser, shared by the probes, the native, Drama and Qwen4 adapters and the direct CLI (native/cuda_device.zig, native/qwen4_cuda.zig, cli/cuda_main.zig). HIP's named budget refusals now include the bad text (hip/admission.zig).
  • Profile registry (core/profile.zig): six setting groups get their classes and stable fallbacks, so --profile and the startup line report them. Kolibri reports an exact 0 as disabling, Dory reports every present non-zero value, and Gemma uses its real tensor-stack names.
  • Disk identities (native/disk_identity.zig): a kept state's identity now records explicit prompt widths and Dory's exact-zero setting, and hashes the slide group's real member values in their scopes. Identities hash each applicable setting's value even when it's unset, so this re-keys every kept disk state of Qwen 3.5 and Qwen3.8-27B on Metal, and of Nemotron and Qwen 3.5 on CUDA, whatever the settings: each is prefilled once after upgrading, with the same reply, and saved again under the new identity.
  • Capabilities: capabilities --json stops listing two environment names the native binary doesn't read (TENSORFOLD_NO_UPDATE_CHECK, HF_HUB_OFFLINE).
  • docs/environment.md lists every validated variable, its accepted forms and its refusal; the developer selectors and policies left as they are are listed there too.

No DeepSeek, Flash Next, lane-host or kernel implementation file changes.

Tests

Host only. The strict-parser refusals and every valid, unset, empty and whitespace-only fixture; registry and startup and JSON reporting; Qwen's native prompt widths; the CUDA runtime and host suite; HIP's named refusals; the native CUDA and server cross-compiles for both Linux targets; disk-identity regressions for the new members. The Metal server refuses all 15 malformed-setting cases before resolving a model, and starts as before with valid or unset values. Lean has no new findings and every changed Zig file is at most 600 lines. The landing gate's host checks pass on today's main.

No model or GPU run: this changes how settings are parsed and reported, not what an engine computes.

@ashhart

ashhart commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Two changes after a second read, on e5c1b50c8e:

  • Blank values mean unset again. Main's readers used their defaults on empty or whitespace-only text, and this branch refused it for every rule but three. Now any blank value is unset for every rule, so only malformed text stops the server. The per-rule empty-default flag went with it; the tests check "", " " and "\t \n" for every rule.
  • Wording on kept disk states. Identities hash each applicable setting's value even when it's unset, so every kept disk state of Qwen 3.5 and Qwen3.8-27B on Metal, and of Nemotron and Qwen 3.5 on CUDA, is prefilled once after upgrading, whatever the settings. The body now says so, and so will the changelog line.

The landing gate's host checks pass on the new head.

Main's readers fell back to their defaults on empty text; the strict
parser refused it for every rule but three. Blank values now return
null for every rule, so only malformed text is refused. The per-rule
empty_default flag is gone with it.
@ashhart
ashhart merged commit 1fedcfc into main Nov 7, 2026
0 of 11 checks passed
ashhart added a commit that referenced this pull request Nov 8, 2026
#2405 routed every malformed TF_PROMPT_ROWS through the environment table's
generic refusal, so a count under 128 lost the floor's explanation and
test-qwen27-prompt-floor-host (not in CI) failed on main. A whole count
below the floor is admitted through the floor's message; any other bad
text keeps the table's.
ashhart added a commit that referenced this pull request Nov 8, 2026
…s message

6a1feb2 (#2405) wrote two expectations here that main has since changed on purpose:

- 19e9062 (environment: empty or whitespace-only values mean unset again) made blank text unset
  for every setting. "" now reaches the loader, and expecting InvalidEnvironment for it stopped the
  malformed-value loop at its first value. "" leaves that loop, and a new test pins "", " " and
  "\t\n" as unset: the loader is called and why is untouched.
- 199a02c (#2527) gave a whole count below 128 the prompt floor's own message again. The
  below-floor test expected the generic table message, so it failed as soon as #2527 landed. It
  now expects the floor's text, origin and remedy, as test-qwen27-prompt-floor-host does.

test-qwen27-prompt-rows-host: 14 of 14.
@ashhart
ashhart deleted the lead/env-refusals branch November 10, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant