Files
Kite 9cd9297305 refactor: retire per-file naming left over from grouped review (#1168)
* refactor(llmloop): rename RunPerFile to RunMainTask

The loop stopped being per-file when review switched from one subtask per
file to one subtask per group: internal/agent passes a groupKey that may
name several files, while internal/scan still passes a single path. The
name asserted a granularity only one of the two callers has.

RunMainTask names what the function actually drives — one MAIN_TASK
conversation — matching the vocabulary already in place around it
(MainLoopStop, the main.loop span, session.MainTask). RunSubtask would
have been a second misfit, since review calls this once per review round
and one subtask spans several rounds.

The newPath parameter is renamed taskKey along the whole private chain
(runGraceRound, executeToolCall, addNextMessage, runCompression,
triggerAsyncCompression, requestCtx). Deps.NewRequestMeta keeps filePath:
the session layer still spells that slot "file path" in its persisted
records, and requestCtx now documents the seam instead of hiding it.

ToolFailureDetail.FilePath is where a group key becomes externally visible
— it reaches --format json as file_path — so the field now says so rather
than letting a consumer assume it parses as one path.

Two comments claimed executeToolCall overrides a comment's path with the
loop's path argument. It has always been a fallback that applies only when
the model named no path, and the difference decides whether a grouped
review files its comments under the right files, so both now describe the
fallback.

Pure rename plus comment edits; no behavior change.

* refactor(cli): retire per-file naming left over from grouped review

perFileTimeout was the last holdout of the old granularity in the CLI
options: its flag is --timeout, its help already said "concurrent task
timeout", and it feeds Args.ConcurrentTaskTimeout. Only the field name
still claimed a per-file deadline it never set.

Two review help strings also outlived the change to grouped subtasks, and
disagreed with cli-reference.md, which already documents both as per-group:
--concurrency dispatches file groups, and --max-tokens caps a group's
prompt. The scan command keeps its per-file wording, where one subtask is
still one file.

Same for six agent comments that describe per-group work as per-file — the
budget look-ahead, the dispatch step and its function doc, the only
deadline classifyItemError can see, and the goroutines allDiffs is read
from — plus Run's pipeline summary, which omitted the grouping step
altogether.

Granularity that really is per-file stays as it is, and the two are easy to
confuse: filterLargeDiffs measures each file's diff against the token
ceiling on its own, review items and their status badges are per file, and
a group's prompt embeds one XML element per file. The comment in
review_cmd.go now names filterLargeDiffs so the distinction is checkable
rather than a matter of trusting the adjective.

The estimator keeps both its name avgMainRoundsPerFile and its arithmetic:
it still bills every file for its own MAIN_TASK rounds, so a group of files
is over-estimated. That is a costing bug rather than a naming one and needs
its own change; only estimateDiffFileTokens' doc comment is corrected here,
since the look-ahead consuming it sums per group.
2026-09-05 11:48:46 +08:00
..