fix(startup): clear Letta Code tool rules on boot (#1405)
Co-authored-by: Jin Peng <jinjpeng@gmail.com> Co-authored-by: Letta Code <noreply@letta.com>
This commit is contained in:
28
src/index.ts
28
src/index.ts
@@ -48,7 +48,8 @@ import { settingsManager } from "./settings-manager";
|
||||
import { startStartupAutoUpdateCheck } from "./startup-auto-update";
|
||||
import { telemetry } from "./telemetry";
|
||||
import { loadTools } from "./tools/manager";
|
||||
import { debugLog } from "./utils/debug";
|
||||
import { clearPersistedClientToolRules } from "./tools/toolset";
|
||||
import { debugLog, debugWarn } from "./utils/debug";
|
||||
import { markMilestone } from "./utils/timing";
|
||||
|
||||
// Stable empty array constants to prevent new references on every render
|
||||
@@ -1793,6 +1794,31 @@ async function main(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
const startupAgentId = agent.id;
|
||||
void clearPersistedClientToolRules(startupAgentId)
|
||||
.then((cleanup) => {
|
||||
if (cleanup) {
|
||||
const count = cleanup.removedToolNames.length;
|
||||
const names = cleanup.removedToolNames.join(", ");
|
||||
debugLog(
|
||||
"startup",
|
||||
`Cleared ${count} persisted client tool rule${count === 1 ? "" : "s"} for ${startupAgentId}${count > 0 ? `: ${names}` : ""}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
debugLog(
|
||||
"startup",
|
||||
`No persisted client tool rules to clear for ${startupAgentId}`,
|
||||
);
|
||||
})
|
||||
.catch((error) => {
|
||||
debugWarn(
|
||||
"startup",
|
||||
`Failed to clear persisted client tool rules for ${startupAgentId}: ${error instanceof Error ? error.message : String(error)}`,
|
||||
);
|
||||
});
|
||||
|
||||
// Handle conversation: either resume existing or create new
|
||||
// Using definite assignment assertion - all branches below either set this or exit/throw
|
||||
let conversationIdToUse!: string;
|
||||
|
||||
Reference in New Issue
Block a user