fix(telegram): keep diagnostics on turn lane · openclaw/openclaw@83b525b
steipete
·
2026-05-18
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -141,6 +141,19 @@ describe("getTelegramSequentialKey", () => {
|
141 | 141 | { message: mockMessage({ chat: mockChat({ id: 123 }), text: "/whoami" }) }, |
142 | 142 | "telegram:123:control", |
143 | 143 | ], |
| 144 | +[ |
| 145 | +{ message: mockMessage({ chat: mockChat({ id: 123 }), text: "/diagnostics" }) }, |
| 146 | +"telegram:123", |
| 147 | +], |
| 148 | +[ |
| 149 | +{ |
| 150 | +message: mockMessage({ |
| 151 | +chat: mockChat({ id: 123 }), |
| 152 | +text: "/diagnostics confirm abc123def456", |
| 153 | +}), |
| 154 | +}, |
| 155 | +"telegram:123", |
| 156 | +], |
144 | 157 | [ |
145 | 158 | { message: mockMessage({ chat: mockChat({ id: 123 }), text: "/export-session" }) }, |
146 | 159 | "telegram:123", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -11,7 +11,15 @@ import {
|
11 | 11 | } from "openclaw/plugin-sdk/command-primitives-runtime"; |
12 | 12 | import { resolveTelegramForumThreadId } from "./bot/helpers.js"; |
13 | 13 | |
14 | | -const TELEGRAM_NON_READ_ONLY_STATUS_COMMAND_KEYS = new Set(["export-session", "export-trajectory"]); |
| 14 | +const TELEGRAM_READ_ONLY_STATUS_COMMAND_KEYS = new Set([ |
| 15 | +"commands", |
| 16 | +"context", |
| 17 | +"help", |
| 18 | +"status", |
| 19 | +"tasks", |
| 20 | +"tools", |
| 21 | +"whoami", |
| 22 | +]); |
15 | 23 | |
16 | 24 | type TelegramSequentialKeyContext = { |
17 | 25 | chat?: { id?: number }; |
@@ -34,8 +42,8 @@ export function isTelegramReadOnlyControlLaneText(params: {
|
34 | 42 | rawText?: string; |
35 | 43 | botUsername?: string; |
36 | 44 | }): boolean { |
37 | | -// Only read-only status commands should bypass the per-topic lane. Export |
38 | | -// commands materialize mutable session state and should not interleave with an active turn. |
| 45 | +// Only read-only status commands should bypass the per-topic lane. |
| 46 | +// Diagnostics and export commands materialize state and should not interleave with an active turn. |
39 | 47 | const normalizedBody = normalizeCommandBody( |
40 | 48 | params.rawText?.trim() ?? "", |
41 | 49 | params.botUsername ? { botUsername: params.botUsername } : undefined, |
@@ -47,9 +55,7 @@ export function isTelegramReadOnlyControlLaneText(params: {
|
47 | 55 | const command = listChatCommands().find((entry) => |
48 | 56 | entry.textAliases.some((candidate) => candidate.trim().toLowerCase() === alias), |
49 | 57 | ); |
50 | | -return ( |
51 | | -command?.category === "status" && !TELEGRAM_NON_READ_ONLY_STATUS_COMMAND_KEYS.has(command.key) |
52 | | -); |
| 58 | +return command?.category === "status" && TELEGRAM_READ_ONLY_STATUS_COMMAND_KEYS.has(command.key); |
53 | 59 | } |
54 | 60 | |
55 | 61 | function isTelegramTargetedStopCommand(rawText?: string, botUsername?: string): boolean { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -48,6 +48,12 @@ describe("shouldSupersedeTelegramReplyFence", () => {
|
48 | 48 | CommandAuthorized: true, |
49 | 49 | }), |
50 | 50 | ).toBe(true); |
| 51 | +expect( |
| 52 | +shouldSupersedeTelegramReplyFence({ |
| 53 | +CommandBody: "/diagnostics confirm abc123def456", |
| 54 | +CommandAuthorized: true, |
| 55 | +}), |
| 56 | +).toBe(true); |
51 | 57 | }); |
52 | 58 | }); |
53 | 59 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。