Repository navigation
fix(reviewer): split agy prompt into trusted AGENTS.md, real argv, and a diff file - #175
Merged
Merged
Conversation
…d a diff file The interim file-delivery fix for the MAX_ARG_STRLEN argv crash (staging the entire untrusted payload behind a generic --print pointer) traded one problem for two others: it buried the angry personality's narrative "prefill" inside a file read via a tool call instead of the model's actual literal prompt, and it left `append_ci_coverage_context` inlining ~39-96KB of raw workflow YAML / package.json into every review regardless of PR size -- itself a quarter of what made PR #38's prompt oversized in the first place. Redesign the split three ways instead: - AGENTS.md holds only genuinely trusted, daemon-authored content. The angry personality's simulated dialogue (`append_angry_agents_prefill`) is removed from it entirely -- a Rules file is static instructions, not a conversation, and agy's own documented Rules system (auto-loading exactly GEMINI.md/AGENTS.md/.agents/rules/*.md by walking up from cwd) confirms AGENTS.md was always the real trusted channel here, not a workaround. - The literal --print argv value is a real, PR-specific prompt again: PR metadata, commit subjects, prior review/threads, and the angry interruption/prefix/tail are reunified into one continuous string assembled in agy.sh, small and bounded by construction (new REVIEWER_MAX_ARGV_PROMPT_BYTES budget, default 100000, plus a hard ~130000-byte backstop against the actual kernel limit right before exec). Only the diff -- the one section that can legitimately run large and the one thing the model cannot self-serve, since the PR-head snapshot has no .git history -- goes to a separately staged file (task_dir/REVIEW_DIFF.md, --add-dir'd alongside the trusted workspace). - CI coverage context is no longer inlined at all. append_ci_status (GitHub-API pass/fail facts) stays; the raw YAML/JSON dump is replaced by one sentence in the existing append_source_snapshot_hint, pointing the model at .github/workflows/ and package.json to read itself if a finding needs it -- the same explore-yourself idiom already proven for the PR-head snapshot generally, not new machinery. Verified live against PR asavs/mog-template#38 (the diff-heavy PR that had been failing since it opened): AGENTS.md dropped from what would have been ~45KB to 6.5KB, the reunified --print argv came in at 1268 bytes for a 112KB diff, and the model produced its first real review verdict on that PR. Full fixture suite passes (633 assertions, up from 617; new coverage for the argv/diff split, the CI self-serve pointer, and the reunified angry narrative in the actual --print value rather than build_review_prompt's own output).
3 tasks done
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.
Supersedes #174
#174 fixed the
MAX_ARG_STRLENargv crash (staging the entire untrusted payload behind a generic--printpointer) but traded it for two new problems, both found during review of that fix:append_ci_coverage_contextwas still inlining ~39–96KB of raw workflow YAML /package.jsoncontent into every review regardless of PR size — itself a quarter of what made PR M0: Add launch validation before enabling cron/live daemon #38's prompt oversized in the first place.This PR redesigns the split three ways instead of patching #174 further:
AGENTS.mdholds only genuinely trusted, daemon-authored content. The angry personality's simulated dialogue (append_angry_agents_prefill) is removed entirely — a Rules file is static instructions, not a conversation. Confirmed viaagy's own bundled docs thatAGENTS.mdis a real, documented Rules-loading feature (auto-discovered by exact filename, walking up from cwd), not a workaround.--printargv value is a real, PR-specific prompt again. PR metadata, commit subjects, prior review/threads, and the angry interruption/prefix/tail are reunified into one continuous string assembled inagy.sh— small and bounded by construction (newREVIEWER_MAX_ARGV_PROMPT_BYTES, default 100000, plus a hard ~130000-byte backstop against the real kernel limit right before exec). Only the diff — the one section that can legitimately run large, and the one thing the model can't self-serve since the PR-head snapshot has no.githistory — goes to a separately staged file (task_dir/REVIEW_DIFF.md).append_ci_status(GitHub API pass/fail facts) stays; the raw YAML/JSON dump is replaced by one sentence inappend_source_snapshot_hintpointing the model at.github/workflows/andpackage.jsonto read itself if a finding needs it — the same explore-yourself idiom already proven for the PR-head snapshot generally.Verification
asavs/mog-template#38— the diff-heavy PR that's been silently failing to get reviewed since it opened:AGENTS.mddropped from what would have been ~45KB to 6.5KB, the reunified--printargv came in at 1268 bytes for a 112KB diff, and the model produced its first real review verdict on that PR (APPROVE), citing specific files by path from the separately-staged diff.Test plan
bash -non every touched shell filebash scripts/reviewer/tests/run-fixtures.sh— 633/633git diff --check