Skip to content

perf(sdk): Omit ignored files from hunk prompts - #495

Open
alectimison-maker wants to merge 1 commit into
getsentry:mainfrom
alectimison-maker:perf/omit-ignored-prompt-files
Open

perf(sdk): Omit ignored files from hunk prompts#495
alectimison-maker wants to merge 1 commit into
getsentry:mainfrom
alectimison-maker:perf/omit-ignored-prompt-files

Conversation

@alectimison-maker

Copy link
Copy Markdown

Summary

  • Remove files already classified as irrelevant from the changed-file list repeated in every hunk prompt.
  • Preserve analyzed files and every limit:* skipped file so budget/read coverage remains visible to the reviewer.
  • Share the selection policy across direct SDK runs and task-based CLI/Action runs.

Motivation

prepareFiles() already excludes built-in, user-ignored, generated, empty, and pattern-skipped files from analysis. Both execution paths then rebuilt prompt context from the original pull-request file list, so up to 50 excluded paths could still be sent with every hunk for every skill.

This follows the pre-analysis filtering pattern used by Qodo PR-Agent, while retaining budget-limited filenames in the same spirit as its remaining-files context.

In a deterministic synthetic fixture with 40 long generated paths and 10 budget-limited relevant paths, one hunk user prompt decreased from 3,695 to 985 characters. This is prompt-size evidence, not a wall-clock or billed-token claim.

Design

selectChangedFilesForPrompt() omits only explicit irrelevant reasons:

  • pattern
  • builtin
  • ignored:builtin
  • ignored:user
  • ignored:generated

All limit:* reasons, and any future reason not explicitly classified as irrelevant, fail open and remain in prompt context. Existing current-file exclusion and maxContextFiles behavior are unchanged.

Testing

  • pnpm --filter @sentry/warden exec vitest run --config vitest.config.ts src/sdk/analyze.test.ts src/cli/output/tasks.test.ts src/sdk/prompt-sections.test.ts — passed, 98 tests
  • pnpm lint && pnpm build && pnpm test — passed, 1,915 tests passed and 4 repository-defined tests skipped
  • pnpm typecheck — passed via the pre-commit hook
  • Two-axis review against upstream/main — no Standards or Spec findings

Compatibility and risks

There is no public configuration, schema, finding, or analysis-scope change. Ignored filenames can occasionally carry intent, so the selector deliberately keeps capacity/read/patch failures visible and removes only files Warden or the user already classified as irrelevant.

Scope

Incremental review, cross-run caching, prompt character budgets, and workflow cancellation remain separate work. Workflow cancellation is intentionally deferred while #402 tracks orphaned in-progress checks after runner cancellation.

Related to #378.

Keep analyzed and budget-limited paths in changed-file context while removing paths already classified as irrelevant. This reduces repeated prompt input without hiding incomplete scan coverage.

Co-Authored-By: GPT-5 Codex <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 15, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
warden-prod Skipped Skipped Aug 15, 2026 5:07am

Request Review

@vercel
vercel Bot temporarily deployed to Preview – warden-prod August 15, 2026 05:07 Inactive
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.

1 participant