Commit f7d4fb8
authored
feat(test-classifier): let the agent re-resolve the diff range (fix 'nothing to classify') (#75)
A user on a GitHub Enterprise host (github.cms.gov) got the PR lookup working via
AI_REVIEW_REPO, but then hit 'No change under test (git diff origin/main HEAD) —
nothing to classify'. Root cause: the dispatcher hardcodes the diff base as
origin/<base> and the prompt told the agent to 'use it verbatim'. When the PR
lives on a repo that is NOT the local origin (fork, enterprise host, or a stale/
absent origin/<base>), that range is wrong/empty — and 'verbatim' made the agent
trust the emptiness instead of recovering.
Reframe: the precomputed range is a STARTING POINT, and the agent (which has git
+ shell) re-resolves the real diff itself when it looks empty/wrong — exactly the
deterministic recovery it was already improvising in practice.
• dispatcher exports AI_REVIEW_PR_NUMBER / AI_REVIEW_PR_BASE / AI_REVIEW_REPO_SLUG
so the prompt can reference them; AI_REVIEW_DIFF_RANGE stays as the start.
• prompt: drop 'use it verbatim' → 'START there, verify, do NOT treat as gospel';
on empty/wrong range, fetch the base from the PR's OWN repo
(gh repo view -R <slug> --json url → git fetch <url> <base>) and diff
FETCH_HEAD HEAD. Works across remotes/hosts. Note the re-resolved base in the
summary.
• SKILL.md Step 2 updated to match.
Does NOT change the happy path (origin/<base> still the default when correct).
Still need a user on the fork/enterprise layout to confirm end-to-end; the change
only ADDS a recovery path, so it can't regress runs that already worked.1 parent 114c77c commit f7d4fb8
2 files changed
Lines changed: 49 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
200 | | - | |
201 | | - | |
| 199 | + | |
| 200 | + | |
202 | 201 | | |
203 | 202 | | |
204 | | - | |
205 | | - | |
| 203 | + | |
| 204 | + | |
206 | 205 | | |
207 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
208 | 217 | | |
209 | 218 | | |
210 | 219 | | |
| |||
Lines changed: 35 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
404 | | - | |
405 | | - | |
406 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
407 | 407 | | |
408 | | - | |
409 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
410 | 433 | | |
411 | 434 | | |
412 | 435 | | |
| |||
947 | 970 | | |
948 | 971 | | |
949 | 972 | | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
950 | 979 | | |
951 | 980 | | |
952 | 981 | | |
953 | 982 | | |
| 983 | + | |
| 984 | + | |
954 | 985 | | |
955 | 986 | | |
956 | 987 | | |
| |||
0 commit comments