Skip to content

feat(review): emit fix-handoff blocks into the unified review comment (#1962)#4053

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
real-venus:feat/gittensory-fix-handoff-emission
Jul 7, 2026
Merged

feat(review): emit fix-handoff blocks into the unified review comment (#1962)#4053
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
real-venus:feat/gittensory-fix-handoff-emission

Conversation

@real-venus

@real-venus real-venus commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Wires the final, missing piece of the fix-handoff feature: emission. The renderer (buildFixHandoffBlock(s), #2175), its config/gate resolver (shouldEmitFixHandoff, #2176), the review.fixHandoff manifest toggle, and the follow-up-issue local-write action (#2177/#2185) all landed in prior slices — but buildFixHandoffBlocks had no caller, so the blocks were never actually shown. This appends a "Fix handoff" collapsible to the unified review comment: one machine-readable "apply this fix" block per inline finding that a contributor's own local coding agent can consume (content only — every block carries the LOCAL_WRITE_BOUNDARY, no server-side write to contributor code).

Closes #1962

Design

Mirrors the merged impact-map / finding-category collapsible slices exactly, so it's a familiar additive shape:

  • src/review/unified-comment-bridge.ts: a pure buildFixHandoffCollapsible(blocks) (returns null on empty, so it chains unconditionally) + an optional fixHandoffBlocks? bridge arg, appended in buildUnifiedCommentBody right after the Impact map section (another structural, no-AI collapsible) and ahead of the visual preview.
  • src/queue/processors.ts: resolves fixHandoffEnabledForReview once per pass via shouldEmitFixHandoff, which ANDs the operator GITTENSORY_REVIEW_FIX_HANDOFF kill-switch, the per-repo review.fixHandoff manifest opt-in, and the convergence allowlist. The blocks are built at the publish site from this pass's inline findings — the exact same aiReview.inlineFindings source findingCategories uses, so a cache hit never re-emits them.
  • Default-OFF ⇒ byte-identical. With the flag off the processor passes nothing and the rendered comment is unchanged. No new config surface (the review.fixHandoff toggle already parses in packages/gittensory-engine), no DB migration, no generated-file changes.

Tests

  • test/unit/fix-handoff-collapsible.test.ts (new): buildFixHandoffCollapsible renders one block per finding under a single collapsible (blocker + suggestion, and a path-only nit), carries the no-server-side-write boundary, returns null on empty, isn't raw HTML; and buildUnifiedCommentBody appends the section when blocks are present, omits it when absent/empty (flag-OFF parity), and coexists with the Impact map + Visual preview sections.
  • test/unit/queue.test.ts: an end-to-end review with GITTENSORY_REVIEW_FIX_HANDOFF + review.fixHandoff on emits the "Fix handoff" collapsible with the per-finding block (location anchor, instruction, suggested change) into the published unified comment.

Validation

  • git diff --check — clean.
  • npm run typecheck — clean.
  • npm run test:coverage (full, unsharded) — no logic failures; codecov/patch predicted 100% of the changed src/** lines and branches (bridge builder + both chain sides + the processor resolve/emit branch). Only the known Windows spawn claude/codex/docker ENOENT env suites fail locally (green on Linux CI).
  • Every new branch is covered: collapsible empty vs non-empty, section present vs absent, and the emit gate ON (integration) vs OFF (every other review test).

If any required check was skipped, explain why:

  • test:workers / build:mcp / ui:* / actionlint / npm audit were not run locally — this is an additive backend review-rendering slice touching no worker entrypoint, MCP package, UI, workflow, or dependency; CI covers them.

Safety

  • No secrets/wallet/hotkey/trust-score/reward terms exposed — each block wraps InlineFinding.body/suggestion, already sanitized upstream by composeInlineFindings; the collapsible adds only fixed label/marker strings.
  • Public GitHub text stays sanitized and low-noise; the section is a single collapsible, default-OFF.
  • No auth/cookie/CORS/GitHub App/session change.
  • No API/OpenAPI/MCP surface change.
  • No UI change.
  • No docs/changelog change needed (the review.fixHandoff toggle is already documented in the example config).

UI Evidence

N/A — backend review-comment rendering; no dashboard/frontend/extension surface. (The rendered section is exercised by the unit + integration tests above.)

Notes

…ment (JSONbored#1962)

The fix-handoff renderer (JSONbored#2175), its config/gate resolver (JSONbored#2176), the
review.fixHandoff manifest toggle, and the follow-up-issue local-write action
(JSONbored#2177/JSONbored#2185) all landed, but buildFixHandoffBlocks had no caller — the blocks
were never emitted. Wire the final piece: append a "Fix handoff" collapsible to
the unified review comment, one machine-readable block per inline finding a
contributor's own local coding agent can consume (content only, no server-side
write — every block carries the LOCAL_WRITE_BOUNDARY).

Mirrors the impact-map / finding-category collapsible slices exactly: a pure
buildFixHandoffCollapsible in the bridge (null on empty) plus an optional
fixHandoffBlocks arg, fed at the publish site from THIS pass's inline findings
(same source as findingCategories) only when shouldEmitFixHandoff ANDs the
operator GITTENSORY_REVIEW_FIX_HANDOFF flag, the per-repo review.fixHandoff
manifest opt-in, and the convergence allowlist. Default-OFF ⇒ the processor
passes nothing ⇒ the rendered comment is byte-identical.

Closes JSONbored#1962.
@real-venus
real-venus requested a review from JSONbored as a code owner July 7, 2026 16:02
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 7, 2026
@loopover-orb

loopover-orb Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-07 16:13:44 UTC

4 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This wires the already-built fix-handoff renderer into the unified comment: `buildFixHandoffCollapsible` in unified-comment-bridge.ts stitches pre-rendered blocks into a new collapsible, chained correctly between Impact map and Visual preview (`withImpactMap` → `withFixHandoff` → `withVisual`), and processors.ts resolves the gate once via `shouldEmitFixHandoff` and builds blocks only on a cache-miss review from the same `aiReview.inlineFindings` source `findingCategories` already uses, so a cache hit never re-emits them. The flag-off path adds nothing to the args object (spread of an empty object), keeping the rendered comment byte-identical, and tests cover both the pure collapsible builder and full processor wiring at the queue-integration level.

Nits — 4 non-blocking
  • The manifest toggle is read directly as `reviewManifestForAutoReview?.review.fixHandoff ?? undefined` (processors.ts) instead of going through a small `resolveXManifestToggle` wrapper the way `reviewMemoryEnabledForReview` does via `resolveReviewMemoryManifestToggle` — worth confirming `shouldEmitFixHandoff` itself handles any DB-vs-manifest precedence, or note why this feature doesn't need that layer.
  • unified-comment-bridge.ts:608 references issue Agent fix-handoff blocks + follow-up-issue suggestions #1962 only in a comment, not a real magic-number smell — no action needed.
  • The flagged 'generic_secret_assignment' at queue.test.ts:18293 is a test env var (`GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem()`), matching the existing pattern used throughout this test file — not a real leaked secret.
  • If `shouldEmitFixHandoff`'s convergence-allowlist/DB-fallback behavior isn't already covered by its own unit tests from feat(config): add review.fixHandoff toggle (default off) for fix-handoff blocks #2176, consider a note in the PR description confirming that coverage rather than re-deriving it here.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #1962
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 113 registered-repo PR(s), 67 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor real-venus; Gittensor profile; 113 PR(s), 0 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: real-venus
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript, JavaScript, MDX, Rust, Svelte, Swift
  • Official Gittensor activity: 113 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.59%. Comparing base (0979321) to head (8f93367).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4053   +/-   ##
=======================================
  Coverage   93.59%   93.59%           
=======================================
  Files         379      379           
  Lines       35575    35582    +7     
  Branches    13044    13049    +5     
=======================================
+ Hits        33295    33302    +7     
  Misses       1618     1618           
  Partials      662      662           
Files with missing lines Coverage Δ
src/queue/processors.ts 94.95% <100.00%> (+<0.01%) ⬆️
src/review/unified-comment-bridge.ts 99.54% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 66a70b8 into JSONbored:main Jul 7, 2026
8 checks passed
@loopover-orb loopover-orb Bot added gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. and removed gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. labels Jul 7, 2026
@real-venus
real-venus deleted the feat/gittensory-fix-handoff-emission branch July 7, 2026 16:14
loopover-orb Bot pushed a commit that referenced this pull request Jul 14, 2026
Adds buildFixHandoffAggregateBlock, the aggregate sibling of the
existing per-finding buildFixHandoffBlock/buildFixHandoffBlocks
(#2175): it combines every InlineFinding into ONE fix-handoff block
for a single local-agent run over the whole PR, instead of one run
per finding. Mirrors CodeRabbit's split between a per-finding
"Prompt for AI Agents" collapsible and its separate aggregate "Fix
all issues" prompt.

Render slice only, same as buildFixHandoffBlock was before its own
wiring PR (#4053) -- not wired into the unified comment here. Reuses
the exact public-safe/boundary-safe contract already established by
the per-finding renderer (InlineFinding fields are sanitized upstream
by composeInlineFindings; same LOCAL_WRITE_BOUNDARY text).

Closes #5102

Co-authored-by: nghetienhiep <13849419+nghetienhiep@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent fix-handoff blocks + follow-up-issue suggestions

1 participant