feat: silently ignore unknown /-shorthand comments (foreign-bot friendly)#273
feat: silently ignore unknown /-shorthand comments (foreign-bot friendly)#273eg-ayoub wants to merge 1 commit into
Conversation
7f60778 to
813e7a2
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #273 +/- ##
==========================================
+ Coverage 89.62% 89.65% +0.02%
==========================================
Files 81 81
Lines 10614 10681 +67
==========================================
+ Hits 9513 9576 +63
- Misses 1101 1105 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Design feedback
|
813e7a2 to
3d677d4
Compare
|
ok @matthiasL-scality I will first split this into two PRs and we'll look at them separately. |
e9fdd63 to
7422ee2
Compare
|
@matthiasL-scality this is the offshoot PR #274 for the approve issue |
…mmand Bert-E's reactor treats any comment starting with /word as a shorthand for one of its own commands, and posts an "UnknownCommand" reply when the keyword doesn't match a registered command. On pull requests shared with bots such as CodeRabbit, Gemini or GitHub Copilot, that behaviour produces noisy "unknown command" replies every time a user runs /coderabbit review, /gemini ..., /copilot ..., etc. Use the reactor's own command/option registry as an implicit allowlist: when an unknown keyword arrives on the / shorthand path, silently drop it unless it looks like a typo of a registered keyword. "Looks like a typo" is determined with difflib.get_close_matches (default cutoff 0.6, empirically clean against realistic bot names). Behaviour matrix (/ shorthand path only; @<robot> mentions are unaffected and always dispatch as before): /help -> registered command fires /hlep -> close match to `help` -> UnknownCommand /apporve -> close match to `approve` -> UnknownCommand /coderabbit review -> no close match -> silently ignored /gemini ... -> no close match -> silently ignored PTFE-3408 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7422ee2 to
a2014a1
Compare
Bert-E's reactor treats any comment starting with
/wordas a shorthand for one of its own commands, and posts an "UnknownCommand" reply when the keyword doesn't match a registered command. On pull requests shared with bots such as CodeRabbit, Gemini or GitHub Copilot, that behaviour produces noisy "unknown command" replies every time a user runs/coderabbit review,/gemini …,/copilot …, etc.Approach
Use the reactor's own command/option registry as an implicit allowlist. When an unknown keyword arrives on the
/shorthand path, silently drop it unless it looks like a typo of a registered keyword. "Looks like a typo" is determined withdifflib.get_close_matches(default cutoff0.6).No new configuration surface — the behaviour is derived from the commands and options
bert-ealready registers.Behaviour matrix
/shorthand path only; comments that explicitly address Bert-E via its@<robot>mention are unaffected and always dispatch as before./help/hlephelp→ UnknownCommand reply (typo hint)/apporveapprove→ UnknownCommand reply (typo hint)/coderabbit review/gemini …/copilot …@bert-e coderabbitCutoff choice
Empirically validated against the reactor's actual registry (
Reactor.get_commands()+Reactor.get_options()aftercommands.setup()):coderabbit,copilot,gemini,devin,claude,other-bot-name, …) → no close match at cutoffs 0.6, 0.7 or 0.75.apporve,hlep,wiat,staus,resset, …) → match at all three cutoffs.Sticking with the Python default (
0.6).Ticket: PTFE-3408