Skip to content

fix(windows): normalize native reasoning modes case-insensitively - #8153

Closed
vaibhavsrv wants to merge 1 commit into
Osmantic:mainfrom
vaibhavsrv:fix/windows-native-reasoning-case
Closed

vaibhavsrv wants to merge 1 commit into
Osmantic:mainfrom
vaibhavsrv:fix/windows-native-reasoning-case

Conversation

@vaibhavsrv

Copy link
Copy Markdown
Contributor

Summary

Fixes #7321. Normalize native reasoning mode strings case-insensitively in Get-ODSNativeReasoningArgs and Get-ODSNativeLlamaLegacyReasoning.

install-windows.ps1 and ods.ps1 read and map LLAMA_REASONING using PowerShell's case-insensitive parameter semantics, and both ods-host-agent.py (.strip().lower()) and scripts/bootstrap-upgrade.sh (tr '[:upper:]' '[:lower:]') normalize the mode string to lowercase. However, Get-ODSNativeReasoningArgs in ods/installers/windows/lib/native-llama-args.ps1 compared the mode using case-sensitive -cin @("off", "on", "auto"), and Get-ODSNativeLlamaLegacyReasoning in ods/installers/windows/lib/native-llama-legacy.ps1 tested -ceq 'off' and -ceq 'on'.

When an owner configured LLAMA_REASONING=OFF, Off, or AUTO in .env, the case-sensitive checks failed to match. On binary b9014+ (which supports --reasoning), this fell through to emit only --reasoning-format OFF while omitting --reasoning off and --reasoning-budget 0. Because llama-server defaults to --reasoning auto, thinking remained enabled and reasoning tokens leaked into normal replies. On binaries without --reasoning, passing uppercase --reasoning-format OFF causes llama-server to exit with an invalid format error.

This fix normalizes $value and $mode via .ToLowerInvariant() when matched against the documented modes (off, on, auto). Any unrecognized value continues to pass through unchanged as a custom format name.

AI Assistance

AI drafted the fix and tests and ran the checks. The human author did not review each line before submission.

Release Lane

  • Stable hotfix targeting release/2.6.x
  • Mainline change targeting main
    • Normalizes native Windows llama-server reasoning flag generation.
  • Next-minor work targeting the next feature/minor release
  • Not sure; reviewer should help classify

Stable hotfix reason:

<!-- If this targets release/2.6.x, explain the current-stable user problem it fixes. -->

Changed Surface

  • Docs only
  • Tests only
  • Dashboard UI
  • Dashboard API / host agent
  • Installer / bootstrap / lifecycle
    • Normalizes argument construction in native-llama-args.ps1 and native-llama-legacy.ps1.
  • Docker Compose / service manifests
  • Model routing / Hermes / capabilities
    • Ensures LLAMA_REASONING=OFF reliably disables thinking tokens in model responses.
  • Network exposure / auth / proxy
  • Dependencies / runtime wiring

Risk And Validation

  • Risk level: Low
  • Validation run:
    • git diff --check
      • Clean whitespace and line endings across all modified files.
    • Markdown/link sanity for docs
    • Focused tests listed below
      • PowerShell contract regression executed in ods/tests/test-windows-native-checkpoint-args.ps1.
    • Dashboard lint/test/build
    • Extension audit / compose validation
    • Release-grade fleet or scoped hardware validation
      • Validated argument probe and reasoning flag emissions across mock llama-server variants (b9014 --reasoning, b8248 --reasoning-format/--reasoning-budget, format-only, and legacy).
    • Stable-lane patch validation, if targeting release/2.6.x
    • Not required because:

Commands/results:

# Baseline reproduction (unpatched):
# Get-ODSNativeReasoningArgs -Executable $withReasoning -Mode "OFF" -FallbackFormat "none"
# Result: @("--reasoning-format", "none")  # Missing --reasoning off!
# llama-server b9014 keeps its default --reasoning auto (thinking remains ON).

# Post-fix execution:
# Get-ODSNativeReasoningArgs -Executable $withReasoning -Mode "OFF" -FallbackFormat "none"
# Result: @("--reasoning", "off")
# Get-ODSNativeReasoningArgs -Executable $withReasoning -Mode "Auto" -FallbackFormat "Auto"
# Result: @("--reasoning", "auto")
# Get-ODSNativeReasoningArgs -Executable $b8248Reasoning -Mode "Off" -FallbackFormat "none"
# Result: @("--reasoning-format", "none", "--reasoning-budget", "0")

# Test suite execution:
./ods/tests/test-windows-native-checkpoint-args.ps1
# PASS: b9014 OFF, b9014 Auto, b8248 Off, legacy reasoning helper mapping

Operational Change Check

If this PR touches installer phases, bootstrap logic, compose stack generation,
service manifests, dashboard API control flows, Hermes, model routing, GPU or
runtime detection, lifecycle commands, host mutation, or network exposure, it
requires release-grade fleet validation before release unless the PR explains a
narrower equivalent.

  • This is not an operational change.
  • This is an operational change and validation is recorded above. It is a two-line normalization in native argument helpers covered by contract tests.
  • This is an operational change and validation is intentionally deferred for:

Notes For Reviewers

Map LLAMA_REASONING values case-insensitively in Get-ODSNativeReasoningArgs
and Get-ODSNativeLlamaLegacyReasoning. When configured as OFF, Off, or
AUTO in .env, normalize known modes to lowercase before checking flags so
that llama-server is started with --reasoning off and --reasoning-budget 0
instead of retaining its default auto reasoning.

Fixes Osmantic#7321
@vaibhavsrv

Copy link
Copy Markdown
Contributor Author

Closing: #8151 landed on main right before this.

@vaibhavsrv vaibhavsrv closed this Oct 25, 2026
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.

Windows native: LLAMA_REASONING=OFF leaves thinking on

1 participant