From 5e3d48f1ed05d455c8dc2b63f65010f8fd5f4d43 Mon Sep 17 00:00:00 2001 From: MorikawaSouma Date: Sun, 15 Mar 2026 18:07:49 +0800 Subject: [PATCH 1/2] fix(memory-flush): allow first flush when compactionCount is 0 Previously, hasAlreadyFlushedForCurrentCompaction returned true when both compactionCount and memoryFlushCompactionCount were 0, which incorrectly blocked the first memory flush for sessions that had never been compacted. Now when compactionCount is 0 (never compacted), the function returns false to allow the first memory flush. This fixes the edge case where sessions with high token counts but no compaction history would never auto-flush. Fixes #47143 --- pr-body.md | 19 +++++++++++++++++++ src/auto-reply/reply/memory-flush.ts | 10 ++++++++++ src/auto-reply/reply/reply-state.test.ts | 15 +++++++++++++-- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 pr-body.md diff --git a/pr-body.md b/pr-body.md new file mode 100644 index 00000000000..498e1ac642a --- /dev/null +++ b/pr-body.md @@ -0,0 +1,19 @@ +## Summary + +Fixes #47139 + +Previously, the Control Panel displayed workspace-installed skills as "bundled" when they shared names with bundled skills (e.g., summarize, nano-pdf, video-frames). This was because the bundled check used `bundledNames.has(entry.skill.name)` instead of checking the actual source path. + +### Root Cause +The `bundled` property in `buildSkillStatus` checked if the skill name existed in `bundledNames` set, rather than checking the actual `source` field of the skill entry. This caused workspace-installed copies of bundled skills to be incorrectly displayed as bundled. + +### Fix +Now the `bundled` property is determined solely by the skill's `source` field, which correctly reflects where the skill was loaded from. + +### Test Plan +1. Install a skill from ClawHub that originally came bundled with OpenClaw (e.g., summarize, video-frames) +2. Open Control Panel Web UI +3. Check skills list +4. Verify the skill shows as "workspace" instead of "bundled" + +Also verify `openclaw skills list` and Control Panel show consistent source values. diff --git a/src/auto-reply/reply/memory-flush.ts b/src/auto-reply/reply/memory-flush.ts index 95f6dbaa053..56ca33f2faf 100644 --- a/src/auto-reply/reply/memory-flush.ts +++ b/src/auto-reply/reply/memory-flush.ts @@ -218,11 +218,21 @@ export function shouldRunMemoryFlush(params: { * Returns true when a memory flush has already been performed for the current * compaction cycle. This prevents repeated flush runs within the same cycle — * important for both the token-based and transcript-size–based trigger paths. + * + * Note: When compactionCount is 0 (never compacted), we always return false + * to allow the first memory flush. This fixes the edge case where both + * compactionCount and memoryFlushCompactionCount are 0, which previously + * incorrectly returned true (0 === 0), blocking the first flush. */ export function hasAlreadyFlushedForCurrentCompaction( entry: Pick, ): boolean { const compactionCount = entry.compactionCount ?? 0; const lastFlushAt = entry.memoryFlushCompactionCount; + // When compactionCount is 0, the session has never been compacted. + // Allow flush in this case to enable first-time memory flush. + if (compactionCount === 0) { + return false; + } return typeof lastFlushAt === "number" && lastFlushAt === compactionCount; } diff --git a/src/auto-reply/reply/reply-state.test.ts b/src/auto-reply/reply/reply-state.test.ts index f83d313e2d3..246cb12f508 100644 --- a/src/auto-reply/reply/reply-state.test.ts +++ b/src/auto-reply/reply/reply-state.test.ts @@ -386,12 +386,23 @@ describe("hasAlreadyFlushedForCurrentCompaction", () => { ).toBe(false); }); - it("treats missing compactionCount as 0", () => { + it("returns false when compactionCount is 0 (never compacted)", () => { + // When compactionCount is 0, the session has never been compacted, + // so we should allow the first memory flush. + expect( + hasAlreadyFlushedForCurrentCompaction({ + compactionCount: 0, + memoryFlushCompactionCount: 0, + }), + ).toBe(false); + }); + + it("treats missing compactionCount as 0 and allows flush", () => { expect( hasAlreadyFlushedForCurrentCompaction({ memoryFlushCompactionCount: 0, }), - ).toBe(true); + ).toBe(false); }); }); From e4da6a51888b032ea9b4039104a2d3a28fad82d8 Mon Sep 17 00:00:00 2001 From: MorikawaSouma Date: Sun, 15 Mar 2026 18:34:23 +0800 Subject: [PATCH 2/2] chore: remove pr-body.md from repo --- pr-body.md | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 pr-body.md diff --git a/pr-body.md b/pr-body.md deleted file mode 100644 index 498e1ac642a..00000000000 --- a/pr-body.md +++ /dev/null @@ -1,19 +0,0 @@ -## Summary - -Fixes #47139 - -Previously, the Control Panel displayed workspace-installed skills as "bundled" when they shared names with bundled skills (e.g., summarize, nano-pdf, video-frames). This was because the bundled check used `bundledNames.has(entry.skill.name)` instead of checking the actual source path. - -### Root Cause -The `bundled` property in `buildSkillStatus` checked if the skill name existed in `bundledNames` set, rather than checking the actual `source` field of the skill entry. This caused workspace-installed copies of bundled skills to be incorrectly displayed as bundled. - -### Fix -Now the `bundled` property is determined solely by the skill's `source` field, which correctly reflects where the skill was loaded from. - -### Test Plan -1. Install a skill from ClawHub that originally came bundled with OpenClaw (e.g., summarize, video-frames) -2. Open Control Panel Web UI -3. Check skills list -4. Verify the skill shows as "workspace" instead of "bundled" - -Also verify `openclaw skills list` and Control Panel show consistent source values.