[No QA] Refactor Claude code reviewer to use structured JSON output#83226
Conversation
Leverage claude-code-action's --json-schema flag to enforce validated JSON output from the reviewer agent instead of having the agent call shell scripts directly. Comment posting and PR reactions are now handled in a dedicated workflow step that consumes the structured_output.
|
@ShridharGoel Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Hi @ShridharGoel! It was premature undrafting - there is no need for review for now. Sorry about that ❤️ |
|
@Julesssss could I ask you to run this improvement against #82206 in order to check its correctness? Thanks! ❤️ |
Julesssss
left a comment
There was a problem hiding this comment.
Looking good, conflicts and a couple of improvements. @kacper-mikolajczak I'll merge this one first tomorrow to avoid another conflict
Sure, I did this locally again. Seems that the JSON improvement worked well. Reviewed the PR again
|
|
Thanks for the review @Julesssss! All the comments were addressed. As those changes touch critical parts of the reviewer pipeline, I'd suggest we test it once again before merging. |
|
Local test successful, though I see one less violation captured than the last local run: |
|
PERF-3 was missed |
|
Hmm, that's interesting. We'd need to check the agent logs to see what has happened that PERF-3 was missed. Do you have access to those locally @Julesssss? |
It seems just a bit flakey, as it worked on 2nd run 🤷 I think that's okay. |
|
@kacper-mikolajczak lets just keep an eye on new runs once merged. Overall seems a good improvement |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cad72bdf6d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| PATH_ARG=$(echo "$v" | jq -r '.path') | ||
| BODY_ARG=$(echo "$v" | jq -r '.body') | ||
| LINE_ARG=$(echo "$v" | jq -r '.line') | ||
| createInlineComment.sh "$PATH_ARG" "$BODY_ARG" "$LINE_ARG" || true |
There was a problem hiding this comment.
Stop swallowing inline comment posting failures
The createInlineComment.sh call is wrapped with || true, so any failure to post a violation (for example an invalid line/path from the model output or a rule validation rejection) is silently ignored. In that case the workflow still succeeds, and because COUNT > 0 it also skips the +1 reaction path, leaving the PR with neither inline comments nor a success signal even though violations were detected.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
That's a valid remark. However it is more of a dispute about how strict the reviewer check should be - initially it was defined as an auxiliary tool, which should not impact the CI process directly.
We started the discussion about it with Jules already - let's keep it intact for this PR and address it if needed on its own.
a7d154b to
0e64a28
Compare
|
Prettier is failing on schema file we've added |
|
Prettier issues finally resolved @Julesssss 🚀 |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
And it lifted off! Let's see how it performs in the wild :) |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
It is failing due to: gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable. Example:
env:
GH_TOKEN: ${{ github.token }}I am working on fixing that. |
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.3.27-0 🚀
|
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.3.27-8 🚀
|

Explanation of Change
Replace the Claude code reviewer's direct shell script calls (
createInlineComment.sh,addPrReaction.sh) with structured JSON output enforced byclaude-code-action's--json-schemaflag. The agent now returns a validated{ violations: [...] }object, and a separate workflow step handles posting inline comments or adding a PR reaction.This separates infrastructure/usage logic from the reviewer's core analysis work, making it easier to extend capabilities or change the use-case without touching the reviewer agent itself.
Fixed Issues
$ #83224
Tests
Offline tests
N/A - CI workflow only
QA Steps
// [No QA] - CI/tooling change only, no user-facing impact
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A - CI/tooling change only
Android: mWeb Chrome
N/A - CI/tooling change only
iOS: Native
N/A - CI/tooling change only
iOS: mWeb Safari
N/A - CI/tooling change only
MacOS: Chrome / Safari
N/A - CI/tooling change only