Skip to content

Let routed CI cache researched reviews too, from one shared policy - #74

Merged
brentvatne merged 1 commit into
mainfrom
routed-research-cache
Aug 9, 2026
Merged

brentvatne merged 1 commit into
mainfrom
routed-research-cache

Conversation

@brentvatne

Copy link
Copy Markdown
Member

Caught by the reviewer on the roadmap PR (#72). It flagged the roadmap for claiming researched reviews are cacheable again — and it was right, because the fix only half-landed.

The miss

#71 removed the offline index and dropped the research gate from cacheAllowed in runLegacyCi. runRoutedCi — the path taken by every repo that has adopted routing.jsonc — still had it:

const cacheAllowed =
  !bypassTriggerGate &&
  !stackWalk &&
  !feedbackNeedsRunSeam(rootConfig.feedback) &&
  !rootConfig.research.enabled &&   // ← still here
  metadata !== undefined;

git log -S confirms both gates were added by the same commit (#61) for the same reason: the offline index was an artifact whose contents the cache key could not represent. With the index gone that reason is gone, so this was a missed half rather than an independent constraint. Effect: routed repos have been running a fresh review for every researched PR unnecessarily.

The fix is the deduplication

Correcting the second copy would leave the actual defect in place — one policy written out twice will drift, and this one already did. reviewCacheAllowed in review-cache.ts is now the single definition, and both paths call it.

A unit test pins each flag and records explicitly that research is not among them, so the next person to wonder doesn't have to re-derive it from two call sites.

Note on the roadmap PR

I fixed the code rather than qualifying the prose, so #72's text ("removing the offline index let ci.ts drop !config.research.enabled from cacheAllowed, so researched reviews are cacheable again") is accurate once this merges. No change needed there.

Verification

tsc clean · oxlint clean · oxfmt clean · ref-check 0 errors · 709 tests pass (+1).

🤖 Generated with Claude Code

#71 removed the offline index and dropped the research gate from `cacheAllowed`
— but only from runLegacyCi. runRoutedCi, which handles every repo that has
adopted routing.jsonc, kept `!rootConfig.research.enabled` and so has been
running a fresh review for every researched PR, for a reason that stopped
existing when the index did. Both gates were added by the same commit (#61) for
the same index reason, so this was a missed half, not a separate constraint.

Caught by the reviewer on the roadmap PR (#72), which claimed the fix had already
landed. Rather than qualify that claim, make it true.

The duplication is the actual defect: one policy written out twice will drift,
and did. `reviewCacheAllowed` in review-cache.ts is now the single definition and
both paths call it, with a unit test pinning each flag and recording that research
is deliberately not among them.
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

🤖 AI code review

Decision: Approve

Overall PR risk: Medium. This change modifies existing behavior by consolidating the cache-allow policy from two separate implementations into one shared function. Both the legacy and routed CI paths now have identical logic, which is correct: the reason for blocking cache reuse (the offline index artifact) was removed in #71 for the legacy path but missed in the routed path. The behavior is now consistent across both code paths. What might break: routed repositories with research enabled will now reuse cached reviews when the input hash matches; the hash covers scoped files, content, scope config, PR metadata, agents, and route, but does not cover live documentation content, so reused reviews could carry stale citations and skip fresh MCP calls. Blast radius is limited to routed CI runs only, and rollback is straightforward (add the research flag back to reviewCacheAllowed or bump REVIEW_INPUT_HASH_VERSION). No critical or warning-level defects found.

🔗 Review setup:

  • This PR changes code the reviewer prompts cite (src, src/tests). Check that the guidance quoting it is still correct.

No findings.


This review is advisory — it never blocks a merge and never auto-approves.

@brentvatne
brentvatne merged commit ba9bbd7 into main Aug 9, 2026
3 checks passed
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