You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(diff): strip index header line from diff embedded in prompts #606
When diffs are embedded into LLM prompts for code review, the full git unified diff header is included. The index <hash>..<hash> [mode] line (e.g. index d2a6fb5..f5c9b00 100644) provides no value for code review — the SHA hashes and file mode are meaningless to the model and waste tokens.
The index line should be skipped when building the Diff string field, but only outside hunks (inside a hunk, a content line starting with index is valid file content prefixed with +/-/).
Acceptance Criteria
Lines matching index prefix (outside hunk context) are excluded from model.Diff.Diff
Metadata parsing (e.g. new file mode, deleted file mode) still works correctly since index line is not used for those
Tests pass (make test)
Code check passes (make check)
Context
All diff content flows through a single pipeline: GetDiff → ParseDiffText → model.Diff.Diff → prompt template substitution (via {{diff}}). Stripping the line in ParseDiffText covers all downstream consumers (main task, plan task, review filter task).
This is a minimal change (~3 lines) with no risk to existing functionality.
Activity
amh1k commentedon Jul 30, 2026
Would like to work on this