Skip to content

Introduce a way to load external content when an agent review code#6128

Open
padenot wants to merge 6 commits into
mozilla:masterfrom
padenot:external-context-rules
Open

Introduce a way to load external content when an agent review code#6128
padenot wants to merge 6 commits into
mozilla:masterfrom
padenot:external-context-rules

Conversation

@padenot

@padenot padenot commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

See the doc and example in the last commit first.

padenot added 6 commits June 4, 2026 15:52
Introduce ExternalContent as the common loader for review-time files fetched
over HTTP. It strips frontmatter, caches the fetched body, and reports load
failures with context.

The loader uses a shared retrying fetch helper so skills and future
review-context content use the same network behavior.
Add a stdlib-only schema parser for review-context.toml, including reusable
predicate definitions, boolean composition, file predicates, metadata
predicates, and file or revision load actions.

The validator rejects unknown fields and malformed rules before the runtime
loader sees them, and exposes bugbug-validate-review-context for
repository-side checks.
Add the initial review-context runtime: fetch review-context.toml from GitHub,
match rules against changed files, deduplicate load actions, and inject fetched
files with an audit manifest.

Cross-repository file loads are restricted to the rule repository unless
explicitly allow-listed, and the parsed rules file is cached briefly to avoid
repeated fetches during adjacent reviews.
Extend review-context matching with Bugzilla component lookup for patches that
have an associated bug, failing closed when metadata is unavailable.

Also implement fetch_revision actions for Phabricator revisions and GitHub
commits so rules can include trusted related diffs as review context.
Thread review_context_repo, review_context_branch, extra_context_toml, and
content overrides through the CodeReviewTool.

When matching rules load content, the prompt receives the formatted external
context and the tool response records the content manifest for auditing.
Add developer and rule-author documentation for review-context.toml, including
validation, matching semantics, trust policy, metadata predicates,
fetch_revision, testing overrides, and prompt injection.

The example TOML demonstrates the intended full rule language separately from
the subset currently active in the loader, and the docs examples are covered by
tests to keep them valid.
@padenot padenot requested review from marco-c and suhaibmujahid and removed request for suhaibmujahid June 8, 2026 09:53
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