fix(cli): reinject bootstrap reminders on conversation switches (#1000)
Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
47
src/tests/cli/bootstrap-reminders-reset-wiring.test.ts
Normal file
47
src/tests/cli/bootstrap-reminders-reset-wiring.test.ts
Normal 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();");
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user