storkit: create 461_bug_strip_bot_mention_fails_on_element_markdown_mention_pill_format
This commit is contained in:
-34
@@ -1,34 +0,0 @@
|
||||
---
|
||||
name: "strip_bot_mention fails on Element Markdown mention pill format"
|
||||
---
|
||||
|
||||
# Bug 460: strip_bot_mention fails on Element Markdown mention pill format
|
||||
|
||||
## Description
|
||||
|
||||
When Element sends a mention pill, the plain text `body` field contains a Markdown-style link like `[@timmy:crashlabs.io](https://matrix.to/#/@timmy:crashlabs.io) status`. The `strip_bot_mention` function uses prefix matching, so it tries to match `@timmy:crashlabs.io`, `@timmy`, and `Timmy` against text starting with `[` — none match. The entire message falls through to the LLM as a non-command.
|
||||
|
||||
`mentions_bot` works because it uses `body.contains(full_id)` which finds the MXID embedded inside the Markdown link. But `strip_bot_mention` fails because the text starts with `[`, not `@` or the display name.
|
||||
|
||||
This causes all deterministic bot commands (status, help, ambient, etc.) to be routed to the LLM instead of being handled by the bot when the user uses Element's mention pill (@-autocomplete).
|
||||
|
||||
## How to Reproduce
|
||||
|
||||
1. In Element, type `@timmy` and use the autocomplete pill to mention the bot
|
||||
2. Append a command like `status`
|
||||
3. Send the message
|
||||
|
||||
## Actual Result
|
||||
|
||||
The command falls through to the LLM. The bot logs show no "Handled bot command" entry. The plain body is `[@timmy:crashlabs.io](https://matrix.to/#/@timmy:crashlabs.io) status` which `strip_bot_mention` cannot parse.
|
||||
|
||||
## Expected Result
|
||||
|
||||
The bot should strip the Markdown mention link wrapper, extract the MXID or display name, and match the command deterministically. `@timmy status` via mention pill should produce the same pipeline status output as typing `@timmy status` manually.
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] strip_bot_mention handles Markdown link format `[display](https://matrix.to/#/@user:server) command` and extracts the command text
|
||||
- [ ] Deterministic commands (status, help, ambient, etc.) work when invoked via Element mention pill autocomplete
|
||||
- [ ] Unit tests cover the Markdown mention pill body format
|
||||
- [ ] Existing strip_bot_mention tests still pass (plain @mention and display name formats)
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
---
|
||||
name: "strip_bot_mention fails on Element markdown mention pill format"
|
||||
---
|
||||
|
||||
# Bug 461: strip_bot_mention fails on Element markdown mention pill format
|
||||
|
||||
## Description
|
||||
|
||||
When Element sends a message with a mention pill, the plain text body uses Markdown link format: `[@timmy:crashlabs.io](https://matrix.to/#/@timmy:crashlabs.io) status`. The `strip_bot_mention` function in chat/util.rs uses `strip_prefix_ci` which expects the message to start with `@timmy` or the display name. Since the message starts with `[`, all prefix checks fail, the mention is not stripped, and the entire Markdown link becomes the "command name". Deterministic commands like `status`, `help`, etc. are never matched — they fall through to the LLM instead. The `mentions_bot` function works correctly because it uses `contains()` rather than prefix matching, so the bot IS triggered, but the command text extraction is broken.
|
||||
|
||||
## How to Reproduce
|
||||
|
||||
1. In Element, mention the bot using a mention pill: @botname status. 2. Element sends plain body as `[@bot:server](https://matrix.to/#/@bot:server) status`. 3. Observe that the bot routes to LLM instead of the deterministic status command handler.
|
||||
|
||||
## Actual Result
|
||||
|
||||
strip_bot_mention returns the original text unchanged. The command name is parsed as the entire Markdown link. No deterministic command matches. Message falls through to LLM.
|
||||
|
||||
## Expected Result
|
||||
|
||||
strip_bot_mention strips the Markdown mention pill `[...](https://matrix.to/...)` and returns `status`. The deterministic command handler matches and handles it.
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] strip_bot_mention in chat/util.rs handles the Markdown mention pill format [display](https://matrix.to/#/@user:server)
|
||||
- [ ] Deterministic commands like 'status', 'help', 'overview' work when sent via Element mention pills
|
||||
- [ ] Existing plain-text mention formats (@bot:server command, @bot command, BotName command) continue to work
|
||||
- [ ] Tests added for Markdown mention pill format in util.rs
|
||||
Reference in New Issue
Block a user