fix: resolve small triage issues

This commit is contained in:
Peter Steinberger
2026-05-04 07:38:34 +01:00
parent deffd11a43
commit fa689295c6
40 changed files with 739 additions and 61 deletions

View File

@@ -92,6 +92,9 @@ Docs: https://docs.openclaw.ai
- Media: treat `EPERM` from the post-write media fsync step as best-effort, allowing WebChat and channel uploads to finish on Windows filesystems that reject `fsync` after a successful write. Fixes #76844.
- Media/Telegram: send in-limit original images when optional image optimization is unavailable, so Telegram MEDIA replies and message-tool image sends do not fail just because `sharp` is missing. Fixes #77081. (#77117) Thanks @pfrederiksen.
- Diagnostics: include last progress, cron job/run ids, stopped cron job name, and the last assistant transcript snippet in stalled-session and stuck-session recovery logs so cron stalls show what was stopped.
- Streaming channels: add `streaming.preview.commandText: "status"` / `streaming.progress.commandText: "status"` to hide command/exec text in preview progress lines while keeping the released raw command text default. Fixes #77072.
- Agents/cron: let explicit cron `timeoutSeconds` drive both CLI no-output and embedded LLM idle watchdogs instead of being capped by resume defaults. Fixes #76289.
- Plugins/catalog: suppress missing `channelConfigs` compatibility diagnostics for external channel plugins that are disabled, denied, or outside a restrictive allowlist. Fixes #76095.
- Diagnostics: keep webhook/message OTEL attributes and Prometheus delivery labels low-cardinality and omit raw chat/message IDs from spans, so progress-draft and message-tool modes do not leak high-cardinality messaging identifiers.
- Google Meet: stop advertising legacy `mode: "realtime"` to agents and config UIs, while keeping it as a hidden compatibility alias for `mode: "agent"`, so new joins use the STT -> OpenClaw agent -> TTS path instead of selecting the direct realtime voice fallback.
- Google Meet: add `chrome.audioBufferBytes` for generated command-pair SoX audio commands and lower the default buffer from SoX's 8192 bytes to 4096 bytes to reduce Chrome talk-back latency.

View File

@@ -1,4 +1,4 @@
953aece02c70b8df690b51e865a4aea838b53bbe9d43ef9495f80f719a831e38 config-baseline.json
2c78fb7af01e2ee9e919be5ab7b675347b36cae1e347f97fd2640a6f7c72f3ac config-baseline.json
31ec333df9f8b92c7656ac7107cecd5860dd02e08f7e18c7c674dc47a8811baa config-baseline.core.json
e10ba2f29f25fc665b96c714075af954eed686c56ca12783cf1f49498f86ac98 config-baseline.channel.json
606641569764473005f8343f4550500dcbe99cf54e1dc21960018cf455912196 config-baseline.plugin.json
cd7c0c7fb1435bc7e59099e9ac334462d5ad444016e9ab4512aae63a238f78dc config-baseline.channel.json
9832b30a696930a3da7efccf38073137571e1b66cae84e54d747b733fdafcc54 config-baseline.plugin.json

View File

@@ -685,6 +685,25 @@ Default slash command settings:
- `block` emits draft-sized chunks (use `draftChunk` to tune size and breakpoints, clamped to `textChunkLimit`).
- Media, error, and explicit-reply finals cancel pending preview edits.
- `streaming.preview.toolProgress` (default `true`) controls whether tool/progress updates reuse the preview message.
- `streaming.preview.commandText` / `streaming.progress.commandText` controls command/exec detail in compact progress lines: `raw` (default) or `status` (tool label only).
Hide raw command/exec text while keeping compact progress lines:
```json
{
"channels": {
"discord": {
"streaming": {
"mode": "progress",
"progress": {
"toolProgress": true,
"commandText": "status"
}
}
}
}
}
```
Preview streaming is text-only; media replies fall back to normal delivery. When `block` streaming is explicitly enabled, OpenClaw skips the preview stream to avoid double-streaming.

View File

@@ -666,6 +666,25 @@ Notes:
- `block`: append chunked preview updates.
- `progress`: show progress status text while generating, then send final text.
- `streaming.preview.toolProgress`: when draft preview is active, route tool/progress updates into the same edited preview message (default: `true`). Set `false` to keep separate tool/progress messages.
- `streaming.preview.commandText` / `streaming.progress.commandText`: set to `status` to keep compact tool-progress lines while hiding raw command/exec text (default: `raw`).
Hide raw command/exec text while keeping compact progress lines:
```json
{
"channels": {
"slack": {
"streaming": {
"mode": "progress",
"progress": {
"toolProgress": true,
"commandText": "status"
}
}
}
}
}
```
`channels.slack.streaming.nativeTransport` controls Slack native text streaming when `channels.slack.streaming.mode` is `partial` (default: `true`).

View File

