Page MenuHomePhabricator

ORES is not working on testwiki
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • We noticed on testwiki that AutoModerator hasn't made a revert since July 31. Upon closer inspection of the logs in logstash we're seeing that the ORESFetchScoreJob is failing on testwiki

What happens?:
ORESFetchScoreJob failing is causing ORESRecentChangeScoreSavedHookHandler not to fire and thus AutoModerator no longer works on testwiki.

What should have happened instead?:
ORESFetchScoreJob shouldn't fail and should trigger ORESRecentChangeScoreSavedHookHandler to fire.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
MediaWiki 1.45/wmf.12

Other information (browser name/version, screenshots, etc.):

  • Search "ORESFetchScoreJob" on the testwiki host in logstash to see the errors
  • Example failure in logstash

Event Timeline

Update

This is a normal and reasonable behaviour since the ml-team introduced an extra check for the language field in the incoming requests.
That logic was deployed on July in this patch: https://gerrit.wikimedia.org/r/c/machinelearning/liftwing/inference-services/+/1169195 .
We are using a list with canonical wikipedias for checking every incoming request. So if the filed "lang": "test" contains a string that it does not exist as a 'wikipedia' in the list, then liftwing considers it as a bad request, and that is why you are getting a status code HTTP/2 400.

The testwiki is not a canonical Wikipedia, it is a testing environment where articles can be written in any language, and it wasn’t part of the RR model’s training data, so we excluded from the list of canonical Wikipedias. So the, RR model doesn’t support testwiki.
We can easily parse this in the following two requests to enwiki and testwiki, respectively:

# Request to enwiki
$ curl -i -s "https://api.wikimedia.org/service/lw/inference/v1/models/revertrisk-multilingual:predict" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"rev_id": 1, "lang": "en"}'  

HTTP/2 200 
content-length: 197
content-type: application/json
date: Wed, 17 Dec 2025 12:32:57 GMT
server: istio-envoy
cache-control: no-cache
x-ratelimit-limit: 50000, 50000;w=3600
x-ratelimit-remaining: 49993
x-ratelimit-reset: 1623
age: 2
x-cache: cp3067 miss, cp3067 pass
x-cache-status: pass
server-timing: cache;desc="pass", host;desc="cp3067"
strict-transport-security: max-age=106384710; includeSubDomains; preload
report-to: { "group": "wm_nel", "max_age": 604800, "endpoints": [{ "url": "https://intake-logging.wikimedia.org/v1/events?stream=w3c.reportingapi.network_error&schema_uri=/w3c/reportingapi/network_error/1.0.0" }] }
nel: { "report_to": "wm_nel", "max_age": 604800, "failure_fraction": 0.05, "success_fraction": 0.0}
x-client-ip: 2a02:a452:6251:0:15ff:e307:a04f:aeea
set-cookie: WMF-Uniq=v5UEmjdxL-XDZDYo1JesGQLMAAAAAFvdwktQ_Aei-ufjyuFf6LA-m0csgi3FQ5NQ;Domain=api.wikimedia.org;Path=/;HttpOnly;secure;SameSite=None;Expires=Thu, 17 Dec 2026 00:00:00 GMT
x-request-id: 3155171c-32b1-4cf0-b7d5-fe7f3fb00b71
x-analytics: 

{"model_name":"revertrisk-multilingual","model_version":"4","wiki_db":"enwiki","revision_id":1,"output":{"prediction":false,"probabilities":{"true":0.20766703241505555,"false":0.7923329675849444}}}%
# Request to testwiki
$ curl -i -s "https://api.wikimedia.org/service/lw/inference/v1/models/revertrisk-multilingual:predict" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"rev_id": 1, "lang": "test"}'

