Skip to content

fix(sdk): Constrain skill findings to diff hunk line range#151

Merged
dcramer merged 2 commits intomainfrom
fix/constrain-findings-to-hunk-range
Feb 17, 2026
Merged

fix(sdk): Constrain skill findings to diff hunk line range#151
dcramer merged 2 commits intomainfrom
fix/constrain-findings-to-hunk-range

Conversation

@dcramer
Copy link
Member

@dcramer dcramer commented Feb 17, 2026

Summary

  • Prompt constraints: Updated the system prompt to explicitly tell the LLM that all findings must reference lines within the hunk range, and that tools/context are for understanding only
  • Defense-in-depth filter: Added filterOutOfRangeFindings() in analyzeHunk that drops findings with startLine outside the hunk range after extraction, with Sentry breadcrumb logging
  • Tests: Added 7 tests covering in-range, out-of-range, boundary, no-location, and mixed finding scenarios

Fixes #150

Test plan

  • pnpm lint && pnpm build && pnpm test passes
  • Verify on a real PR that findings no longer get 422 rejections from GitHub's API
  • Confirm dropped findings appear as Sentry breadcrumbs

🤖 Generated with Claude Code

dcramer and others added 2 commits February 17, 2026 10:48
Findings with startLine outside the hunk range get rejected by GitHub's
API (422) when posted as inline PR comments. Add prompt constraints
telling the LLM to anchor findings within the hunk, plus a defense-in-depth
filter that drops out-of-range findings after extraction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rename local getHunkLineRange to formatHunkLineRange since it produces
a display string, removing the need for the getHunkNumericRange import
alias. Extract isWithinHunk helper for readability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 17, 2026

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

Project Deployment Actions Updated (UTC)
warden Ready Ready Preview, Comment Feb 17, 2026 7:07pm

Request Review

@dcramer
Copy link
Member Author

dcramer commented Feb 17, 2026

This likely isnt good enough but its an improvement.

@dcramer dcramer merged commit 96841d0 into main Feb 17, 2026
13 checks passed
@dcramer dcramer deleted the fix/constrain-findings-to-hunk-range branch February 17, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Constrain skill findings to diff hunk line range

1 participant