summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authortanaka takashi <isazaka@gmail.com>2026-08-12 00:02:23 +0900
committertanaka takashi <isazaka@gmail.com>2026-08-12 00:02:23 +0900
commitce550a127b7dc972651bd15b9f09979a2c38688f (patch)
treef4e09d0f64f74a585e015e6f548c5589fd2442ba /tests
parent55db81082f9165a3965f860cd618bac4242c56b1 (diff)
feat: harden Python workflow and structured planning
Replace the uv-specific skill with a portable Python skill and rewrite the default user system prompt as a concise, structured Markdown execution policy. Normalize a single fenced structured-JSON response, retry invalid skill selection with think disabled, validate selected skill output, and make coding plans keep editing and verification in one task. Document the file_edit patch payload, expose that contract in the tool catalog, and convert malformed patch input into a retryable tool failure instead of terminating the agent task. Update configuration and runtime tests for the Python skill, exact tool catalog, structured-output retry, and implementation-and-verification planning guidance. Verified with 82 Agent.Core tests and an agent-mcp Python scheduling scenario with 49 passing unittest cases.
Diffstat (limited to 'tests')
-rw-r--r--tests/Agent.Core.Tests/ConfigurationTests.cs6
-rw-r--r--tests/Agent.Core.Tests/PromptAndRuntimeTests.cs13
2 files changed, 15 insertions, 4 deletions
diff --git a/tests/Agent.Core.Tests/ConfigurationTests.cs b/tests/Agent.Core.Tests/ConfigurationTests.cs
index f6db9f2..64b2d85 100644
--- a/tests/Agent.Core.Tests/ConfigurationTests.cs
+++ b/tests/Agent.Core.Tests/ConfigurationTests.cs
@@ -139,14 +139,14 @@ public sealed class ConfigurationTests
// Legacy single markdown — should be ignored (not loaded).
directory.File("skills/legacy.md", "legacy skill");
// Standard skill directory with frontmatter.
- directory.File("skills/python-via-uv/SKILL.md", "---\nname: python-via-uv\ndescription: Python execution skill.\n---\n# Python via uv\nInstructions here.");
+ directory.File("skills/python/SKILL.md", "---\nname: python\ndescription: Python execution skill.\n---\n# Python\nInstructions here.");
// Non-SKILL.md files in skill directory should not be loaded as skills.
- directory.File("skills/python-via-uv/reference.md", "must not be loaded as a skill");
+ directory.File("skills/python/reference.md", "must not be loaded as a skill");
var skills = SkillLoader.Load(Path.Combine(directory.Path, "skills"));
Assert.Single(skills);
- Assert.Equal("python-via-uv", skills[0].Name);
+ Assert.Equal("python", skills[0].Name);
Assert.Equal("Python execution skill.", skills[0].Description);
Assert.Contains("Instructions here.", skills[0].Instructions);
}
diff --git a/tests/Agent.Core.Tests/PromptAndRuntimeTests.cs b/tests/Agent.Core.Tests/PromptAndRuntimeTests.cs
index fef5340..6dad528 100644
--- a/tests/Agent.Core.Tests/PromptAndRuntimeTests.cs
+++ b/tests/Agent.Core.Tests/PromptAndRuntimeTests.cs
@@ -284,6 +284,10 @@ public sealed class PromptAndRuntimeTests
Assert.Equal(AgentTaskState.Completed, completed!.State);
Assert.Equal([null, false], ollama.ThinkOverrides);
Assert.All(ollama.Temperatures, value => Assert.Equal(0.7, value));
+ Assert.Contains(ollama.PlanningMessages[0], message =>
+ message.Role == "system" && message.Content.Contains("There is no file_write Tool", StringComparison.Ordinal));
+ Assert.Contains(ollama.PlanningMessages[0], message =>
+ message.Role == "system" && message.Content.Contains("one implementation-and-verification Task", StringComparison.Ordinal));
Assert.Contains(ollama.PlanningMessages[1], message =>
message.Role == "system" && message.Content.Contains("Do not call or execute any Tool", StringComparison.Ordinal));
}
@@ -615,7 +619,14 @@ public sealed class PromptAndRuntimeTests
Temperatures.Add(temperatureOverride);
PlanningMessages.Add(messages);
string content = ThinkOverrides.Count == 2 && succeedOnRetry
- ? """{"tasks":[{"description":"analyze","dependencies":[],"budget_class":"4K","optimistic_tokens":10,"most_likely_tokens":20,"pessimistic_tokens":30,"requires_external_effect":false}]}"""
+ ? """
+ Here is the requested plan.
+
+ ```json
+ {"tasks":[{"description":"analyze","dependencies":[],"budget_class":"4K","optimistic_tokens":10,"most_likely_tokens":20,"pessimistic_tokens":30,"requires_external_effect":false}]}
+ ```
+ The JSON above is the complete plan.
+ """
: "not-json";
return Task.FromResult(new OllamaResult(content, 1, 1));
}