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

推荐订阅源

WordPress大学
WordPress大学
H
Help Net Security
Jina AI
Jina AI
V
V2EX
G
Google Developers Blog
B
Blog
GbyAI
GbyAI
U
Unit 42
爱范儿
爱范儿
腾讯CDC
Engineering at Meta
Engineering at Meta
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 三生石上(FineUI控件)
宝玉的分享
宝玉的分享
小众软件
小众软件
D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - Franky
博客园 - 聂微东
The Cloudflare Blog
I
InfoQ
Microsoft Azure Blog
Microsoft Azure Blog
Hugging Face - Blog
Hugging Face - Blog
大猫的无限游戏
大猫的无限游戏

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
docs: document embedded subscribe lifecycle · openclaw/op...
steipete · 2026-06-05 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -1,10 +1,13 @@

1+

// Soft chunking tests cover paragraph-preferred block reply splits and fenced

2+

// code preservation during streamed assistant output.

13

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

24

import {

35

createParagraphChunkedBlockReplyHarness,

46

emitAssistantTextDeltaAndEnd,

57

} from "./embedded-agent-subscribe.e2e-harness.js";

68
79

function blockReplyTexts(onBlockReply: ReturnType<typeof vi.fn>): string[] {

10+

// Helper extracts just user-visible text from emitted block reply payloads.

811

return onBlockReply.mock.calls.map(([payload]) => (payload as { text?: string }).text ?? "");

912

}

1013
Original file line numberDiff line numberDiff line change

@@ -1,3 +1,5 @@

1+

// End-to-end subscription tests cover usage, lifecycle, tool logging,

2+

// messaging/media side effects, and replay-state behavior for embedded runs.

13

import fs from "node:fs/promises";

24

import os from "node:os";

35

import path from "node:path";

@@ -22,6 +24,8 @@ import { makeZeroUsageSnapshot } from "./usage.js";

2224
2325

describe("subscribeEmbeddedAgentSession", () => {

2426

async function flushBlockReplyCallbacks(): Promise<void> {

27+

// Block replies can schedule nested microtasks; drain twice before checking

28+

// delivery state in broad subscription tests.

2529

await Promise.resolve();

2630

await Promise.resolve();

2731

}

@@ -54,6 +58,8 @@ describe("subscribeEmbeddedAgentSession", () => {

5458

function createSubscribedHarness(

5559

options: Omit<Parameters<typeof subscribeEmbeddedAgentSession>[0], "session">,

5660

) {

61+

// Default trusted media tools to built-ins so tests that opt into custom

62+

// builtin sets get matching local media trust behavior.

5763

const { session, emit } = createStubSessionHarness();

5864

subscribeEmbeddedAgentSession({

5965

session,

@@ -135,6 +141,8 @@ describe("subscribeEmbeddedAgentSession", () => {

135141

}

136142
137143

async function captureToolLifecycleLogSubsystems(messageChannel?: string): Promise<string[]> {

144+

// Use a temporary file-backed logger so subsystem attribution is verified

145+

// against real serialized log lines.

138146

const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-tool-log-attribution-"));

139147

const logFile = path.join(tempDir, "openclaw.log");

140148

try {

Original file line numberDiff line numberDiff line change

@@ -1,8 +1,12 @@

1+

// Commentary suppression tests ensure commentary-phase assistant messages do

2+

// not become replies or assistantTexts before tool use.

13

import type { AssistantMessage } from "openclaw/plugin-sdk/llm";

24

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

35

import { createSubscribedSessionHarness } from "./embedded-agent-subscribe.e2e-harness.js";

46
57

type AssistantMessageWithPhase = AssistantMessage & {

8+

// Some providers expose phase on the assistant message, while others only

9+

// include it in textSignature metadata.

610

phase?: "commentary" | "final_answer";

711

};

812
Original file line numberDiff line numberDiff line change

@@ -1,3 +1,5 @@

1+

// Message-tool suppression tests cover delivery tracking, source-reply mirrors,

2+

// and duplicate reply prevention after message tool sends.

13

import type { AssistantMessage } from "openclaw/plugin-sdk/llm";

24

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

35

import {

@@ -9,6 +11,8 @@ import {

911

import { subscribeEmbeddedAgentSession } from "./embedded-agent-subscribe.js";

1012
1113

function createBlockReplyHarness(blockReplyBreak: "message_end" | "text_end") {

14+

// Harness exposes both emitted block replies and subscription state so tests

15+

// can distinguish suppression from missing delivery tracking.

1216

const { session, emit } = createStubSessionHarness();

1317

const onBlockReply = vi.fn();

1418

const subscription = subscribeEmbeddedAgentSession({

@@ -27,6 +31,8 @@ async function emitMessageToolLifecycle(params: {

2731

media?: string;

2832

result: unknown;

2933

}) {

34+

// Message tool sends are modeled as normal tool start/end events because the

35+

// subscription records pending send text at start and delivery at end.

3036

params.emit({

3137

type: "tool_execution_start",

3238

toolName: "message",

@@ -97,6 +103,8 @@ describe("subscribeEmbeddedAgentSession", () => {

97103

});

98104
99105

it("tracks internal-ui source replies for message-tool-only final payloads", async () => {

106+

// internal-ui source replies are not ordinary channel sends; they are stored

107+

// for terminal payload mirroring in message_tool_only mode.

100108

const { emit, subscription } = createBlockReplyHarness("message_end");

101109
102110

await emitMessageToolLifecycle({

Original file line numberDiff line numberDiff line change

@@ -1,3 +1,5 @@

1+

// Compaction retry subscription tests cover retry wait accounting, compaction

2+

// event emission, abort-on-unsubscribe, and verbose tool summary behavior.

13

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

24

import { onAgentEvent } from "../infra/agent-events.js";

35

import { createSubscribedSessionHarness } from "./embedded-agent-subscribe.e2e-harness.js";

@@ -8,6 +10,7 @@ function toolResultPayloadAt(

810

): {

911

text?: string;

1012

} {

13+

// Tool summary assertions only need text payloads from onToolResult calls.

1114

const [payload] = onToolResult.mock.calls[index] ?? [];

1215

if (!payload || typeof payload !== "object") {

1316

throw new Error(`expected tool result payload for call ${index + 1}`);

@@ -17,6 +20,8 @@ function toolResultPayloadAt(

1720
1821

describe("subscribeEmbeddedAgentSession", () => {

1922

it("waits for multiple compaction retries before resolving", async () => {

23+

// Each retrying compaction requires a matching agent_end before waiters are

24+

// released, preventing early continuation during repeated overflow repairs.

2025

const { emit, subscription } = createSubscribedSessionHarness({

2126

runId: "run-3",

2227

});