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

推荐订阅源

Vercel News
Vercel News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
V
V2EX
量子位
Last Week in AI
Last Week in AI
Jina AI
Jina AI
博客园 - 【当耐特】
爱范儿
爱范儿
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Hugging Face - Blog
Hugging Face - Blog
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
小众软件
小众软件
IT之家
IT之家
博客园_首页
博客园 - 聂微东
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗

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(commitments): guard extraction prompt timestamps · op...
steipete · 2026-05-30 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -17,6 +17,7 @@ describe("commitment extraction", () => {

1717

const nowMs = Date.parse("2026-04-29T16:00:00.000Z");

1818
1919

afterEach(async () => {

20+

vi.restoreAllMocks();

2021

vi.unstubAllEnvs();

2122

await Promise.all(tmpDirs.map((dir) => fs.rm(dir, { recursive: true, force: true })));

2223

tmpDirs.length = 0;

@@ -113,6 +114,38 @@ describe("commitment extraction", () => {

113114

expect(prompt).not.toContain("thread-secret");

114115

});

115116
117+

it("does not throw on out-of-range extraction prompt timestamps", () => {

118+

vi.spyOn(Date, "now").mockReturnValue(Date.parse("2026-05-30T12:00:00.000Z"));

119+
120+

const prompt = buildCommitmentExtractionPrompt({

121+

items: [

122+

item({

123+

nowMs: 8_640_000_000_000_001,

124+

existingPending: [

125+

{

126+

kind: "event_check_in",

127+

reason: "valid pending",

128+

dedupeKey: "valid",

129+

earliestMs: Date.parse("2026-05-31T12:00:00.000Z"),

130+

latestMs: Date.parse("2026-05-31T13:00:00.000Z"),

131+

},

132+

{

133+

kind: "open_loop",

134+

reason: "invalid pending",

135+

dedupeKey: "invalid",

136+

earliestMs: 8_640_000_000_000_001,

137+

latestMs: 8_640_000_000_000_001,

138+

},

139+

],

140+

}),

141+

],

142+

});

143+
144+

expect(prompt).toContain('"now": "2026-05-30T12:00:00.000Z"');

145+

expect(prompt).toContain('"dedupeKey": "valid"');

146+

expect(prompt).not.toContain('"dedupeKey": "invalid"');

147+

});

148+
116149

it("rejects disabled, low-confidence, and non-future candidates", () => {

117150

const cfg: OpenClawConfig = { commitments: { enabled: true } };

118151

const valid = validateCommitmentCandidates({

Original file line numberDiff line numberDiff line change

@@ -1,7 +1,7 @@

11

import { resolveAgentConfig } from "../agents/agent-scope.js";

22

import type { OpenClawConfig } from "../config/config.js";

33

import { resolveHeartbeatIntervalMs } from "../infra/heartbeat-summary.js";

4-

import { asFiniteNumber } from "../shared/number-coercion.js";

4+

import { asFiniteNumber, timestampMsToIsoString } from "../shared/number-coercion.js";

55

import { normalizeOptionalString as asString } from "../shared/string-coerce.js";

66

import { isRecord } from "../utils.js";

77

import { resolveCommitmentsConfig } from "./config.js";

@@ -179,13 +179,30 @@ export async function hydrateCommitmentExtractionItem(params: {

179179

}

180180
181181

function formatExistingPending(item: CommitmentExtractionItem) {

182-

return item.existingPending.map((commitment) => ({

183-

kind: commitment.kind,

184-

reason: commitment.reason,

185-

dedupeKey: commitment.dedupeKey,

186-

earliest: new Date(commitment.earliestMs).toISOString(),

187-

latest: new Date(commitment.latestMs).toISOString(),

188-

}));

182+

return item.existingPending.flatMap((commitment) => {

183+

const earliest = timestampMsToIsoString(commitment.earliestMs);

184+

const latest = timestampMsToIsoString(commitment.latestMs);

185+

if (!earliest || !latest) {

186+

return [];

187+

}

188+

return [

189+

{

190+

kind: commitment.kind,

191+

reason: commitment.reason,

192+

dedupeKey: commitment.dedupeKey,

193+

earliest,

194+

latest,

195+

},

196+

];

197+

});

198+

}

199+
200+

function formatExtractionNow(valueMs: unknown): string {

201+

return (

202+

timestampMsToIsoString(valueMs) ??

203+

timestampMsToIsoString(Date.now()) ??

204+

"1970-01-01T00:00:00.000Z"

205+

);

189206

}

190207
191208

export function buildCommitmentExtractionPrompt(params: {

@@ -194,7 +211,7 @@ export function buildCommitmentExtractionPrompt(params: {

194211

}): string {

195212

const items = params.items.map((item) => ({

196213

itemId: item.itemId,

197-

now: new Date(item.nowMs).toISOString(),

214+

now: formatExtractionNow(item.nowMs),

198215

timezone: item.timezone,

199216

latestUserMessage: item.userText,

200217

assistantResponse: item.assistantText ?? "",