Skip to content

feat(mobile): render generic tool details as labelled fields - #6320

Merged
iscekic merged 4 commits into
mainfrom
kwf/req-20260918-040530-e325
Sep 21, 2026
Merged

iscekic merged 4 commits into
mainfrom
kwf/req-20260918-040530-e325

Conversation

@iscekic

@iscekic iscekic commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Changelog for users

  • Tools without a dedicated card show each argument as a labelled key/value row in the detail sheet instead of a raw JSON block.
  • MCP calls show the inner arguments fields rather than the server_name/tool_name envelope.
  • Known image MCP tool names are readable and translated for non-English readers; a row without a state title shows a short argument summary.
  • The question tool shows its header, question, and options as rows; a blank header or question is omitted, and two or more questions are numbered.
  • Completed JSON output is pretty-printed; a number literal that cannot round-trip through JSON.stringify stays raw.
  • A multi-megabyte output opens the sheet promptly as raw text cut at the display budget, and a very large string argument keeps a short summary without stalling.
  • A terminal generic tool with no arguments, output, or error shows a muted No output. line; a failed call with a blank message shows a failure line instead.
  • Sign-in and cloud-agent session creation no longer fail when a stored promo code cannot be decrypted; the affected promo is unavailable.

Changelog for maintainers

  • @kilocode/app-shared/tool-detail exports buildToolDetail and formatToolDetailOutput; ToolDetail returns { status, name, summary?, arguments?, fields, output?, error? }. It resolves the known image MCP tools and unwraps the mcp envelope to server/tool; mobile's sheet body and transcript subtitle consume it. The subtitle prefers a trimmed state title, then a 60-character summary, then the projected name (the old getGenericToolTitle is gone).
  • packages/app-shared/src/tool-detail/index.ts:245 — accepted: an oversized output paid the full JSON.parse, number-literal scan, and JSON.stringify before the cap discarded it. It now returns raw first; the post-pretty-print check still guards the parsed path.
  • packages/app-shared/src/tool-detail/index.ts:93 — accepted: the row projection collapsed whitespace across an unbounded argument on every render. Each summary candidate is now trimmed and bounded to 200 characters before the collapse. Field values still cap at 4000 characters, and a mono block defaults to a 20000-character budget when no caller cap is given.
  • packages/app-shared/src/tool-detail/index.test.ts:356 — accepted: new tests cover digits inside a string staying pretty-printed, the early oversized discard, and the 200-character summary bound.
  • apps/mobile/src/components/agents/tool-card-display.ts:271 — accepted: ToolDetailSummary.nameIsLabel marks a known-tool label translatable. The English app copy reaches the gateway, while raw ids and server/tool identifiers stay out; review this decision with the caps above first.
  • packages/app-shared/src/tool-detail/index.ts:171 — accepted: the per-question and bare question rows require non-blank text, and the raw-input fallback drops blank values, so a question: '' part emits no empty row and does not suppress the empty state.
  • apps/mobile/src/components/agents/tool-cards/generic-tool-card.tsx:44 — accepted: the empty state keys on detail.status !== 'error', so an errored part with a blank error message shows the localized failure line instead of No output..
  • Web repair: buildSelfServicePromos in promoCreditCategories.ts skips and logs entries whose ciphertext fails to decrypt instead of throwing at module scope, which had returned 500 for sign-in and cloud-agent session creation.

E2E proof

ux-check: Open a completed MCP tool part whose arguments is an empty object and whose output is empty; the sheet body shows a visible state (argument rows or a 'No output.' line), not an empty… — p3-mcp-empty-sheet.png

ux-check: Tap a generic tool row in the transcript; the sheet opens with the projected content already rendered, with no blank frame and no layout jump. — p6-generic-sheet.png

[p4] ux-check: two-question tool part groups/numbered header/question/options so options are attributable — prior/p4.png

[e2] the generic tool sheet's non-retryable unhappy and empty states do not blank the sheet — prior/e2-transcript.png

[e2] the generic tool sheet's non-retryable unhappy and empty states do not blank the sheet — scripted-shard1/e2.png

[e2] the generic tool sheet's non-retryable unhappy and empty states do not blank the sheet — prior/e2.png

