Files
openclaw/qa/scenarios/channels/telegram-queue-invalid-mode.yaml
Peter Steinberger 1a0fde18d6 fix(commands): validate native settings and preserve Telegram ingress outcomes (#116773)
* fix(commands): validate native directives and preserve Telegram outcomes

* test(commands): isolate native directive fast runtime

---------

Co-authored-by: Peter Steinberger <steipete@macos.shared>
2026-07-31 04:36:54 -07:00

118 lines
5.3 KiB
YAML

title: Telegram native settings commands reject prose as command arguments
scenario:
id: telegram-queue-invalid-mode
surface: channels
category: channels.channel-actions-commands-and-approvals
coverage:
primary:
- telegram.built-in-commands
regressionRefs:
- openclaw/openclaw#116688
objective: Verify native Telegram settings commands validate their complete arguments without invoking the model or synthesizing a model-failure fallback.
successCriteria:
- Telegram accepts the native queue command with its complete trailing argument text.
- The reply identifies the invalid queue mode and lists supported queue modes.
- Valid queue settings followed by unexpected prose produce an explicit argument error.
- Native thinking commands preserve and reject invalid multiword arguments.
- The reply never blames the model, and a mock provider receives no request for the command.
codeRefs:
- extensions/telegram/src/bot-native-commands.ts
- src/auto-reply/reply/get-reply-directives.ts
- src/auto-reply/reply/directive-handling.native.ts
- src/auto-reply/reply/directive-handling.queue-validation.ts
execution:
kind: flow
channel: telegram
summary: Send the reported native queue command and verify its explicit validation reply.
config:
commandText: /queue Can you diagnose this?
invalidModeNeedle: Unrecognized queue mode "Can"
validModesNeedle: "Valid modes: steer, followup, collect, interrupt."
falseFallbackNeedle: temporary model failure
flow:
steps:
- name: invalid native queue arguments produce a visible command error
actions:
- resetTransport: true
- set: requestCursorBefore
value:
expr: "env.mock ? (await fetchJson(`${env.mock.baseUrl}/debug/request-cursor`)).cursor : 0"
- set: startIndex
value:
expr: "state.getSnapshot().messages.filter((message) => message.direction === 'outbound').length"
- sendInbound:
conversation: { id: telegram-command-room, kind: channel }
senderId: qa-command-operator
senderName: QA Command Operator
text: { ref: config.commandText }
nativeCommand: { name: queue }
- waitForOutbound:
conversation: { id: telegram-command-room, kind: channel }
sinceIndex: { ref: startIndex }
textIncludes: { ref: config.invalidModeNeedle }
timeoutMs: 60000
saveAs: reply
- assert:
expr: "reply.text.includes(config.validModesNeedle)"
message:
expr: "`queue validation reply omitted the valid modes: ${reply.text}`"
- assert:
expr: "!reply.text.includes(config.falseFallbackNeedle)"
message:
expr: "`queue validation emitted the false model fallback: ${reply.text}`"
- set: scenarioRequests
value:
expr: "env.mock ? await fetchJson(`${env.mock.baseUrl}/debug/requests?after=${requestCursorBefore}`) : []"
- assert:
expr: "!env.mock || scenarioRequests.length === 0"
message:
expr: "`native queue validation unexpectedly invoked the model ${String(scenarioRequests.length)} time(s)`"
detailsExpr: reply.text
- name: valid native queue options reject unexpected trailing prose
actions:
- set: queueStartIndex
value:
expr: "state.getSnapshot().messages.filter((message) => message.direction === 'outbound').length"
- sendInbound:
conversation: { id: telegram-command-room, kind: channel }
senderId: qa-command-operator
senderName: QA Command Operator
text: /queue collect please help
nativeCommand: { name: queue }
- waitForOutbound:
conversation: { id: telegram-command-room, kind: channel }
sinceIndex: { ref: queueStartIndex }
textIncludes: Unexpected argument "please" for /queue.
timeoutMs: 60000
saveAs: queueTrailingReply
detailsExpr: queueTrailingReply.text
- name: native thinking commands preserve invalid multiword arguments
actions:
- set: thinkStartIndex
value:
expr: "state.getSnapshot().messages.filter((message) => message.direction === 'outbound').length"
- sendInbound:
conversation: { id: telegram-command-room, kind: channel }
senderId: qa-command-operator
senderName: QA Command Operator
text: /think about my deployment plan
nativeCommand: { name: think }
- waitForOutbound:
conversation: { id: telegram-command-room, kind: channel }
sinceIndex: { ref: thinkStartIndex }
textIncludes: Unrecognized thinking level "about".
timeoutMs: 60000
saveAs: thinkReply
- set: allScenarioRequests
value:
expr: "env.mock ? await fetchJson(`${env.mock.baseUrl}/debug/requests?after=${requestCursorBefore}`) : []"
- assert:
expr: "!env.mock || allScenarioRequests.length === 0"
message:
expr: "`native settings validation unexpectedly invoked the model ${String(allScenarioRequests.length)} time(s)`"
detailsExpr: thinkReply.text