@@ -280,6 +280,7 @@ curl "https://api.telegram.org/bot<bot_token>/getUpdates"
- `channels.telegram.streaming` is `off | partial | block | progress` (default: `partial`)
- `progress` keeps one editable status draft and updates it with tool progress until final delivery
- `streaming.preview.toolProgress` controls whether tool/progress updates reuse the same edited preview message (default: `true` when preview streaming is active)
- `streaming.preview.commandText` controls command/exec detail inside those tool-progress lines: `raw` (default, preserves released behavior) or `status` (tool label only)
- legacy `channels.telegram.streamMode` and boolean `streaming` values are detected; run `openclaw doctor --fix` to migrate them to `channels.telegram.streaming.mode`
Tool-progress preview updates are the short status lines shown while tools run, for example command execution, file reads, planning updates, or patch summaries. Telegram keeps these enabled by default to match released OpenClaw behavior from `v2026.4.22` and later. To keep the edited preview for answer text but hide tool-progress lines, set:
@@ -299,6 +300,41 @@ curl "https://api.telegram.org/bot<bot_token>/getUpdates"
}
```
To keep tool-progress visible but hide command/exec text, set:
```json
{
"channels": {
"telegram": {
"streaming": {
"mode": "partial",
"preview": {
"commandText": "status"
}
}
}
}
}
```
For progress-draft mode, put the same command-text policy under `streaming.progress`:
```json
{
"channels": {
"telegram": {
"streaming": {
"mode": "progress",
"progress": {
"toolProgress": true,
"commandText": "status"
}
}
}
}
}
```
Use `streaming.mode: "off"` only when you want final-only delivery: Telegram preview edits are disabled and generic tool/progress chatter is suppressed instead of being sent as standalone status messages. Approval prompts, media payloads, and errors still route through normal final delivery. Use `streaming.preview.toolProgress: false` when you only want to keep answer preview edits while hiding the tool-progress status lines.
<Note>

View File

@@ -201,10 +201,10 @@ Supported surfaces:
- Telegram has shipped with tool-progress preview updates enabled since `v2026.4.22`; keeping them enabled preserves that released behavior.
- **Mattermost** already folds tool activity into its single draft preview post (see above).
- Tool-progress edits follow the active preview streaming mode; they are skipped when preview streaming is `off` or when block streaming has taken over the message. On Telegram, `streaming.mode: "off"` is final-only: generic progress chatter is also suppressed instead of being delivered as standalone status messages, while approval prompts, media payloads, and errors still route normally.
- To keep preview streaming but hide tool-progress lines, set `streaming.preview.toolProgress` to `false` for that channel. To disable preview edits entirely, set `streaming.mode` to `off`.
- To keep preview streaming but hide tool-progress lines, set `streaming.preview.toolProgress` to `false` for that channel. To keep tool-progress lines visible while hiding command/exec text, set `streaming.preview.commandText` to `"status"` or `streaming.progress.commandText` to `"status"`; the default is `"raw"` to preserve released behavior. This policy is shared by draft/progress channels that use OpenClaw's compact progress renderer, including Discord, Matrix, Microsoft Teams, Mattermost, Slack draft previews, and Telegram. To disable preview edits entirely, set `streaming.mode` to `off`.
- Telegram selected quote replies are an exception: when `replyToMode` is not `"off"` and selected quote text is present, OpenClaw skips the answer preview stream for that turn so tool-progress preview lines cannot render. Current-message replies without selected quote text still keep preview streaming. See [Telegram channel docs](/channels/telegram) for details.
Example:
Keep progress lines visible but hide raw command/exec text:
```json
{
@@ -213,7 +213,26 @@ Example:
"streaming": {
"mode": "partial",
"preview": {
"toolProgress": false
"toolProgress": true,
"commandText": "status"
}
}
}
}
}
```
Use the same shape under another compact progress channel key, for example `channels.discord`, `channels.matrix`, `channels.msteams`, `channels.mattermost`, or Slack draft previews. For progress-draft mode, put the same policy under `streaming.progress`:
```json
{
"channels": {
"telegram": {
"streaming": {
"mode": "progress",
"progress": {
"toolProgress": true,
"commandText": "status"
}
}
}

View File

@@ -65,6 +65,10 @@ export const discordChannelConfigUiHints = {
label: "Discord Draft Tool Progress",
help: "Show tool/progress activity in the live draft preview message (default: true). Set false to hide interim tool updates while the draft preview stays active.",
},
"streaming.preview.commandText": {
label: "Discord Draft Command Text",
help: 'Command/exec detail in preview tool-progress lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"streaming.progress.label": {
label: "Discord Progress Label",
help: 'Initial progress draft title. Use "auto" for built-in single-word labels, a custom string, or false to hide the title.',
@@ -81,6 +85,10 @@ export const discordChannelConfigUiHints = {
label: "Discord Progress Tool Lines",
help: "Show compact tool/progress lines in progress draft mode (default: true). Set false to keep only the label until final delivery.",
},
"streaming.progress.commandText": {
label: "Discord Progress Command Text",
help: 'Command/exec detail in progress draft lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"retry.attempts": {
label: "Discord Retry Attempts",
help: "Max retry attempts for outbound Discord API calls (default: 3).",

View File

@@ -1567,6 +1567,37 @@ describe("processDiscordMessage draft streaming", () => {
);
});
it("can hide raw command progress text in Discord progress drafts by config", async () => {
const draftStream = createMockDraftStreamForTest();
dispatchInboundMessage.mockImplementationOnce(async (params?: DispatchInboundParams) => {
await params?.replyOptions?.onToolStart?.({
name: "exec",
phase: "start",
args: { command: "pnpm test -- --watch=false" },
detailMode: "raw",
});
await params?.replyOptions?.onItemEvent?.({ progressText: "done" });
return createNoQueuedDispatchResult();
});
const ctx = await createAutomaticSourceDeliveryContext({
discordConfig: {
streaming: {
mode: "progress",
progress: {
label: "Shelling",
commandText: "status",
},
},
},
});
await runProcessDiscordMessage(ctx);
expect(draftStream.update).toHaveBeenCalledWith("Shelling\n🛠 Exec\n• done");
});
it("keeps Discord progress lines across assistant boundaries", async () => {
const draftStream = createMockDraftStreamForTest();

View File

@@ -13,6 +13,7 @@ import {
} from "openclaw/plugin-sdk/channel-reply-pipeline";
import {
formatChannelProgressDraftLine,
formatChannelProgressDraftLineForEntry,
resolveChannelStreamingBlockEnabled,
} from "openclaw/plugin-sdk/channel-streaming";
import { recordInboundSession } from "openclaw/plugin-sdk/conversation-runtime";
@@ -669,7 +670,8 @@ export async function processDiscordMessage(
await maybeBindStatusReactionsToToolReaction(payload);
await statusReactions.setTool(payload.name);
await draftPreview.pushToolProgress(
formatChannelProgressDraftLine(
formatChannelProgressDraftLineForEntry(
discordConfig,
{
event: "tool",
name: payload.name,
@@ -683,7 +685,7 @@ export async function processDiscordMessage(
},
onItemEvent: async (payload) => {
await draftPreview.pushToolProgress(
formatChannelProgressDraftLine({
formatChannelProgressDraftLineForEntry(discordConfig, {
event: "item",
itemKind: payload.kind,
title: payload.title,

View File

@@ -1,7 +1,7 @@
import { logTypingFailure } from "openclaw/plugin-sdk/channel-feedback";
import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline";
import {
formatChannelProgressDraftLine,
formatChannelProgressDraftLineForEntry,
isChannelProgressDraftWorkToolName,
} from "openclaw/plugin-sdk/channel-streaming";
import {
@@ -708,7 +708,8 @@ export function createFeishuReplyDispatcher(params: CreateFeishuReplyDispatcherP
if (!isChannelProgressDraftWorkToolName(payload.name)) {
return;
}
const statusLine = formatChannelProgressDraftLine(
const statusLine = formatChannelProgressDraftLineForEntry(
account.config,
{
event: "tool",
name: payload.name,

View File

@@ -17,4 +17,8 @@ export const matrixChannelConfigUiHints = {
label: "Matrix Progress Tool Lines",
help: "Show compact tool/progress lines in progress draft mode (default: true). Set false to keep only the label until final delivery.",
},
"streaming.progress.commandText": {
label: "Matrix Progress Command Text",
help: 'Command/exec detail in progress draft lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
} satisfies Record<string, ChannelConfigUiHint>;

View File

@@ -1,6 +1,7 @@
import {
createChannelProgressDraftGate,
formatChannelProgressDraftLine,
formatChannelProgressDraftLineForEntry,
formatChannelProgressDraftText,
isChannelProgressDraftWorkToolName,
resolveChannelProgressDraftMaxLines,
@@ -1580,7 +1581,8 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
onToolStart: async (payload) => {
const toolName = payload.name?.trim();
await pushPreviewToolProgress(
formatChannelProgressDraftLine(
formatChannelProgressDraftLineForEntry(
progressConfigEntry,
{
event: "tool",
name: toolName,
@@ -1594,7 +1596,7 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
},
onItemEvent: async (payload) => {
await pushPreviewToolProgress(
formatChannelProgressDraftLine({
formatChannelProgressDraftLineForEntry(progressConfigEntry, {
event: "item",
itemKind: payload.kind,
title: payload.title,

View File

@@ -33,10 +33,18 @@ export const mattermostChannelConfigUiHints = {
label: "Mattermost Progress Tool Lines",
help: "Show compact tool/progress lines in progress draft mode (default: true). Set false to keep only the label until final delivery.",
},
"streaming.progress.commandText": {
label: "Mattermost Progress Command Text",
help: 'Command/exec detail in progress draft lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"streaming.preview.toolProgress": {
label: "Mattermost Draft Tool Progress",
help: "Show tool/progress activity in the live draft preview post (default: true). Set false to hide interim tool updates while the draft preview stays active.",
},
"streaming.preview.commandText": {
label: "Mattermost Draft Command Text",
help: 'Command/exec detail in preview tool-progress lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"streaming.block.enabled": {
label: "Mattermost Block Streaming Enabled",
help: 'Enable chunked block-style Mattermost preview delivery when channels.mattermost.streaming.mode="block".',

View File

@@ -256,4 +256,15 @@ describe("buildMattermostToolStatusText", () => {
}),
).toBe("🛠️ Exec: run tests, `pnpm test -- --watch=false`");
});
it("can hide raw exec detail from status text", () => {
expect(
buildMattermostToolStatusText({
name: "exec",
args: { command: "pnpm test -- --watch=false" },
detailMode: "raw",
config: { streaming: { preview: { commandText: "status" } } },
}),
).toBe("🛠️ Exec");
});
});

View File

@@ -1,5 +1,5 @@
import { createFinalizableDraftLifecycle } from "openclaw/plugin-sdk/channel-lifecycle";
import { formatChannelProgressDraftLine } from "openclaw/plugin-sdk/channel-streaming";
import { formatChannelProgressDraftLineForEntry } from "openclaw/plugin-sdk/channel-streaming";
import {
createMattermostPost,
deleteMattermostPost,
@@ -37,9 +37,11 @@ export function buildMattermostToolStatusText(params: {
phase?: string;
args?: Record<string, unknown>;
detailMode?: "explain" | "raw";
config?: Parameters<typeof formatChannelProgressDraftLineForEntry>[0];
}): string {
return (
formatChannelProgressDraftLine(
formatChannelProgressDraftLineForEntry(
params.config,
{
event: "tool",
name: params.name,

View File

@@ -1876,7 +1876,12 @@ export async function monitorMattermostProvider(opts: MonitorMattermostOpts = {}
if (!draftToolProgressEnabled) {
return;
}
draftStream.update(buildMattermostToolStatusText(payload));
draftStream.update(
buildMattermostToolStatusText({
...payload,
config: account.config,
}),
);
},
},
}),

View File

@@ -29,4 +29,8 @@ export const msTeamsChannelConfigUiHints = {
label: "MS Teams Progress Tool Lines",
help: "Show compact tool/progress lines in progress mode (default: true). Set false to keep only the title until final delivery.",
},
"streaming.progress.commandText": {
label: "MS Teams Progress Command Text",
help: 'Command/exec detail in progress lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
} satisfies Record<string, ChannelConfigUiHint>;

View File

@@ -1,5 +1,6 @@
import {
formatChannelProgressDraftLine,
formatChannelProgressDraftLineForEntry,
resolveChannelPreviewStreamMode,
resolveChannelStreamingBlockEnabled,
} from "openclaw/plugin-sdk/channel-streaming";
@@ -384,7 +385,8 @@ export function createMSTeamsReplyDispatcher(params: {
detailMode?: "explain" | "raw";
}) => {
await streamController.pushProgressLine(
formatChannelProgressDraftLine(
formatChannelProgressDraftLineForEntry(
msteamsCfg,
{
event: "tool",
name: payload.name,
@@ -407,7 +409,7 @@ export function createMSTeamsReplyDispatcher(params: {
status?: string;
}) => {
await streamController.pushProgressLine(
formatChannelProgressDraftLine({
formatChannelProgressDraftLineForEntry(msteamsCfg, {
event: "item",
itemKind: payload.kind,
title: payload.title,

View File

@@ -117,6 +117,10 @@ export const slackChannelConfigUiHints = {
label: "Slack Draft Tool Progress",
help: "Show tool/progress activity in the live draft preview message (default: true). Set false to hide interim tool updates while the draft preview stays active.",
},
"streaming.preview.commandText": {
label: "Slack Draft Command Text",
help: 'Command/exec detail in preview tool-progress lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"streaming.progress.label": {
label: "Slack Progress Label",
help: 'Initial progress draft title. Use "auto" for built-in single-word labels, a custom string, or false to hide the title.',
@@ -137,6 +141,10 @@ export const slackChannelConfigUiHints = {
label: "Slack Progress Tool Lines",
help: "Show compact tool/progress lines in progress draft mode (default: true). Set false to keep only the label until final delivery.",
},
"streaming.progress.commandText": {
label: "Slack Progress Command Text",
help: 'Command/exec detail in progress draft lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"thread.historyScope": {
label: "Slack Thread History Scope",
help: 'Scope for Slack thread history context ("thread" isolates per thread; "channel" reuses channel history).',

View File

@@ -37,7 +37,16 @@ let capturedReplyOptions:
| {
disableBlockStreaming?: boolean;
suppressDefaultToolProgressMessages?: boolean;
onItemEvent?: (payload: { progressText: string }) => Promise<void> | void;
onItemEvent?: (payload: {
kind?: string;
progressText?: string;
summary?: string;
title?: string;
name?: string;
phase?: string;
status?: string;
meta?: string;
}) => Promise<void> | void;
onPartialReply?: (payload: { text: string }) => Promise<void> | void;
}
| undefined;
@@ -73,7 +82,18 @@ let mockedDispatchSequence: Array<{
}> = [];
let mockedProgressEvents: string[] = [];
let mockedReplyOptionEvents: Array<
{ kind: "item"; progressText: string } | { kind: "partial"; text: string }
| {
kind: "item";
itemKind?: string;
progressText?: string;
summary?: string;
title?: string;
name?: string;
phase?: string;
status?: string;
meta?: string;
}
| { kind: "partial"; text: string }
> = [];
const noop = () => {};
@@ -246,6 +266,41 @@ vi.mock("openclaw/plugin-sdk/channel-streaming", () => ({
}
: undefined;
},
buildChannelProgressDraftLineForEntry: (
entry: {
streaming?: {
progress?: { commandText?: "raw" | "status" };
preview?: { commandText?: "raw" | "status" };
};
},
params: {
itemKind?: string;
progressText?: string;
summary?: string;
title?: string;
name?: string;
},
) => {
if (
(entry.streaming?.progress?.commandText ?? entry.streaming?.preview?.commandText) ===
"status" &&
(params.itemKind === "command" || params.name === "exec")
) {
return {
kind: "item",
text: "🛠️ Exec",
label: "Exec",
};
}
const text = params.progressText ?? params.summary ?? params.title ?? params.name;
return text
? {
kind: "item",
text,
label: params.title ?? params.name ?? "Update",
}
: undefined;
},
createChannelProgressDraftGate: (params: { onStart: () => void | Promise<void> }) => {
let started = false;
let workEvents = 0;
@@ -290,6 +345,15 @@ vi.mock("openclaw/plugin-sdk/channel-streaming", () => ({
title?: string;
name?: string;
}) => params.progressText ?? params.summary ?? params.title ?? params.name,
formatChannelProgressDraftLineForEntry: (
_entry: unknown,
params: {
progressText?: string;
summary?: string;
title?: string;
name?: string;
},
) => params.progressText ?? params.summary ?? params.title ?? params.name,
resolveChannelProgressDraftMaxLines: (entry?: {
streaming?: { progress?: { maxLines?: number } };
}) => entry?.streaming?.progress?.maxLines ?? 8,
@@ -472,7 +536,16 @@ vi.mock("../reply.runtime.js", () => ({
replyOptions?: {
disableBlockStreaming?: boolean;
suppressDefaultToolProgressMessages?: boolean;
onItemEvent?: (payload: { progressText: string }) => Promise<void> | void;
onItemEvent?: (payload: {
kind?: string;
progressText?: string;
summary?: string;
title?: string;
name?: string;
phase?: string;
status?: string;
meta?: string;
}) => Promise<void> | void;
onPartialReply?: (payload: { text: string }) => Promise<void> | void;
};
dispatcher: {
@@ -492,7 +565,16 @@ vi.mock("../reply.runtime.js", () => ({
if (mockedReplyOptionEvents.length > 0) {
for (const entry of mockedReplyOptionEvents) {
if (entry.kind === "item") {
await params.replyOptions?.onItemEvent?.({ progressText: entry.progressText });
await params.replyOptions?.onItemEvent?.({
kind: entry.itemKind,
progressText: entry.progressText,
summary: entry.summary,
title: entry.title,
name: entry.name,
phase: entry.phase,
status: entry.status,
meta: entry.meta,
});
} else {
await params.replyOptions?.onPartialReply?.({ text: entry.text });
}
@@ -749,6 +831,34 @@ describe("dispatchPreparedSlackMessage preview fallback", () => {
);
});
it("can hide raw Slack command progress text by config", async () => {
const draftStream = createDraftStreamStub();
createSlackDraftStreamMock.mockReturnValueOnce(draftStream);
mockedSlackStreamingMode = "progress";
mockedSlackDraftMode = "status_final";
mockedDispatchSequence = [];
mockedReplyOptionEvents = [
{
kind: "item",
itemKind: "command",
name: "exec",
progressText: "exec pnpm test -- --watch=false",
},
{ kind: "item", progressText: "done" },
];
await dispatchPreparedSlackMessage(
createPreparedSlackMessage({
accountConfig: {
streaming: { mode: "progress", progress: { label: "Shelling", commandText: "status" } },
},
}),
);
expect(draftStream.update).toHaveBeenCalledWith("Shelling\n• 🛠️ Exec\n• done");
expect(draftStream.update.mock.calls.flat().join("\n")).not.toContain("pnpm test");
});
it("suppresses standalone Slack tool progress when progress lines are disabled", async () => {
mockedSlackStreamingMode = "progress";
mockedSlackDraftMode = "status_final";

View File

@@ -14,6 +14,7 @@ import {
} from "openclaw/plugin-sdk/channel-reply-pipeline";
import {
buildChannelProgressDraftLine,
buildChannelProgressDraftLineForEntry,
createChannelProgressDraftGate,
formatChannelProgressDraftText,
isChannelProgressDraftWorkToolName,
@@ -1108,7 +1109,8 @@ export async function dispatchPreparedSlackMessage(prepared: PreparedSlackMessag
await statusReactions.setTool(payload.name);
}
await pushPreviewToolProgress(
buildChannelProgressDraftLine(
buildChannelProgressDraftLineForEntry(
account.config,
{
event: "tool",
name: payload.name,
@@ -1122,7 +1124,7 @@ export async function dispatchPreparedSlackMessage(prepared: PreparedSlackMessag
},
onItemEvent: async (payload) => {
await pushPreviewToolProgress(
buildChannelProgressDraftLine({
buildChannelProgressDraftLineForEntry(account.config, {
event: "item",
itemKind: payload.kind,
title: payload.title,

View File

@@ -780,14 +780,14 @@ describe("dispatchTelegramMessage draft streaming", () => {
);
});
it("keeps the Telegram progress draft across post-tool assistant boundaries", async () => {
it("keeps non-command Telegram progress draft lines across post-tool assistant boundaries", async () => {
const draftStream = createSequencedDraftStream(2001);
createTelegramDraftStream.mockReturnValue(draftStream);
dispatchReplyWithBufferedBlockDispatcher.mockImplementation(
async ({ dispatcherOptions, replyOptions }) => {
await replyOptions?.onReplyStart?.();
await replyOptions?.onAssistantMessageStart?.();
await replyOptions?.onItemEvent?.({ progressText: "exec ls ~/Desktop" });
await replyOptions?.onItemEvent?.({ kind: "search", progressText: "docs lookup" });
await replyOptions?.onItemEvent?.({ progressText: "tests passed" });
await replyOptions?.onAssistantMessageStart?.();
await dispatcherOptions.deliver({ text: "Final after tool" }, { kind: "final" });
@@ -802,7 +802,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
});
expect(draftStream.update).toHaveBeenCalledWith(
expect.stringMatching(/^Shelling\n• `exec ls ~\/Desktop`\n• `tests passed`$/),
expect.stringMatching(/^Shelling\n`🔎 Web Search: docs lookup`\n• `tests passed`$/),
);
expect(draftStream.forceNewMessage).not.toHaveBeenCalled();
expect(draftStream.materialize).not.toHaveBeenCalled();
@@ -815,19 +815,23 @@ describe("dispatchTelegramMessage draft streaming", () => {
expect(draftStream.clear).not.toHaveBeenCalled();
});
it("streams Telegram tool progress by default when preview streaming is active", async () => {
it("streams Telegram command progress text by default when preview streaming is active", async () => {
const draftStream = createDraftStream();
createTelegramDraftStream.mockReturnValue(draftStream);
dispatchReplyWithBufferedBlockDispatcher.mockImplementation(async ({ replyOptions }) => {
await replyOptions?.onToolStart?.({ name: "exec", phase: "start" });
await replyOptions?.onItemEvent?.({ progressText: "exec ls ~/Desktop" });
await replyOptions?.onItemEvent?.({
kind: "command",
name: "exec",
progressText: "exec ls ~/Desktop",
});
return { queuedFinal: false };
});
await dispatchWithContext({ context: createContext(), streamMode: "partial" });
expect(draftStream.update).toHaveBeenCalledWith(
expect.stringMatching(/\n`🛠️ Exec`\n• `exec ls ~\/Desktop`$/),
expect.stringMatching(/\n`🛠️ Exec`\n`🛠️ Exec: exec ls ~\/Desktop`$/),
);
expect(dispatchReplyWithBufferedBlockDispatcher).toHaveBeenCalledWith(
expect.objectContaining({
@@ -838,6 +842,36 @@ describe("dispatchTelegramMessage draft streaming", () => {
);
});
it("can hide Telegram command progress text by config", async () => {
const draftStream = createDraftStream();
createTelegramDraftStream.mockReturnValue(draftStream);
dispatchReplyWithBufferedBlockDispatcher.mockImplementation(async ({ replyOptions }) => {
await replyOptions?.onToolStart?.({ name: "exec", phase: "start" });
await replyOptions?.onItemEvent?.({
kind: "command",
name: "exec",
progressText: "exec ls ~/Desktop",
});
return { queuedFinal: false };
});
await dispatchWithContext({
context: createContext(),
streamMode: "partial",
telegramCfg: { streaming: { mode: "partial", preview: { commandText: "status" } } },
});
expect(draftStream.update).toHaveBeenCalledWith(expect.stringMatching(/\n`🛠️ Exec`$/));
expect(draftStream.update.mock.calls.at(-1)?.[0]).not.toContain("exec ls");
expect(dispatchReplyWithBufferedBlockDispatcher).toHaveBeenCalledWith(
expect.objectContaining({
replyOptions: expect.objectContaining({
suppressDefaultToolProgressMessages: true,
}),
}),
);
});
it("suppresses Telegram tool progress when explicitly disabled", async () => {
const draftStream = createDraftStream();
createTelegramDraftStream.mockReturnValue(draftStream);
@@ -882,12 +916,15 @@ describe("dispatchTelegramMessage draft streaming", () => {
);
});
it("keeps Telegram tool progress links inside code formatting", async () => {
it("keeps non-command Telegram tool progress links inside code formatting", async () => {
const draftStream = createDraftStream();
createTelegramDraftStream.mockReturnValue(draftStream);
dispatchReplyWithBufferedBlockDispatcher.mockImplementation(async ({ replyOptions }) => {
await replyOptions?.onToolStart?.({ name: "exec", phase: "start" });
await replyOptions?.onItemEvent?.({ progressText: "read [label](tg://user?id=123)" });
await replyOptions?.onItemEvent?.({
kind: "search",
progressText: "read [label](tg://user?id=123)",
});
return { queuedFinal: false };
});
@@ -897,7 +934,9 @@ describe("dispatchTelegramMessage draft streaming", () => {
});
const lastPreviewText = draftStream.update.mock.calls.at(-1)?.[0];
expect(lastPreviewText).toMatch(/\n`🛠️ Exec`\n• `read \[label\]\(tg:\/\/user\?id=123\)`$/);
expect(lastPreviewText).toMatch(
/\n`🛠️ Exec`\n`🔎 Web Search: read \[label\]\(tg:\/\/user\?id=123\)`$/,
);
expect(renderTelegramHtmlText(lastPreviewText ?? "")).not.toContain("<a ");
expect(dispatchReplyWithBufferedBlockDispatcher).toHaveBeenCalledWith(
expect.objectContaining({
@@ -927,7 +966,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
const progressLine = lastPreviewText.split("\n").at(1) ?? "";
expect(lastPreviewText.length).toBeLessThan(340);
expect(progressLine).toMatch(/^• `'{10}/);
expect(progressLine).toMatch(/^• `.*…`$/);
expect(progressLine).toContain("…");
expect(renderTelegramHtmlText(lastPreviewText)).not.toContain("<a ");
});

View File

@@ -9,6 +9,7 @@ import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pi
import {
createChannelProgressDraftGate,
formatChannelProgressDraftLine,
formatChannelProgressDraftLineForEntry,
formatChannelProgressDraftText,
isChannelProgressDraftWorkToolName,
resolveChannelProgressDraftMaxLines,
@@ -1173,7 +1174,8 @@ export const dispatchTelegramMessage = async ({
await statusReactionController.setTool(toolName);
}
await pushPreviewToolProgress(
formatChannelProgressDraftLine(
formatChannelProgressDraftLineForEntry(
telegramCfg,
{
event: "tool",
name: toolName,
@@ -1187,7 +1189,7 @@ export const dispatchTelegramMessage = async ({
},
onItemEvent: async (payload) => {
await pushPreviewToolProgress(
formatChannelProgressDraftLine({
formatChannelProgressDraftLineForEntry(telegramCfg, {
event: "item",
itemKind: payload.kind,
title: payload.title,

View File

@@ -73,6 +73,10 @@ export const telegramChannelConfigUiHints = {
label: "Telegram Draft Tool Progress",
help: "Show tool/progress activity in the live draft preview message (default: true when preview streaming is active). Set false to keep tool updates out of the edited Telegram preview.",
},
"streaming.preview.commandText": {
label: "Telegram Draft Command Text",
help: 'Command/exec detail in preview tool-progress lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"streaming.progress.label": {
label: "Telegram Progress Label",
help: 'Initial progress draft title. Use "auto" for built-in single-word labels, a custom string, or false to hide the title.',
@@ -89,6 +93,10 @@ export const telegramChannelConfigUiHints = {
label: "Telegram Progress Tool Lines",
help: "Show compact tool/progress lines in progress draft mode (default: true). Set false to keep only the label until final delivery.",
},
"streaming.progress.commandText": {
label: "Telegram Progress Command Text",
help: 'Command/exec detail in progress draft lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"retry.attempts": {
label: "Telegram Retry Attempts",
help: "Max retry attempts for outbound Telegram API calls (default: 3).",

View File

@@ -889,4 +889,14 @@ describe("resolveCliNoOutputTimeoutMs", () => {
});
expect(timeoutMs).toBe(42_000);
});
it("lets explicit cron timeouts lift the default resume no-output ceiling", () => {
const timeoutMs = resolveCliNoOutputTimeoutMs({
backend: { command: "codex" },
timeoutMs: 600_000,
useResume: true,
trigger: "cron",
});
expect(timeoutMs).toBe(480_000);
});
});

View File

@@ -383,6 +383,7 @@ export async function executePreparedCliRun(
backend,
timeoutMs: params.timeoutMs,
useResume,
trigger: params.trigger,
});
const hasJsonlOutput = backend.output === "jsonl";
if (shouldUseClaudeLiveSession(context)) {

View File

@@ -6,20 +6,27 @@ import {
CLI_RESUME_WATCHDOG_DEFAULTS,
CLI_WATCHDOG_MIN_TIMEOUT_MS,
} from "../cli-watchdog-defaults.js";
import type { EmbeddedRunTrigger } from "../pi-embedded-runner/run/params.js";
function pickWatchdogProfile(
backend: CliBackendConfig,
useResume: boolean,
trigger?: EmbeddedRunTrigger,
): {
noOutputTimeoutMs?: number;
noOutputTimeoutRatio: number;
minMs: number;
maxMs: number;
} {
const defaults = useResume ? CLI_RESUME_WATCHDOG_DEFAULTS : CLI_FRESH_WATCHDOG_DEFAULTS;
const configured = useResume
? backend.reliability?.watchdog?.resume
: backend.reliability?.watchdog?.fresh;
const defaults =
trigger === "cron" && useResume && !configured
? CLI_FRESH_WATCHDOG_DEFAULTS
: useResume
? CLI_RESUME_WATCHDOG_DEFAULTS
: CLI_FRESH_WATCHDOG_DEFAULTS;
const ratio = (() => {
const value = configured?.noOutputTimeoutRatio;
@@ -59,8 +66,9 @@ export function resolveCliNoOutputTimeoutMs(params: {
backend: CliBackendConfig;
timeoutMs: number;
useResume: boolean;
trigger?: EmbeddedRunTrigger;
}): number {
const profile = pickWatchdogProfile(params.backend, params.useResume);
const profile = pickWatchdogProfile(params.backend, params.useResume, params.trigger);
// Keep watchdog below global timeout in normal cases.
const cap = Math.max(CLI_WATCHDOG_MIN_TIMEOUT_MS, params.timeoutMs - 1_000);
if (profile.noOutputTimeoutMs !== undefined) {

View File

@@ -34,6 +34,10 @@ describe("resolveLlmIdleTimeoutMs", () => {
expect(resolveLlmIdleTimeoutMs({ runTimeoutMs: 30_000 })).toBe(30_000);
});
it("honors explicit cron run timeouts as the idle watchdog ceiling", () => {
expect(resolveLlmIdleTimeoutMs({ trigger: "cron", runTimeoutMs: 600_000 })).toBe(600_000);
});
it("disables the idle watchdog when an explicit run timeout disables timeouts", () => {
expect(resolveLlmIdleTimeoutMs({ runTimeoutMs: 2_147_000_000 })).toBe(0);
});

View File

@@ -138,6 +138,9 @@ export function resolveLlmIdleTimeoutMs(params?: {
}
if (typeof runTimeoutMs === "number" && Number.isFinite(runTimeoutMs) && runTimeoutMs > 0) {
if (params?.trigger === "cron") {
return clampTimeoutMs(runTimeoutMs);
}
return clampImplicitTimeoutMs(runTimeoutMs);
}

View File

@@ -930,6 +930,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
toolProgress: {
type: "boolean",
},
commandText: {
type: "string",
enum: ["raw", "status"],
},
},
additionalProperties: false,
},
@@ -965,6 +969,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
toolProgress: {
type: "boolean",
},
commandText: {
type: "string",
enum: ["raw", "status"],
},
},
additionalProperties: false,
},
@@ -2368,6 +2376,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
toolProgress: {
type: "boolean",
},
commandText: {
type: "string",
enum: ["raw", "status"],
},
},
additionalProperties: false,
},
@@ -2403,6 +2415,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
toolProgress: {
type: "boolean",
},
commandText: {
type: "string",
enum: ["raw", "status"],
},
},
additionalProperties: false,
},
@@ -3621,6 +3637,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
label: "Discord Draft Tool Progress",
help: "Show tool/progress activity in the live draft preview message (default: true). Set false to hide interim tool updates while the draft preview stays active.",
},
"streaming.preview.commandText": {
label: "Discord Draft Command Text",
help: 'Command/exec detail in preview tool-progress lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"streaming.progress.label": {
label: "Discord Progress Label",
help: 'Initial progress draft title. Use "auto" for built-in single-word labels, a custom string, or false to hide the title.',
@@ -3637,6 +3657,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
label: "Discord Progress Tool Lines",
help: "Show compact tool/progress lines in progress draft mode (default: true). Set false to keep only the label until final delivery.",
},
"streaming.progress.commandText": {
label: "Discord Progress Command Text",
help: 'Command/exec detail in progress draft lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"retry.attempts": {
label: "Discord Retry Attempts",
help: "Max retry attempts for outbound Discord API calls (default: 3).",
@@ -8040,6 +8064,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
label: "Matrix Progress Tool Lines",
help: "Show compact tool/progress lines in progress draft mode (default: true). Set false to keep only the label until final delivery.",
},
"streaming.progress.commandText": {
label: "Matrix Progress Command Text",
help: 'Command/exec detail in progress draft lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
},
},
{
@@ -8882,10 +8910,18 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
label: "Mattermost Progress Tool Lines",
help: "Show compact tool/progress lines in progress draft mode (default: true). Set false to keep only the label until final delivery.",
},
"streaming.progress.commandText": {
label: "Mattermost Progress Command Text",
help: 'Command/exec detail in progress draft lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"streaming.preview.toolProgress": {
label: "Mattermost Draft Tool Progress",
help: "Show tool/progress activity in the live draft preview post (default: true). Set false to hide interim tool updates while the draft preview stays active.",
},
"streaming.preview.commandText": {
label: "Mattermost Draft Command Text",
help: 'Command/exec detail in preview tool-progress lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"streaming.block.enabled": {
label: "Mattermost Block Streaming Enabled",
help: 'Enable chunked block-style Mattermost preview delivery when channels.mattermost.streaming.mode="block".',
@@ -9119,6 +9155,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
toolProgress: {
type: "boolean",
},
commandText: {
type: "string",
enum: ["raw", "status"],
},
},
additionalProperties: false,
},
@@ -9154,6 +9194,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
toolProgress: {
type: "boolean",
},
commandText: {
type: "string",
enum: ["raw", "status"],
},
},
additionalProperties: false,
},
@@ -9526,6 +9570,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
label: "MS Teams Progress Tool Lines",
help: "Show compact tool/progress lines in progress mode (default: true). Set false to keep only the title until final delivery.",
},
"streaming.progress.commandText": {
label: "MS Teams Progress Command Text",
help: 'Command/exec detail in progress lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
},
},
{
@@ -12349,6 +12397,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
toolProgress: {
type: "boolean",
},
commandText: {
type: "string",
enum: ["raw", "status"],
},
},
additionalProperties: false,
},
@@ -12384,6 +12436,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
toolProgress: {
type: "boolean",
},
commandText: {
type: "string",
enum: ["raw", "status"],
},
},
additionalProperties: false,
},
@@ -13315,6 +13371,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
toolProgress: {
type: "boolean",
},
commandText: {
type: "string",
enum: ["raw", "status"],
},
},
additionalProperties: false,
},
@@ -13350,6 +13410,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
toolProgress: {
type: "boolean",
},
commandText: {
type: "string",
enum: ["raw", "status"],
},
},
additionalProperties: false,
},
@@ -13906,6 +13970,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
label: "Slack Draft Tool Progress",
help: "Show tool/progress activity in the live draft preview message (default: true). Set false to hide interim tool updates while the draft preview stays active.",
},
"streaming.preview.commandText": {
label: "Slack Draft Command Text",
help: 'Command/exec detail in preview tool-progress lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"streaming.progress.label": {
label: "Slack Progress Label",
help: 'Initial progress draft title. Use "auto" for built-in single-word labels, a custom string, or false to hide the title.',
@@ -13926,6 +13994,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
label: "Slack Progress Tool Lines",
help: "Show compact tool/progress lines in progress draft mode (default: true). Set false to keep only the label until final delivery.",
},
"streaming.progress.commandText": {
label: "Slack Progress Command Text",
help: 'Command/exec detail in progress draft lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"thread.historyScope": {
label: "Slack Thread History Scope",
help: 'Scope for Slack thread history context ("thread" isolates per thread; "channel" reuses channel history).',
@@ -14690,6 +14762,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
toolProgress: {
type: "boolean",
},
commandText: {
type: "string",
enum: ["raw", "status"],
},
},
additionalProperties: false,
},
@@ -14725,6 +14801,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
toolProgress: {
type: "boolean",
},
commandText: {
type: "string",
enum: ["raw", "status"],
},
},
additionalProperties: false,
},
@@ -15794,6 +15874,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
toolProgress: {
type: "boolean",
},
commandText: {
type: "string",
enum: ["raw", "status"],
},
},
additionalProperties: false,
},
@@ -15829,6 +15913,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
toolProgress: {
type: "boolean",
},
commandText: {
type: "string",
enum: ["raw", "status"],
},
},
additionalProperties: false,
},
@@ -16257,6 +16345,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
label: "Telegram Draft Tool Progress",
help: "Show tool/progress activity in the live draft preview message (default: true when preview streaming is active). Set false to keep tool updates out of the edited Telegram preview.",
},
"streaming.preview.commandText": {
label: "Telegram Draft Command Text",
help: 'Command/exec detail in preview tool-progress lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"streaming.progress.label": {
label: "Telegram Progress Label",
help: 'Initial progress draft title. Use "auto" for built-in single-word labels, a custom string, or false to hide the title.',
@@ -16273,6 +16365,10 @@ export const GENERATED_BUNDLED_CHANNEL_CONFIG_METADATA = [
label: "Telegram Progress Tool Lines",
help: "Show compact tool/progress lines in progress draft mode (default: true). Set false to keep only the label until final delivery.",
},
"streaming.progress.commandText": {
label: "Telegram Progress Command Text",
help: 'Command/exec detail in progress draft lines: "raw" preserves released behavior; "status" shows only the tool label.',
},
"retry.attempts": {
label: "Telegram Retry Attempts",
help: "Max retry attempts for outbound Telegram API calls (default: 3).",

View File

@@ -10,6 +10,7 @@ export type DmPolicy = "pairing" | "allowlist" | "open" | "disabled";
export type ContextVisibilityMode = "all" | "allowlist" | "allowlist_quote";
export type TextChunkMode = "length" | "newline";
export type StreamingMode = "off" | "partial" | "block" | "progress";
export type ChannelStreamingCommandTextMode = "raw" | "status";
export type OutboundRetryConfig = {
/** Max retry attempts for outbound requests (default: 3). */
@@ -45,6 +46,8 @@ export type ChannelStreamingProgressConfig = {
render?: "text" | "rich";
/** Include compact tool/task progress in the draft. Default: true. */
toolProgress?: boolean;
/** Command/exec progress detail in the draft. "raw" preserves released behavior; "status" shows only the tool label. Default: "raw". */
commandText?: ChannelStreamingCommandTextMode;
};
export type ChannelStreamingPreviewConfig = {
@@ -56,6 +59,8 @@ export type ChannelStreamingPreviewConfig = {
* Default: true.
*/
toolProgress?: boolean;
/** Command/exec progress detail in the preview. "raw" preserves released behavior; "status" shows only the tool label. Default: "raw". */
commandText?: ChannelStreamingCommandTextMode;
};
export type ChannelStreamingBlockConfig = {

View File

@@ -84,6 +84,7 @@ const ChannelStreamingPreviewSchema = z
.object({
chunk: BlockStreamingChunkSchema.optional(),
toolProgress: z.boolean().optional(),
commandText: z.enum(["raw", "status"]).optional(),
})
.strict();
const ChannelStreamingProgressSchema = z
@@ -93,6 +94,7 @@ const ChannelStreamingProgressSchema = z
maxLines: z.number().int().positive().optional(),
render: z.enum(["text", "rich"]).optional(),
toolProgress: z.boolean().optional(),
commandText: z.enum(["raw", "status"]).optional(),
})
.strict();
const ChannelPreviewStreamingConfigSchema = z

View File

@@ -1201,7 +1201,7 @@ describe("agent event handler", () => {
);
});
it("strips tool output when verbose is on", () => {
it("keeps tool output for Control UI recipients when verbose is on", () => {
const { broadcastToConnIds, toolEventRecipients, handler } = createHarness({
resolveSessionKeyForRun: () => "session-1",
});
@@ -1225,8 +1225,8 @@ describe("agent event handler", () => {
expect(broadcastToConnIds).toHaveBeenCalledTimes(1);
const payload = broadcastToConnIds.mock.calls[0]?.[1] as { data?: Record<string, unknown> };
expect(payload.data?.result).toBeUndefined();
expect(payload.data?.partialResult).toBeUndefined();
expect(payload.data?.result).toEqual({ content: [{ type: "text", text: "secret" }] });
expect(payload.data?.partialResult).toEqual({ content: [{ type: "text", text: "partial" }] });
resetAgentRunContextForTest();
});

View File

@@ -613,8 +613,9 @@ export function createAgentEventHandler({
const isToolEvent = evt.stream === "tool";
const isItemEvent = evt.stream === "item";
const toolVerbose = isToolEvent ? resolveToolVerboseLevel(evt.runId, sessionKey) : "off";
// Build tool payload: strip result/partialResult unless verbose=full
const toolPayload =
// Channel/node subscribers respect verbose; authenticated Control UI
// recipients need tool result payloads to render live tool cards.
const channelToolPayload =
isToolEvent && toolVerbose !== "full"
? (() => {
const data = evt.data ? { ...evt.data } : {};
@@ -655,7 +656,7 @@ export function createAgentEventHandler({
if (isControlUiVisible && recipients && recipients.size > 0) {
broadcastToConnIds(
"agent",
sessionKey ? { ...toolPayload, ...buildSessionEventSnapshot(sessionKey) } : toolPayload,
sessionKey ? { ...agentPayload, ...buildSessionEventSnapshot(sessionKey) } : agentPayload,
recipients,
);
}
@@ -669,7 +670,7 @@ export function createAgentEventHandler({
if (sessionSubscribers.size > 0) {
broadcastToConnIds(
"session.tool",
{ ...toolPayload, ...buildSessionEventSnapshot(sessionKey) },
{ ...agentPayload, ...buildSessionEventSnapshot(sessionKey) },
sessionSubscribers,
{ dropIfSlow: true },
);
@@ -692,7 +693,9 @@ export function createAgentEventHandler({
nodeSendToSession(
sessionKey,
"agent",
isToolEvent ? { ...toolPayload, ...buildSessionEventSnapshot(sessionKey) } : agentPayload,
isToolEvent
? { ...channelToolPayload, ...buildSessionEventSnapshot(sessionKey) }
: agentPayload,
);
}
if (

View File

@@ -92,6 +92,49 @@ describe("openclaw channel mcp server", () => {
describe("gateway-backed flows", () => {
describe("gateway integration", () => {
test("returns conversation and message payloads in primary MCP content", async () => {
const sessionKey = "agent:main:telegram:direct:123";
const mcp = await connectMcpWithoutGateway({ claudeChannelMode: "off" });
try {
const gatewayRequest = vi.fn(async (method: string) => {
if (method === "sessions.list") {
return {
sessions: [
{
key: sessionKey,
deliveryContext: { channel: "telegram", to: "123" },
lastMessagePreview: "hello",
},
],
};
}
if (method === "sessions.get") {
return {
messages: [{ id: "msg-1", role: "assistant", content: "hello from transcript" }],
};
}
throw new Error(`unexpected gateway method ${method}`);
});
attachReadyGateway(mcp.bridge, gatewayRequest);
const conversations = (await mcp.client.callTool({
name: "conversations_list",
arguments: {},
})) as { content?: Array<{ type: string; text?: string }> };
expect(conversations.content?.[0]?.text).toContain(`"sessionKey": "${sessionKey}"`);
expect(conversations.content?.[0]?.text).toContain(`"lastMessagePreview": "hello"`);
const messages = (await mcp.client.callTool({
name: "messages_read",
arguments: { session_key: sessionKey },
})) as { content?: Array<{ type: string; text?: string }> };
expect(messages.content?.[0]?.text).toContain(`"id": "msg-1"`);
expect(messages.content?.[0]?.text).toContain("hello from transcript");
} finally {
await mcp.close();
}
});
test("lists conversations and reads messages", async () => {
const sessionKey = "agent:main:main";
const gatewayRequest = vi.fn(async (method: string) => {

View File

@@ -4,6 +4,7 @@ import {
createChannelProgressDraftGate,
DEFAULT_PROGRESS_DRAFT_LABELS,
formatChannelProgressDraftLine,
formatChannelProgressDraftLineForEntry,
formatChannelProgressDraftText,
getChannelStreamingConfigObject,
isChannelProgressDraftWorkToolName,
@@ -15,6 +16,7 @@ import {
resolveChannelStreamingBlockEnabled,
resolveChannelStreamingChunkMode,
resolveChannelStreamingNativeTransport,
resolveChannelStreamingPreviewCommandText,
resolveChannelStreamingPreviewChunk,
resolveChannelStreamingSuppressDefaultToolProgressMessages,
resolveChannelStreamingPreviewToolProgress,
@@ -37,6 +39,7 @@ describe("channel-streaming", () => {
preview: {
chunk: { minChars: 10, maxChars: 20, breakPreference: "sentence" },
toolProgress: false,
commandText: "status",
},
},
chunkMode: "length",
@@ -61,6 +64,7 @@ describe("channel-streaming", () => {
breakPreference: "sentence",
});
expect(resolveChannelStreamingPreviewToolProgress(entry)).toBe(false);
expect(resolveChannelStreamingPreviewCommandText(entry)).toBe("status");
});
it("keeps progress-only tool progress config out of normal preview modes", () => {
@@ -293,6 +297,46 @@ describe("channel-streaming", () => {
{ detailMode: "raw" },
),
).toBe("🛠️ Exec: run tests, `pnpm test -- --watch=false`");
expect(
formatChannelProgressDraftLine({
event: "item",
itemKind: "command",
name: "exec",
progressText: "raw command output",
}),
).toBe("🛠️ Exec: raw command output");
expect(
formatChannelProgressDraftLine(
{
event: "item",
itemKind: "command",
name: "exec",
progressText: "raw command output",
},
{ commandText: "status" },
),
).toBe("🛠️ Exec");
expect(
formatChannelProgressDraftLine(
{
event: "tool",
name: "exec",
args: { command: "pnpm test" },
},
{ detailMode: "raw", commandText: "status" },
),
).toBe("🛠️ Exec");
expect(
formatChannelProgressDraftLineForEntry(
{ streaming: { preview: { commandText: "status" } } },
{
event: "item",
itemKind: "command",
name: "exec",
progressText: "raw command output",
},
),
).toBe("🛠️ Exec");
});
it("starts progress drafts after five seconds or a second work event", async () => {

View File

@@ -5,6 +5,7 @@ import type {
BlockStreamingCoalesceConfig,
ChannelDeliveryStreamingConfig,
ChannelPreviewStreamingConfig,
ChannelStreamingCommandTextMode,
ChannelStreamingProgressConfig,
ChannelStreamingConfig,
SlackChannelStreamingConfig,
@@ -17,6 +18,7 @@ export type {
ChannelDeliveryStreamingConfig,
ChannelPreviewStreamingConfig,
ChannelStreamingBlockConfig,
ChannelStreamingCommandTextMode,
ChannelStreamingConfig,
ChannelStreamingProgressConfig,
ChannelStreamingPreviewConfig,
@@ -86,6 +88,10 @@ function asProgressConfig(value: unknown): ChannelStreamingProgressConfig | unde
return asObjectRecord(value) as ChannelStreamingProgressConfig | undefined;
}
function asCommandTextMode(value: unknown): ChannelStreamingCommandTextMode | undefined {
return value === "raw" || value === "status" ? value : undefined;
}
export const DEFAULT_PROGRESS_DRAFT_LABELS = [
"Thinking...",
"Shelling...",
@@ -127,9 +133,10 @@ export function isChannelProgressDraftWorkToolName(name: string | null | undefin
return Boolean(normalized && !NON_WORK_PROGRESS_TOOL_NAMES.has(normalized));
}
type ChannelProgressLineOptions = {
export type ChannelProgressLineOptions = {
markdown?: boolean;
detailMode?: "explain" | "raw";
commandText?: ChannelStreamingCommandTextMode;
};
export type ChannelProgressDraftRenderMode = "text" | "rich";
@@ -258,6 +265,16 @@ function itemKindToToolName(kind: string | undefined): string | undefined {
}
}
function isCommandToolName(name: string | undefined): boolean {
const normalized = normalizeOptionalLowercaseString(name);
return normalized === "exec" || normalized === "shell" || normalized === "bash";
}
function isCommandProgressItem(input: Extract<ChannelProgressDraftLineInput, { event: "item" }>) {
const itemKind = normalizeOptionalLowercaseString(input.itemKind);
return itemKind === "command" || isCommandToolName(input.name);
}
function patchMetas(input: Extract<ChannelProgressDraftLineInput, { event: "patch" }>): string[] {
const fileMetas = [...(input.added ?? []), ...(input.modified ?? []), ...(input.deleted ?? [])];
return compactStrings([input.summary, ...fileMetas, input.title]);
@@ -267,6 +284,42 @@ function shouldPrefixProgressLine(line: string): boolean {
return !EMOJI_PREFIX_RE.test(line);
}
export function formatChannelProgressDraftLine(
input: ChannelProgressDraftLineInput,
options?: ChannelProgressLineOptions,
): string | undefined {
return buildChannelProgressDraftLine(input, options)?.text;
}
export function resolveChannelProgressDraftLineOptions(
entry: StreamingCompatEntry | null | undefined,
options?: ChannelProgressLineOptions,
): ChannelProgressLineOptions {
return {
...options,
commandText: options?.commandText ?? resolveChannelStreamingPreviewCommandText(entry),
};
}
export function buildChannelProgressDraftLineForEntry(
entry: StreamingCompatEntry | null | undefined,
input: ChannelProgressDraftLineInput,
options?: ChannelProgressLineOptions,
): ChannelProgressDraftLine | undefined {
return buildChannelProgressDraftLine(
input,
resolveChannelProgressDraftLineOptions(entry, options),
);
}
export function formatChannelProgressDraftLineForEntry(
entry: StreamingCompatEntry | null | undefined,
input: ChannelProgressDraftLineInput,
options?: ChannelProgressLineOptions,
): string | undefined {
return buildChannelProgressDraftLineForEntry(entry, input, options)?.text;
}
export function buildChannelProgressDraftLine(
input: ChannelProgressDraftLineInput,
options?: ChannelProgressLineOptions,
@@ -277,7 +330,9 @@ export function buildChannelProgressDraftLine(
input.event,
input.name,
[
inferToolMeta(input.name, input.args, options?.detailMode),
options?.commandText === "status" && isCommandToolName(input.name)
? undefined
: inferToolMeta(input.name, input.args, options?.detailMode),
input.phase && !input.name ? input.phase : undefined,
],
options,
@@ -285,7 +340,12 @@ export function buildChannelProgressDraftLine(
}
case "item": {
const name = input.name ?? itemKindToToolName(input.itemKind);
const meta = input.meta ?? input.progressText ?? input.summary;
const meta =
input.meta ??
input.summary ??
(options?.commandText === "status" && isCommandProgressItem(input)
? undefined
: input.progressText);
if (name) {
return buildNamedProgressLine(input.event, name, [meta], options, {
status: input.status,
@@ -339,9 +399,7 @@ export function buildChannelProgressDraftLine(
input.name ?? "exec",
[status, input.title],
options,
{
status,
},
{ status },
);
}
case "patch": {
@@ -359,13 +417,6 @@ export function buildChannelProgressDraftLine(
return undefined;
}
export function formatChannelProgressDraftLine(
input: ChannelProgressDraftLineInput,
options?: ChannelProgressLineOptions,
): string | undefined {
return buildChannelProgressDraftLine(input, options)?.text;
}
export function createChannelProgressDraftGate(params: {
onStart: () => void | Promise<void>;
initialDelayMs?: number;
@@ -498,6 +549,18 @@ export function resolveChannelStreamingPreviewToolProgress(
return asBoolean(config?.preview?.toolProgress) ?? defaultValue;
}
export function resolveChannelStreamingPreviewCommandText(
entry: StreamingCompatEntry | null | undefined,
defaultValue: ChannelStreamingCommandTextMode = "raw",
): ChannelStreamingCommandTextMode {
const config = getChannelStreamingConfigObject(entry);
return (
asCommandTextMode(config?.progress?.commandText) ??
asCommandTextMode(config?.preview?.commandText) ??
defaultValue
);
}
export function resolveChannelStreamingSuppressDefaultToolProgressMessages(
entry: StreamingCompatEntry | null | undefined,
options?: {

View File

@@ -432,6 +432,40 @@ describe("loadPluginManifestRegistry", () => {
expect(channelConfigWarnings).toHaveLength(1);
});
it("suppresses missing channel config diagnostics for inactive external channel plugins", () => {
const dir = makeTempDir();
writeManifest(dir, {
id: "external-chat",
channels: ["external-chat"],
configSchema: { type: "object" },
});
const candidate = createPluginCandidate({
idHint: "external-chat",
rootDir: dir,
origin: "global",
});
const disabledRegistry = loadPluginManifestRegistry({
config: { plugins: { entries: { "external-chat": { enabled: false } } } },
candidates: [candidate],
});
expect(
disabledRegistry.diagnostics.some((diagnostic) =>
diagnostic.message.includes("without channelConfigs metadata"),
),
).toBe(false);
const allowlistRegistry = loadPluginManifestRegistry({
config: { plugins: { allow: ["other-plugin"] } },
candidates: [candidate],
});
expect(
allowlistRegistry.diagnostics.some((diagnostic) =>
diagnostic.message.includes("without channelConfigs metadata"),
),
).toBe(false);
});
it("suppresses duplicate warnings for explicit installed globals overriding bundled plugins", () => {
const bundledDir = makeTempDir();
const globalDir = makeTempDir();

View File

@@ -568,10 +568,20 @@ function pushProviderAuthEnvVarsCompatDiagnostic(params: {
function pushNonBundledChannelConfigDescriptorDiagnostic(params: {
record: PluginManifestRecord;
diagnostics: PluginDiagnostic[];
normalized?: ReturnType<typeof normalizePluginsConfigWithResolver>;
}): void {
if (params.record.origin === "bundled" || params.record.format === "bundle") {
return;
}
const configuredEntry = params.normalized?.entries[params.record.id];
if (
params.normalized?.enabled === false ||
configuredEntry?.enabled === false ||
params.normalized?.deny.includes(params.record.id) ||
(params.normalized?.allow.length && !params.normalized.allow.includes(params.record.id))
) {
return;
}
const declaredChannels = params.record.channels
.map((channelId) => channelId.trim())
.filter((channelId) => channelId.length > 0);
@@ -597,6 +607,7 @@ function pushNonBundledChannelConfigDescriptorDiagnostic(params: {
function pushManifestCompatibilityDiagnostics(params: {
record: PluginManifestRecord;
diagnostics: PluginDiagnostic[];
normalized?: ReturnType<typeof normalizePluginsConfigWithResolver>;
}): void {
pushProviderAuthEnvVarsCompatDiagnostic(params);
pushNonBundledChannelConfigDescriptorDiagnostic(params);
@@ -856,7 +867,7 @@ export function loadPluginManifestRegistry(
if (PLUGIN_ORIGIN_RANK[candidate.origin] < PLUGIN_ORIGIN_RANK[existing.candidate.origin]) {
records[existing.recordIndex] = record;
seenIds.set(manifest.id, { candidate, recordIndex: existing.recordIndex });
pushManifestCompatibilityDiagnostics({ record, diagnostics });
pushManifestCompatibilityDiagnostics({ record, diagnostics, normalized });
}
continue;
}
@@ -881,7 +892,7 @@ export function loadPluginManifestRegistry(
if (candidateWins) {
records[existing.recordIndex] = record;
seenIds.set(manifest.id, { candidate, recordIndex: existing.recordIndex });
pushManifestCompatibilityDiagnostics({ record, diagnostics });
pushManifestCompatibilityDiagnostics({ record, diagnostics, normalized });
}
if (
isIntentionalInstalledBundledDuplicate({
@@ -909,7 +920,7 @@ export function loadPluginManifestRegistry(
seenIds.set(manifest.id, { candidate, recordIndex: records.length });
records.push(record);
pushManifestCompatibilityDiagnostics({ record, diagnostics });
pushManifestCompatibilityDiagnostics({ record, diagnostics, normalized });
}
const registry = { plugins: records, diagnostics: dedupePluginDiagnostics(diagnostics) };

View File

@@ -29,6 +29,12 @@
margin: 0;
}
.chat-text :where(table) {
display: block;
max-width: 100%;
overflow-x: auto;
}
.chat-text :where(p + p, p + ul, p + ol, p + pre, p + blockquote) {
margin-top: 0.75em;
}