[Bug]: Workflow fails in legacy prompt format: “Cannot use ‘in’ operator to search for ‘choices’ in OK”
Summary
Description:
The workflow fails during simple inference without tools (legacy prompt format). The API call returns the string OK instead of a JSON completion object, and the response handler then throws a TypeError.
Logs:
Using legacy prompt format Running simple inference without tools Error: API error: TypeError: Cannot use 'in' operator to search for 'choices' in OK
Suspected cause(to be confirmed during fixing): Wrong endpoint/base URL, or a non-JSON response reaching a code path that assumes an object. The handler should check typeof response === 'object' before using in.
Steps to reproduce
- Open a PR
- Upon workflows running
- Check Pull Request Scope / check-scope (pull_request) fails
Expected behaviour
Either a valid completion response, or a clear error explaining that the API returned an unexpected response (including status code and body).
Actual behaviour
An unhandled TypeError from 'choices' in response where response is the string "OK".
Device name
Workflows(Github)
Android version
Workflows(Github)
Commons app version
Workflows(Github)
Device logs
Shown in the screenshot below
Screenshots
Would you like to work on the issue?
Yes
Even if we fix the workflow, we need to check for a GitHub models alternative that have been deprecated.
Agreed, that makes sense. A deprecated model could also be the root cause of the OK response, so I’ll check that first.
Hello @RitikaPahwa4444, @nicolas-raoul
To clarify the scope: this failure does not appear to come from this repository's code.
- The
check-scopeworkflow passes the PR content toactions/ai-inference@v1and consumes its result. The workflow itself does not parse the API response, and a search of the repository for the error-related terms (choices,legacy prompt,simple inference) finds nothing. - The same failure occurs on another PR with different content, which indicates that this is not specific to the changes or prompt content of a particular contributor's PR.
- The workflow does not provide an endpoint override, so the action is using the GitHub Models inference endpoint. GitHub retired GitHub Models and its inference API on July 30, 2026 retirement, and the run history shows the failures becoming sustained around that time.
I can't prove exactly what returned the OK (the retired endpoint or an intermediary), because the workflow log does not expose the HTTP status or response headers. The retirement is therefore the most likely trigger, rather than a confirmed root cause.
So fixing the workflow's error handling alone won't make the check work again. As @RitikaPahwa4444 mentioned, it also needs an alternative to GitHub Models. I'd suggest making the step non-blocking as a temporary measure, and then evaluating supported replacements. Any thoughts?
It's non-blocking only, we're reviewing and merging the PRs.
GitHub had suggested some alternative as far as I remember, so we can check whether that's free and could be replaced directly.
If a free replacement is not available quickly, how about disabling this check for now? It makes real problems less visible.
I do agree with you @nicolas-raoul!, but of course, as we get a solution.
Hello @RitikaPahwa4444 @nicolas-raoul,
I looked into the alternatives, and I think GitHub Copilot CLI is the most natural option to investigate first.
The current actions/ai-inference@v1 action supports Copilot as its provider, using the GitHub Copilot CLI. This means we may be able to keep the existing actions/ai-inference approach without rewriting the check-scope workflow from scratch.
The main thing to confirm would be whether the project has access to a suitable Copilot plan/token for use in GitHub Actions and whether the maintainers are comfortable making Copilot a CI dependency.
Other alternatives we could think of include the following;
Microsoft Foundry — GitHub's recommended direction for direct model access after GitHub Models' retirement, with access to multiple models.
OpenAI API — straightforward to integrate, but would require a separate API key and potentially paid usage.
Hugging Face — could provide access to open models, but would introduce another external dependency and would need us to check the available free limits. Thanks!
Please try in your forked repository, and when you find a solution, send a pull request here. Thanks! :-)
Hello @nicolas-raoul , I have some nice updates right here . Though it is still a WIP but there is progress!
I am trying to push PRs on the fork n see how the workflows behave. So far so good!
Nice!
Hello @nicolas-raoul , here is a well polished fix! Your review is highly appreciated. Thanks!
I ended up switching to OpenRouter because Gemini no longer offered a suitable free-tier option. I've also configured the required secret and repository variable on my fork for testing. Thanks! CC @nicolas-raoul @RitikaPahwa4444
What are the conditions for the OpenRouter free tier? For instance, do we have to pay if consumption is higher than expected? Thanks!
Not really!. When we go past the limit(50 requests/day) as reported right here, requests fail until it resets.
There's this code snippet
if [[ "$model" != *:free ]]; then echo "::error::OpenRouter model ID must end in :free." exit 1 fi
if for instance someone "accidentally" changed the model to a paid OpenRouter model, the workflow fails instead of making a paid request.
One gigantic caveat we have though is reliability(free models OpenRouter inclusive can be discontinued any time)
Sounds good to me. :-)
@RitikaPahwa4444 Do you want to use your account? If you'd rather not, I can try creating an account.
Sure, I can add mine.
Reopening as this doesn't run on forks
Hello @RitikaPahwa4444! is it fine if we close this issue as well?
23. Reopening as this doesn't run on forks
sorry for the late reply @RitikaPahwa4444, is it now resolved?