Skip to content

Repo guidelines & linked-issue context are computed but never injected into the review prompt #79

Description

@mk7luke

Summary

Repo guidelines and linked-issue context are computed in Reviewer but never injected into the review prompt. Both features appear wired up but are silent no-ops for the actual code review.

  • Guidelines: dropped entirely — never reach the review or the walkthrough.
  • Linked issues: reach the walkthrough but not the review.

Evidence (src/reviewer.ts)

The review prompt receives repo knowledge only through the learnings array (knowledgeLearnings), which is passed to this.ai.review(context, repoConfig, knowledgeLearnings):

// Build enhanced prompt context by injecting knowledge into the AI prompt
// (Guidelines and issues are injected via the prompt builder's learnings param)
const knowledgeLearnings = [...relevantLearnings];
// Add guideline content as synthetic learnings
const guidelinesPrompt = formatGuidelinesForPrompt(relevantGuidelines); // reviewer.ts:756 — assigned, never used
const issuesPrompt   = formatIssuesForPrompt(linkedIssues);             // reviewer.ts:757 — assigned, never used

knowledgeLearnings is only ever [...relevantLearnings] (754), then unshift-ed with the language preference (761); it is never given guidelinesPrompt or issuesPrompt before being passed to this.ai.review(...) (813). Despite the comment ("injected via the prompt builder's learnings param" / "Add guideline content as synthetic learnings"), that injection never happens.

Corroborating facts:

  • formatGuidelinesForPrompt (src/guidelines.ts:147) and formatIssuesForPrompt (src/issues.ts:88) are pure string formatters — no side effects — so lines 756/757 are pure dead computation.
  • Only call site of each is the dead assignment above (formatGuidelinesForPrompt → reviewer.ts:756; formatIssuesForPrompt → reviewer.ts:757).
  • relevantGuidelines has no other consumer (defined 744, used only at the dead 756).
  • linkedIssues is used for the walkthrough (reviewer.ts:1217, formatIssuesForWalkthrough), so issue context reaches the walkthrough but not the review.
  • buildReviewPrompt (src/ai/prompt.ts) takes no guidelines/issues parameters — the learnings array is the only channel into the review prompt.

Impact

  • Repo guidelines configured by users have no effect on inline review findings.
  • Linked-issue context does not inform the review (only the walkthrough).
  • Both fail silently — no error, no log — so the gap is invisible to operators.

Suspected intended behavior

Push the formatted strings into knowledgeLearnings as synthetic Learning entries before the review call, e.g.:

if (guidelinesPrompt) knowledgeLearnings.push({ id: "__guidelines__", repo: repoFullName, content: guidelinesPrompt, createdAt: "" });
if (issuesPrompt)     knowledgeLearnings.push({ id: "__issues__",     repo: repoFullName, content: issuesPrompt,     createdAt: "" });

(Exact shape/placement TBD — verify against how learnings are rendered in buildReviewPrompt and add a regression test asserting guideline/issue content reaches the built prompt.)

Provenance / notes

  • Introduced by befbb49 ("Add CodeRabbit-parity features: walkthrough, chat, config, knowledge base, finishing touches"). Pre-existing on main.
  • Surfaced via the advisory-lint warning 'guidelinesPrompt' is assigned a value but never used while reviewing PR Add backup AI provider / failover (off by default) #78 (backup AI failover). Unrelated to that PR and intentionally left out of its scope to keep the diff focused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions