Skip to content

fix(web): show useful details in tool call previews - #75

Merged
adampeterhiggins merged 4 commits into
mainfrom
ah/improve-tool-call-previews
Sep 30, 2026
Merged

adampeterhiggins merged 4 commits into
mainfrom
ah/improve-tool-call-previews

Conversation

@adampeterhiggins

@adampeterhiggins adampeterhiggins commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Tool previews often repeated a file path while hiding the edit itself. Preserve a bounded summary before activity payload slimming, then show it in agent hover previews and expanded tool details. Edits render as unified diffs (generated with jsdiff, shown with the app's existing @pierre/diffs view) with line totals; reads include ranges; searches include patterns and filters; commands include working directories and exit codes when available.

Compared the parsing with fd-symphony's agent_tool_call_logging.py. The shared formatter supports provider input envelopes and caps previews at 2,400 characters, with bounded traversal and excerpts. Agent completions retain earlier details and preview contents are searchable. Web and desktop share the Agents UI; web and mobile share chat detail formatting. Existing MCP detail rendering is preserved.

Validation: 249 focused tests passed, targeted lint passed, and web/server/client-runtime typechecks passed. A real web-client pass verified the same edit fixture against the old and new code in isolated state.

The same isolated edit fixture, expanded before and after:

Before After
Before: repeated path with no edit contents After: file path, line counts, and a unified diff

Follow-ups in this PR:

  • Claude subagent tool calls now reach the Agents panel. Claude forwards a subagent's tool calls as whole assistant messages tagged with parent_tool_use_id, not as stream events. The adapter dropped those messages, so Claude subagents never showed any tool calls. It now records them against the owning agent, and the matching tool_result completes them. Claude tool labels for file, search and fetch tools use their target (Write: /path) instead of raw JSON.
  • Rows are named after the tool (Edit, Write, Read, Bash) instead of the category (File change, Tool call).
  • Small Write calls render as an all-addition diff. Large bodies keep a plain excerpt.
  • Diff rendering is more robust. Tool diffs are keyed by content, as the app's other diff views are, so the shared highlighting worker matches results to the right diff. The renderer occasionally drew its own error and stack trace instead; if that still happens, the preview falls back to plain @@/-/+ lines.

Images are hosted in a dedicated GitHub review-evidence release; no screenshot assets are committed.

Model: GPT-6.1-Sol (Codex through T3 Code); unified diff rendering finished by Claude Opus 5.5 (Claude Code through T3 Code).

🤖 Generated with Claude Code

adampeterhiggins and others added 4 commits September 30, 2026 10:32
Replace the Before/After text blocks with jsdiff-generated unified
patches, rendered through the same @pierre/diffs view the rest of the
app uses. Oversized edits show a short notice instead of a clipped patch.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude forwards a subagent's tool calls as whole assistant messages
tagged with parent_tool_use_id, not as stream events. The adapter only
registered tools from stream events and dropped these messages, so the
Agents panel never saw a subagent's tool calls. Register their tool_use
blocks with the owning agent; the matching tool_result completes them.

Tool labels for file, search and fetch tools now use their target
instead of the tool's raw JSON input.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Name rows after the tool (Edit, Write, Read) instead of its category.
- Show small Write calls as an all-addition diff.
- Key tool diffs by content so worker highlights match their diff, and
  fall back to plain hunks if the diff renderer still fails.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant