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

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
博客园 - 叶小钗
爱范儿
爱范儿
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
阮一峰的网络日志
阮一峰的网络日志
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
美团技术团队
T
Tailwind CSS Blog
博客园 - 司徒正美
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
小众软件
小众软件
博客园 - 【当耐特】
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell

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: validate message poll duration hours · openclaw/open...
steipete · 2026-05-29 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -390,6 +390,14 @@ describe("message tool gateway timeout", () => {

390390

expect(getToolProperties(tool).timeoutMs).toMatchObject({ type: "integer", minimum: 1 });

391391

});

392392
393+

it("advertises shared poll duration as a positive integer", () => {

394+

const tool = createMessageTool();

395+

expect(getToolProperties(tool).pollDurationHours).toMatchObject({

396+

type: "integer",

397+

minimum: 1,

398+

});

399+

});

400+
393401

it.each([-1, 1.5, "fast"])(

394402

"rejects invalid timeoutMs value %s before dispatch",

395403

async (timeoutMs) => {

Original file line numberDiff line numberDiff line change

@@ -40,7 +40,12 @@ import { stripFormattedReasoningMessage } from "../../shared/text/formatted-reas

4040

import { normalizeMessageChannel } from "../../utils/message-channel.js";

4141

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

4242

import { listAllChannelSupportedActions, listChannelSupportedActions } from "../channel-tools.js";

43-

import { channelTargetSchema, channelTargetsSchema, stringEnum } from "../schema/typebox.js";

43+

import {

44+

channelTargetSchema,

45+

channelTargetsSchema,

46+

optionalPositiveIntegerSchema,

47+

stringEnum,

48+

} from "../schema/typebox.js";

4449

import type { AnyAgentTool } from "./common.js";

4550

import { jsonResult, readStringParam } from "./common.js";

4651

import { gatewayCallOptionSchemaProperties } from "./gateway-schema.js";

@@ -349,8 +354,8 @@ function buildPollSchema() {

349354

case "stringArray":

350355

props[name] = Type.Optional(Type.Array(Type.String()));

351356

break;

352-

case "number":

353-

props[name] = Type.Optional(Type.Number());

357+

case "positiveInteger":

358+

props[name] = optionalPositiveIntegerSchema();

354359

break;

355360

case "boolean":

356361

props[name] = Type.Optional(Type.Boolean());

Original file line numberDiff line numberDiff line change

@@ -191,6 +191,24 @@ describe("runMessageAction poll handling", () => {

191191

expect(call?.ctx?.params?.threadId).toBe("42");

192192

});

193193
194+

it.each([0, -1, 1.5, "1.5", "soon"])(

195+

"rejects invalid pollDurationHours value %s",

196+

async (pollDurationHours) => {

197+

await expect(

198+

runPollAction({

199+

cfg: pollerConfig,

200+

actionParams: {

201+

channel: "poller",

202+

target: "poller:123",

203+

pollQuestion: "Lunch?",

204+

pollOption: ["Pizza", "Sushi"],

205+

pollDurationHours,

206+

},

207+

}),

208+

).rejects.toThrow(/pollDurationHours must be a positive integer/i);

209+

},

210+

);

211+
194212

it("passes inbound event kind to poll execution", async () => {

195213

const call = await runPollAction({

196214

cfg: pollerConfig,

Original file line numberDiff line numberDiff line change

@@ -2,7 +2,7 @@ import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-pay

22

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

33

import type { AgentToolResult } from "../../agents/runtime/index.js";

44

import {

5-

readNumberParam,

5+

readPositiveIntegerParam,

66

readStringArrayParam,

77

readStringParam,

88

} from "../../agents/tools/common.js";

@@ -1174,9 +1174,8 @@ async function handlePollAction(ctx: ResolvedActionContext): Promise<MessageActi

11741174

throw new Error("pollOption requires at least two values");

11751175

}

11761176

const allowMultiselect = readBooleanParam(params, "pollMulti") ?? false;

1177-

const durationHours = readNumberParam(params, "pollDurationHours", {

1178-

integer: true,

1179-

strict: true,

1177+

const durationHours = readPositiveIntegerParam(params, "pollDurationHours", {

1178+

message: "pollDurationHours must be a positive integer",

11801179

});

11811180
11821181

return {

Original file line numberDiff line numberDiff line change

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

11

import { readSnakeCaseParamRaw } from "./param-key.js";

22

import { normalizeLowercaseStringOrEmpty } from "./shared/string-coerce.js";

33
4-

type PollCreationParamKind = "string" | "stringArray" | "number" | "boolean";

4+

type PollCreationParamKind = "string" | "stringArray" | "positiveInteger" | "boolean";

55
66

type PollCreationParamDef = {

77

kind: PollCreationParamKind;

@@ -10,7 +10,7 @@ type PollCreationParamDef = {

1010

const SHARED_POLL_CREATION_PARAM_DEFS = {

1111

pollQuestion: { kind: "string" },

1212

pollOption: { kind: "stringArray" },

13-

pollDurationHours: { kind: "number" },

13+

pollDurationHours: { kind: "positiveInteger" },

1414

pollMulti: { kind: "boolean" },

1515

} satisfies Record<string, PollCreationParamDef>;

1616

@@ -91,7 +91,7 @@ export function hasPollCreationParams(params: Record<string, unknown>): boolean

9191

return true;

9292

}

9393

}

94-

if (def.kind === "number") {

94+

if (def.kind === "positiveInteger") {

9595

// Treat zero-valued numeric defaults as unset, but preserve any non-zero

9696

// numeric value as explicit poll intent so invalid durations still hit

9797

// the poll-only validation path.