Wikipedia:Bots/Requests for approval/AWMBot


Operator: BJackJS (talk · contribs · SUL · edit count · logs · page moves · block log · rights log · ANI search)

Time filed: 18:21, Wednesday, October 21, 2020 (UTC)

Automatic, Supervised, or Manual: supervised

Programming language(s): Node.JS with MWN Library

Source code available: github

Function overview: Repair broken links that occur due to page moves. This would be done to broken links that are in large volumes that cannot be fixed by individual editors efficiently and timely.

Links to relevant discussions (where appropriate): Wikipedia:Bot_requests#Bot_to_fix_broken_peer_review_links was the primary reason for this bot, but it could be extended.

Edit period(s): Likely weekly or when a need arises to repair a group of links.

Estimated number of pages affected: 1000+

Exclusion compliant (Yes/No): Yes

Already has a bot flag (Yes/No): No

Function details: Scans categories that are identified to have broken links (such as Category:Pages using Template:Old peer review with broken archive link). Once broken links are found, it locates redirects and fixes the link with the most recent redirect/move. Rescans after all of the links have been fixed and repeats any ones with a later redirect if needed.


  • This is a very useful bot. Relevant details:--Tom (LT) (talk) 20:59, 22 October 2020 (UTC)
  • This is a tricky issue and so a trial run of 10 articles or so is likely necessary to make sure any unanticipated issues are ironed out. Thanks again to BJackJS for proposing this bot.--Tom (LT) (talk) 20:59, 22 October 2020 (UTC)
  •   Note: This bot appears to have edited since this BRFA was filed. Bots may not edit outside their own or their operator's userspace unless approved or approved for trial. AnomieBOT 21:52, 23 October 2020 (UTC)
  •   Approved for trial (50 edits). Please provide a link to the relevant contributions and/or diffs when the trial is complete. @BJackJS:, for future reference, please do not edit with the bot account until a trial has been approved by a BAG member (limiting the edits to the number requested) and until it is fully approved. Not doing so is a violation of bot policy and can result in the account being blocked as an unauthorized bot. --TheSandDoctor Talk 18:40, 27 October 2020 (UTC)
    • Thanks. I apologize for the bot edits. I was testing the bots ability to pick out the templates but forgot to remove the edit function. BJackJS talk 20:36, 27 October 2020 (UTC)
      • @TheSandDoctor: After issues with repeating args, loop problems, undefined added as args, and many other errors. I have completed the 50 actual edits from the bot, as shown here with diff ids: 986969783, 986968303, 986969709, 986969783, 986967683. With my recent edits, it is shown that the bot does need some help occasionally, but this bot would cut down on all of that very quicky to the point that simple code changes and human work could repair the remaining ones that are not fixable by a bot.
        • I agree, this has been much appreciated and I've checked around ten of the entries all of which seem to have been properly fixed. --Tom (LT) (talk) 00:49, 5 November 2020 (UTC)
  •   Trial complete. [1] — Preceding unsigned comment added by BJackJS (talkcontribs) 17:48, 4 November 2020 (UTC)
Special:Diff/986964116, a few things that could also be addressed as a side note, like ensuring the bot doesn't use the same parameter twice. It may also help users if the edit summary has (Bot) or similar appended to it. It looks like a great bot though! — Yours, Berrely • TalkContribs 19:42, 4 November 2020 (UTC)

  Approved for extended trial (50 edits). Please provide a link to the relevant contributions and/or diffs when the trial is complete. The double-parameter issue is concerning that should be fixed. While I know it's a GIGO issue, it would be nice if changes like Special:Diff/987701203 would be skipped since neither the old nor new link exist. Additionally, as mentioned by Berrely, please include a link to this BRFA in your edit summaries. Primefac (talk) 01:33, 16 November 2020 (UTC)

  • Ah, I think this may well be the first time the MWN library is being used by someone other than me. Please feel free to reach out for any issues you face. – SD0001 (talk) 04:38, 16 November 2020 (UTC)

  Trial complete. [2] There was an error in which it put the argument in twice which I didn't notice at first. I saw it and worried about mass-reverting a good amount of edits that did fix the problem. The code problem has been fixed and I would do another trial if necessary. BJackJS talk 07:15, 18 November 2020 (UTC)

  • Hmm, based on analysis of around 5 - 10 edits from that last batch, the double parameter problem is still quite prevalent. The two most recent changes don't have it, but it seems like a high proportion of the other edits do. That said we only need another 14 trials before the backlog is cleared ;)! --Tom (LT) (talk) 07:41, 18 November 2020 (UTC)
  • @BJackJS: Just to be clear, you're saying the double parameter issue is now fixed after that trial, and shouldn't happen in the next one? For future reference, you can break up your trial in 'multiple runs' (eg do 5/10 at a time, evaluate those), so you're checking it as you go along. Also, what happened here Special:Diff/989310175? And here Special:Diff/989309968/Special:Diff/989309969? ProcrastinatingReader (talk) 07:57, 26 November 2020 (UTC)
    • Yes. Those broken edits were caused by previously strange arguments being added because the bot doesn't actually replace the whole tag. That combined with the code error made those edits possible. BJackJS talk 18:12, 29 November 2020 (UTC)
      @BJackJS: that explains the first diff, but what about the second and third diffs? those base pages themselves are valid redirects, and valid parameters, but there is no actual page there for peer review? ProcrastinatingReader (talk) 06:41, 30 November 2020 (UTC)
      Those pages had broken links which added them to the category. The bot handles all pages in the category the same way by adding the most recent redirect. There isn't any other way I can think of to make it so it does the task in a way that completely repairs the link. BJackJS talk 00:16, 2 December 2020 (UTC)
      They seem to still be in the category; changing one broken link for another isn't ideal. How about making a request to the API to check if the generated page title is valid? ProcrastinatingReader (talk) 00:25, 2 December 2020 (UTC)
      The problem is that it takes up a 2nd request per edit and I'm not sure I want to increase that. BJackJS talk 03:48, 2 December 2020 (UTC)
      I don't think it's much of a problem. Your only per-edit request currently is the edit one, so adding a data fetch each whilst not ideal is not a dealbreaker; it's certainly better than making bad edits. That being said, you can just add one request for all your pages if you want. Loop through your pages, fetch your redirect and generate the predicted archive page title as you do, add it into an array, then make a single mw:API:Query with all the page names stuffed in as "titles". You know it's a valid title if the resulting request (when plucked for page titles) contains the title. If it is, make the edit. Sample ProcrastinatingReader (talk) 13:17, 2 December 2020 (UTC)
      Another idea is to merge that with completly removing the template then readding it with the correct arguments. If the page isnt valid, it wouldn't make the edit. The goal of the bot is to whittle it down to like 50 pages that cant be repaired by the bot so humans can do them. I'll work on getting that implemented. BJackJS talk 18:09, 2 December 2020 (UTC)
  •   Approved for extended trial (50 edits). Please provide a link to the relevant contributions and/or diffs when the trial is complete. @BJackJS: given the issues spotted above and repaired, let's do another trial just to be sure. --TheSandDoctor Talk 17:51, 28 December 2020 (UTC)
      A user has requested the attention of the operator. Once the operator has seen this message and replied, please deactivate this tag. (user notified) Any progress? Primefac (talk) 23:27, 14 January 2021 (UTC)