[e1] the generic tool sheet's non-retryable unhappy and empty states do not blank the sheet — e2e-mobile-app/e1err.png

[e1] the generic tool sheet's non-retryable unhappy and empty states do not blank the sheet — e2e-mobile-app/e1.png

[p2] ux-check: completed MCP tool part with empty arguments and empty output shows a visible sheet body — prior/p2-sheet.png

[e6] ux-check: generic tool row opens the sheet with projected content already rendered — e6.png

[e3] ux-check: completed MCP tool part with empty arguments and empty output shows a visible sheet body — e3.png

[e1] Open a generic tool part with status error, an empty error message, and no arguments, output or attachments; the sheet body shows a failure line (Failed), not the muted 'No output.' line. — e2e-mobile-app/e1-failed-sheet.png

[e3] Open a question tool part with input { question: '', options: [{ label: 'Red' }] }; the sheet shows the options row without an empty question row. — e2e-mobile-app/e3-options-sheet.png

[e1] Open a completed tool part whose output is a multi-MB JSON document; the detail sheet opens promptly and shows the raw output text.

[p2] Open a generic tool part whose only argument is a ~500 KB string; the transcript row still shows a short summary and the detail sheet opens without a stall.

Verified on Android emulators. The multi-megabyte-output and very-large-argument captures are this run's proof for the two size caps, and they replace the repair's earlier captures for those paths. The image-tool name translation is proved from the UI tree, where the sheet header and transcript row show the German Bild veröffentlichen for app-builder-images/transfer_image, so it has no separate screenshot. The earlier captures for the error, empty, and question states stay valid. Limitations: the blank-question case needs a seeded fixture because the live trigger always sends non-blank question text; the literal zero-length-error part's transcript row is not tappable, so a whitespace-only error covers the blank-message failure; on web, the local-setup sign-in smoke test timed out, so the promo-decrypt change has no passing web E2E proof.

Owner request

Report generic tool rendering, so we can render pretty tool-detail sheets for the most-used tools.

E2E proof — log excerpts

[e1] Open a completed tool part whose output is a multi-MB JSON document; the de -> pass :: SCENE e1 OK; the open fetch_document sheet renders 'EditText textlen=20000' with head '{"rows":[{"index":0,"name":"row-0"},{"index":1,"na' and tail '0,"name":"row-650"},{"index":651,"name":"row-651"}' (raw, cut at the display budget), plus 'android.widget.TextView Content truncated tappable [37,2245][1045,2282]' in the same sheet's hierarchy, and the app process survived the open (later steps and a second Appium session attached to the same sheet).
[p2] Open a generic tool part whose only argument is a ~500 KB string; the trans -> pass :: SCENE p2 OK; the transcript row was tapped by its exact 61-char summary, the sheet header shows 'android.view.View inspect_data: content=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA… tappable [37,165][858,295]', and the body's content field is capped ('EditText textlen=4001', tail 'AAAAAAAAAAAAA…') with no stall.
/home/igor_kilocode_ai/.local/share/kwf/sections/kwf-fix-review-b543/e2e-mobile-app/e1-capped-output.log
SCENE e1 OK
EditText textlen=28
  head: https://example.com/big.json
  tail: https://example.com/big.json
