Skip to content

armgit / ODS

Public Imported from GitHub
0

ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.

fix(windows): accept LLAMA_REASONING in any case so llama-server starts (#8151)

Satyam Singh2596f8c0c7db
diff --git a/ods/installers/windows/lib/native-llama-args.ps1 b/ods/installers/windows/lib/native-llama-args.ps1
index d6f30c895..982e323d3 100644
--- a/ods/installers/windows/lib/native-llama-args.ps1
+++ b/ods/installers/windows/lib/native-llama-args.ps1
@@ -163,6 +163,9 @@ function Get-ODSNativeReasoningArgs {
$value = $value.Substring(1, $value.Length - 2)
}
if (-not $value) { $value = "off" }
+ # Modes are case-insensitive, as in ods-host-agent.py; llama-server only
+ # accepts the lowercase spelling.
+ if ($value -in @("off", "on", "auto")) { $value = $value.ToLowerInvariant() }
if ($value -cin @("off", "on", "auto") -and (Test-ODSLlamaServerHelpFlag -Executable $Executable -Flag "--reasoning")) {
return @("--reasoning", $value)
}
diff --git a/ods/installers/windows/lib/native-llama-legacy.ps1 b/ods/installers/windows/lib/native-llama-legacy.ps1
index a5d3986d9..a5a379d15 100644
--- a/ods/installers/windows/lib/native-llama-legacy.ps1
+++ b/ods/installers/windows/lib/native-llama-legacy.ps1
@@ -138,6 +138,9 @@ function Get-ODSNativeLlamaLegacyReasoning([hashtable]$EnvMap) {
# --reasoning-format for binaries without --reasoning.
$mode = Get-ODSNativeLlamaLegacyEnvValue $EnvMap 'LLAMA_REASONING'
if (-not $mode) { $mode = 'off' }
+ # Modes are case-insensitive, as in Get-ODSNativeReasoningArgs; the
+ # fallback format must be llama.cpp's lowercase name.
+ if ($mode -in @('off', 'on', 'auto')) { $mode = $mode.ToLowerInvariant() }
$format = $mode
if ($mode -ceq 'off') { $format = 'none' } elseif ($mode -ceq 'on') { $format = 'deepseek' }
return [pscustomobject]@{ Mode = $mode; Format = $format }
diff --git a/ods/tests/test-windows-native-checkpoint-args.ps1 b/ods/tests/test-windows-native-checkpoint-args.ps1
index 0143df6ac..f9f251ae7 100644
--- a/ods/tests/test-windows-native-checkpoint-args.ps1
+++ b/ods/tests/test-windows-native-checkpoint-args.ps1
@@ -8,6 +8,7 @@ $ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
. (Join-Path $root "installers\windows\lib\native-llama-args.ps1")
+. (Join-Path $root "installers\windows\lib\native-llama-legacy.ps1")
$onWindows = ($env:OS -eq "Windows_NT")
$testRoot = Join-Path ([IO.Path]::GetTempPath()) "ods-native-checkpoint-$([Guid]::NewGuid().ToString('N'))"
@@ -85,7 +86,12 @@ try {
Assert-Reasoning (Get-ODSNativeReasoningArgs -Executable $withReasoning -Mode "" -FallbackFormat "none") @("--reasoning", "off") "b9014 default"
Assert-Reasoning (Get-ODSNativeReasoningArgs -Executable $withReasoning -Mode "auto" -FallbackFormat "auto") @("--reasoning", "auto") "b9014 auto"
Assert-Reasoning (Get-ODSNativeReasoningArgs -Executable $withReasoning -Mode "deepseek" -FallbackFormat "deepseek") @("--reasoning-format", "deepseek") "format name"
- Assert-Reasoning (Get-ODSNativeReasoningArgs -Executable $withReasoning -Mode "OFF" -FallbackFormat "OFF") @("--reasoning-format", "OFF") "case-sensitive mode"
+ # Modes are case-insensitive, as in ods-host-agent.py and bootstrap-upgrade.sh.
+ # A case-sensitive mode here turned OFF into the fallback format alone:
+ # b9014's default --reasoning auto then kept thinking on in the reply.
+ Assert-Reasoning (Get-ODSNativeReasoningArgs -Executable $withReasoning -Mode "OFF" -FallbackFormat "none") @("--reasoning", "off") "b9014 OFF"
+ Assert-Reasoning (Get-ODSNativeReasoningArgs -Executable $withReasoning -Mode "Auto" -FallbackFormat "Auto") @("--reasoning", "auto") "b9014 Auto"
+ Assert-Reasoning (Get-ODSNativeReasoningArgs -Executable $b8248Reasoning -Mode "Off" -FallbackFormat "none") @("--reasoning-format", "none", "--reasoning-budget", "0") "b8248 Off"
Assert-Reasoning (Get-ODSNativeReasoningArgs -Executable $b8248Reasoning -Mode "off" -FallbackFormat "none") @("--reasoning-format", "none", "--reasoning-budget", "0") "b8248 off"
Assert-Reasoning (Get-ODSNativeReasoningArgs -Executable $b8248Reasoning -Mode "" -FallbackFormat "none") @("--reasoning-format", "none", "--reasoning-budget", "0") "b8248 default"
Assert-Reasoning (Get-ODSNativeReasoningArgs -Executable $b8248Reasoning -Mode "on" -FallbackFormat "deepseek") @("--reasoning-format", "deepseek") "b8248 on"
@@ -93,6 +99,25 @@ try {
Assert-Reasoning (Get-ODSNativeReasoningArgs -Executable $removed -Mode "off" -FallbackFormat "none") @("--reasoning-format", "none") "removed flag"
Assert-Reasoning (Get-ODSNativeReasoningArgs -Executable $failing -Mode "off" -FallbackFormat "none") @("--reasoning-format", "none") "help exits non-zero"
+ # The launchers take the mode and fallback format from
+ # native-llama-legacy.ps1. An uppercase mode must still map to llama.cpp's
+ # lowercase format, or a binary without --reasoning gets
+ # --reasoning-format OFF and exits.
+ foreach ($case in @(
+ @{ Mode = "OFF"; Format = "none" },
+ @{ Mode = "On"; Format = "deepseek" },
+ @{ Mode = "AUTO"; Format = "auto" },
+ @{ Mode = ""; Format = "none" }
+ )) {
+ $choice = Get-ODSNativeLlamaLegacyReasoning @{ LLAMA_REASONING = $case.Mode }
+ if ($choice.Format -cne $case.Format) {
+ throw "legacy '$($case.Mode)': expected format '$($case.Format)', got '$($choice.Format)'"
+ }
+ }
+ $choice = Get-ODSNativeLlamaLegacyReasoning @{ LLAMA_REASONING = "OFF" }
+ Assert-Reasoning (Get-ODSNativeReasoningArgs -Executable $formatOnly -Mode $choice.Mode -FallbackFormat $choice.Format) @("--reasoning-format", "none") "legacy OFF without --reasoning"
+ Assert-Reasoning (Get-ODSNativeReasoningArgs -Executable $withReasoning -Mode $choice.Mode -FallbackFormat $choice.Format) @("--reasoning", "off") "legacy OFF with --reasoning"
+
# Every Windows launch goes through the probes: install-windows.ps1 and
# ods.ps1 start llama-server only through native-llama-legacy.ps1, and the
# Portal records its reasoning flags in wsl-portal-amd.ps1.