From f2d9b2c493af45dbc1cd7c9f58adef418cfc033a Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 3 May 2026 21:46:18 -0700 Subject: [PATCH] fix(tests): restore progress draft changed gate --- CHANGELOG.md | 2 ++ .../dispatch.preview-fallback.test.ts | 24 +++++++++++++++++-- .../diagnostic-session-context.test.ts | 4 ++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d01feaa307..8b8da00be2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,8 @@ Docs: https://docs.openclaw.ai ### Fixes +- Diagnostics: handle missing session-tail files in cron recovery context without tripping extension test typecheck. Thanks @vincentkoc. +- QA/Slack: update the Slack dispatch preview fallback test SDK mock for structured progress draft helpers, so the rich progress draft regression suite covers the new imports instead of failing before assertions run. Thanks @vincentkoc. - Plugins/loader: keep bundled plugin package `test-api.js` aliases behind private QA mode, so source transforms do not expose test-only public surfaces during normal plugin loading. Thanks @vincentkoc. - Gateway/startup: start cron and record the post-ready memory trace even when deferred maintenance timers fail after readiness, so a non-fatal timer setup issue does not silently leave scheduled jobs idle. Thanks @vincentkoc. - Exec approvals: unwrap BSD/macOS `env -P ` carrier commands before approval-command and strict inline-eval checks, so `/approve` shell execution and inline interpreter payloads are still blocked behind that env form. diff --git a/extensions/slack/src/monitor/message-handler/dispatch.preview-fallback.test.ts b/extensions/slack/src/monitor/message-handler/dispatch.preview-fallback.test.ts index 05240b001e9..924cb731df1 100644 --- a/extensions/slack/src/monitor/message-handler/dispatch.preview-fallback.test.ts +++ b/extensions/slack/src/monitor/message-handler/dispatch.preview-fallback.test.ts @@ -231,6 +231,21 @@ vi.mock("openclaw/plugin-sdk/channel-reply-pipeline", () => ({ })); vi.mock("openclaw/plugin-sdk/channel-streaming", () => ({ + buildChannelProgressDraftLine: (params: { + progressText?: string; + summary?: string; + title?: string; + name?: string; + }) => { + const text = params.progressText ?? params.summary ?? params.title ?? params.name; + return text + ? { + kind: "item", + text, + label: params.title ?? params.name ?? "Update", + } + : undefined; + }, createChannelProgressDraftGate: (params: { onStart: () => void | Promise }) => { let started = false; let workEvents = 0; @@ -257,12 +272,14 @@ vi.mock("openclaw/plugin-sdk/channel-streaming", () => ({ }, formatChannelProgressDraftText: (params: { entry?: { streaming?: { progress?: { label?: string | false; maxLines?: number } } }; - lines: string[]; + lines: Array; + formatLine?: (line: string) => string; }) => { const label = params.entry?.streaming?.progress?.label; + const formatLine = params.formatLine ?? ((line: string) => line); return [ label === false ? undefined : (label ?? "Thinking"), - ...params.lines.map((line) => `• ${line}`), + ...params.lines.map((line) => `• ${formatLine(typeof line === "string" ? line : line.text)}`), ] .filter((line): line is string => Boolean(line)) .join("\n"); @@ -276,6 +293,9 @@ vi.mock("openclaw/plugin-sdk/channel-streaming", () => ({ resolveChannelProgressDraftMaxLines: (entry?: { streaming?: { progress?: { maxLines?: number } }; }) => entry?.streaming?.progress?.maxLines ?? 8, + resolveChannelProgressDraftRender: (entry?: { + streaming?: { progress?: { render?: "text" | "rich" } }; + }) => entry?.streaming?.progress?.render ?? "text", resolveChannelStreamingBlockEnabled: () => mockedBlockStreamingEnabled, resolveChannelStreamingNativeTransport: () => mockedNativeStreaming, resolveChannelStreamingPreviewToolProgress: (entry?: { diff --git a/src/logging/diagnostic-session-context.test.ts b/src/logging/diagnostic-session-context.test.ts index 6904df2cff8..0a5e913a1ee 100644 --- a/src/logging/diagnostic-session-context.test.ts +++ b/src/logging/diagnostic-session-context.test.ts @@ -91,4 +91,8 @@ describe("diagnostic session context", () => { expect(readLastAssistantFromSessionFile(filePath)).toBe("newer"); }); + + it("ignores missing transcript tail files", () => { + expect(readLastAssistantFromSessionFile(path.join(tempDir!, "missing.jsonl"))).toBeUndefined(); + }); });