EditText textlen=20000
  head: {"rows":[{"index":0,"name":"row-0"},{"index":1,"na
  tail: 0,"name":"row-650"},{"index":651,"name":"row-651"}
android.widget.TextView Content truncated tappable [37,2245][1045,2282]
sources: verify-e1.log (SCENE line), e1-scene.xml (hierarchy of the open big.json detail sheet), verify-e1c.log (marker line) — all this run
/home/igor_kilocode_ai/.local/share/kwf/sections/kwf-fix-review-b543/e2e-mobile-app/p2-capped-argument.log
SCENE p2 OK
android.view.View inspect_data: content=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA… tappable [37,165][858,295]
EditText textlen=4001
  head: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  tail: AAAAAAAAAAAAA…
sources: verify-p2.log (SCENE + sheet-header digest lines), p2-scene.xml (hierarchy of the open detail sheet) — this run

Comment thread apps/mobile/src/components/agents/tool-card-display.ts Outdated
Comment thread apps/mobile/src/components/agents/tool-card-display.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The incremental commits pre-bound the tool-detail JSON work before parsing, cap summary candidates before the whitespace collapse, gate the transcript translatable flag on the known-tool label, and give MonoScrollBlock a 20 000-character default display budget; every prior finding is resolved and no new issues were found in the changed lines.

Files Reviewed (8 files)
  • apps/mobile/src/components/agents/mono-scroll-block-model.ts
  • apps/mobile/src/components/agents/mono-scroll-block.mounted.test.tsx
  • apps/mobile/src/components/agents/mono-scroll-block.test.ts
  • apps/mobile/src/components/agents/mono-scroll-block.tsx
  • apps/mobile/src/components/agents/tool-card-display.test.ts
  • apps/mobile/src/components/agents/tool-card-display.ts
  • packages/app-shared/src/tool-detail/index.test.ts
  • packages/app-shared/src/tool-detail/index.ts
Previous Review Summaries (5 snapshots, latest commit fc74274)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit fc74274)

Status: 4 Issues Found | Recommendation: Address before merge

Executive Summary

Residual performance cost in the new tool-detail projection: the JSON output size cap is applied only after the full parse, scan, and pretty-print, so oversized tool outputs pay the worst case on every detail-sheet render.

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 3
Issue Details (click to expand)

WARNING

File Line Issue
packages/app-shared/src/tool-detail/index.ts 245 formatToolDetailOutput parses, regex-scans, and pretty-prints arbitrarily large output before the 20 000-character cap check, and buildToolDetail runs unmemoized on every detail-sheet render

SUGGESTION

File Line Issue
packages/app-shared/src/tool-detail/index.ts 93 getArgumentSummary collapses whitespace over an unbounded argument string on every render before the caller truncates to 60 characters
packages/app-shared/src/tool-detail/index.test.ts 356 No test covers the string-skipping branch of numberLiteralPattern (digits inside JSON strings)
apps/mobile/src/components/agents/tool-card-display.ts 271 Known-tool labels (Publish Image / Analyze Image) are hardcoded English shown with translatable: false, never localized
Files Reviewed (100 files)
  • packages/app-shared/src/tool-detail/index.ts - 2 issues
  • packages/app-shared/src/tool-detail/index.test.ts - 1 issue
  • packages/app-shared/package.json
  • apps/mobile/src/components/agents/tool-card-display.ts - 1 issue
  • apps/mobile/src/components/agents/tool-card-display.test.ts
  • apps/mobile/src/components/agents/tool-card-utils.ts
  • apps/mobile/src/components/agents/tool-card-utils.test.ts
  • apps/mobile/src/components/agents/tool-cards/generic-tool-card.tsx
  • apps/mobile/src/components/agents/tool-cards/generic-tool-card.mounted.test.tsx
  • apps/mobile/src/components/agents/tool-cards/tool-card-output-cap.test.ts
  • apps/mobile/src/components/agents/part-detail-sheet.mounted.test.tsx
  • apps/web/src/lib/promoCreditCategories.ts
  • apps/web/src/lib/promoCreditCategories.test.ts
  • apps/mobile/src/i18n/locales/*.json (87 catalogs)

Fix these issues in Kilo Cloud

Previous review

Status: 2 Issues Found | Recommendation: Address before merge

Executive Summary

Two low-severity edge cases in the new generic tool-detail projection: a blank question string emits an empty row and suppresses the sheet's empty state, and an errored part with an empty error message shows the No output. line.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/app-shared/src/tool-detail/index.ts 171 entry.question is pushed for any string, unlike the trimmed header, so question: '' emits a blank row and suppresses the mobile empty state
apps/mobile/src/components/agents/tool-cards/generic-tool-card.tsx 44 !detail.error treats an empty-string error as no error, showing No output. for a failed call
Files Reviewed (100 files)
  • packages/app-shared/src/tool-detail/index.ts - 1 issue
  • packages/app-shared/src/tool-detail/index.test.ts
  • packages/app-shared/package.json
  • apps/mobile/src/components/agents/tool-card-display.ts
  • apps/mobile/src/components/agents/tool-card-display.test.ts
  • apps/mobile/src/components/agents/tool-card-utils.ts
  • apps/mobile/src/components/agents/tool-card-utils.test.ts
  • apps/mobile/src/components/agents/tool-cards/generic-tool-card.tsx - 1 issue
  • apps/mobile/src/components/agents/tool-cards/generic-tool-card.mounted.test.tsx
  • apps/mobile/src/components/agents/tool-cards/tool-card-output-cap.test.ts
  • apps/mobile/src/components/agents/part-detail-sheet.mounted.test.tsx
  • apps/web/src/lib/promoCreditCategories.ts
  • apps/web/src/lib/promoCreditCategories.test.ts
  • apps/mobile/src/i18n/locales/*.json (87 catalogs)

Fix these issues in Kilo Cloud

Previous review (commit 19e21dd)

Status: No Issues Found | Recommendation: Merge

Executive Summary

History was rewritten (the prior df5a0e2 head is not an ancestor of the current head), so I re-reviewed the whole PR at head 19e21dd4: the shared tool-detail projection (MCP envelope unwrapping and incomplete-envelope suppression, question row numbering, empty-projection fallback, field capping, JSON output round-trip guard) and the generic card/row rendering are internally consistent, and the promo-decryption guard degrades safely; no new issues were found in the changed lines.

Files Reviewed (100 files)
  • packages/app-shared/src/tool-detail/index.ts
  • packages/app-shared/src/tool-detail/index.test.ts
  • packages/app-shared/package.json
  • apps/mobile/src/components/agents/tool-card-display.ts
  • apps/mobile/src/components/agents/tool-card-display.test.ts
  • apps/mobile/src/components/agents/tool-card-utils.ts
  • apps/mobile/src/components/agents/tool-card-utils.test.ts
  • apps/mobile/src/components/agents/tool-cards/generic-tool-card.tsx
  • apps/mobile/src/components/agents/tool-cards/generic-tool-card.mounted.test.tsx
  • apps/mobile/src/components/agents/tool-cards/tool-card-output-cap.test.ts
  • apps/mobile/src/components/agents/part-detail-sheet.mounted.test.tsx
  • apps/web/src/lib/promoCreditCategories.ts
  • apps/web/src/lib/promoCreditCategories.test.ts
  • apps/mobile/src/i18n/locales/*.json (87 catalogs)

Previous review (commit df5a0e2)

Status: No Issues Found | Recommendation: Merge

Executive Summary

The follow-up commit replaces the transcript-row buildToolDetail call with the new output-free buildToolDetailSummary and extends translatable to cover the projected argument summary, resolving both prior warnings; no new issues were found in the changed lines.

Files Reviewed (4 files)
  • apps/mobile/src/components/agents/tool-card-display.ts
  • apps/mobile/src/components/agents/tool-card-display.test.ts
  • packages/app-shared/src/tool-detail/index.ts
  • packages/app-shared/src/tool-detail/index.test.ts

Previous review (commit 82e0313)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
apps/mobile/src/components/agents/tool-card-display.ts 258 buildToolDetail parses/pretty-prints full tool output on every row render just to read the name/summary
apps/mobile/src/components/agents/tool-card-display.ts 264 New summary subtitle is not covered by the translatable flag, so question/description content is shown untranslated
Files Reviewed (100 files)
  • apps/mobile/src/components/agents/part-detail-sheet.mounted.test.tsx - 0 issues
  • apps/mobile/src/components/agents/tool-card-display.test.ts - 0 issues
  • apps/mobile/src/components/agents/tool-card-display.ts - 2 issues
  • apps/mobile/src/components/agents/tool-card-utils.test.ts - 0 issues
  • apps/mobile/src/components/agents/tool-card-utils.ts - 0 issues
  • apps/mobile/src/components/agents/tool-cards/generic-tool-card.mounted.test.tsx - 0 issues
  • apps/mobile/src/components/agents/tool-cards/generic-tool-card.tsx - 0 issues
  • apps/mobile/src/components/agents/tool-cards/tool-card-output-cap.test.ts - 0 issues
  • apps/web/src/lib/promoCreditCategories.test.ts - 0 issues
  • apps/web/src/lib/promoCreditCategories.ts - 0 issues
  • packages/app-shared/package.json - 0 issues
  • packages/app-shared/src/tool-detail/index.test.ts - 0 issues
  • packages/app-shared/src/tool-detail/index.ts - 0 issues
  • apps/mobile/src/i18n/locales/*.json (87 catalogs) - 0 issues

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

@iscekic
iscekic marked this pull request as draft September 18, 2026 17:20
@iscekic
iscekic force-pushed the kwf/req-20260918-040530-e325 branch from feb9e9e to df5a0e2 Compare September 18, 2026 17:40
@iscekic
iscekic marked this pull request as ready for review September 18, 2026 20:44
@iscekic

iscekic commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator Author

kilo-review — independent audit of the published diff.

Status: 2 Issues

File Line Issue
apps/mobile/src/i18n/locales/af.json 2158 The diff hand-edits all 86 non-en catalogs ("noOutput") in addition to en.json, which apps/mobile/AGENTS.md forbids and this review's i18n rule treats as blocking for a non-translation task.
apps/mobile/src/components/agents/tool-card-display.ts 264 An mcp part whose envelope is incomplete (server_name without tool_name) now shows the raw envelope field as its row label (server_name=github) instead of the tool name mcp.

@iscekic
iscekic marked this pull request as draft September 18, 2026 21:05
@iscekic

iscekic commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator Author

bot: Accepted. Pushed 79b7eb4 (kwf kwf-fix-review-6783).

What changed:

  • apps/mobile/src/i18n/locales/af.json:2158 — rejected (no_change): check-catalogs.mjs:496-500 fails a catalog missing any en.json key, and .github/workflows/kilo-app-ci.yml:169 runs it, so the 86 catalogs keep agentChat.toolCard.noOutput.
  • apps/mobile/src/components/agents/tool-card-display.ts:264 — accepted: an mcp part without an arguments record no longer summarizes its raw envelope, so the row keeps the tool name mcp instead of server_name=github.
  • summaryArguments withholds the argument summary when an mcp part's arguments is missing or not a record; the row falls back to the tool name.
  • The mobile display test and the shared tool-detail test cover the incomplete envelope: name mcp, no summary, not translatable.

@iscekic
iscekic force-pushed the kwf/req-20260918-040530-e325 branch from 79b7eb4 to 19e21dd Compare September 18, 2026 22:56
@iscekic
iscekic marked this pull request as ready for review September 18, 2026 23:16
@iscekic iscekic added the human-ready The PR is ready for human review. label Sep 18, 2026
@iscekic iscekic self-assigned this Sep 18, 2026
@iscekic
iscekic force-pushed the kwf/req-20260918-040530-e325 branch from 19e21dd to 7d1a29d Compare September 20, 2026 18:13
Comment thread packages/app-shared/src/tool-detail/index.ts Outdated
Comment thread apps/mobile/src/components/agents/tool-cards/generic-tool-card.tsx Outdated
Comment thread packages/app-shared/src/tool-detail/index.ts
Comment thread packages/app-shared/src/tool-detail/index.ts
Comment thread packages/app-shared/src/tool-detail/index.test.ts
Comment thread apps/mobile/src/components/agents/tool-card-display.ts Outdated

@eshurakov eshurakov 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.

Approved after a shallow triage pass. Note: also carries an unrelated web change (promoCreditCategories.ts) worth splitting out.

@iscekic iscekic added the merge-by-human the merge bot routed this PR to a human label Sep 21, 2026
@iscekic

iscekic commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator Author

The merge bot leaves this one to a human: Jev reads it as a human's merge (confidence 0.98).

@iscekic iscekic added merge-by-human the merge bot routed this PR to a human and removed merge-by-human the merge bot routed this PR to a human labels Sep 21, 2026
@iscekic

iscekic commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator Author

The merge bot leaves this one to a human: Jev reads it as a human's merge (confidence 0.98).

@iscekic iscekic removed the merge-by-human the merge bot routed this PR to a human label Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

human-ready The PR is ready for human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants