Skip to content

Commit d580d69

Browse files
committed
ai-code-review.yml: semcode integration
The review-prompts [1] are designed to work with semcode [2], which provides various search tools for AI to use. Update the AI code review workflow to run in a special docker image [3] with baked-in semcode database. Configure Claude Code to enable it to access semcode MCP server and use its tools. [1] https://github.com/masoncl/review-prompts [2] https://github.com/facebookexperimental/semcode [3] kernel-patches/runner@e5ca8b9 Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
1 parent 3aad064 commit d580d69

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

.github/workflows/ai-code-review.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ jobs:
1414
get-commits:
1515
# This codition is an indicator that we are running in a context of PR owned by kernel-patches org
1616
if: ${{ github.repository == 'kernel-patches/bpf' && vars.AWS_REGION }}
17-
runs-on: [self-hosted, x86_64]
17+
runs-on:
18+
- ${{ format('codebuild-bpf-ci-{0}-{1}', github.run_id, github.run_attempt) }}
19+
- image:custom-linux-ghcr.io/kernel-patches/runner:kbuilder-debian-x86_64
20+
- instance-size:small
1821
continue-on-error: true
1922
outputs:
2023
commits: ${{ steps.get-commits.outputs.commits }}
@@ -43,7 +46,10 @@ jobs:
4346
4447
ai-review:
4548
needs: get-commits
46-
runs-on: [self-hosted, x86_64]
49+
runs-on:
50+
- ${{ format('codebuild-bpf-ci-{0}-{1}', github.run_id, github.run_attempt) }}
51+
- image:custom-linux-ghcr.io/kernel-patches/runner:ai-review
52+
- instance-size:xlarge
4753
strategy:
4854
matrix:
4955
commit: ${{ fromJson(needs.get-commits.outputs.commits) }}
@@ -98,11 +104,17 @@ jobs:
98104
cd ..
99105
rmdir .kernel
100106
101-
- name: Checkout target commit
107+
- name: semcode-index
102108
shell: bash
103109
run: |
104-
git checkout -b patch-series.local
105-
git checkout ${{ matrix.commit }}
110+
git remote add bpf-next https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
111+
git fetch bpf-next
112+
git checkout ${{ matrix.commit }} -b patch-series.local
113+
MERGE_BASE=$(git merge-base bpf-next/master HEAD)
114+
rm -rf /ci/.semcode.db/lore
115+
ln -s /ci/.semcode.db ${{ github.workspace }}/.semcode.db
116+
semcode-index --git "${MERGE_BASE}..HEAD"
117+
semcode-index --lore bpf
106118
107119
- name: Get patch subject
108120
id: get-patch-subject
@@ -121,6 +133,7 @@ jobs:
121133
- name: Set up review prompts
122134
shell: bash
123135
run: |
136+
cd review-prompts/kernel/scripts && ./claude-setup.sh && cd -
124137
mv review-prompts/kernel ${{ github.workspace }}/review
125138
rm -rf review-prompts
126139
@@ -129,7 +142,10 @@ jobs:
129142
show_full_output: true
130143
github_token: ${{ steps.app-token.outputs.token }}
131144
use_bedrock: "true"
132-
claude_args: '--max-turns 100 --model us.anthropic.claude-opus-4-5-20251101-v1:0'
145+
claude_args: |
146+
--max-turns 100
147+
--mcp-config ci/claude/mcp.json
148+
--model us.anthropic.claude-opus-4-5-20251101-v1:0
133149
allowed_bots: "kernel-patches-daemon-bpf,kernel-patches-review-bot"
134150
prompt: |
135151
Current directory is the root of a Linux Kernel git repository.

ci/claude/mcp.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"mcpServers": {
3+
"semcode": {
4+
"command": "semcode-mcp",
5+
"args": ["-d", "/ci/.semcode.db"]
6+
}
7+
}
8+
}

ci/claude/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"permissions": {
3-
"allow": ["Bash", "Edit", "MultiEdit", "Write"],
3+
"allow": ["Bash", "Edit", "MultiEdit", "Write", "mcp__semcode__*"],
4+
"deny": ["mcp__github__*"],
45
"defaultMode": "acceptEdits"
56
}
67
}

0 commit comments

Comments
 (0)