feat(agent): support repo_context_files on LocalGitProvider via shim - #212
Merged
Conversation
pr-agent 0.39.0 ships a new default `repo_context_files = ["AGENTS.md"]`, but LocalGitProvider (the only provider meebox uses) inherits the base no-op `get_repo_file_content`, so the feature is skipped with a per-run WARNING and never injects project guidance into the review. Patch LocalGitProvider.get_repo_file_content in the version-guarded shim to read the blob from the base branch's tree (`git show <target>:<path>`, never the working tree, so it stays independent of _prepare_repo's /ask worktree sanitizing). Missing files / git errors degrade to "" so build_repo_context treats them as "no context" and caches no fetch error. Result: /review /describe /improve now inject the reviewed repo's AGENTS.md (capped at repo_context_max_lines) as <instruction_files>, and the WARNING no longer fires. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…leased Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
pr-agent 0.39.0 introduced a new upstream default in
configuration.toml:The feature fetches these files from the reviewed repo and injects them as
<instruction_files>so/review,/describe, and/improvefollow the project's own conventions. ButLocalGitProvider(the only provider meebox uses) inherits the base no-opget_repo_file_content→_provider_supports_repo_contextjudges it unsupported, logs a per-runWARNING, and silently skips the feature.Change
Add
LocalGitProvider.get_repo_file_contentin the version-guarded shim (local_git_provider.py):git show <target_branch>:<path>), never the working tree — the review diff is alreadyhead.commitvsmerge-base(target_branch), andtarget_branch_nameis the trusted branch the PR merges into (matchesrepo_context_from_default_branch=true)._prepare_repo's/ask-worktree sanitizing of agent instruction files."", sobuild_repo_contexttreats it as "no context" and caches no fetch error.Docs: added the patch to the current-patches list in
docs/arch/02-agent/05-pragent-runtime.md.Effect
/review /describe /improveinject the reviewed repo'sAGENTS.md(capped atrepo_context_max_lines = 500) as<instruction_files>; theWARNINGno longer fires.git show, near-zero). When present, bounded by the line cap; the 15-min cache saves fetch/render, not prompt tokens.Verification
prepare:pragentre-synced the shim + smoke test passed (shim patch active).get_repo_file_contentoverrides the base no-op; existing file returns content, missing file returns"";_provider_supports_repo_contextnow returnsTrue.The embedded shim is pure Python and not part of npm/Nx, so the root
lint/typecheck/test/builddo not cover it.🤖 Generated with Claude Code