From 98b6a2aeedd591058c1d81e401d24f3ded162926 Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Wed, 12 Aug 2026 00:21:23 +0900 Subject: fix: implement native Ollama thinking semantics Model Ollama chat thinking separately from final content, preserve it only across assistant tool-call continuation, and keep private reasoning out of user results, session context, and logs. Accept native boolean and low/medium/high/max think values, normalize YAML booleans, and serialize explicit overrides using the native top-level chat field. Stop forcing think=false for structured planning, skill selection, and context summaries; corrected retries now retain the configured thinking mode. Update the specification, design, audit report, and requirement traceability for OLL-14. Add request/response, configuration, observability, retry, and tool-continuation coverage. Verified with 92 passing Agent.Core tests and a deepseek-v4-flash:cloud think:true MCP operational run. --- tests/Agent.Core.Tests/ConfigurationTests.cs | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests/Agent.Core.Tests/ConfigurationTests.cs') diff --git a/tests/Agent.Core.Tests/ConfigurationTests.cs b/tests/Agent.Core.Tests/ConfigurationTests.cs index 64b2d85..e588825 100644 --- a/tests/Agent.Core.Tests/ConfigurationTests.cs +++ b/tests/Agent.Core.Tests/ConfigurationTests.cs @@ -37,6 +37,36 @@ public sealed class ConfigurationTests Assert.Throws(() => ConfigurationLoader.Load(config)); } + [Theory] + [InlineData("true")] + [InlineData("false")] + [InlineData("low")] + [InlineData("medium")] + [InlineData("high")] + [InlineData("max")] + public void Ollama_think_accepts_native_boolean_and_level_values(string value) + { + using var directory = new TestDirectory(); + string config = CreateValidConfiguration(directory); + System.IO.File.WriteAllText(config, System.IO.File.ReadAllText(config).Replace(" model: model", $" model: model\n think: {value}", StringComparison.Ordinal)); + + AgentConfiguration result = ConfigurationLoader.Load(config); + + Assert.Equal(value is "true" or "false" ? bool.Parse(value) : value, result.Ollama.Think); + } + + [Fact] + public void Ollama_think_rejects_unknown_level() + { + using var directory = new TestDirectory(); + string config = CreateValidConfiguration(directory); + System.IO.File.WriteAllText(config, System.IO.File.ReadAllText(config).Replace(" model: model", " model: model\n think: extreme", StringComparison.Ordinal)); + + ConfigurationException error = Assert.Throws(() => ConfigurationLoader.Load(config)); + + Assert.Contains("ollama.think", error.Message, StringComparison.Ordinal); + } + [Fact] public void CommandLineLanguageOverrideIsCaptured() { -- cgit v1.2.3