Agent chat: an edit of several files reads "Edit 2 files", not its first file; adopted tool-calls test follows #22658

Merged
TE
16d ago
+31-4

agent-pane-adopted-tool-calls.test.ts has been red on feat-cmux-next since at least 03:03Z. It's in the base react-apps-check failure list for run 39549244554. It covers two problems:

  • A stale test (test only). #22658 (01:18Z) stopped folding an ended turn's run of tool calls under one "Edited files, ran commands" summary line. Worked for now lists each group, already open, and only the Debug toggle's Codex-style runs still fold. The test clicked that summary line, which no longer exists, and then clicked the open commands group, which closed it. It now reads the groups as drawn.
  • A real bug the second case exists for. #22166 added the case "a patch whose files only its input names counts each file, not one" after #22658, so it never passed. With no diff, that edit keeps its own row, and toolLabel (toolPaths.ts) built the row as the action plus the edit's first path. A patch of CHANGELOG.md and Cargo.toml read "Edit CHANGELOG.md", as if it edited one file. Now an edit that names more than one path keeps the harness's own title ("Edit 2 files"), and an edit of one file still reads "Edit ".

This is not the duplicated live status row (WorkingFor.tsx / row.doing) that activity-indicators is fixing. I told that lane this PR touches only this test and toolLabel.

Testing

CMUX_BROWSER_TESTS=1 bun test test/agent-pane-adopted-tool-calls.test.ts in webviews/ (Linux, bun 1.4.2):

  • Base 29ffea7f8e9: 0 pass, 2 fail (both time out on the missing "Edited files, ran commands" button).
  • Test commit 8ca9b496c2d46b24018116f7c4822a1e257b050c (red): 1 pass, 1 fail, Expected: "Edit 2 files", Received: "Edit CHANGELOG.md".
  • Fix (head): 2 pass.

Also run:

  • test/transcript-density.test.tsx, the other browser test that reads tool row labels: 4 pass.
  • bun test src/agent-session/acpmux: the same 28 failures with and without the fix (base, environment-dependent), so no new ones.
  • prepush-gate.py is clean.
  • scripts/web-lint.sh has one finding outside this PR: a jsx-a11y(prefer-tag-over-role) warning at webviews/src/pages/history/HistoryPage.tsx:177, red on base 29ffea7f8e9. I pushed with CMUX_WEB_LINT_SKIP_REASON naming it.

Observed / Not run

Observed: everything above. Not run: CI on this head. Other callers of toolLabel (turns.ts, the running line and find text) now show "Edit 2 files" for multi-file edits that have a title. I didn't capture that in the app.

Changelog

  • Fixed: in agent chat, an edit of several files reads "Edit 2 files" instead of naming only the first file.

Agent session: huge-blue

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes agent chat so an edit naming multiple files reads "Edit 2 files" instead of naming only the first file, and updates the adopted tool-calls test to follow #22658's open groups layout.

A title that says only its verb ("Edit", "patch") over several files still names the first file; the new tool-label-several-files.test.ts covers both cases.