#3701·pr-agent

Plain comments trigger tools on GitLab and Bitbucket

Author: IsmaelMartinezCreated Sep 27, 2026Updated Sep 27, 2026
Labelshelp wantedLow Effort Issuebug

GitLab, Bitbucket Cloud and Bitbucket Server pass every comment to PRAgent.handle_request, and _run_command strips an optional slash (pr_agent.py:370), so a plain comment whose first word is a command runs it: "review looks good to me" runs /review, "Ask Bob about this" runs /ask, and the same holds for help, describe, improve, config, settings and answer. On GitLab a DiffNote with /ask anywhere in it also runs /ask_line (gitlab_webhook.py:416). Because a raw /ask_line answer is posted verbatim, a reply starting with "Improve" can re-trigger the bot where it is not filtered (GitLab bot names outside bot_user_indicators; Bitbucket Server has no bot filter). #3604 fixed this for the GitHub Action only.

Proposal: a shared is_command_comment(body) check (leading / after lstrip()) where the body is read, before any rewriting: gitlab_webhook.py:411 (ahead of the --comment_id and DiffNote handling), bitbucket_app.py:365 and bitbucket_server_webhook.py:163. Add a test per server that a plain comment does not dispatch and a slash command does.