mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-07 22:44:16 +00:00
fix: include available_skills in isolated cron agentTurn sessions (closes #24888)
buildSkillsSection() had an early-return guard on isMinimal that silently dropped the entire <available_skills> block for any session using promptMode="minimal" — which includes all isolated cron agentTurn sessions (isCronSessionKey → promptMode="minimal" in attempt.ts:497-500). Fix: remove the isMinimal guard from buildSkillsSection so that skills are emitted whenever a non-empty skillsPrompt is provided, regardless of mode. Memory, docs, reply-tags, and other verbose sections remain gated on isMinimal. Tests added: - "includes skills in minimal prompt mode when skillsPrompt is provided (cron regression)" - "omits skills in minimal prompt mode when skillsPrompt is absent" - Updated existing minimal-mode test expectation to match corrected behaviour.
This commit is contained in:
@@ -108,7 +108,8 @@ describe("buildAgentSystemPrompt", () => {
|
||||
});
|
||||
|
||||
expect(prompt).not.toContain("## Authorized Senders");
|
||||
expect(prompt).not.toContain("## Skills");
|
||||
// Skills are included even in minimal mode when skillsPrompt is provided (cron sessions need them)
|
||||
expect(prompt).toContain("## Skills");
|
||||
expect(prompt).not.toContain("## Memory Recall");
|
||||
expect(prompt).not.toContain("## Documentation");
|
||||
expect(prompt).not.toContain("## Reply Tags");
|
||||
@@ -131,6 +132,29 @@ describe("buildAgentSystemPrompt", () => {
|
||||
expect(prompt).toContain("Subagent details");
|
||||
});
|
||||
|
||||
it("includes skills in minimal prompt mode when skillsPrompt is provided (cron regression)", () => {
|
||||
// Isolated cron sessions use promptMode="minimal" but must still receive skills.
|
||||
const skillsPrompt =
|
||||
"<available_skills>\n <skill>\n <name>demo</name>\n </skill>\n</available_skills>";
|
||||
const prompt = buildAgentSystemPrompt({
|
||||
workspaceDir: "/tmp/openclaw",
|
||||
promptMode: "minimal",
|
||||
skillsPrompt,
|
||||
});
|
||||
|
||||
expect(prompt).toContain("## Skills (mandatory)");
|
||||
expect(prompt).toContain("<available_skills>");
|
||||
});
|
||||
|
||||
it("omits skills in minimal prompt mode when skillsPrompt is absent", () => {
|
||||
const prompt = buildAgentSystemPrompt({
|
||||
workspaceDir: "/tmp/openclaw",
|
||||
promptMode: "minimal",
|
||||
});
|
||||
|
||||
expect(prompt).not.toContain("## Skills");
|
||||
});
|
||||
|
||||
it("includes safety guardrails in full prompts", () => {
|
||||
const prompt = buildAgentSystemPrompt({
|
||||
workspaceDir: "/tmp/openclaw",
|
||||
|
||||
@@ -22,9 +22,6 @@ function buildSkillsSection(params: {
|
||||
isMinimal: boolean;
|
||||
readToolName: string;
|
||||
}) {
|
||||
if (params.isMinimal) {
|
||||
return [];
|
||||
}
|
||||
const trimmed = params.skillsPrompt?.trim();
|
||||
if (!trimmed) {
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user