MoonshotAI / MoonshotAI/kimi-code
web: turn file-change cards show no stats/diff for Write calls and replace_all Edits
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
Summary
In the web UI, the per-turn "N files changed" summary card aggregates file changes per tool call. Two cases currently produce no usable result:
- Write calls: the file row shows no
+x/-ystats, and clicking the row/card opens the raw file instead of a diff view. - Edit calls with
replace_all: true: same symptom — no stats, no diff.
Additionally, when any file in the card is affected, the card header hides the aggregate +x/-y totals as well.
Steps to reproduce
- Open the web UI against a running backend.
- Run a session where the agent creates a file with the Write tool (or performs an Edit with
replace_all: true). - Look at the turn's file-change card: the affected file row has no stats; clicking it opens the file, not a diff.
Root cause (from the shipped web bundle, 0.37.2)
Inspecting the bundled frontend code, the turn-changes aggregation works roughly like:
- The aggregator routes
writeto a dedicated branch that setshasWrite = trueandstatsIncomplete = trueand never computes a diff (onlyedit/multi_editgo through the diff builder). - The diff-builder helper returns
nullfor anything that is notedit/multi_edit, and explicitly returnsnullfor edits withreplace_all === true. - The card's click handler decides
openFilevsopenDiffbased onhasWrite, rather than on whether a computed diff actually exists. - The header aggregate is hidden when any entry has
statsIncomplete.
So the data (path, content / old_string / new_string) is all present in the history frames — this is purely a presentation-layer gap.
Suggested behavior
- Write (new file / overwrite): build an all-additions diff from
"" -> content, matching what #2274 proposed for the live preview panel. Show stats from that diff. - Edit with
replace_all: true: build a representative diff fromold_string -> new_string(a single-occurrence view is still far more useful than nothing). - Click handler: prefer
openDiffwhenever a diff exists, regardless ofhasWrite. - Longer term, the ideal fix is server-side: record the real before/after content at execution time so overwrite Writes,
appendmode, andreplace_allmultiplicities can be rendered accurately instead of approximated from args.
Environment
- kimi-code 0.37.2 (single-binary), macOS arm64
- Web UI in Chrome
Related
- #2268 / #2274 covered the Write live preview panel (closed unmerged); this issue is about the turn summary card, which is a separate code path.
Happy to provide bundle-level details (function shapes / exact guards) if useful.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the turn-change aggregator, diff-builder, and card click handler in the web frontend, then reproduce the Write and replace_all cases against a running backend. Trace the existing edit/multi_edit diff path and the related live preview behavior. Done means affected rows show stats, open diffs, and the card header retains aggregate totals when a diff can be computed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100