open-webui / open-webui/computer
bug: Messaging bot commands with arguments (`/workspace <name>`, `/model <id>`) are never intercepted — parsed as plain chat text
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 569
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
Body:
Summary
Commands sent to a messaging bot (Discord/Telegram/etc.) that take an argument — /workspace <name> and /model <id> — are never intercepted by the bot's command layer. They fall through to normal message dispatch and reach the agent as plain text, so the documented behavior (/workspace <name> switches the bot's workspace and starts a new chat) never happens.
Bare commands without arguments (/new, /stop, /retry, /help, /workspaces) work fine.
Environment
- cptr version: 0.9.21 (pip package
cptr, installed via venv) - Platform: Discord bot (bug is in the shared bridge core, so it affects all platforms: Telegram, Discord, Slack, WhatsApp, Signal)
- Docs that document the command: https://docs.openwebui.com/ecosystem/computer/automate/messaging-bots/ ("Commands" table lists
/workspace <name>— Switch workspace (fuzzy match) and start a new chat)
Steps to reproduce
- Create a bot in Settings → Admin → Bots (platform: Discord, workspace:
/projects), start it. - In the Discord channel, send:
/workspace jellyfin-storage - Observe: no "✨ Switched to ... New conversation started." reply. Instead, the message is treated as a normal user message — the agent receives
/workspace jellyfin-storageas plain text and responds to it conversationally. - Same result for
/model <id>.
Root cause
In cptr/utils/bridge.py, BotManager._handle_message, the command is extracted like this:
# Normalize: strip Discord bot mention prefix (<@123456>)
# and Telegram command suffix (/cmd@BotName → /cmd)
import re
clean = re.sub(r"<@!?\d+>\s*", "", text).strip()
cmd = clean.split("@")[0].lower() if clean.startswith("/") else ""
clean.split("@")[0] only strips a Telegram-style @BotName suffix — it does not split on whitespace. So:
/workspace jellyfin-storage→cmd = "/workspace jellyfin-storage"→cmd == "/workspace"isFalse→ falls through to chat dispatch/model gpt-4o→cmd = "/model gpt-4o"→cmd == "/model"isFalse→ falls through
The command handler for /workspace exists and is correct (it matches by name/path suffix, updates the bot config, and starts a new chat) — it's just unreachable because the parser never produces a bare /workspace.
Suggested fix
One line in cptr/utils/bridge.py:
cmd = clean.split()[0].split("@")[0].lower() if clean.startswith("/") else ""
Verified: this yields cmd == "/workspace" for /workspace jellyfin-storage, still strips @BotName suffixes (/cmd@BotName → /cmd), and leaves bare commands and non-slash messages unchanged.
Workaround (for users on affected versions)
Set the bot's workspace directly in Settings → Admin → Bots instead of using /workspace, or patch the single line above (note: it lives in the container's writable layer and is lost on container rebuild).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in cptr/utils/bridge.py at BotManager._handle_message and inspect how incoming command text is normalized before dispatch. Verify that argument-bearing /workspace and /model commands reach their handlers while bare commands, Telegram suffixes, mentions, and ordinary messages retain their existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 90/100