mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:00:42 +00:00
fix(memory-core): use all dreaming signals for light confidence
This commit is contained in:
@@ -406,6 +406,29 @@ describe("memory-core dreaming phases", () => {
|
||||
expect(after[0]?.snippet).toContain("Keep retention at 365 days.");
|
||||
});
|
||||
|
||||
it("renders non-zero light-sleep confidence for dreaming-ingested candidates", async () => {
|
||||
const workspaceDir = await createDreamingWorkspace();
|
||||
await withDreamingTestClock(async () => {
|
||||
await writeDailyNote(workspaceDir, [
|
||||
`# ${DREAMING_TEST_DAY}`,
|
||||
"",
|
||||
"- Move backups to S3 Glacier.",
|
||||
"- Keep retention at 365 days.",
|
||||
]);
|
||||
|
||||
const { beforeAgentReply } = createLightDreamingHarness(workspaceDir);
|
||||
await triggerLightDreaming(beforeAgentReply, workspaceDir, 5);
|
||||
|
||||
const dailyContent = await fs.readFile(
|
||||
path.join(workspaceDir, "memory", `${DREAMING_TEST_DAY}.md`),
|
||||
"utf-8",
|
||||
);
|
||||
expect(dailyContent).toContain("## Light Sleep");
|
||||
expect(dailyContent).toContain("confidence: 0.62");
|
||||
expect(dailyContent).not.toContain("confidence: 0.00");
|
||||
});
|
||||
});
|
||||
|
||||
it("checkpoints session transcript ingestion and skips unchanged transcripts", async () => {
|
||||
const workspaceDir = await createDreamingWorkspace();
|
||||
vi.stubEnv("OPENCLAW_TEST_FAST", "1");
|
||||
|
||||
@@ -1241,7 +1241,13 @@ export async function seedHistoricalDailyMemorySignals(params: {
|
||||
}
|
||||
|
||||
function entryAverageScore(entry: ShortTermRecallEntry): number {
|
||||
return entry.recallCount > 0 ? Math.max(0, Math.min(1, entry.totalScore / entry.recallCount)) : 0;
|
||||
const signalCount = Math.max(
|
||||
0,
|
||||
Math.floor(entry.recallCount ?? 0) +
|
||||
Math.floor(entry.dailyCount ?? 0) +
|
||||
Math.floor(entry.groundedCount ?? 0),
|
||||
);
|
||||
return signalCount > 0 ? Math.max(0, Math.min(1, entry.totalScore / signalCount)) : 0;
|
||||
}
|
||||
|
||||
function tokenizeSnippet(snippet: string): Set<string> {
|
||||
|
||||
Reference in New Issue
Block a user