HTTP/2 400 
content-length: 80
content-type: application/json
date: Wed, 17 Dec 2025 12:31:30 GMT
server: istio-envoy
cache-control: no-cache
x-ratelimit-limit: 50000, 50000;w=3600
x-ratelimit-remaining: 49994
x-ratelimit-reset: 1709
age: 1
x-cache: cp3067 miss, cp3067 pass
x-cache-status: pass
server-timing: cache;desc="pass", host;desc="cp3067"
strict-transport-security: max-age=106384710; includeSubDomains; preload
report-to: { "group": "wm_nel", "max_age": 604800, "endpoints": [{ "url": "https://intake-logging.wikimedia.org/v1/events?stream=w3c.reportingapi.network_error&schema_uri=/w3c/reportingapi/network_error/1.0.0" }] }
nel: { "report_to": "wm_nel", "max_age": 604800, "failure_fraction": 0.05, "success_fraction": 0.0}
x-client-ip: 2a02:a452:6251:0:15ff:e307:a04f:aeea
set-cookie: WMF-Uniq=C1OW6VllFYoe_CYxpc1jZwLMAAAAAFvdf4ILkj69u31uXLg83YSjvAMD0haaO6G8;Domain=api.wikimedia.org;Path=/;HttpOnly;secure;SameSite=None;Expires=Thu, 17 Dec 2026 00:00:00 GMT
x-request-id: 0eb587d7-8600-42a4-89d1-59b44253a27e
x-analytics: 

{"error":"lang 'test' does not exist in the canonical Wikipedia language list."}%

We should not enable AutoModerator on testwiki, or at least shouldn’t expect accurate RR predictions there.
We think that is not a good idea to change the canonical Wikipedias list, we can instead treat the testwiki as a special case and set it to enwiki on the fly when encountered.

We should not enable AutoModerator on testwiki, or at least shouldn’t expect accurate RR predictions there.
We think that is not a good idea to change the canonical Wikipedias list, we can instead treat the testwiki as a special case and set it to enwiki on the fly when encountered.

This sounds fine to me - we're not particularly concerned about which edits Automoderator reverts on testwiki, it would just be helpful if it was operational!

We should not enable AutoModerator on testwiki, or at least shouldn’t expect accurate RR predictions there.
We think that is not a good idea to change the canonical Wikipedias list, we can instead treat the testwiki as a special case and set it to enwiki on the fly when encountered.

This sounds fine to me - we're not particularly concerned about which edits Automoderator reverts on testwiki, it would just be helpful if it was operational!

Agree, this sounds good to me.

Change #1223639 had a related patch set uploaded (by Gkyziridis; author: Gkyziridis):

[machinelearning/liftwing/inference-services@main] revert-risk: Treat 'testwiki' as 'enwiki' on the fly.

https://gerrit.wikimedia.org/r/1223639

Update

On the above patch, we treat testwiki as enwiki on the fly, which means that we can hit the model server sending requests for testwiki and get predictions which makes revert-risk model server operational for testwiki.

Things we need to keep in mind:

  • Testwiki is not a canonical/normal wiki so it is excluded from canonical_wikis list
  • Testwiki is not a supported wiki for the revertrisk model, so predictions will be completely inaccurate.
  • We treat testwiki as enwiki on the fly in order for the revert-risk model server to accept such API hits posting {"lang"="test"}

Check some mock results in the following paste:

1$ curl \
2-s localhost:8080/v1/models/revertrisk-language-agnostic:predict \
3-i -X POST -d '{"lang": "test", "rev_id": 1}'
4
5HTTP/1.1 422 Unprocessable Entity
6date: Tue, 06 Jan 2026 10:55:22 GMT
7server: uvicorn
8content-length: 114
9content-type: application/json
10
11{"detail":"Could not make prediction for revisions dict_keys([(1, 'test')]). Reason: ['parent_revision_missing']"}%
12
13
14$ curl \
15-s localhost:8080/v1/models/revertrisk-language-agnostic:predict \
16-i -X POST -d '{"lang": "test", "rev_id": 2}'
17
18HTTP/1.1 200 OK
19date: Tue, 06 Jan 2026 10:55:30 GMT
20server: uvicorn
21content-length: 203
22content-type: application/json
23
24{"model_name":"revertrisk-language-agnostic","model_version":"3","wiki_db":"testwiki","revision_id":2,"output":{"prediction":true,"probabilities":{"true":0.8534709215164185,"false":0.14652907848358154}}}%
25
26
27$ curl \
28-s localhost:8080/v1/models/revertrisk-language-agnostic:predict \
29-i -X POST -d '{"lang": "test", "rev_id": 3}'
30
31HTTP/1.1 200 OK
32date: Tue, 06 Jan 2026 10:55:37 GMT
33server: uvicorn
34content-length: 200
35content-type: application/json
36
37{"model_name":"revertrisk-language-agnostic","model_version":"3","wiki_db":"testwiki","revision_id":3,"output":{"prediction":true,"probabilities":{"true":0.648537814617157,"false":0.351462185382843}}}%

