fix: auto-create missing skills blocks when resuming older agents (#559)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-01-15 19:18:37 -08:00
committed by GitHub
parent 4f9e7e406a
commit c6d43a1a25
3 changed files with 77 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ import {
import { getClient } from "./agent/client";
import { initializeLoadedSkillsFlag, setAgentContext } from "./agent/context";
import { createAgent } from "./agent/create";
import { ISOLATED_BLOCK_LABELS } from "./agent/memory";
import { ensureSkillsBlocks, ISOLATED_BLOCK_LABELS } from "./agent/memory";
import { sendMessageStream } from "./agent/message";
import { getModelUpdateArgs } from "./agent/model";
import { SessionStats } from "./agent/stats";
@@ -529,6 +529,12 @@ export async function handleHeadlessCommand(
conversationId,
});
// Ensure the agent has the required skills blocks (for backwards compatibility)
const createdBlocks = await ensureSkillsBlocks(agent.id);
if (createdBlocks.length > 0) {
console.log("Created missing skills blocks for agent compatibility");
}
// Set agent context for tools that need it (e.g., Skill tool, Task tool)
setAgentContext(agent.id, skillsDirectory);
await initializeLoadedSkillsFlag();