fix(telegram): keep trajectory exports on turn lane · ope...
steipete
·
2026-05-18
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -146,6 +146,14 @@ describe("getTelegramSequentialKey", () => {
|
146 | 146 | "telegram:123", |
147 | 147 | ], |
148 | 148 | [{ message: mockMessage({ chat: mockChat({ id: 123 }), text: "/export" }) }, "telegram:123"], |
| 149 | +[ |
| 150 | +{ message: mockMessage({ chat: mockChat({ id: 123 }), text: "/export-trajectory" }) }, |
| 151 | +"telegram:123", |
| 152 | +], |
| 153 | +[ |
| 154 | +{ message: mockMessage({ chat: mockChat({ id: 123 }), text: "/trajectory" }) }, |
| 155 | +"telegram:123", |
| 156 | +], |
149 | 157 | [ |
150 | 158 | { message: mockMessage({ chat: mockChat({ id: 123 }), text: "/btw what is the time?" }) }, |
151 | 159 | "telegram:123:btw:1", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -11,6 +11,8 @@ 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"]); |
| 15 | + |
14 | 16 | type TelegramSequentialKeyContext = { |
15 | 17 | chat?: { id?: number }; |
16 | 18 | me?: UserFromGetMe; |
@@ -32,9 +34,8 @@ export function isTelegramReadOnlyControlLaneText(params: {
|
32 | 34 | rawText?: string; |
33 | 35 | botUsername?: string; |
34 | 36 | }): boolean { |
35 | | -// Only read-only status commands should bypass the per-topic lane. Commands |
36 | | -// like /export-session stay on the normal lane because they materialize |
37 | | -// session state to disk and should not interleave with an active turn. |
| 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. |
38 | 39 | const normalizedBody = normalizeCommandBody( |
39 | 40 | params.rawText?.trim() ?? "", |
40 | 41 | params.botUsername ? { botUsername: params.botUsername } : undefined, |
@@ -46,7 +47,9 @@ export function isTelegramReadOnlyControlLaneText(params: {
|
46 | 47 | const command = listChatCommands().find((entry) => |
47 | 48 | entry.textAliases.some((candidate) => candidate.trim().toLowerCase() === alias), |
48 | 49 | ); |
49 | | -return command?.category === "status" && command.key !== "export-session"; |
| 50 | +return ( |
| 51 | +command?.category === "status" && !TELEGRAM_NON_READ_ONLY_STATUS_COMMAND_KEYS.has(command.key) |
| 52 | +); |
50 | 53 | } |
51 | 54 | |
52 | 55 | function isTelegramTargetedStopCommand(rawText?: string, botUsername?: string): boolean { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -36,5 +36,11 @@ describe("shouldSupersedeTelegramReplyFence", () => {
|
36 | 36 | CommandAuthorized: false, |
37 | 37 | }), |
38 | 38 | ).toBe(false); |
| 39 | +expect( |
| 40 | +shouldSupersedeTelegramReplyFence({ |
| 41 | +CommandBody: "/export-trajectory bundle", |
| 42 | +CommandAuthorized: true, |
| 43 | +}), |
| 44 | +).toBe(true); |
39 | 45 | }); |
40 | 46 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。