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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user