Skip to content

Commit b0ee248

Browse files
committed
ci/claude: add README.md
Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
1 parent 8b67790 commit b0ee248

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

ci/claude/README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# AI Code Reviews in BPF CI
2+
3+
## TL;DR
4+
- **Please make sure AI is actually wrong before dismissing the review**
5+
- An email response explaining why AI is wrong would be very helpful
6+
- BPF CI includes [a workflow](https://github.com/kernel-patches/vmtest/blob/master/.github/workflows/ai-code-review.yml) running AI code review
7+
- The reviews are posted as comments on [kernel-patches/bpf PRs](https://github.com/kernel-patches/bpf/pulls)
8+
- The review comments are forwarded to the patch recipients via email by [KPD](https://github.com/kernel-patches/kernel-patches-daemon)
9+
- Prompts are here: https://github.com/masoncl/review-prompts
10+
11+
If you received an AI review for your patch submission, please try to evaluate it in the same way you would if it was written by a person, and respond.
12+
Your response is for humans, not for AI.
13+
14+
## How does it work?
15+
16+
BPF CI is processing every patch series submitted to the [Linux Kernel BPF mailing list](https://lore.kernel.org/bpf/).
17+
Against each patch the system executes various tests, such as [selftests/bpf](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/testing/selftests/bpf), and since recently it also executes automated code reviews performed by LLM-based AI.
18+
19+
BPF CI runs on [Github Actions](https://docs.github.com/en/actions) workflows orchestrated by [KPD](https://github.com/kernel-patches/kernel-patches-daemon).
20+
21+
The AI review is implemented with [Claude Code GitHub Action](https://github.com/anthropics/claude-code-action), which essentially installs Claude Code command-line app and a MCP server with a number of common tools available to it.
22+
23+
LLMs are accessed via [AWS Bedrock](https://aws.amazon.com/bedrock), the GitHub Actions workflow authenticates to AWS account with [OIDC](https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-aws).
24+
25+
To achieve the output that might have led you to this page, [a set of elaborate prompts](https://github.com/masoncl/review-prompts) were developed specifically targeting the Linux Kernel source code.
26+
The workflow checks out the Linux and prompts repository and initiates the review with a trivial [trigger prompt](https://github.com/kernel-patches/vmtest/blob/master/.github/workflows/ai-code-review.yml#L91-L94).
27+
28+
### Are the reviews even accurate?
29+
30+
We make every effort for AI reviews to be high-signal messages. Although the nature of LLMs makes them prone to mistakes.
31+
32+
At this point this is still an experiment, but the results so far have been promising.
33+
For example, AI is pretty good at catching dumb mistakes (e.g. use-after-free) that humans can easily miss.
34+
At the same time AI can miss context obvious to a human, such as relationships between newer and older changes.
35+
36+
If you'd like to suggest an improvement to the prompts, open a PR to [review-prompts](https://github.com/masoncl/review-prompts) repository.
37+
38+
### Will my patch get nacked because of the AI review?
39+
40+
Paraphrasing IBM training manual:
41+
> "A LLM can never be held accountable, therefore a LLM must never make an Ack/Nack decision"
42+
43+
The review prompts are designed such that AI is only searching for the regressions it can provide evidence for.
44+
For the majority of patches a review is not generated, so if you received one it's worth evaluating.
45+
46+
It's unlikely that your patch gets discarded *just* because AI found something, especially if you address it or explain why AI is wrong.
47+
48+
But if you ignore an AI review, human reviewers will likely ask for a reason.
49+
50+
### What if I don't like it?
51+
52+
Bring it up with the maintainers on the mailing list and elaborate.
53+
54+
It is expected that AI may be mistaken. However it is also expected that the patch authors answer reasonable questions about the code changes they propose.
55+
56+
If there is a technical issue (say with email notifications, formatting etc.), open an issue in [this repository](https://github.com/kernel-patches/vmtest/issues).
57+
58+
### Who pays for the tokens?
59+
60+
[Meta Platforms, Inc.](https://www.meta.com/)
61+
62+
BPF CI in its current form has been developed and maintained by the Linux Kernel team at Meta. Most of the relevant hardware is also provided by Meta.
63+
64+
### Who set this up?
65+
66+
- [Chris Mason](https://github.com/masoncl) is the prompt engineer
67+
- [Ihor Solodrai](https://github.com/theihor) is the infra plumber

0 commit comments

Comments
 (0)