Repository navigation
feat(synthesis): feed the merged PR description and review thread into commit synthesis - #563
Merged
Merged
Conversation
On squash-merge repos the why often lives in the PR description, not the commit that lands (#562: 39% of discussed PRs across 12 repos). When a commit subject names its PR ("Title (#N)" or "Merge pull request #N"), fetch the description with the user's own `gh` and give it to the model as a separate, fenced section labeled as untrusted data. - One `gh api` call per commit, memoized per process; any failure (no GitHub origin, no gh, offline, unauthenticated) degrades to no context. - The PR must match the commit: its merge sha, or GitHub's default squash subject "<title> (#N)". Unmerged PRs are ignored. - Body bounded to 8000 chars after dropping template comments. - Never fetched for local-only/private captures or deterministic drafts. - The Critic sees the same section, so PR-backed alternatives survive it. - Provenance records pr=#N in the synth evidence. HUNCH_PR_CONTEXT=0 opts out. Phase 1 of #562; review-thread context stays gated on the noise audit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review findings on the PR-context change: - gh/git now run through async execFile, so a backfill's parallel workers are not frozen by a blocking lookup; the origin is memoized per root. - After two straight lookup failures (gh missing, offline, timed out) the process stops asking. A 404 or an issue number is an answer, not a failure, so it no longer disables PR context for the rest of a backfill. - `gh api --hostname github.com`, since the origin is proven github.com even when gh defaults to an Enterprise host. - PR title collapsed to one line before it reaches the prompt. - Tests: 404s don't trip the breaker; `private: true` alone never looks up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
🧠 Hunch — Engineering Memory Guard✅ This PR touches no recorded invariants (directly or via blast radius) and re-introduces nothing deliberately retired across 5 changed file(s). 📜 Hunch Constitution — 2 policy receipt(s)
|
The env-surface gate requires every env read in src to be registered with a covering test; the opt-out test in test/pr-context.test.ts covers it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 29, 2026
…esis Phase 2 of #562. On the Critic-verified path only, fetch the merged PR's human review thread (conversation comments, review bodies, inline review comments; bots dropped) with one `gh api graphql` call and hand it to the model as its own fenced, labeled, untrusted DATA section, capped at 14000 chars. The query takes the newest messages (`last:`) and marks the thread truncated when GitHub holds older ones; the char cap keeps the opening and the end, where review converges. A thread failure keeps the description and trips a separate thread breaker, so a GraphQL-only problem never silences working description lookups. All four fences, and the PR title, are neutralized in untrusted text. The verifier is told to flag thread-drawn claims the diff does not show landed. Refs #562 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
This branch was successfully deployed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Phase 1 of #562. On squash-merge repos the why often lives in the PR description, not the commit that lands. Synthesis now reads it.
What changes
src/synthesis/prContext.ts. When a commit subject names its PR (Title (#N), orMerge pull request #N from …) andoriginis GitHub, it fetches the PR with the user's owngh(gh api --hostname github.com repos/{o}/{r}/pulls/{N}).merge_commit_shaequals the commit or the subject is GitHub's default<PR title> (#N). A same-numbered PR from a fork or a cherry-pick never lends its description.<!-- -->comments are dropped, the body is capped at 8000 chars, and the title is collapsed to one line.--verify) prompts. A forged fence in the body is neutralized. The Critic schema now counts the PR description as evidence, so alternatives the PR backs are not pruned.gh, offline, unauthenticated → no context. Lookups are async (backfill workers keep overlapping) and memoized per process. After 2 straight transport failures the process stops asking; a 404 or an issue number is an answer, not a failure. Opt out withHUNCH_PR_CONTEXT=0.pr=#Nwhen the section was sent.Not in this PR
Merge pull request #N) is still skipped as a trivial subject unless its body is substantive, so in practice this targets squash merges.Verification
npx tsc --noEmit: exit 0.node tooling/run-tests.mjson pr-context, provider, cliproviders, synthesis, private-capture, provider-exec, workspaces: 113/113, exit 0.syncCommitto a fake endpoint withpr=#42in provenance, and thatlocalOnly/private: truenever look up PR text.execFileSyncblocked backfill workers, GHEGH_HOST, the multi-line title, and a vacuous private test. Accepted as design: the breaker doesn't half-open in a long-livedhunch mcpprocess, and concurrent identical lookups aren't deduped.🤖 Generated with Claude Code