Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(web): humanize tool-call rows with dynamic strings #5847

Closededuardosilveiradev(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/5847/headopened View on GitHub

Summary

Tool-call rows in the chat timeline rendered generic headings like Tool call - Read: {"file_path":"/x.ts"}, because provider adapters emit fixed per-itemType titles ("Tool call", "MCP tool call", "File change") and JSON-serialized input summaries. Rows now read as real messages built from each call's dynamic data:

BeforeAfter
Tool call - Read: {"file_path":"/x/app.ts"}Read file - t3code/apps/web/src/app.ts
Command run - Bash: git statusRan command - git status
Tool call - WebSearch: {"query":"react useEffect cleanup"}Searched the web - react useEffect cleanup
File change - mcp__github__create_pr: {...}github · create_pr - Fix login bug
Tool call - preview_status: {}Preview status - …

How

  • session-logic.ts — WorkLogEntry gains additive toolName / toolServer / toolInput, extracted from all four provider payload shapes (Claude {toolName, input}, Codex item.tool/server/arguments, OpenCode {tool, state.input}, ACP rawInput) and carried through lifecycle-collapse merging. MCP identity keys off the mcp__<server>__<tool> name (splitMcpToolName), so calls the server misclassifies by keyword (e.g. mcp__github__create_pr → file_change) still display as MCP. Collapse keys and normalizeCompactToolLabel are untouched.
  • MessagesTimeline.logic.ts — new pure describeToolCallWorkEntry(): tool identity table (read/write/edit/command/grep/glob/web-search/web-fetch/subagent/skill/todo), primary-argument previews (workspace-relative paths, whitespace-collapsed, 120-char ellipsis), a guarded legacy parser so historical "<Tool>: <json>" labels also humanize, and a byte-identical fallback for anything unrecognized. Guards prevent prose like bash: foo: command not found from being mislabeled as an executed command, and pending-approval rows keep their original presentation.
  • MessagesTimeline.tsx — rows use the new phrasing; MCP calls get the wrench icon by name; expanded body gains a size-capped Input JSON block.

Web-only: no server, contract, or mobile changes. Mobile (threadActivity.ts) still shows the old headings — parity is a natural follow-up.

Test plan

  • 63 new unit tests across MessagesTimeline.logic.test.ts, session-logic.test.ts, and MessagesTimeline.test.tsx covering all four provider payload shapes, MCP misclassification, legacy-label parsing, merge carry-forward, truncation, and exact-fallback reproduction; no existing assertion changed.
  • bun run test: 220 files / 2044 tests pass. bun run typecheck clean. vp lint clean.
  • Verified live against a real session database (both fresh and historical entries render humanized; unrecognized entries identical to before).

🤖 Generated with Claude Code


Note

Medium Risk Large UI-only change to timeline labeling and parsing; extensive tests and fallbacks limit regressions, but edge-case mislabeling of prose or approvals remains possible.

Overview Chat timeline work rows no longer show generic Tool call labels and raw JSON; they use human headings and previews built from each provider’s tool metadata.

session-logic adds toolName, toolServer, and toolInput on WorkLogEntry, extracted from Claude/Codex/OpenCode/ACP payloads (including mcp__server__tool splitting) and preserved across lifecycle merges. MessagesTimeline.logic centralizes describeToolCallWorkEntry (tool identity table, workspace-relative paths, legacy Tool: … parsing with guards for prose/errors/approvals), icon selection (MCP wrench even when misclassified), and expanded bodies with bounded tool-input JSON plus hasToolCallExpandedBody for cheap expand checks.

MessagesTimeline wires the new phrasing and only builds expanded body text when a row is opened (useMemo), avoiding serialization on every stream tick.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit fdf23fe20c436d83d40b78747e2e815fe296b15f. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Humanize tool-call rows in chat timeline with dynamic headings and previews

  • Adds describeToolCallWorkEntry in MessagesTimeline.logic.ts to derive human-friendly headings and previews for tool-call rows, handling MCP, file ops, web ops, grep/glob, subagents, and legacy formats.
  • Extends WorkLogEntry in session-logic.ts with toolName, toolServer, and toolInput fields extracted from provider payloads (Claude, Codex, OpenCode, ACP) and preserved across lifecycle merges.
  • Replaces inline heading/preview/icon logic in PlainWorkEntryRow with the new helpers; defers buildToolCallExpandedBody via useMemo until a row is expanded to avoid unnecessary serialization.
  • MCP calls are now marked with a wrench icon even when misclassified by the provider, and pending approval entries preserve their request phrasing rather than being converted to finished calls.
  • Risk: Behavioral change — tool row headings, previews, and icons now differ from the previous inline logic for all providers.
Macroscope summarized fdf23fe.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: c9636aac-2a94-4128-8cf1-589a06475eba

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).

      Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f6c2c2891267684798babd375793b588e61131b8. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -1321,0 +1384,21 @@
      1384+ const input =
      1385+ asToolInputRecord(data.input) ??
      1386+ asToolInputRecord(item?.arguments) ??
      1387+ asToolInputRecord(state?.input) ??
      1388+ asToolInputRecord(data.rawInput);
      1389+
      1390+ const meta: ToolCallMeta = {};
      1391+ if (rawName) {
      1392+ const { server: mcpServer, name } = splitMcpToolName(rawName);
      1393+ meta.toolName = name;
      1394+ // Codex splits the MCP identity across `item.server` / `item.tool`.
      1395+ const server = mcpServer ?? asTrimmedString(item?.server);
      1396+ if (server) {
      1397+ meta.toolServer = server;
      1398+ }
      1399+ }
      1400+ if (input) {
      1401+ meta.toolInput = input;
      1402+ }
      1403+ return meta;
      1404+}

      Tool fields stripped on the wire

      High Severity

      extractToolCallMeta reads toolName, input, tool, state.input, and rawInput from activity data, but the server projection allowlist drops those fields for every non-mcp_tool_call item — including misclassified MCP calls. Live WS and thread snapshots both slim, so structured humanization, MCP wrench identity, and the expanded Input block never see the payload this PR depends on.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f6c2c2891267684798babd375793b588e61131b8. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -240,0 +656,21 @@
      656+}
      657+
      658+function resolveToolCallSubject(entry: WorkLogEntry): ToolCallSubject | null {
      659+ if (entry.toolName) {
      660+ return {
      661+ toolName: entry.toolName,
      662+ ...(entry.toolServer !== undefined ? { toolServer: entry.toolServer } : {}),
      663+ ...(entry.toolInput !== undefined ? { input: entry.toolInput } : {}),
      664+ fromDetail: false,
      665+ };
      666+ }
      667+ const fromDetail = parseLegacyToolCallText(entry, entry.detail);
      668+ if (fromDetail) {
      669+ return { ...fromDetail.subject, fromDetail: true };
      670+ }
      671+ const fromLabel = parseLegacyToolCallText(entry, entry.label);
      672+ if (fromLabel) {
      673+ return { ...fromLabel.subject, fromDetail: false };
      674+ }
      675+ const fromTitle = toolNameFromTitle(entry.toolTitle);
      676+ return fromTitle ? { toolName: fromTitle, fromDetail: false } : null;

      OpenCode name ignores row label

      Medium Severity

      resolveToolCallSubject recovers bare OpenCode tool names only from toolTitle via toolNameFromTitle, but tool lifecycle ingestion puts that name in the activity summary (label), not payload.title. The documented title fallback never runs, so rows stay on generic label phrasing instead of identities like Ran command or Read file.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f6c2c2891267684798babd375793b588e61131b8. Configure [here](https://www.cursor.com/dashboard/bugbot).
    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      This PR introduces significant new feature logic (~730 lines) for humanizing tool-call row displays, including complex provider-specific parsing and fallback handling. New UI capabilities of this scope warrant human review. Additionally, there are unresolved High and Medium severity findings regarding data field availability and fallback behavior.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. Note

      🤖 GPT-5.6 Sol responding on behalf of Theo

      We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together.

      This changes tool call rows to use dynamic humanized text across the message timeline and session logic. We are keeping the current tool call presentation, so we are not taking this large display rewrite forward.

      If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed.

Sign in to join this conversation.