惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
D
Docker
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
Y
Y Combinator Blog
Vercel News
Vercel News
F
Fortinet All Blogs
B
Blog
Recent Announcements
Recent Announcements
A
About on SuperTechFans
GbyAI
GbyAI
T
The Blog of Author Tim Ferriss
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
MongoDB | Blog
MongoDB | Blog
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
C
Check Point Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
Visual Studio Blog
月光博客
月光博客

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(video): skip delivering tasks in active-task prompt g...
palomyates51 · 2026-06-24 · via Recent Commits to openclaw:main
1+

import { beforeEach, describe, expect, it, vi } from "vitest";

2+

import type { TaskRecord } from "../tasks/task-registry.types.js";

3+

import {

4+

buildActiveMediaGenerationTaskPromptContextForSession,

5+

findActiveMediaGenerationTaskForSession,

6+

findDuplicateGuardMediaGenerationTaskForSession,

7+

listActiveMediaGenerationTasksForSession,

8+

MEDIA_GENERATION_DELIVERING_COMPLETION_PROGRESS,

9+

resetRecentMediaGenerationDuplicateGuardsForTests,

10+

} from "./media-generation-task-status-shared.js";

11+12+

const taskRuntimeInternalMocks = vi.hoisted(() => ({

13+

listFreshTasksForOwnerKey: vi.fn(),

14+

}));

15+16+

vi.mock("../tasks/runtime-internal.js", () => taskRuntimeInternalMocks);

17+18+

function makeTask(overrides: Partial<TaskRecord> = {}): TaskRecord {

19+

const now = Date.now();

20+

return {

21+

taskId: "task-1",

22+

runtime: "cli",

23+

taskKind: "video-generate",

24+

sourceId: "video-generate:byteplus",

25+

requesterSessionKey: "session/A",

26+

ownerKey: "session/A",

27+

scopeKind: "session",

28+

runId: "run-1",

29+

task: "generate clip 01",

30+

status: "running",

31+

deliveryStatus: "not_applicable",

32+

notifyPolicy: "silent",

33+

createdAt: now,

34+

startedAt: now,

35+

lastEventAt: now,

36+

...overrides,

37+

};

38+

}

39+40+

beforeEach(() => {

41+

resetRecentMediaGenerationDuplicateGuardsForTests();

42+

taskRuntimeInternalMocks.listFreshTasksForOwnerKey.mockReset();

43+

});

44+45+

describe("media generation delivery-phase prompt guard", () => {

46+

it("does not warn about a task waiting only for completion delivery", () => {

47+

taskRuntimeInternalMocks.listFreshTasksForOwnerKey.mockReturnValue([

48+

makeTask({ progressSummary: MEDIA_GENERATION_DELIVERING_COMPLETION_PROGRESS }),

49+

]);

50+51+

expect(

52+

buildActiveMediaGenerationTaskPromptContextForSession({

53+

sessionKey: "session/A",

54+

taskKind: "video-generate",

55+

sourcePrefix: "video-generate",

56+

nounLabel: "video",

57+

toolName: "video_generate",

58+

completionLabel: "video",

59+

}),

60+

).toBeUndefined();

61+

});

62+63+

it("still warns while media generation is running", () => {

64+

taskRuntimeInternalMocks.listFreshTasksForOwnerKey.mockReturnValue([

65+

makeTask({ progressSummary: "Generating video" }),

66+

]);

67+68+

expect(

69+

buildActiveMediaGenerationTaskPromptContextForSession({

70+

sessionKey: "session/A",

71+

taskKind: "video-generate",

72+

sourcePrefix: "video-generate",

73+

nounLabel: "video",

74+

toolName: "video_generate",

75+

completionLabel: "video",

76+

}),

77+

).toContain("Do not call `video_generate` again for the same request");

78+

});

79+80+

it("keeps delivery-phase tasks available to duplicate/status lookups", () => {

81+

const task = makeTask({ progressSummary: MEDIA_GENERATION_DELIVERING_COMPLETION_PROGRESS });

82+

taskRuntimeInternalMocks.listFreshTasksForOwnerKey.mockReturnValue([task]);

83+84+

expect(

85+

listActiveMediaGenerationTasksForSession({

86+

sessionKey: "session/A",

87+

taskKind: "video-generate",

88+

sourcePrefix: "video-generate",

89+

}),

90+

).toEqual([task]);

91+

expect(

92+

findActiveMediaGenerationTaskForSession({

93+

sessionKey: "session/A",

94+

taskKind: "video-generate",

95+

sourcePrefix: "video-generate",

96+

}),

97+

).toEqual(task);

98+

});

99+100+

it("blocks the same prompt while allowing a distinct prompt", () => {

101+

const task = makeTask({

102+

task: "generate clip 01",

103+

progressSummary: MEDIA_GENERATION_DELIVERING_COMPLETION_PROGRESS,

104+

});

105+

taskRuntimeInternalMocks.listFreshTasksForOwnerKey.mockReturnValue([task]);

106+107+

expect(

108+

findDuplicateGuardMediaGenerationTaskForSession({

109+

sessionKey: "session/A",

110+

taskKind: "video-generate",

111+

sourcePrefix: "video-generate",

112+

taskLabel: "generate clip 01",

113+

maxAgeMs: 120_000,

114+

}),

115+

).toEqual(task);

116+

expect(

117+

findDuplicateGuardMediaGenerationTaskForSession({

118+

sessionKey: "session/A",

119+

taskKind: "video-generate",

120+

sourcePrefix: "video-generate",

121+

taskLabel: "generate clip 02",

122+

maxAgeMs: 120_000,

123+

}),

124+

).toBeUndefined();

125+

});

126+

});