perf: eliminate redundant API calls on startup (#1067)

Co-authored-by: cpacker <packercharles@gmail.com>
Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Kian Jones
2026-02-20 16:59:45 -08:00
committed by GitHub
parent 539ce175e5
commit c5033666b4
4 changed files with 76 additions and 63 deletions

View File

@@ -222,6 +222,26 @@ export async function applyMemfsFlags(
if (isEnabled && (memfsFlag || shouldAutoEnableFromTag)) {
const { detachMemoryTools } = await import("../tools/toolset");
await detachMemoryTools(agentId);
// Migration (LET-7353): Remove legacy skills/loaded_skills blocks.
// These blocks are no longer used — skills are now injected via system reminders.
const { getClient } = await import("./client");
const client = await getClient();
for (const label of ["skills", "loaded_skills"]) {
try {
const block = await client.agents.blocks.retrieve(label, {
agent_id: agentId,
});
if (block) {
await client.agents.blocks.detach(block.id, {
agent_id: agentId,
});
await client.blocks.delete(block.id);
}
} catch {
// Block doesn't exist or already removed, skip
}
}
}
// Keep server-side state aligned with explicit disable.
@@ -235,7 +255,10 @@ export async function applyMemfsFlags(
if (isEnabled) {
const { addGitMemoryTag, isGitRepo, cloneMemoryRepo, pullMemory } =
await import("./memoryGit");
await addGitMemoryTag(agentId);
await addGitMemoryTag(
agentId,
options?.agentTags ? { tags: options.agentTags } : undefined,
);
if (!isGitRepo(agentId)) {
await cloneMemoryRepo(agentId);
} else if (options?.pullOnExistingRepo) {