Commit graph

8 commits

Author SHA1 Message Date
kite
96987b785d fix(diff): remove trailing blank lines from concatenated multi-file diffs
strings.Split produces an empty trailing element when the git diff
output ends with \n. The empty element was written into the last file's
buffer, and TrimSuffix only removed one \n — leaving the last Diff
field with an extra trailing newline that earlier files didn't have.
Switch to TrimRight so all Diff values are consistently clean.
2026-06-21 10:46:27 +08:00
kite
77e73e53f8 feat(agent): add LLM-driven file grouping for multi-file co-review
Group functionally related files (e.g., impl + test, handler + model) into
a single review context using an LLM clustering step. This improves review
quality by giving the model cross-file awareness within related changes.

Key changes:
- Add file grouping agent with threshold-based decisions and recursive splitting
- Refactor dispatchSubtasks/executeSubtask to operate on DiffGroup instead of
  individual diffs, supporting combined multi-file diffs with FILE separators
- Add path validation in code_comment tool for multi-file groups
- Add StripDiffHeaders to reduce token usage in prompts
- Add extractJSONArray fallback for filter response parsing robustness
- Persist file group metadata to JSONL and render groups in viewer UI
- Merge intermediate tool-only agent rounds in viewer for cleaner display
- Update prompt templates: remove {{current_file_path}}, use <pending_review_diff>
2026-06-20 21:31:14 +08:00
MuoDoo
4b3f41df10
Fix workspace symlink diff containment (#125)
* Fix workspace symlink diff containment

* Share repository path containment helpers
2026-06-15 00:03:36 +08:00
ZheNing Hu
283ec8558c
fix(diff): detect renamed and deleted files correctly in diff parsing (#105)
When a file was renamed on the target branch, ocr review emitted
'[ocr] WARNING: cannot read file <old path> at ref <to>: exit status 128'.

Two compounding bugs:

1. The parser required 'a/'/'b/' prefixes when matching '--- /dev/null' /
   '+++ /dev/null', but git emits these lines without prefixes, so
   IsNew/IsDeleted were never set and deleted files fell through to a
   doomed 'git show ref:<old path>'.

2. 'rename from' / 'rename to' extended headers were never parsed, and
   git diff/show call sites did not force rename detection, so renames
   degraded to delete+add whenever the user had diff.renames=false.

Fixes:
- Parse 'rename from'/'rename to', 'new file mode', 'deleted file mode'
  and unprefixed /dev/null markers in ParseDiffText.
- Pass --find-renames to all git diff/show invocations so rename
  detection no longer depends on user config.
- Add IsRenamed to model.Diff (json: is_renamed) and prefer it in
  diffStatus.
- Add parser unit tests and a range-mode rename regression test.

Fixes #99
2026-06-14 22:29:02 +08:00
MuoDoo
64552aee9b
fix(security): block git ref option injection (#112) 2026-06-13 11:07:59 +08:00
kite
ef46dfdac9 feat(tool): add global git subprocess concurrency limiter and propagate context.Context to diff layer
Introduce gitcmd.Runner with channel-based semaphore to cap concurrent
git subprocesses (default 16, configurable via --max-git-procs). Route
all tool-layer and diff-layer git calls through the shared runner.
Also fix diff.Provider.runGit lacking context.Context — now the full
chain (GetDiff → MergeBase → ParseDiffText → finalizeDiff) propagates
the caller's context for proper cancellation and timeout support.
2026-06-06 20:20:34 +08:00
kite
99e6709603 fix(diff,tool): read file content at reviewed ref in range/commit mode
file_find and finalizeDiff always read from the working tree, even in
range/commit mode where the review targets a specific git ref. This
caused inconsistent file versions compared to file_read and code_search
which correctly used git show. Fix file_find to use git ls-tree and
finalizeDiff to use git show when a ref is specified.
2026-06-04 15:20:14 +08:00
kite
7c8b8562aa feat: init 2026-05-20 22:03:52 +08:00