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

推荐订阅源

Y
Y Combinator Blog
IT之家
IT之家
博客园_首页
量子位
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
博客园 - 聂微东
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
Hugging Face - Blog
Hugging Face - Blog
V
V2EX
爱范儿
爱范儿
大猫的无限游戏
大猫的无限游戏
宝玉的分享
宝玉的分享
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google DeepMind News
Google DeepMind News
Microsoft Azure Blog
Microsoft Azure Blog
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

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: harden clawpatch-reported edge cases · openclaw/open...
steipete · 2026-05-18 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -29,6 +29,7 @@ Docs: https://docs.openclaw.ai

2929
3030

### Fixes

3131
32+

- Core/plugins: harden clawpatch-reported edge cases across gateway auth cleanup, Claude session id paths, plugin activation policy, apply-patch hunk handling, diagnostic redaction, and plugin metadata validation.

3233

- Mac app: keep app-level menu commands and Dashboard failure states reachable when the remote Gateway is disconnected, and keep the Settings sidebar toggle in the leading titlebar area.

3334

- Gateway/webchat: hide internal runtime-context and other `display: false` transcript messages from Chat history and live message events. Fixes #83216. Thanks @EmpireCreator.

3435

- CLI/help: keep `gateway`, `doctor`, `status`, and `health` help registration out of action/runtime imports so subcommand `--help` stays lightweight in constrained terminals. Fixes #83228. Thanks @dfguerrerom.

Original file line numberDiff line numberDiff line change

