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

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
L
LangChain Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
T
Tailwind CSS Blog
IT之家
IT之家
WordPress大学
WordPress大学
The Cloudflare Blog
大猫的无限游戏
大猫的无限游戏
W
WeLiveSecurity
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Jina AI
Jina AI
C
Cyber Attacks, Cyber Crime and Cyber Security
美团技术团队
Hacker News - Newest:
Hacker News - Newest: "LLM"
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
A
Arctic Wolf
量子位
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
博客园 - Franky
李成银的技术随笔
C
CXSECURITY Database RSS Feed - CXSecurity.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Schneier on Security
Schneier on Security
博客园 - 聂微东
博客园 - 司徒正美
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
V
V2EX
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Palo Alto Networks Blog
雷峰网
雷峰网
J
Java Code Geeks
博客园 - 叶小钗
F
Full Disclosure
博客园 - 三生石上(FineUI控件)
O
OpenAI News
T
Tenable Blog
C
Cisco Blogs
人人都是产品经理
人人都是产品经理
S
Securelist
NISL@THU
NISL@THU

Recent Commits to openclaw:main

fix(docker): alias main images to latest release · openclaw/openclaw@3cb7ae5 perf: reduce agent turn CPU overhead · openclaw/openclaw@b58786c fix(matrix): bound bootstrap output capture fix(agents): bound search tool stderr · openclaw/openclaw@f2f18f5 fix(process): bound command output capture fix(ci): run CodeQL on main pushes fix(backup): cap verify manifest extraction fix(telegram): skip stopped draft finalization fix(telegram): preserve final overflow state · openclaw/openclaw@bda924b fix(test): keep btw fs promises mock partial · openclaw/openclaw@56302f7 ci(docker): publish browser release images · openclaw/openclaw@dc31f73 fix(test): detect signaled memory fd gateway exits · openclaw/openclaw@5809bdf fix(test): detect signaled kitchen sink gateway exits · openclaw/openclaw@97ed582 docs: add release verification skill · openclaw/openclaw@6eedc83 fix(test): detect signaled test gateway exits test: stabilize code mode wait timeout · openclaw/openclaw@d7e62a8 fix(test): detect signaled cross-os gateway exits · openclaw/openclaw@f48a89c fix(test): detect signaled bundled smoke exits fix(test): hard kill boundary prep timeouts · openclaw/openclaw@a854331 fix(test): hard kill boundary step timeouts · openclaw/openclaw@3fb6746 docs: tune clawdtributor refresh summaries · openclaw/openclaw@51e57d4 fix(test): handle extension memory spawn errors · openclaw/openclaw@e5a687f chore(release): update appcast for 2026.5.27 · openclaw/openclaw@17c1b06 fix(test): bound startup build helpers · openclaw/openclaw@bda3531 test: speed up slow test suite (#87611) · openclaw/openclaw@aab5410 fix(release): bound npm release checks · openclaw/openclaw@e0635eb fix: reduce gateway warning noise · openclaw/openclaw@4252f07 fix(test): rebuild startup memory artifacts · openclaw/openclaw@4ce3c3e fix(release): bound prepack subprocesses · openclaw/openclaw@653e8d1 fix(release): bound release check commands · openclaw/openclaw@98d6331 fix(release): bound npm verifier commands · openclaw/openclaw@2b0e399 fix(e2e): bound bundled plugin selection · openclaw/openclaw@b234aa0 fix(docker): bound package capture output · openclaw/openclaw@cee364e fix(agent-sessions): fail oversized exec output · openclaw/openclaw@da55146 fix(supervisor): bound captured process output · openclaw/openclaw@2252cf6 fix(file-transfer): bound dir fetch tar listings · openclaw/openclaw@9a7f808 fix(brave): bound search error bodies · openclaw/openclaw@eb273a8 fix(test): bound package candidate command output · openclaw/openclaw@259796d fix(test): bound extension memory profiler output · openclaw/openclaw@d64b394 fix(test): wait for credential timeout cleanup · openclaw/openclaw@88c395c fix(qa-lab): bound plugin tools stderr tail · openclaw/openclaw@9085d17 fix(qa-lab): bound child process output · openclaw/openclaw@4a2b02e fix(test): escalate e2e watchdog termination · openclaw/openclaw@beb25d6 fix(security): avoid fetching untrusted proof refs · openclaw/openclaw@4bd711e fix(security): avoid CodeQL legacy auth patterns · openclaw/openclaw@3844e03 fix(test): keep upgrade survivor runtime state local · openclaw/openclaw@9fef53c Tighten phone-control mutation authorization [AI] (#87150) · openclaw/openclaw@91a4635 fix(voice-call): bound ngrok diagnostics · openclaw/openclaw@629fc2f fix(qa): expose credential fingerprints in admin list · openclaw/openclaw@1bc32e5 fix(memory): bound remote error bodies · openclaw/openclaw@93577ad Clarify directive persistence authorization policy [AI] (#86369) · openclaw/openclaw@bb418a8 fix(install): harden Windows git installs · openclaw/openclaw@dc5671e fix(qa): stabilize live transport lanes · openclaw/openclaw@f9aec04 fix(security): address OpenClaw CodeQL alerts · openclaw/openclaw@b008989 fix(parallels): guard release target harness mismatch · openclaw/openclaw@7275304 docs(skills): add OpenClaw release announcement guide · openclaw/openclaw@9805202 docs(skills): refine beta release announcement guidance · openclaw/openclaw@9ebf51e fix(release): bound cross-os fetch bodies · openclaw/openclaw@13dcded Fix Claude live tool progress for watchdog recovery (#87546) · openclaw/openclaw@4c3a029 test: avoid platform-specific transcript stat assertion · openclaw/openclaw@bd02977 fix(scripts): bound audit advisory error bodies · openclaw/openclaw@9f70064 fix: ignore leading transcript bytes in tail scan · openclaw/openclaw@b005f01 fix: avoid direct transcript stat fallback · openclaw/openclaw@e397636 fix(scripts): bound docker preflight capture fix(scripts): bound gh read error bodies · openclaw/openclaw@744da7e perf: avoid runtime catalog load for reasoning defaults fix(release): pin ClawHub publish workdir · openclaw/openclaw@a0cf185 perf: reuse preflight transcript scan size · openclaw/openclaw@8d5f6c8 fix(scripts): bound labeler error bodies perf: skip recent transcript read after final usage · openclaw/openclaw@39bc43c fix(scripts): bound memory fd ready output perf: reuse transcript scan size · openclaw/openclaw@bd6a404 fix(scripts): bound gateway watch log capture fix(agents): cancel failed skill download bodies · openclaw/openclaw@00fb152 fix(agents): suppress abandoned requester completion handoff (#87541) fix(qa): keep live transport artifacts local fix(release): speed windows upgrade fallback · openclaw/openclaw@1342727 fix(release): close cross-os artifact sockets · openclaw/openclaw@9771727 test(release): satisfy cross-os socket lint chore(ui): refresh nl control ui locale · openclaw/openclaw@43deaf4 chore(ui): refresh fa control ui locale · openclaw/openclaw@c16620c chore(ui): refresh vi control ui locale · openclaw/openclaw@55e1878 chore(ui): refresh th control ui locale · openclaw/openclaw@47c67e3 chore(ui): refresh pl control ui locale · openclaw/openclaw@062d429 chore(ui): refresh id control ui locale · openclaw/openclaw@580e95f chore(ui): refresh tr control ui locale · openclaw/openclaw@dcb00f3 chore(ui): refresh uk control ui locale · openclaw/openclaw@748015b chore(ui): refresh it control ui locale · openclaw/openclaw@ae0f469 chore(ui): refresh ar control ui locale · openclaw/openclaw@5f3012b chore(ui): refresh fr control ui locale · openclaw/openclaw@b0517f1 chore(ui): refresh ja-JP control ui locale · openclaw/openclaw@5058fc9 chore(ui): refresh ko control ui locale · openclaw/openclaw@d4ffac4 chore(ui): refresh es control ui locale · openclaw/openclaw@384dd12 chore(ui): refresh de control ui locale · openclaw/openclaw@6c858ac chore(ui): refresh pt-BR control ui locale · openclaw/openclaw@d3751e4 chore(ui): refresh zh-CN control ui locale · openclaw/openclaw@831bb45 chore(ui): refresh zh-TW control ui locale · openclaw/openclaw@71781b8 test(cron): speed up isolated fallback tests (#87520) · openclaw/openclaw@127c0ad refactor(openai): centralize codex oauth flow (#87411) · openclaw/openclaw@e805ffd test(agents): prove active live subagent steering · openclaw/openclaw@d1bca0c
fix(agents): normalize session tool limits · openclaw/openclaw@38f3040
vincentkoc · 2026-05-28 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -0,0 +1,52 @@

1+

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

2+

import { createFindToolDefinition, type FindOperations } from "./find.js";

3+
4+

function operations(results: string[]): FindOperations {

5+

return {

6+

exists: () => true,

7+

glob: (_pattern, _cwd, options) => results.slice(0, options.limit),

8+

};

9+

}

10+
11+

function textContent(

12+

result: Awaited<ReturnType<ReturnType<typeof createFindToolDefinition>["execute"]>>,

13+

): string {

14+

const first = result.content[0];

15+

return first?.type === "text" ? (first.text ?? "") : "";

16+

}

17+
18+

describe("find tool", () => {

19+

it("clamps non-positive limits before delegating to custom search operations", async () => {

20+

const tool = createFindToolDefinition("/workspace", {

21+

operations: operations(["/workspace/a.ts", "/workspace/b.ts"]),

22+

});

23+
24+

const result = await tool.execute(

25+

"call-1",

26+

{ pattern: "*.ts", limit: -4 },

27+

undefined,

28+

undefined,

29+

{} as never,

30+

);

31+
32+

expect(textContent(result)).toBe("a.ts\n\n[1 results limit reached]");

33+

expect(result.details?.resultLimitReached).toBe(1);

34+

});

35+
36+

it("uses the default limit for non-finite values", async () => {

37+

const tool = createFindToolDefinition("/workspace", {

38+

operations: operations(["/workspace/a.ts", "/workspace/b.ts"]),

39+

});

40+
41+

const result = await tool.execute(

42+

"call-1",

43+

{ pattern: "*.ts", limit: Number.POSITIVE_INFINITY },

44+

undefined,

45+

undefined,

46+

{} as never,

47+

);

48+
49+

expect(textContent(result)).toBe("a.ts\nb.ts");

50+

expect(result.details).toBeUndefined();

51+

});

52+

});

Original file line numberDiff line numberDiff line change

@@ -8,6 +8,7 @@ import { keyHint } from "../../modes/interactive/components/keybinding-hints.js"

88

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

99

import { ensureTool } from "../../utils/tools-manager.js";

1010

import type { ToolDefinition, ToolRenderResultOptions } from "../extensions/types.js";

11+

import { normalizePositiveLimit } from "./limits.js";

1112

import { resolveToCwd } from "./path-utils.js";

1213

import { getTextOutput, invalidArgText, shortenPath, str } from "./render-utils.js";

1314

import type { FindToolDetails } from "./tool-contracts.js";

@@ -161,7 +162,7 @@ export function createFindToolDefinition(

161162

void (async () => {

162163

try {

163164

const searchPath = resolveToCwd(searchDir || ".", cwd);

164-

const effectiveLimit = limit ?? DEFAULT_LIMIT;

165+

const effectiveLimit = normalizePositiveLimit(limit, DEFAULT_LIMIT);

165166

const ops = customOps ?? defaultFindOperations;

166167
167168

// If custom operations provide glob(), use that instead of fd.

Original file line numberDiff line numberDiff line change

@@ -8,6 +8,7 @@ import { keyHint } from "../../modes/interactive/components/keybinding-hints.js"

88

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

99

import { ensureTool } from "../../utils/tools-manager.js";

1010

import type { ToolDefinition, ToolRenderResultOptions } from "../extensions/types.js";

11+

import { normalizePositiveLimit } from "./limits.js";

1112

import { resolveToCwd } from "./path-utils.js";

1213

import { getTextOutput, invalidArgText, shortenPath, str } from "./render-utils.js";

1314

import type { GrepToolDetails } from "./tool-contracts.js";

@@ -205,7 +206,7 @@ export function createGrepToolDefinition(

205206

}

206207
207208

const contextValue = context && context > 0 ? context : 0;

208-

const effectiveLimit = Math.max(1, limit ?? DEFAULT_LIMIT);

209+

const effectiveLimit = normalizePositiveLimit(limit, DEFAULT_LIMIT);

209210

const formatPath = (filePath: string): string => {

210211

if (isDirectory) {

211212

const relative = path.relative(searchPath, filePath);

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,16 @@

1+

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

2+

import { normalizePositiveLimit } from "./limits.js";

3+
4+

describe("session tool limits", () => {

5+

it.each([

6+

[undefined, 500],

7+

[Number.NaN, 500],

8+

[Number.POSITIVE_INFINITY, 500],

9+

[0, 1],

10+

[-12, 1],

11+

[2.9, 2],

12+

[7, 7],

13+

])("normalizes %s to %s", (input, expected) => {

14+

expect(normalizePositiveLimit(input, 500)).toBe(expected);

15+

});

16+

});

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,6 @@

1+

export function normalizePositiveLimit(value: number | undefined, fallback: number): number {

2+

if (value === undefined || !Number.isFinite(value)) {

3+

return fallback;

4+

}

5+

return Math.max(1, Math.floor(value));

6+

}

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,51 @@

1+

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

2+

import { createLsToolDefinition, type LsOperations } from "./ls.js";

3+
4+

function operations(entries: string[]): LsOperations {

5+

return {

6+

exists: () => true,

7+

stat: (absolutePath) => ({

8+

isDirectory: () => absolutePath === "/workspace" || absolutePath.endsWith("/dir"),

9+

}),

10+

readdir: () => entries,

11+

};

12+

}

13+
14+

function textContent(

15+

result: Awaited<ReturnType<ReturnType<typeof createLsToolDefinition>["execute"]>>,

16+

): string {

17+

const first = result.content[0];

18+

return first?.type === "text" ? (first.text ?? "") : "";

19+

}

20+
21+

describe("ls tool", () => {

22+

it("clamps non-positive limits instead of reporting a non-empty directory as empty", async () => {

23+

const tool = createLsToolDefinition("/workspace", {

24+

operations: operations(["beta.txt", "alpha.txt"]),

25+

});

26+
27+

const result = await tool.execute("call-1", { limit: 0 }, undefined, undefined, {} as never);

28+
29+

expect(textContent(result)).toBe(

30+

"alpha.txt\n\n[1 entries limit reached. Use limit=2 for more]",

31+

);

32+

expect(result.details?.entryLimitReached).toBe(1);

33+

});

34+
35+

it("uses the default limit for non-finite values", async () => {

36+

const tool = createLsToolDefinition("/workspace", {

37+

operations: operations(["beta.txt", "alpha.txt"]),

38+

});

39+
40+

const result = await tool.execute(

41+

"call-1",

42+

{ limit: Number.NaN },

43+

undefined,

44+

undefined,

45+

{} as never,

46+

);

47+
48+

expect(textContent(result)).toBe("alpha.txt\nbeta.txt");

49+

expect(result.details).toBeUndefined();

50+

});

51+

});

Original file line numberDiff line numberDiff line change

@@ -5,6 +5,7 @@ import { Type } from "typebox";

55

import { keyHint } from "../../modes/interactive/components/keybinding-hints.js";

66

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

77

import type { ToolDefinition, ToolRenderResultOptions } from "../extensions/types.js";

8+

import { normalizePositiveLimit } from "./limits.js";

89

import { resolveToCwd } from "./path-utils.js";

910

import { getTextOutput, invalidArgText, shortenPath, str } from "./render-utils.js";

1011

import type { LsToolDetails } from "./tool-contracts.js";

@@ -134,7 +135,7 @@ export function createLsToolDefinition(

134135

void (async () => {

135136

try {

136137

const dirPath = resolveToCwd(path || ".", cwd);

137-

const effectiveLimit = limit ?? DEFAULT_LIMIT;

138+

const effectiveLimit = normalizePositiveLimit(limit, DEFAULT_LIMIT);

138139
139140

// Check if path exists.

140141

if (!(await ops.exists(dirPath))) {