Skip to content

fix(code-review): pipeline root, singleton inputs, cache keys, stats and line anchors - #321

Merged
wongk merged 15 commits into
mainfrom
fix/code-review-pipeline-bugs
Oct 20, 2026
Merged

wongk merged 15 commits into
mainfrom
fix/code-review-pipeline-bugs

Conversation

@wongk

@wongk wongk commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Fixes pre-existing code-review pipeline bugs found while running the ISS-12737 campaign (#315, #319, #320). code-review 3.12.0 → 3.12.1.

Fixes

  1. Plugin root is empty for /code-review:deep and /code-review:shallow.
    • Cause: Claude Code fills in ${CLAUDE_PLUGIN_ROOT} only in the text of the command or skill being invoked. It does not fill it in for files the agent later opens with Read, and the variable is empty in Bash (verified with a throwaway plugin). deep.md and shallow.md tell the agent to read and follow start.md, whose stage 0b echoed ${CLAUDE_PLUGIN_ROOT} in Bash, got nothing, and fell back to the in-repo tree or the highest-version marketplace cache, possibly a different version from the one invoked.
    • Fix: deep.md and shallow.md now bind PLUGIN_ROOT explicitly. start.md takes the root from that binding or its own substituted text, checks it as a literal path, and uses the fallbacks only when neither yields one. skills/fix/SKILL.md reads its templates from ${CLAUDE_PLUGIN_ROOT} instead of a never-filled <CLAUDE_PLUGIN_ROOT> placeholder. A sweep found no other file that reads the root after loading.
  2. Singleton agents are not handed all their inputs, by path that resolves.
    • Cause: the signal extractor was never given taxonomy_path, and the coverage critic was never given diff_summary_path. Both prompts named files they never received. Manifest paths were relative to the review's checkout, which is not the agent's working directory on worktree runs.
    • Fix: both manifests now declare extra_inputs (absolute paths). The singleton-dispatch template hands over exactly that list. Both prompts name the files they actually receive.
  3. Singleton caches are keyed on the literal "HEAD".
    • Cause: diff_tip is "HEAD" for branch reviews, so every later review of any branch could reuse the first run's signals and coverage-critic output.
    • Fix: both keys are now content-addressed: the signal key on the agent's input bundle, the critic key on its bundle plus the diff summary. The dead --diff-tip plumbing for stages 11 and 15 is removed.
  4. Verification stats hard-code zeros.
    • Fix: tentative_count, downgrade_count, skipped_count and the per-reviewer tentative bucket now count real verdicts. The local and GitHub summaries were counting JUSTIFIED-INVALID and unverified findings as "CONFIRMED + DOWNGRADE"; that formula is corrected, and they gain a "Not verified (skipped)" line.
  5. Finding lines past the end of their file are accepted.
    • Cause: a reviewer can cite a line number from inside a patch file. A live run had the auditor report records.py:267 on a 22-line file, so the same bug appeared twice.
    • Fix: validate now re-anchors such a finding by its code_snippet (recording line_reanchored_from) before duplicates are merged. If there is no single match, it keeps the finding tagged line_out_of_range and shows it in the summary only; it is never posted inline and never discarded.

Verification

  • uv run pytest plugins/code-review/tools/python/ -q: 1459 passed, 3 skipped. uv run ruff check .: pass. uv run pyright: 0 errors.
  • Every behaviour fix has a test shown to fail with the fix reverted.
  • Live: two headless /code-review:deep runs loading this branch's plugin via --plugin-dir, on a test repo outside the monorepo, so the in-repo fallback could not supply the helpers.
    • Plugin root: the run resolved to this branch's plugin; the signal manifest's prompt_path points into it.
    • Signal extraction: the extractor received the taxonomy through extra_inputs (absolute path) and returned signals. It previously returned none.
    • Stats: downgrade_count was 1, matching the verifier's one DOWNGRADE (previously hard-coded 0).
    • Cache key: after a new commit, the second run's signal stage was needs_agent with a different key from the first run, although the first run's entry was in the global cache. The old "HEAD" key would have reused it.
    • The coverage critic was skipped in that repo (no project reviewers), so its fixes are proven by tests only.

Notes

  • Intermediate commits: four of them (f9df74b, 6e30c86, 878ebd2 and the merge f49c295) each fail one stale test-pin assertion, which the follow-ups 8c04ba4 and 0a159a1 fix. Squash-merge removes this.
  • Version clash: fix(code-review): show BHA the old version of moved files #320 also bumps code-review to 3.12.1. Whichever merges second needs re-bumping to 3.12.2 and its changelog heading regenerated.
  • Seen but not changed here:
    • On a diff small enough for the fast path, a --depth deep review spawns only the fast agent, so the always-on Design Critic is dropped.
    • A verifier DOWNGRADE to LOW is shown as MEDIUM in review_result.json.

@wongk
wongk merged commit e3c021d into main Oct 20, 2026
10 checks passed
@wongk
wongk deleted the fix/code-review-pipeline-bugs branch October 20, 2026 18:52
mikeangstadt added a commit that referenced this pull request Nov 3, 2026
main's #321 already keys the signals cache on the agent input bundle and
drops diff_tip from the key; this branch keeps that key shape and retains
its additive pieces (input_hash in the manifest, the no-changed-files
cache bypass). The override-clock pin is dropped in favour of main's
_iso_days_ago fixtures.
mikeangstadt added a commit that referenced this pull request Nov 3, 2026
…674-coverage-critic-cache-key

main's #321 already keys the coverage_critic cache on the diff summary
(without diff_tip), passes the summary to the critic via extra_inputs, and
seeds a prior entry in its changed-diff regression. This branch keeps that
shape and retains diff_summary_hash in the manifest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant