Skip to content

feat(synthesis): feed the PR review thread into verified commit synthesis - #568

Merged
davesheffer merged 1 commit into
feat/pr-context-synthesisfrom
feat/pr-thread-synthesis
Oct 29, 2026
Merged

davesheffer merged 1 commit into
feat/pr-context-synthesisfrom
feat/pr-thread-synthesis

Conversation

@davesheffer

Copy link
Copy Markdown
Owner

Phase 2 of #562. Stacked on #563 (phase 1, PR description); merge after it.

What

On the Critic-verified synthesis path only (verify / deep), Hunch now also fetches the merged PR's human review thread (conversation comments, review bodies, inline review comments) with one gh api graphql call, and passes it to the model as its own fenced, labeled, untrusted DATA section.

  • Bots dropped (__typename: Bot, [bot] logins, deleted authors). Messages sorted oldest first.
  • Bounded: newest 40 comments / 30 reviews / 30 inline per review (last:); threadTruncated is set when GitHub holds older messages. Rendered text capped at 14000 chars, keeping the opening and the end (where review converges), dropping the middle.
  • Never fetched for local-only captures, the deterministic provider, a PR that doesn't match the commit, or HUNCH_PR_CONTEXT=0 (no new env var).
  • A thread failure keeps the description and trips a separate thread breaker, so a GraphQL-only problem (its own rate limit, a token REST accepts but GraphQL refuses) never silences working description lookups.
  • Prompt-injection containment: all four fence strings, in the description, thread and PR title, are neutralized. The verifier is told to flag thread-drawn claims the diff doesn't show landed.
  • Provenance: synth:… pr=#N+thread.
  • gh is the user's own CLI, not an LLM API (con_2ce3f2a547 holds).

Why only the verified path: the noise gate

Measured before building (material-error rate per claim, judged against the diff):

arm material / claims
A: commit only 13 / 406
C: + thread, no verify 14 / 493
Cv: + thread, verified 10 / 449

Cv/A = 0.70 (gate: ≤ 1.10), so the thread passes with verify. C/A = 0.89.

Observed failure mode: thread-fed records sometimes present a design the thread later dropped as the final decision; verify didn't always catch it.

Not measured

These changes target that failure mode but were not in the measured harness: chronological sort, the "proposals may have been revised or dropped; the DIFF shows what landed" framing, the verifier sentence, and the head+tail cut. Treat their effect as unmeasured.

Known limitation: if the verifier itself fails twice (verify=failed), the thread-influenced draft is still written without a Critic audit. It shows in provenance (pr=#N+thread verify=failed), so it isn't silent.

Review and checks

Refs #562

🤖 Generated with Claude Code

…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>
@vercel

vercel Bot commented Oct 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hunch Ready Ready Preview Oct 29, 2026 2:40pm UTC

@github-actions

Copy link
Copy Markdown
Contributor

🧠 Hunch — Engineering Memory Guard

✅ This PR touches no recorded invariants (directly or via blast radius) and re-introduces nothing deliberately retired across 4 changed file(s).

📜 Hunch Constitution — 2 policy receipt(s)

  • ✅ pol_01cf084e1e satisfied — symbol:renderAdoptedDoc does not reach symbol:writeFileAtomic
    • receipt: sha1:fa9ba4f13e62b615447d60af5c36bac5950f04ed
  • ✅ pol_3f3aee11ad satisfied — symbol:src/store/db.ts:openDb does not reach external:better-sqlite3
    • receipt: sha1:e198c777bd38232f0324a0d22166d9765bc3985b

@davesheffer
davesheffer merged commit 99dac2e into feat/pr-context-synthesis Oct 29, 2026
12 of 14 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 29, 2026
@davesheffer
davesheffer deleted the feat/pr-thread-synthesis branch November 3, 2026 03:23

This branch was successfully deployed

1 active deployment
Preview — 99dac2ec Deployed Oct 29, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant