fix(cli): reinject bootstrap reminders on conversation switches (#1000)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-02-17 16:45:28 -08:00
committed by GitHub
parent cda9f3d71d
commit 5d9f2b68ff
2 changed files with 74 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
import { describe, expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
describe("bootstrap reminder reset wiring", () => {
test("defines helper that clears session, skills, and discovery cache", () => {
const appPath = fileURLToPath(
new URL("../../cli/App.tsx", import.meta.url),
);
const source = readFileSync(appPath, "utf-8");
expect(source).toContain(
"const resetBootstrapReminderState = useCallback(() => {",
);
expect(source).toContain("hasSentSessionContextRef.current = false;");
expect(source).toContain("hasInjectedSkillsRef.current = false;");
expect(source).toContain("discoveredSkillsRef.current = null;");
});
test("invokes helper for all conversation/agent switch entry points", () => {
const appPath = fileURLToPath(
new URL("../../cli/App.tsx", import.meta.url),
);
const source = readFileSync(appPath, "utf-8");
const anchors = [
'origin: "agent-switch"',
'const inputCmd = "/new";', // new-agent creation flow
'if (msg.trim() === "/new")',
'if (msg.trim() === "/clear")',
'origin: "resume-direct"',
'if (action.type === "switch_conversation")', // queued conversation switch flow
'origin: "resume-selector"',
"onNewConversation={async () => {",
'origin: "search"',
];
for (const anchor of anchors) {
const anchorIndex = source.indexOf(anchor);
expect(anchorIndex).toBeGreaterThanOrEqual(0);
const windowEnd = Math.min(source.length, anchorIndex + 5000);
const scoped = source.slice(anchorIndex, windowEnd);
expect(scoped).toContain("resetBootstrapReminderState();");
}
});
});