Skip to content

Commit 57ea097

Browse files
committed
fix(memory-core): make the diary fallback marker cause-neutral
1 parent cc03bd1 commit 57ea097

4 files changed

Lines changed: 11 additions & 8 deletions

File tree

‎extensions/memory-core/src/dreaming-narrative.test.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ describe("generateAndAppendDreamNarrative", () => {
936936
expect(subagent.getSessionMessages).toHaveBeenCalledTimes(5);
937937
const content = await fs.readFile(path.join(workspaceDir, "DREAMS.md"), "utf-8");
938938
expect(content).toContain(
939-
"(Fallback entry: narrative generation produced no usable text for this run.) A memory trace surfaced, but details were unavailable.",
939+
"(Fallback entry: this run could not generate a diary narrative.) A memory trace surfaced, but details were unavailable.",
940940
);
941941
expectLogIncludes(logger.warn, "produced no text");
942942
} finally {
@@ -1105,7 +1105,7 @@ describe("generateAndAppendDreamNarrative", () => {
11051105
// placeholder is written on fallback.
11061106
expect(content).not.toContain("some memory");
11071107
expect(content).toContain(
1108-
"(Fallback entry: narrative generation produced no usable text for this run.) A memory trace surfaced, but details were unavailable.",
1108+
"(Fallback entry: this run could not generate a diary narrative.) A memory trace surfaced, but details were unavailable.",
11091109
);
11101110
expect(logger.info).toHaveBeenCalledWith(expect.stringContaining("status=timeout"));
11111111
});
@@ -1138,7 +1138,7 @@ describe("generateAndAppendDreamNarrative", () => {
11381138
expect(content).not.toContain("Session Key:");
11391139
expect(content).not.toContain("agent:main:dashboard");
11401140
expect(content).toContain(
1141-
"(Fallback entry: narrative generation produced no usable text for this run.) A memory trace surfaced, but details were unavailable.",
1141+
"(Fallback entry: this run could not generate a diary narrative.) A memory trace surfaced, but details were unavailable.",
11421142
);
11431143
});
11441144

@@ -1203,7 +1203,7 @@ describe("generateAndAppendDreamNarrative", () => {
12031203
// Raw staging snippets must never leak into the diary on fallback.
12041204
expect(content).not.toContain("API endpoints need authentication");
12051205
expect(content).toContain(
1206-
"(Fallback entry: narrative generation produced no usable text for this run.) A memory trace surfaced, but details were unavailable.",
1206+
"(Fallback entry: this run could not generate a diary narrative.) A memory trace surfaced, but details were unavailable.",
12071207
);
12081208
expectLogIncludes(logger.info, "request-scoped");
12091209
expectLogExcludes(logger.warn, "request-scoped");
@@ -1237,7 +1237,7 @@ describe("generateAndAppendDreamNarrative", () => {
12371237
// Raw staging promotions must never leak into the diary on fallback.
12381238
expect(content).not.toContain("A durable candidate surfaced.");
12391239
expect(content).toContain(
1240-
"(Fallback entry: narrative generation produced no usable text for this run.) A memory trace surfaced, but details were unavailable.",
1240+
"(Fallback entry: this run could not generate a diary narrative.) A memory trace surfaced, but details were unavailable.",
12411241
);
12421242
expectLogIncludes(logger.info, "request-scoped");
12431243
expectLogExcludes(logger.warn, "request-scoped");

‎extensions/memory-core/src/dreaming-narrative.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,11 @@ function formatFallbackWriteFailure(err: unknown): string {
146146
return "unknown error";
147147
}
148148

149+
// Cause-neutral marker: this fallback covers no-text completions, failed
150+
// runs, and request-scoped runtime unavailability alike — the specific cause
151+
// belongs in the gateway log line, never in DREAMS.md.
149152
const REQUEST_SCOPED_FALLBACK_NARRATIVE =
150-
"(Fallback entry: narrative generation produced no usable text for this run.) A memory trace surfaced, but details were unavailable.";
153+
"(Fallback entry: this run could not generate a diary narrative.) A memory trace surfaced, but details were unavailable.";
151154

152155
export async function appendFallbackNarrativeEntry(params: {
153156
workspaceDir: string;

‎extensions/memory-core/src/dreaming-phases.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ describe("memory-core dreaming phases", () => {
427427

428428
const dreams = await fs.readFile(path.join(workspaceDir, "DREAMS.md"), "utf-8");
429429
expect(dreams).toContain(
430-
"(Fallback entry: narrative generation produced no usable text for this run.) A memory trace surfaced, but details were unavailable.",
430+
"(Fallback entry: this run could not generate a diary narrative.) A memory trace surfaced, but details were unavailable.",
431431
);
432432
expect(dreams).not.toContain("Move backups to S3 Glacier.");
433433
expect(logger.error).not.toHaveBeenCalled();

‎extensions/memory-core/src/dreaming.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2385,7 +2385,7 @@ describe("short-term dreaming trigger", () => {
23852385
const dreamsText = await fs.readFile(path.join(workspaceDir, "DREAMS.md"), "utf-8");
23862386
expect(dreamsText).toContain("<!-- openclaw:dreaming:diary:start -->");
23872387
expect(dreamsText).toContain(
2388-
"(Fallback entry: narrative generation produced no usable text for this run.) A memory trace surfaced, but details were unavailable.",
2388+
"(Fallback entry: this run could not generate a diary narrative.) A memory trace surfaced, but details were unavailable.",
23892389
);
23902390
expect(dreamsText).not.toContain("Move backups to S3 Glacier.");
23912391
expect(logger.info).toHaveBeenCalledWith(

0 commit comments

Comments
 (0)