Skip to content

Fix: preserve Telegram slash command arguments for command-dispatch#9

Open
Octane0411 wants to merge 1214 commits intomainfrom
fix/issue-59228-command-dispatch-args
Open

Fix: preserve Telegram slash command arguments for command-dispatch#9
Octane0411 wants to merge 1214 commits intomainfrom
fix/issue-59228-command-dispatch-args

Conversation

@Octane0411
Copy link
Copy Markdown

@Octane0411 Octane0411 commented Apr 3, 2026

Summary

  • Preserve Telegram-native slash command arguments when dispatching to command-dispatch skills.
  • Normalize native command matching so variants like /dispatch_command 115, /dispatch_command@bot 115, and /dispatch_command@bot:115 resolve to the same configured skill command and keep argument payloads.
  • Keep command argument forwarding unchanged for existing non-Telegram dispatch paths.

Security Impact

  • No security behavior changes.
  • No new capabilities or trust boundaries are introduced.

Repro+Verification

  • Before: /dispatch_command 115 via Telegram command dispatch only forwarded /dispatch_command, dropping 115.
  • After: /dispatch_command 115 now resolves to command dispatch-command with args 115 and passes command=115 to command-dispatch tool execution.
  • Also covers Telegram bot-suffixed command variants in existing coverage paths.

Testing

  • Added/updated regression tests in src/telegram/bot-native-commands.test.ts for normalized skill command names and argument preservation.
  • Existing command-dispatch inline-action regression cases for slash variants remain in place in src/auto-reply/reply/get-reply-inline-actions.command-dispatch.test.ts.

AI Assisted

  • ChatGPT assisted with tracing the dispatch path and identifying where normalized command mismatch caused argument stripping.
  • Changes were limited to dispatch parsing and targeted tests.

Fixes

Fixes openclaw#59228

steipete and others added 30 commits March 9, 2026 06:34
Merged via squash.

Prepared head SHA: f9b2375
Co-authored-by: velvet-shark <126378+velvet-shark@users.noreply.github.com>
Co-authored-by: velvet-shark <126378+velvet-shark@users.noreply.github.com>
Reviewed-by: @velvet-shark
…ema instead of OpenAI … (openclaw#40008)

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: opriz <51957849+opriz@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…penclaw#40460)

Merged via squash.

Prepared head SHA: 44622ab
Co-authored-by: dsantoreis <220753637+dsantoreis@users.noreply.github.com>
Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Reviewed-by: @jalehman
…estart (openclaw#40324)

Merged via squash.

Prepared head SHA: cfd9956
Co-authored-by: cgdusek <38732970+cgdusek@users.noreply.github.com>
Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Reviewed-by: @jalehman
…#40995)

Merged via squash.

Prepared head SHA: c1191ed
Co-authored-by: xaeon2026 <264572156+xaeon2026@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
…al (openclaw#41187)

* fix(acp): map error states to end_turn instead of unconditional refusal

* fix: map ACP error stop reason to end_turn (openclaw#41187) (thanks @pejmanjohn)

---------

Co-authored-by: Pejman Pour-Moezzi <481729+pejmanjohn@users.noreply.github.com>
Co-authored-by: Onur <onur@textcortex.com>
…#41185)

* fix(acp): propagate setSessionMode gateway errors to client

* fix: add changelog entry for ACP setSessionMode propagation (openclaw#41185) (thanks @pejmanjohn)

---------

Co-authored-by: Pejman Pour-Moezzi <481729+pejmanjohn@users.noreply.github.com>
Co-authored-by: Onur <onur@textcortex.com>
…penclaw#40185)

* telegram: bridge direct delivery message hooks

* telegram: align sent hooks with command session
Merged via squash.

Prepared head SHA: 5877389
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
Merged via squash.

Prepared head SHA: 4900042
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
wangruobing02 added 29 commits March 12, 2026 18:45
@Octane0411
Copy link
Copy Markdown
Author

Root Cause

Telegram-native dispatch matching in parseTelegramNativeCommandArgs used only case normalization, so configured slash command aliases that differ by normalization (such as hyphen vs underscore forms or bot suffix variants) could fail matching. In those mismatch paths, the payload was not reliably preserved for command-dispatch execution.

Fix

Updated parseTelegramNativeCommandArgs to compare names through normalizeTelegramCommandName(...) in both matching branches, keeping capture behavior unchanged. Added regression coverage in src/telegram/bot-native-commands.test.ts to verify dispatch_command style invocations keep 115 and route to the configured skill command.

Verification

  • New regression test in src/telegram/bot-native-commands.test.ts covering normalized Telegram command names with arguments.
  • Existing slash-variant dispatch assertions already cover the /command and /command@bot forms in src/auto-reply/reply/get-reply-inline-actions.command-dispatch.test.ts.
  • Current HEAD: 5caa889de0288238ab558a24614826a725cc1781.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: command-dispatch skill routing strips arguments from slash commands