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

推荐订阅源

G
Google Developers Blog
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
博客园 - 司徒正美
D
Docker
B
Blog
V
Visual Studio Blog
Blog — PlanetScale
Blog — PlanetScale
U
Unit 42
S
SegmentFault 最新的问题
小众软件
小众软件
J
Java Code Geeks
美团技术团队
腾讯CDC
MyScale Blog
MyScale Blog
爱范儿
爱范儿
H
Help Net Security
宝玉的分享
宝玉的分享
Microsoft Azure Blog
Microsoft Azure Blog
A
About on SuperTechFans
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
博客园 - 【当耐特】

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: keep custom pi tools executable · openclaw/openclaw@...
steipete · 2026-04-22 · via Recent Commits to openclaw:main

5 files changed

+

48

-

6

lines changed

Original file line numberDiff line numberDiff line change

@@ -132,7 +132,7 @@ import {

132132

buildEmbeddedSystemPrompt,

133133

createSystemPromptOverride,

134134

} from "./system-prompt.js";

135-

import { collectAllowedToolNames } from "./tool-name-allowlist.js";

135+

import { collectAllowedToolNames, toSessionToolAllowlist } from "./tool-name-allowlist.js";

136136

import {

137137

logProviderToolSchemaDiagnostics,

138138

normalizeProviderToolSchemas,

@@ -839,10 +839,14 @@ export async function compactEmbeddedPiSessionDirect(

839839

contextTokenBudget: ctxInfo.tokens,

840840

});

841841
842-

const { builtInTools, customTools } = splitSdkTools({

842+

const { customTools } = splitSdkTools({

843843

tools: effectiveTools,

844844

sandboxEnabled: !!sandbox?.enabled,

845845

});

846+

// Pi treats `tools` as a name allowlist. Compaction uses the same custom

847+

// tool path as normal turns, so pass names here to keep those tools active

848+

// across compaction retries.

849+

const sessionToolAllowlist = toSessionToolAllowlist(allowedToolNames);

846850
847851

const providerStreamFn = resolveCompactionProviderStream({

848852

effectiveModel,

@@ -880,7 +884,7 @@ export async function compactEmbeddedPiSessionDirect(

880884

modelRegistry,

881885

model: effectiveModel,

882886

thinkingLevel: mapThinkingLevel(thinkLevel),

883-

tools: builtInTools,

887+

tools: sessionToolAllowlist,

884888

customTools,

885889

sessionManager,

886890

settingsManager,

Original file line numberDiff line numberDiff line change

@@ -5,7 +5,7 @@ export type EmbeddedAgentSessionOptions = {

55

modelRegistry: unknown;

66

model: unknown;

77

thinkingLevel: unknown;

8-

tools: readonly unknown[];

8+

tools: readonly string[];

99

customTools: readonly unknown[];

1010

sessionManager: unknown;

1111

settingsManager: unknown;

Original file line numberDiff line numberDiff line change

@@ -167,7 +167,7 @@ import {

167167

createSystemPromptOverride,

168168

} from "../system-prompt.js";

169169

import { dropThinkingBlocks } from "../thinking.js";

170-

import { collectAllowedToolNames } from "../tool-name-allowlist.js";

170+

import { collectAllowedToolNames, toSessionToolAllowlist } from "../tool-name-allowlist.js";

171171

import {

172172

installContextEngineLoopHook,

173173

installToolResultContextGuard,

@@ -1121,6 +1121,11 @@ export async function runEmbeddedAttempt(

11211121

: [];

11221122
11231123

const allCustomTools = [...customTools, ...clientToolDefs];

1124+

// Pi's `tools` option is a name allowlist, not the tool definitions.

1125+

// OpenClaw registers local tools through `customTools`, so passing the

1126+

// same names here keeps custom tools executable instead of silently

1127+

// filtering them out with an empty allowlist.

1128+

const sessionToolAllowlist = toSessionToolAllowlist(allowedToolNames);

11241129
11251130

({ session } = await createEmbeddedAgentSessionWithResourceLoader({

11261131

createAgentSession: async (options) =>

@@ -1132,7 +1137,7 @@ export async function runEmbeddedAttempt(

11321137

modelRegistry: params.modelRegistry,

11331138

model: params.model,

11341139

thinkingLevel: mapThinkingLevel(params.thinkLevel),

1135-

tools: builtInTools,

1140+

tools: sessionToolAllowlist,

11361141

customTools: allCustomTools,

11371142

sessionManager,

11381143

settingsManager,

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,29 @@

1+

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

2+

import { createStubTool } from "../test-helpers/pi-tool-stubs.js";

3+

import { collectAllowedToolNames, toSessionToolAllowlist } from "./tool-name-allowlist.js";

4+
5+

describe("tool name allowlists", () => {

6+

it("collects local and client tool names", () => {

7+

const names = collectAllowedToolNames({

8+

tools: [createStubTool("read"), createStubTool("memory_search")],

9+

clientTools: [

10+

{

11+

type: "function",

12+

function: {

13+

name: "image_generate",

14+

description: "Generate an image",

15+

parameters: { type: "object", properties: {} },

16+

},

17+

},

18+

],

19+

});

20+
21+

expect([...names]).toEqual(["read", "memory_search", "image_generate"]);

22+

});

23+
24+

it("builds a stable Pi session allowlist from custom tool names", () => {

25+

const allowlist = toSessionToolAllowlist(new Set(["write", "read", "read", "edit"]));

26+
27+

expect(allowlist).toEqual(["edit", "read", "write"]);

28+

});

29+

});

Original file line numberDiff line numberDiff line change

@@ -24,3 +24,7 @@ export function collectAllowedToolNames(params: {

2424

}

2525

return names;

2626

}

27+
28+

export function toSessionToolAllowlist(allowedToolNames: Iterable<string>): string[] {

29+

return [...new Set(allowedToolNames)].toSorted((a, b) => a.localeCompare(b));

30+

}