@@ -206,9 +206,15 @@ function collectReferenceEvents(

206206

if (!clause?.namedBindings) {

207207

continue;

208208

}

209+

if (clause.isTypeOnly) {

210+

continue;

211+

}

209212
210213

if (ts.isNamedImports(clause.namedBindings)) {

211214

for (const element of clause.namedBindings.elements) {

215+

if (element.isTypeOnly) {

216+

continue;

217+

}

212218

const importedName = element.propertyName?.text ?? element.name.text;

213219

const record = recordMap.get(importedName);

214220

if (!record) {

Original file line numberDiff line numberDiff line change

@@ -110,5 +110,9 @@ const reportModules: Record<ReportModule["name"], ReportModule> = {

110110

};

111111
112112

export function renderTextReport(envelope: TopologyEnvelope, limit: number): string {

113-

return reportModules[envelope.report].describe(envelope, limit);

113+

const reportModule = reportModules[envelope.report];

114+

if (!reportModule) {

115+

throw new Error(`Unsupported topology report: ${envelope.report}`);

116+

}

117+

return reportModule.describe(envelope, limit);

114118

}

Original file line numberDiff line numberDiff line change

@@ -64,4 +64,34 @@ describe("createAnthropicPayloadLogger", () => {

6464

expect(source.sha256).toBe(crypto.createHash("sha256").update("QUJDRA==").digest("hex"));

6565

expect(event.payloadDigest).toMatch(/^[a-f0-9]{64}$/u);

6666

});

67+
68+

it("sanitizes usage and error fields before writing logs", () => {

69+

const lines: string[] = [];

70+

const logger = createAnthropicPayloadLogger({

71+

env: { OPENCLAW_ANTHROPIC_PAYLOAD_LOG: "1" },

72+

writer: {

73+

filePath: "memory",

74+

write: (line) => lines.push(line),

75+

flush: async () => undefined,

76+

},

77+

});

78+
79+

logger?.recordUsage(

80+

[

81+

{

82+

role: "assistant",

83+

content: "",

84+

usage: {

85+

input: 1,

86+

authorization: "Bearer sk-secret", // pragma: allowlist secret

87+

},

88+

} as never,

89+

],

90+

new Error("failed with Bearer sk-secret"), // pragma: allowlist secret

91+

);

92+
93+

const event = JSON.parse(lines[0]?.trim() ?? "{}") as Record<string, unknown>;

94+

expect(event.error).toBe("failed with Bearer <redacted>");

95+

expect(event.usage).toEqual({ input: 1 });

96+

});

6797

});

Original file line numberDiff line numberDiff line change

@@ -53,16 +53,18 @@ function getWriter(filePath: string): PayloadLogWriter {

5353
5454

function formatError(error: unknown): string | undefined {

5555

if (error instanceof Error) {

56-

return error.message;

56+

const redacted = sanitizeDiagnosticPayload(error.message);

57+

return typeof redacted === "string" ? redacted : error.message;

5758

}

5859

if (typeof error === "string") {

59-

return error;

60+

const redacted = sanitizeDiagnosticPayload(error);

61+

return typeof redacted === "string" ? redacted : error;

6062

}

6163

if (typeof error === "number" || typeof error === "boolean" || typeof error === "bigint") {

6264

return String(error);

6365

}

6466

if (error && typeof error === "object") {

65-

return safeJsonStringify(error) ?? "unknown error";

67+

return safeJsonStringify(sanitizeDiagnosticPayload(error)) ?? "unknown error";

6668

}

6769

return undefined;

6870

}

@@ -173,7 +175,7 @@ export function createAnthropicPayloadLogger(params: {

173175

...base,

174176

ts: new Date().toISOString(),

175177

stage: "usage",

176-

usage,

178+

usage: sanitizeDiagnosticPayload(usage) as Record<string, unknown>,

177179

error: errorMessage,

178180

});

179181

log.info("anthropic usage", {

Original file line numberDiff line numberDiff line change

@@ -53,10 +53,13 @@ function computeReplacements(

5353
5454

if (chunk.oldLines.length === 0) {

5555

const insertionIndex =

56-

originalLines.length > 0 && originalLines[originalLines.length - 1] === ""

57-

? originalLines.length - 1

58-

: originalLines.length;

56+

chunk.changeContext && !chunk.isEndOfFile

57+

? lineIndex

58+

: originalLines.length > 0 && originalLines[originalLines.length - 1] === ""

59+

? originalLines.length - 1

60+

: originalLines.length;

5961

replacements.push([insertionIndex, 0, chunk.newLines]);

62+

lineIndex = insertionIndex;

6063

continue;

6164

}

6265
Original file line numberDiff line numberDiff line change

@@ -131,6 +131,57 @@ describe("applyPatch", () => {

131131

expect(result.summary.modified).toEqual(["dest.txt"]);

132132

});

133133
134+

it("updates in place when move target resolves to the source file", async () => {

135+

const memory = createMemoryPatchSandbox({

136+

"source.txt": "foo\nbar\n",

137+

});

138+

const patch = `*** Begin Patch

139+

*** Update File: source.txt

140+

*** Move to: ./source.txt

141+

@@

142+

foo

143+

-bar

144+

+baz

145+

*** End Patch`;

146+
147+

const result = await applyPatch(patch, memory.options);

148+
149+

expect(memory.files.get("/sandbox/source.txt")).toBe("foo\nbaz\n");

150+

expect(result.summary.modified).toEqual(["source.txt"]);

151+

});

152+
153+

it("applies context-only insertions at the requested context", async () => {

154+

const memory = createMemoryPatchSandbox({

155+

"source.txt": "alpha\nanchor\nomega\n",

156+

});

157+

const patch = `*** Begin Patch

158+

*** Update File: source.txt

159+

@@ anchor

160+

+inserted

161+

*** End Patch`;

162+
163+

await applyPatch(patch, memory.options);

164+
165+

expect(memory.files.get("/sandbox/source.txt")).toBe("alpha\nanchor\ninserted\nomega\n");

166+

});

167+
168+

it("keeps later insertion contexts in original file coordinates", async () => {

169+

const memory = createMemoryPatchSandbox({

170+

"source.txt": "a\nb\nc\n",

171+

});

172+

const patch = `*** Begin Patch

173+

*** Update File: source.txt

174+

@@ a

175+

+after-a

176+

@@ b

177+

+after-b

178+

*** End Patch`;

179+
180+

await applyPatch(patch, memory.options);

181+
182+

expect(memory.files.get("/sandbox/source.txt")).toBe("a\nafter-a\nb\nafter-b\nc\n");

183+

});

184+
134185

it("supports end-of-file inserts", async () => {

135186

const memory = createMemoryPatchSandbox({

136187

"end.txt": "line1\n",

Original file line numberDiff line numberDiff line change

@@ -175,9 +175,21 @@ export async function applyPatch(

175175

const moveTarget = await resolvePatchPath(hunk.movePath, options);

176176

await assertPatchParentPath(hunk.movePath, options);

177177

await ensureDir(moveTarget.resolved, fileOps);

178-

await fileOps.writeFile(moveTarget.resolved, applied);

179-

await fileOps.remove(target.resolved);

180-

recordSummary(summary, seen, "modified", moveTarget.display);

178+

const moveResolvesToSource =

179+

path.resolve(moveTarget.resolved) === path.resolve(target.resolved);

180+

await fileOps.writeFile(

181+

moveResolvesToSource ? target.resolved : moveTarget.resolved,

182+

applied,

183+

);

184+

if (!moveResolvesToSource) {

185+

await fileOps.remove(target.resolved);

186+

}

187+

recordSummary(

188+

summary,

189+

seen,

190+

"modified",

191+

moveResolvesToSource ? target.display : moveTarget.display,

192+

);

181193

} else {

182194

await fileOps.writeFile(target.resolved, applied);

183195

recordSummary(summary, seen, "modified", target.display);

Original file line numberDiff line numberDiff line change

@@ -172,12 +172,17 @@ const transport = new StdioClientTransport({

172172

});

173173

const client = new Client({ name: "fake-claude", version: "1.0.0" });

174174

await client.connect(transport);

175-

const tools = await client.listTools();

176-

if (!tools.tools.some((tool) => tool.name === "bundle_probe")) {

177-

throw new Error("bundle_probe tool not exposed");

178-

}

179-

const result = await client.callTool({ name: "bundle_probe", arguments: {} });

180-

await transport.close();

175+

const result = await (async () => {

176+

try {

177+

const tools = await client.listTools();

178+

if (!tools.tools.some((tool) => tool.name === "bundle_probe")) {

179+

throw new Error("bundle_probe tool not exposed");

180+

}

181+

return await client.callTool({ name: "bundle_probe", arguments: {} });

182+

} finally {

183+

await transport.close();

184+

}

185+

})();

181186
182187

const text = Array.isArray(result.content)

183188

? result.content

Original file line numberDiff line numberDiff line change

@@ -157,6 +157,18 @@ describe("channel-health-monitor", () => {

157157

vi.useRealTimers();

158158

});

159159
160+

it("removes abort listener when stopped manually", () => {

161+

const signal = new AbortController().signal;

162+

const addEventListener = vi.spyOn(signal, "addEventListener");

163+

const removeEventListener = vi.spyOn(signal, "removeEventListener");

164+

const monitor = startDefaultMonitor(createMockChannelManager(), { abortSignal: signal });

165+
166+

monitor.stop();

167+
168+

expect(addEventListener).toHaveBeenCalledWith("abort", expect.any(Function), { once: true });

169+

expect(removeEventListener).toHaveBeenCalledWith("abort", addEventListener.mock.calls[0]?.[1]);

170+

});

171+
160172

it("does not run before the grace period", async () => {

161173

const manager = createMockChannelManager();

162174

const monitor = startDefaultMonitor(manager, { startupGraceMs: 60_000 });