Wikibugs

wikibugs is an IRC bot that idles in the #wikimedia-dev development channel (and others) on the freenode IRC network.

After restart, the bot joins only #wikimedia-cloud by default. Other channels are joined when the first relevant message to them is supposed to be sent.

Functions
The bot polls the phabricator API, listens to the Gerrit events feed, and posts changes to tasks and patches into various IRC channels.


 * wikibugs.py: Runs as  and polls the API, and inserts all task events into a redis queue
 * grrrrit.py: Runs as  and listens to the Gerrit stream-events feed, and inserts all changes events into a redis queue
 * redis2irc.py: Runs as, reads from the redis-queue, and notifies various channels.
 * redis2stdout.py is useful when debugging if you don't want to have to connect to IRC all the time.

Source
The source for wikibugs can be found in Git:

https://gerrit.wikimedia.org/g/labs/tools/wikibugs2/

Including the channels list and gerrit-channels list.

Deploying changes
You need to ssh into tools-login.wmflabs.org and run the following commands:

become wikibugs # sudo -i become wikibugs if you're in sudoers but not a member of tools.wikibugs cd ~/wikibugs2

Since deployment is performed using a 'manage.py' script in the tool directory.

The manage.py script provides the following commands:


 * This will pull changes, and will restart the jobs provided (see above for job names)
 * If no job names are provided, all jobs will be restarted
 * pulls changes into the working directory
 * Starts (i.e., jsub) the provided job
 * This will start all jobs.
 * Restarts (i.e., qmod -rj) the provided job
 * Starts (i.e., jsub) the provided job
 * This will start all jobs.
 * Restarts (i.e., qmod -rj) the provided job
 * Restarts (i.e., qmod -rj) the provided job
 * Restarts (i.e., qmod -rj) the provided job

Muting wikibugs
There is currently no IRC-based method for this. Maintainers can kill the phabricator listener via:

Restarting wikibugs

 * ssh tools-login.wmflabs.org ; sudo -i become wikibugs
 * stop all jobs found in 's output with
 * poll  until all jobs have been successfully deleted and its output is empty
 * and run.

Making wikibugs ignore certain users
In the case of a vandal attacking Phabricator, you likely want to quietly cause the bot to drop their messages (so Freenode stops killing the bot for flooding) without giving them the recognition of a commit.

In, there is a function named   with an ignored tuple in it. Add the username to the tuple on labs,, wait for it to disappear from  , then on your machine. Then let it run for a while until the vandal's account has been disabled and all their messages have been popped from redis. Then reverse the change.

During this it will still be processing their phabricator edits behind the scenes so depending on volume it may be slow to post things to IRC.

Configuring channels
Update channels.yaml or gerrit-channels.yaml with the channel name and project name. Project names can be regular expressions and are case insensitive.

Note that before wikibugs can be added to a new channel, it must be whitelisted by freenode staff (454263 has some more details). wikibugs maintainers will take care of this step when necessary.

Help
Find any of the following friendly people on IRC and they should be able to help you out:
 * legoktm
 * valhallasw

The list of people who have access to the bot can be found here.

History
The first wikibugs, started in August 2004, was a Perl script that parsed Bugzilla's email messages, wrote them to a log file, and relied on ircecho to post them. In April 2014, the bot was rewritten in Python ("pywikibugs"), still parsing email messages, but using a Redis queue to post on IRC. Later in November 2014, the bot was rewritten again ("wikibugs2"), this time handling bugs from Phabricator rather than Bugzilla, but reused many of the ideas from pywikibugs such as a Redis queue and asyncio.