Skip to content

feat(delivery): fetch changed-file source context for reviews - #12

Merged
dooodledad merged 2 commits into
mainfrom
feat/repo-context
Dec 2, 2026
Merged

dooodledad merged 2 commits into
mainfrom
feat/repo-context

Conversation

@dooodledad

Copy link
Copy Markdown
Owner

What

Adds optional repo-context to reviews. When REVIEW_REPO_CONTEXT=true, the
worker fetches the surrounding source of each changed file at the queued head
SHA (via the GitHub contents API) and feeds it to the model as
source_context, so findings are verified against real code rather than
patches alone. The prompt builders already consumed source_context; this
wires the plumbing in the delivery path.

Why

Competitor gap (feature #3 in the feature-matrix plan): Macroscope, CodeRabbit
and Kodus all review with codebase context beyond the diff. This is the
largest review-quality lever of the P0 batch.

Behavior

  • Off by default; no behavior change unless the flag is set.
  • Best-effort and bounded: up to 20 files (largest patches first), 256KB total,
    64KB per file; binary/oversized/unavailable files are skipped, never fail a
    review. Pinned to the queued head SHA, never a moving branch.
  • Docs: .env.example + README config table.

Tests

  • github contents decode / caps / path+ref validation.
  • worker context on (populated), off (no fetch).

Full suite: 549 passed, 2 skipped.

REVIEW_REPO_CONTEXT (off by default) fetches the surrounding source of each
changed file at the queued head SHA via the GitHub contents API and feeds it
to the model as source_context, giving the reviewer real code to verify
findings against instead of patches alone. Best-effort and bounded: 20 files,
256KB total, 64KB per file, binary/oversized/unavailable skipped. Falls back
cleanly when disabled.

@pascal-reviewer pascal-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pascal at your service 🐶

Comment thread delivery/worker.py Resolved
… size

_f_add_repo_context stored the full file text even when it exceeded the
remaining _CONTEXT_MAX_TOTAL_CHARS, so summed context could run up to a full
file (64KB) over the documented 256KB cap. Store only the remaining chars and
decrement the budget by what was stored, enforcing the total cap exactly.
Adds a regression test that shrinks the caps and asserts total stored context
stays within budget.

@pascal-reviewer pascal-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pascal approves this change 🐶

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