refactor: Unify reminder management across interactive and headless modes (#1001)

Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: cpacker <packercharles@gmail.com>
This commit is contained in:
Devansh Jain
2026-02-18 15:44:59 -08:00
committed by GitHub
parent 5b12a30293
commit b322a46a43
13 changed files with 907 additions and 395 deletions

View File

@@ -3,7 +3,7 @@ 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", () => {
test("defines helper that resets shared reminder state", () => {
const appPath = fileURLToPath(
new URL("../../cli/App.tsx", import.meta.url),
);
@@ -12,9 +12,12 @@ describe("bootstrap reminder reset wiring", () => {
expect(source).toContain(
"const resetBootstrapReminderState = useCallback(() => {",
);
expect(source).toContain("hasSentSessionContextRef.current = false;");
expect(source).toContain("hasInjectedSkillsRef.current = false;");
expect(source).toContain("discoveredSkillsRef.current = null;");
expect(source).toContain(
"resetSharedReminderState(sharedReminderStateRef.current);",
);
expect(source).not.toContain("hasSentSessionContextRef.current = false;");
expect(source).not.toContain("hasInjectedSkillsRef.current = false;");
expect(source).not.toContain("discoveredSkillsRef.current = null;");
});
test("invokes helper for all conversation/agent switch entry points", () => {

View File

@@ -3,20 +3,26 @@ import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
describe("reflection auto-launch wiring", () => {
test("handles step-count and compaction-event auto-launch modes", () => {
test("routes step-count and compaction-event auto-launch through shared reminder engine", () => {
const appPath = fileURLToPath(
new URL("../../cli/App.tsx", import.meta.url),
);
const source = readFileSync(appPath, "utf-8");
const enginePath = fileURLToPath(
new URL("../../reminders/engine.ts", import.meta.url),
);
const appSource = readFileSync(appPath, "utf-8");
const engineSource = readFileSync(enginePath, "utf-8");
expect(source).toContain("const maybeLaunchReflectionSubagent = async");
expect(source).toContain(
'await maybeLaunchReflectionSubagent("step-count")',
expect(appSource).toContain("const maybeLaunchReflectionSubagent = async");
expect(appSource).toContain("hasActiveReflectionSubagent()");
expect(appSource).toContain("spawnBackgroundSubagentTask({");
expect(appSource).toContain("maybeLaunchReflectionSubagent,");
expect(engineSource).toContain(
'await context.maybeLaunchReflectionSubagent("step-count")',
);
expect(source).toContain(
'await maybeLaunchReflectionSubagent("compaction-event")',
expect(engineSource).toContain(
'await context.maybeLaunchReflectionSubagent("compaction-event")',
);
expect(source).toContain("hasActiveReflectionSubagent()");
expect(source).toContain("spawnBackgroundSubagentTask({");
});
});