Skip to content

fix(mobile): label native-chat tool rows with a clean, expandable input summary (STA-3333) - #12498

Merged
brennanb2025 merged 9 commits into
mainfrom
brennanb2025/sta-3333-tool-summary
Aug 5, 2026
Merged

brennanb2025 merged 9 commits into
mainfrom
brennanb2025/sta-3333-tool-summary

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Mobile tool rows in native chat labelled themselves with the raw tool-call input JSON — a Read showed {"file_path":"src/index.ts","offset":10} instead of the file it read — and tapping the row open just repeated that same truncated string as the "detail", so expanding revealed nothing new.

This makes the mobile tool row read as a clean, bounded, expandable summary:

  • Row label is a human summary. New shared describeToolInput labels a row with the target file path, else the primary argument (command / cmd / query / pattern / url, falling back to description), else the existing bounded JSON preview. Concrete target/action wins over prose, so a Bash call labels with its command rather than its description.
  • Codex JSON-string inputs are understood. Codex delivers tool arguments as a JSON string rather than an object, so every helper saw an opaque blob: no file path, no command label, no pretty-printed detail, and no tappable open-file link. The helpers now normalize a leading {/[ string by parsing it into the object shape they already handle; prose strings, JSON scalars, and malformed JSON are left exactly as-is.
  • Expanded detail shows the real input, capped like desktop. A diff-less call now expands to the fully formatted (pretty-printed) input rather than the row label repeated, bounded at MAX_TOOL_RESULT_CHARS (4000) — the same cap desktop applies to its tool detail, and the same cap the mobile result body already used. Native text layout has no scroll container to absorb a runaway payload, so this is bounded before it reaches layout. A structured input also makes the row expandable, which it previously wasn't unless the preview happened to exceed 40 chars. Conversely, a row with nothing to expand no longer renders a panel at all: the detail panel and the open-chevron are gated on the same hasDetail guard as the tap, so the Tools toggle — which opens every row at once, bypassing that tap — can no longer leave a row echoing its own label under itself with no way to dismiss it. This matches desktop NativeChatToolRun.tsx.

Known limitation, pre-existing and left for follow-up. sanitizeToolInput in src/main/runtime/rpc/methods/native-chat.ts clips a tool-call input that is a JSON string at MOBILE_BLOCK_CHAR_CAP (4000) and appends a truncation marker, which leaves it unparseable. So a Codex call whose arguments exceed 4000 chars — a write with large content, or a multi-line script — still falls back to the raw-JSON label, and loses its open-file link, where the byte-identical Claude call keeps both (the sanitizer shrinks object values key-by-key but truncates a string as one opaque blob). main showed raw JSON at every size, so nothing regresses; this PR simply doesn't reach that case. The contained fix is to parse the string main-side, sanitize the parsed object with the existing caps, and re-stringify — which keeps the wire shape a string — but that is a main-process change outside this PR's scope.

Split out of #12373 (item 10 of that QA sweep) as an independent, focused PR targeting main. #12373 stays open and is not affected by this branch.

Refs STA-3333.

Screenshots

No visual change to layout, spacing, color, or typography — existing tokens and components only. The user-visible change is the text inside the existing tool row.

Desktop A/B captured with playwright-cli over CDP against a dev build of this branch, on a resumed read-only Codex session with 104 real exec_command calls. Same session, viewport, scroll offset and DOM in both frames; the only difference is src/shared/native-chat-tool-summary.ts (branch vs origin/main).

Before (origin/main) After (this branch)
before after

The 18× run is the clearest case: on main the {"cmd":" prefix eats 8 of the 28 label characters, so two different calls render byte-identical labels (exec_command {"cmd":"ps -p 20068 -o pid=, twice); after the fix they read ps -p 20068 -o pid=,pgid=,cw and …,pgid=,co and are distinguishable.

Desktop parity — a Codex JSON-string call now pretty-prints in its expanded detail via the same formatToolInput normalization:

expanded detail

The per-call row label inside an expanded desktop run still uses summarizeToolInput (the raw bounded preview) — unchanged from main, and a desktop-renderer decision left outside this PR.

Testing

  • pnpm lint — root oxlint clean, mobile oxlint clean, native + type-aware code-quality audits clean, check:max-lines-ratchet OK (352 grandfathered, no new bypasses), lint:react-doctor:changed exit 0 (the three no-array-index-as-key warnings it prints are pre-existing, on lines this PR does not touch)
  • pnpm typecheck — all three root tsc projects (node, tc.cli, tc.web) and mobile tsc --noEmit clean
  • pnpm test — 464 files / 4452 tests desktop+shared, 403 files / 3015 tests mobile, all passing
  • pnpm build — not run; no build-affecting changes (pure string formatting + one renderer file), CI covers it
  • Added or updated high-quality tests that would catch regressions

Tests added: describeToolInput path/primary-argument/fallback/truncation labelling and the url-before-description ordering; a dedicated Codex JSON-string block covering label, formatted detail, file link, briefToolArg, isStructuredToolInput, argv-array joining, and the negative cases (prose, malformed JSON, JSON scalar); mobile renderer tests that the row labels with the path rather than raw JSON, that the expanded diff-less detail is capped at exactly MAX_TOOL_RESULT_CHARS + 1 chars ending in …, that a Codex JSON-string call labels with its command and reveals pretty-printed JSON only once its row is tapped, that a row with nothing to expand renders no detail panel even when the Tools toggle opens every row, and that a present-but-blank primary argument keeps the run header reading Bash rather than Bash {"command":""} while a populated but non-string one (mixed argv, structured query) still falls back to the preview.

Anti-vacuity check: every new test was re-run against mutated source rather than only against a revert. Reverting the three source files (tests kept) fails all four original renderer/barrel tests; deleting the detail-panel guard fails the row-echo test; deleting the blank-argument guard fails the run-header test. Two things are deliberately not pinned and are cosmetic: the segment-boundary alignment inside summarizeToolPath, and the chevron half of the detail-panel guard.

AI Review Report

Self-reviewed with focus on:

  1. Blast radius of the shared change. formatToolInput, toolFilePath and briefToolArg are shared with the desktop renderer (NativeChatToolRun.tsx), so normalizing JSON-string input changes desktop behavior too. Verified this is strictly an improvement and intended parity: a Codex JSON-string call on desktop now pretty-prints in its detail and becomes expandable via the existing detailAddsInfo check, where it previously collapsed to detail-equals-preview. The desktop renderer itself is deliberately untouched (this PR is scoped to the mobile row label); its 897 existing tests pass unchanged.
  2. Parsing safety. normalizeToolInput only attempts JSON.parse when the trimmed string starts with { or [, is wrapped in try/catch, and returns the original string on failure or when the parse yields a non-object — so prose, malformed JSON, and JSON scalars round-trip unchanged. Locked by test.
  3. Unbounded-output risk. The new expanded detail is the full input, not the bounded preview, so it is capped before reaching React Native text layout; the cap is shared with the result body via one boundedText helper rather than duplicated. Verified with a 100 KB payload.
  4. Render cost. Detail formatting is computed only when the row is expanded, matching the existing lazy-diff pattern. The collapsed path is not free, though: describeToolInput, toolFilePath and isStructuredToolInput each re-run the JSON-string normalization, so a collapsed Codex row costs 3 JSON.parse of its arguments per render (+1 per run-header render via summarizeToolRun → briefToolArg). Measured over 6 rows: 2 KB payload 0.81 → 0.87 ms (noise), 100 KB 0.70 → 1.47 ms. Sub-millisecond and bounded upstream by the 4000-char wire cap, so not worth memoizing here — but worth memoizing if these helpers ever move onto a hot virtualized list.
  5. Render purity / hooks. No new hooks, effects, state, or dependencies; ToolLine remains a pure render. lint:react-doctor:changed passes.

Cross-platform: no keyboard shortcuts, shortcut labels, shell invocation, or filesystem path construction are touched. Path handling is read-only string inspection that already splits on [\\/], and Windows backslash paths are covered by both pre-existing and newly added assertions. The change is React Native / renderer string formatting and is identical on iOS and Android and agnostic of the desktop host OS — it behaves the same for a local, WSL, SSH, or relay-backed session, and for folder workspaces as well as git worktrees, because it never inspects the workspace kind. No Git commands involved.

Security Audit

No command execution, no auth, no secrets, no dependency changes, and no IPC/RPC surface change (no new methods; this is pure presentation over data the chat transcript already carries).

The one new input-handling surface is JSON.parse on agent-supplied tool-argument strings. It is gated on a leading {/[, wrapped in try/catch, and its result is only ever read as data — never evaluated, never used to construct a path or command, and never used for a filesystem or network operation. Parsed values flow through the pre-existing bounded-preview logic (length, collection-size, depth, and circular-reference caps) and render into plain Text nodes, so there is no injection or amplification surface. Deeply nested or oversized payloads are bounded by the existing preview caps for the label and by MAX_TOOL_RESULT_CHARS for the detail. JSON.parse on a hostile string is a memory cost only, and tool inputs are already fully materialized in the transcript before this code runs.

The existing onOpenFile link now also fires for Codex calls, since toolFilePath can finally read their path. That path goes to the same already-validated open-file handler used by object-input calls — this widens which calls get a link, not what the handler accepts.

Notes

  • Split from fix(mobile): native chat QA sweep — reconnect history, stale status, prompt-card and paging fixes (STA-3333) #12373, which remains open and unmerged. This branch is an Orca child worktree for lineage only — it is not a stacked Git branch: it was fast-forwarded to origin/main and targets main, so it can merge independently and in any order relative to fix(mobile): native chat QA sweep — reconnect history, stale status, prompt-card and paging fixes (STA-3333) #12373.
  • Scoped deliberately to the tool-row summary. The other fix(mobile): native chat QA sweep — reconnect history, stale status, prompt-card and paging fixes (STA-3333) #12373 fixes (reconnect history, stale status, prompt cards, paging, write lock, streaming bubble) are not included here.
  • diffFromToolCall still receives the raw, un-normalized call.input, so a Codex JSON-string Edit renders as formatted JSON rather than a diff — unchanged from main, and left alone as it belongs to the diff module rather than this summary scope. Worth a follow-up if Codex edit diffs are wanted on mobile.
  • A tool call with an empty object input ({} or []) is no longer advertised as expandable: its formatted detail is byte-identical to the row label, so offering the expander promised detail and then repeated the row — the same defect this PR removes. isStructuredToolInput now requires the collection to be non-empty; the lazy-detail path is untouched.
  • Known residual (pre-existing, not a regression): the paired-mobile transport clips each tool-call block at 4000 chars (MOBILE_BLOCK_CHAR_CAP), and for a Codex JSON-string input that clip lands mid-JSON, so JSON.parse fails and the row falls back to the raw-JSON label. Measured against 29,947 real Codex tool calls across 1,981 transcripts, 0.2% exceed that cap (exec_command median 221 chars, p95 740). Fixing it means parsing before sanitizing in the main-process RPC — a different layer, and it would also silently un-defer the diffFromToolCall gap noted above. Left for a follow-up rather than widened into this PR.

…(STA-3333)

Mobile tool rows showed the raw input JSON (`{"file_path":…}`) as the row
label, and the expanded detail just repeated that same truncated string.

- `describeToolInput` labels a row with the target file path, else the
  primary argument (command/cmd/query/pattern/url/description), else the
  bounded JSON preview.
- Codex delivers tool arguments as a JSON string; normalize those into the
  object shape the helpers already understand, so labels, file links,
  run summaries and the expanded detail all work for Codex calls too.
- The expanded detail now renders the fully formatted input, capped at
  MAX_TOOL_RESULT_CHARS like desktop's tool detail (and like the result
  body), and a structured input makes the row expandable.
@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The change adds shared normalization for structured and JSON-string tool inputs. It adds labels for paths, commands, queries, patterns, URLs, and descriptions. Mobile code re-exports the shared helpers. Tool messages now display human-readable previews, bounded input and result text, formatted expanded details, and structured-input expansion. Tests cover normalization, labeling, formatting, truncation, rendering, and interaction.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description covers all required sections, documents testing and known limitations, and includes AI review, cross-platform, and security audit details.
Title check ✅ Passed The title clearly and concisely describes the main change to mobile native-chat tool-row labels and expandable input summaries.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c095b630-e48b-4f68-b027-3252e7513591

📥 Commits

Reviewing files that changed from the base of the PR and between e9cf106 and 0a38ecc.

📒 Files selected for processing (6)
  • mobile/src/session/MobileNativeChatMessage.test.ts
  • mobile/src/session/MobileNativeChatMessage.tsx
  • mobile/src/session/mobile-native-chat-tool-summary.test.ts
  • mobile/src/session/mobile-native-chat-tool-summary.ts
  • src/shared/native-chat-tool-summary.test.ts
  • src/shared/native-chat-tool-summary.ts

Comment on lines +95 to +111
// The row label is a human summary (path / primary arg), never raw JSON; the
// expanded detail below carries the full formatted input.
const preview = call
? summarizeToolInput(call.input)
? describeToolInput(call.input)
: (result?.output.split('\n')[0]?.slice(0, 80) ?? '')
// Why: collapsed tool rows are the common path; defer bounded diff parsing
// until the user asks to reveal the detail.
// and detail formatting until the user asks to reveal the detail.
const callDiff = expanded && call ? diffFromToolCall(call.name, call.input, diffLineLimit) : null
const resultDiff = expanded && result ? diffFromText(result.output, diffLineLimit) : null
const hasDetail = callDiff !== null || result !== undefined || preview.length > 40
// Bound before handing it to native text layout, like the result body.
const callDetail =
expanded && call && !callDiff ? boundedText(formatToolInput(call.input)) : undefined
const hasDetail =
callDiff !== null ||
result !== undefined ||
preview.length > 40 ||
(call !== undefined && isStructuredToolInput(call.input))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Normalize serialized edit inputs before diff extraction.

Line 102 passes the raw JSON string to diffFromToolCall. That helper rejects non-object input. A Codex Edit call with serialized JSON therefore shows formatted JSON instead of the existing diff view.

Normalize the input before calling diffFromToolCall. Add a rendering test for a JSON-string Edit input with old_string and new_string.

…path labels (STA-3333)

Review follow-ups to the tool-row summary, all in the shared helper:

- A Grep/Glob row labelled itself with the directory it scanned and dropped
  the pattern entirely, because `toolFilePath` treats `path` as a file target.
  That path is a scan root, so it also rendered a tap-to-open link that asked
  the app to open a folder. `toolFilePath` now ignores the generic `path` key
  for search-shaped input, which lets the pattern win the label and drops the
  bogus link; an explicit `file_path` still wins.

- An overlong path was truncated from the head, cutting off the basename —
  the one part that tells two rows apart. Trim from the front instead, so
  the label reads `…/session/MobileNativeChatMessage.tsx`.

- The primary-argument chain used `??`, so a present-but-blank key selected
  itself and swallowed the keys ranked after it, dropping the label all the
  way back to raw JSON. Take the first key that actually yields a label.

Refs STA-3333.
…A-3333)

An empty tool input formats back to the row label verbatim, so `{}` and `[]`
advertised an expander and then re-showed the label — the same repeat-the-JSON
problem this change set out to remove. Gate `isStructuredToolInput` on the
collection actually having contents; the lazy detail path is untouched.

Also pins the overlong-path test to the path itself: asserting only length<=80
plus a `…` passed just as well with path labelling deleted.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron QA — desktop A/B on a real Codex transcript

Driven with playwright-cli over CDP against a dev build of this branch in an isolated Electron profile (no Computer Use, AppleScript, or OS-level input injection).

Fixture: a resumed read-only Codex worker session with 104 exec_command calls, so every tool row below is real function_call data, not a synthetic payload. Both frames are the same session, same viewport, same scroll offset, same DOM — the only difference is src/shared/native-chat-tool-summary.ts (branch vs origin/main). The transcript's dispatch-preamble and a no-op QA probe message are hidden in both frames so no capability token appears in the evidence.

Before (origin/main) After (this branch)
01-before-main-tool-rows-raw-json.png 02-after-branch-tool-rows-clean-summary.png

Row-by-row:

Before After
65× exec_command {"cmd":"orca-dev orchestrati exec_command orca-dev orchestration send
10× exec_command {"cmd":"git status --short & exec_command git status --short && git di
18× exec_command {"cmd":"ps -p 20068 -o pid=, exec_command ps -p 20068 -o pid=,pgid=,cw
18× exec_command {"cmd":"ps -p 20068 -o pid=, exec_command ps -p 20068 -o pid=,pgid=,co
11× exec_command {"cmd":"pnpm exec oxfmt --wr exec_command pnpm exec oxfmt --write src/

The 18× pair is the clearest win: on main the {"cmd":" prefix eats 8 of the 28 label characters, so two different calls render as byte-identical labels. After the fix those 8 characters carry signal and the rows are distinguishable.

Desktop parity check — the expanded detail of a Codex JSON-string call now pretty-prints instead of rendering one minified line, via the same formatToolInput normalization:

03-after-branch-expanded-detail-pretty-printed.png

Scope note, deliberately not changed here: the per-call row label inside an expanded desktop run still uses summarizeToolInput (the raw bounded preview), so it keeps showing exec_command {"cmd":"…. That is unchanged from main and is a desktop-renderer decision outside this PR.

Review

Two review/fix passes landed on top of the original commit:

  • 8ebc662530 — path labels trim from the front (an absolute path was head-truncated, dropping the basename, the one part that tells two rows apart); a search call's path is a scan root, so it no longer swallows the pattern or offers an open-file link to a folder; a present-but-blank key no longer suppresses the keys ranked after it.
  • 27fe90a6f2 — an empty object/array no longer offers an expander whose detail is just the row label repeated.

Gates at head 27fe90a6f2: pnpm lint, pnpm typecheck, mobile tsc + oxlint, React Doctor and the changed-code quality gate all clean; 4452 desktop+shared tests and 3015 mobile tests pass, including 19 in src/shared/native-chat-tool-summary.test.ts.

The Tools toggle opens every row at once, bypassing the row's tap guard,
so a row with nothing to expand rendered its own label again underneath
itself — and the tap that would dismiss it is a no-op. Matches desktop.
Skipping a present-but-blank primary key let `briefToolArg` fall through
to the raw JSON preview, so a run header read `Bash {"command":""}` where
it used to read `Bash`. Also state the search-path trade-off honestly:
suppressing the link costs a file-scoped search its tap target.
…A-3333)

The previous guard tested key presence, so a populated but non-string
argument — a mixed argv like ['kill','-9',pid], or a structured query —
dropped out of the run header instead of falling back to the preview.
The panel gate was covered but the chevron beside it was not: swapping
`showDetail` back to `expanded` on the icon alone left all 909 mobile
tests green, so the affordance lie this branch fixes could return
unnoticed — a down-chevron over no panel, on a row whose tap is guarded
off.

Asserts both icon counts on the fixture that test already renders. The
two halves now die for distinct reasons: the panel gate on the duplicate
label text, the chevron on the icon count.
…333)

Dropping `.trim()` from summarizePrimaryToolArg left all 32 tests green,
yet it leaks through isSearchToolInput: a whitespace-only `query` starts
counting as a search term, which suppresses `path`. One character takes
the row's label, its tap-to-open link and its run-header argument at
once, and puts the raw JSON label back — the bug this branch removes.

Asserts all three outputs on that shape. Kills only that mutant; the
isSearchToolInput mutant still dies on the existing search test.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review loop — final state

Head f2fe3c7811. Six files (2 shared, 4 mobile), +410/−38. CI green (42 pass, 1 skipping).

Reviewed by successive independent same-model passes until clean. Three passes found something real; each finding was reproduced locally before any code changed, and each fix was mutation-tested in both directions before being pushed.

What the passes caught

6fd7dd552a → 288671aa49 — a cascading regression, caught by the second pass.
main short-circuited on typeof command === 'string', so a present-but-blank key returned '' and the run header read Bash. Making blank keys defer to later keys was right for {command:'', query:'needle'}, but it sent an all-blank object through to the JSON preview — Bash {"command":""}. The first fix guarded on key presence, which over-triggered and silently dropped populated-but-non-string arguments ({command:['kill','-9',1234]}, {query:{text:'…'}}) that main previewed. The guard has to test blankness, not presence.

I verified the final guard against main by importing both modules side by side over a 17-case matrix. 12 identical; 5 differ, and every difference is either the intended fix or benign. Three of the five are a narrow seam where a blank key suppresses a different key's structured content — left deliberately, because in every one of those cases main's output was a truncated raw-JSON fragment, which is precisely what this PR removes. "Fixing" it would put JSON noise back in the header.

752220deb7 — a coverage gap in this branch's own new code.
showDetail gates two things: the chevron icon and the detail panel. Only the panel was pinned — reverting the icon to expanded left all 909 mobile tests green. The regression it would allow is the exact affordance lie the branch exists to remove: a row with nothing to expand showing an open-state chevron over no panel, with the tap that would dismiss it guarded off.

f2fe3c7811 — a one-character seam with an outsized blast radius.
Dropping .trim() from summarizePrimaryToolArg passed all 32 tests, but it leaks through isSearchToolInput: a whitespace-only query starts counting as a search term and suppresses path. On {query:' ', path:'src/a.ts'} that single character costs three things at once:

correct with .trim() removed
toolFilePath "src/a.ts" null — tap-to-open link lost
briefToolArg "a.ts" "" — run header loses its argument
describeToolInput "src/a.ts" {"query":" ","path":"src/a.ts"} — raw JSON label

Both new tests were checked for vacuity in both directions: each kills its intended mutant, and each survives the other's mutant, so they pin distinct edges rather than standing in for one another.

Known limitation, pre-existing, not addressed here

sanitizeToolInput caps a mobile tool-call block at 4000 chars. A Codex input arrives as a JSON string, so it gets clipped as one opaque blob and fails to parse on the device — meaning a Codex call with >4 KB of input still falls back to a raw-JSON label with no open-file link. This is unchanged from main (which showed raw JSON at every size) and the fix belongs in a main-process file outside this PR's six. Tracked separately.

Evidence and gates

The Electron A/B screenshots above were captured at 27fe90a6f2 and remain accurate for the content shown: every row in that fixture has a populated string cmd, so it returns from firstPrimaryToolArg before the line the later commits changed — those commits only alter blank and non-string primary arguments. The two most recent commits are test-only.

Gates at f2fe3c7811: 33 shared/renderer tests, 909 mobile session tests (114 files), pnpm run typecheck clean across all three projects, oxfmt --check clean, oxlint clean, React Doctor and the changed-code quality gate reporting no new findings.

Mobile emulator QA was not run — simulator capacity was held by other owners at the time, so this carries desktop evidence only.

Build the tool row label, file target, detail eligibility and bounded detail from one normalized input model. Mobile no longer reparses JSON-string input across independent helpers or repeats an already-complete plain label, and desktop now uses the same clean row summary instead of retaining raw JSON.\n\nKeep full detail formatting lazy for collapsed rows and share the 4000-character detail cap across both renderers. Tests pin desktop adoption, mobile disclosure parity, one-pass JSON parsing and the shared bound.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

QA screenshots for 18190479f5, using real read-only Bash tool calls against the same transcript.

Electron — compact run summary:

Electron compact tool summary

Electron — expanded structured input and result:

Electron expanded tool detail

iOS — clean per-tool labels:

iOS clean tool rows

iOS — single expanded formatted detail/result view:

iOS expanded tool detail

@brennanb2025
brennanb2025 merged commit c511e51 into main Aug 5, 2026
43 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…ut summary (STA-3333) (stablyai#12498)

* fix(mobile): label tool rows with a clean summary, expand full input (STA-3333)

Mobile tool rows showed the raw input JSON (`{"file_path":…}`) as the row
label, and the expanded detail just repeated that same truncated string.

- `describeToolInput` labels a row with the target file path, else the
  primary argument (command/cmd/query/pattern/url/description), else the
  bounded JSON preview.
- Codex delivers tool arguments as a JSON string; normalize those into the
  object shape the helpers already understand, so labels, file links,
  run summaries and the expanded detail all work for Codex calls too.
- The expanded detail now renders the fully formatted input, capped at
  MAX_TOOL_RESULT_CHARS like desktop's tool detail (and like the result
  body), and a structured input makes the row expandable.

* fix(mobile): name search rows by their term and keep the filename in path labels (STA-3333)

Review follow-ups to the tool-row summary, all in the shared helper:

- A Grep/Glob row labelled itself with the directory it scanned and dropped
  the pattern entirely, because `toolFilePath` treats `path` as a file target.
  That path is a scan root, so it also rendered a tap-to-open link that asked
  the app to open a folder. `toolFilePath` now ignores the generic `path` key
  for search-shaped input, which lets the pattern win the label and drops the
  bogus link; an explicit `file_path` still wins.

- An overlong path was truncated from the head, cutting off the basename —
  the one part that tells two rows apart. Trim from the front instead, so
  the label reads `…/session/MobileNativeChatMessage.tsx`.

- The primary-argument chain used `??`, so a present-but-blank key selected
  itself and swallowed the keys ranked after it, dropping the label all the
  way back to raw JSON. Take the first key that actually yields a label.

Refs STA-3333.

* fix(mobile): don't offer an expander whose detail repeats the row (STA-3333)

An empty tool input formats back to the row label verbatim, so `{}` and `[]`
advertised an expander and then re-showed the label — the same repeat-the-JSON
problem this change set out to remove. Gate `isStructuredToolInput` on the
collection actually having contents; the lazy detail path is untouched.

Also pins the overlong-path test to the path itself: asserting only length<=80
plus a `…` passed just as well with path labelling deleted.

* fix(mobile): gate the tool detail panel on having detail (STA-3333)

The Tools toggle opens every row at once, bypassing the row's tap guard,
so a row with nothing to expand rendered its own label again underneath
itself — and the tap that would dismiss it is a no-op. Matches desktop.

* fix(mobile): keep a blank tool argument out of the run header (STA-3333)

Skipping a present-but-blank primary key let `briefToolArg` fall through
to the raw JSON preview, so a run header read `Bash {"command":""}` where
it used to read `Bash`. Also state the search-path trade-off honestly:
suppressing the link costs a file-scoped search its tap target.

* fix(mobile): only treat a blank primary key as a missing argument (STA-3333)

The previous guard tested key presence, so a populated but non-string
argument — a mixed argv like ['kill','-9',pid], or a structured query —
dropped out of the run header instead of falling back to the preview.

* test(mobile): pin the tool-row chevron to the detail panel (STA-3333)

The panel gate was covered but the chevron beside it was not: swapping
`showDetail` back to `expanded` on the icon alone left all 909 mobile
tests green, so the affordance lie this branch fixes could return
unnoticed — a down-chevron over no panel, on a row whose tap is guarded
off.

Asserts both icon counts on the fixture that test already renders. The
two halves now die for distinct reasons: the panel gate on the duplicate
label text, the chevron on the icon count.

* test(shared): pin the blank-search-key guard in the tool label (STA-3333)

Dropping `.trim()` from summarizePrimaryToolArg left all 32 tests green,
yet it leaks through isSearchToolInput: a whitespace-only `query` starts
counting as a search term, which suppresses `path`. One character takes
the row's label, its tap-to-open link and its run-header argument at
once, and puts the raw JSON label back — the bug this branch removes.

Asserts all three outputs on that shape. Kills only that mutant; the
isSearchToolInput mutant still dies on the existing search test.

* fix(native-chat): share tool input display semantics (STA-3333)

Build the tool row label, file target, detail eligibility and bounded detail from one normalized input model. Mobile no longer reparses JSON-string input across independent helpers or repeats an already-complete plain label, and desktop now uses the same clean row summary instead of retaining raw JSON.\n\nKeep full detail formatting lazy for collapsed rows and share the 4000-character detail cap across both renderers. Tests pin desktop adoption, mobile disclosure parity, one-pass JSON parsing and the shared bound.
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