Change #1223639 merged by jenkins-bot:

[machinelearning/liftwing/inference-services@main] revert-risk: Treat 'testwiki' as 'enwiki' on the fly.

https://gerrit.wikimedia.org/r/1223639

Change #1224604 had a related patch set uploaded (by Gkyziridis; author: Gkyziridis):

[operations/deployment-charts@master] revert-risk: Deploy on prod and staging new model version for both language-agnosting and multingual.

https://gerrit.wikimedia.org/r/1224604

Change #1224604 merged by jenkins-bot:

[operations/deployment-charts@master] revert-risk: Deploy on prod and staging new model version for both language-agnosting and multingual.

https://gerrit.wikimedia.org/r/1224604

Change #1224969 had a related patch set uploaded (by Gkyziridis; author: Gkyziridis):

[operations/deployment-charts@master] revert-risk: Roll back mulkilingual model.

https://gerrit.wikimedia.org/r/1224969

Change #1224969 merged by jenkins-bot:

[operations/deployment-charts@master] revert-risk: Roll back mulkilingual model.

https://gerrit.wikimedia.org/r/1224969

Update

I deployed on production the changes for the revertrisk language agnostic.
Now the testwiki is working as enwiki, you can hit the prod endpoint and get a prediction.
Keep in mind as it mentioned above: https://phabricator.wikimedia.org/T411786#11495265 we should not expect accurate prediction for testwiki.

curl -s -X \
POST "https://inference.svc.eqiad.wmnet:30443/v1/models/revertrisk-language-agnostic:predict" \
-d '{"rev_id": 2, "lang": "test"}' \
-H "Host: revertrisk-language-agnostic.revertrisk.wikimedia.org" 

{"model_name":"revertrisk-language-agnostic","model_version":"3","wiki_db":"testwiki","revision_id":2,"output":{"prediction":true,"probabilities":{"true":0.8534709215164185,"false":0.14652907848358154}}}

I tried to update the rr-multilingual model as well, but I had issues on deploying it so I revert the multilingual model back to the previous version.

revertrisk-multilingual:
 -     image: "machinelearning-liftwing-inference-services-revertrisk"
 -     image_version: "2026-01-08-091023-publish"

revertrisk-language-agnostic-pre-save:
 -     image: "machinelearning-liftwing-inference-services-revertrisk"
 -     image_version: "2026-01-08-091023-publish"

revertrisk-multilingual:
 -     image: "machinelearning-liftwing-inference-services-revertrisk-multilingual"
 -     image_version: "2025-07-25-071731-publish"

revertrisk-multilingual-pre-save:
 -     image: "machinelearning-liftwing-inference-services-revertrisk-multilingual"
 -     image_version: "2026-01-08-091023-publish"

Change #1225474 had a related patch set uploaded (by Bartosz Wójtowicz; author: Bartosz Wójtowicz):

[operations/deployment-charts@master] ml-services: Decrease minReplicas for revertrisk-multilingual to 3.

https://gerrit.wikimedia.org/r/1225474

Change #1225474 merged by jenkins-bot:

[operations/deployment-charts@master] ml-services: Decrease minReplicas for revertrisk-multilingual to 3.

https://gerrit.wikimedia.org/r/1225474

Change #1225603 had a related patch set uploaded (by Gkyziridis; author: Gkyziridis):

[machinelearning/liftwing/inference-services@main] revertrisk-multilingual: Use the same bookworm base image as in revertrisk-language-agnostic.

https://gerrit.wikimedia.org/r/1225603

Change #1225603 merged by jenkins-bot:

[machinelearning/liftwing/inference-services@main] revertrisk-multilingual: Use the same bookworm base image as in revertrisk-language-agnostic.

https://gerrit.wikimedia.org/r/1225603

Change #1227296 had a related patch set uploaded (by Gkyziridis; author: Gkyziridis):

[operations/deployment-charts@master] ml-services: Deploy rr-multilingual model using bookworm base image.

https://gerrit.wikimedia.org/r/1227296

Change #1227296 merged by jenkins-bot:

[operations/deployment-charts@master] ml-services: Deploy rr-multilingual model using bookworm base image.

https://gerrit.wikimedia.org/r/1227296