Skip to content

fix(chat): label purpose-less shell pills from the command, not the title - #8294

Open
jingchaodev wants to merge 1 commit into
kirodotdev:mainfrom
jingchaodev:feat/purposeless-pill-label
Open

fix(chat): label purpose-less shell pills from the command, not the title#8294
jingchaodev wants to merge 1 commit into
kirodotdev:mainfrom
jingchaodev:feat/purposeless-pill-label

Conversation

@jingchaodev

@jingchaodev jingchaodev commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Problem / Motivation

In simplified-tool-names mode the pill label is the agent-authored __tool_use_purpose. kiro-cli's injection of that argument is inconsistent for built-in shell calls (allocated per spawned process — two sessions one minute apart observed at 16/16 vs 0/22 execute calls carrying it). When it is absent, kiro-cli's auto-title for a bash call is a digest of argument fragments, and the pill renders it verbatim:

--title, --text, Three, 1. ...

#6435's deriveShellSummary does not catch this: it only fires above 200 chars / on multi-line labels, and it parses the TITLE — which in this failure mode is not the command.

Why it matters

Every session that lands on an untreated kiro-cli process renders unreadable step rows for its whole transcript — the reader cannot tell what any shell step did without expanding it. Restored/old sessions are additionally affected (see the isShell fix below).

What changed (motivation → approach → change)

Goal: the pill should be readable from ground truth, not from a title that is unreliable exactly when it is needed, and it should read in the same verb-led register as agent-authored purposes ("Read the full ticket …" beside "Run ledger.py ticket-log").

Approach considered and rejected: LLM back-fill of missing purposes (per-call cost/latency on the hot streaming path for chrome text). Chosen: deterministic re-label from the call's raw input.

  • ToolCallLine: when a shell pill would show its raw label (no purpose, or purpose suppressed by the language guard) and the raw input carries a command, label from the command — verbatim when short/single-line, deriveShellSummary digest when flood-length — framed by a new catalog key pages.chat.toolCallLine.run_command ("Run {{cmd}}", translated in all 12 locales + pseudolocale regen).
  • deriveShellSummary: steps over wrappers (sudo), variable references ($PY), and interpreters (python3 script.pyscript.py), and attaches one subcommand word to the first meaningful name — the observed oncall command derives to ledger.py ticket-log instead of cd. Two existing test pins changed to strictly richer labels (makemake build, docker-compose, teedocker-compose up, tee).
  • commandFromToolInput (new, utils/toolLabel.ts): reads command out of the raw-input JSON.
  • Historical rows: the restored-session path hardcoded isShell: false, so no shell derivation ever ran on old transcripts; it now reads the persisted meta.kind === 'execute', mirroring the live branch.

Tests

  • toolLabel.test.ts (16): interpreter/varref/wrapper stepping, subcommand attaches to the first meaningful name only, commandFromToolInput parsing and rejection shapes.
  • ToolCallLine.test.tsx (41): soup-title pill re-labels from the command (short verbatim, flood-length derived); an agent-authored purpose still wins over the re-label; short verbatim-command titles unchanged.
  • Catalog parity suite (717 total across i18n): new key present in all locales incl. regenerated en-XA.

Manual verification

Screenshots below were produced by the committed fixture harness (website/scripts/capture-purposeless-shell-pill.mjs) driving the real built SPA with the exact transcript shape from the reporting session (P503465049 triage). tsc 0 errors, eslint 0 warnings at the CI cap, i18n added-lines gate clean.

Screenshots / video

Dark — an agent-authored purpose (unchanged), a short command re-labeled verbatim, a flood-length command derived to its digest:

pills dark

Light theme

pills light

Related Issues

None open upstream for this; the root cause (inconsistent __tool_use_purpose injection) is filed with the kiro-cli team internally, and this change makes the dashboard robust to it either way.

Pattern harvest

Rule candidate: review-prompt
Pattern: "UI fallback renders an upstream-generated summary verbatim — when the upstream summary is generated from the same missing data that triggered the fallback, derive from ground truth (raw input) instead."

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable) — N/A, behavior documented in code comments per repo comment rules
  • No secrets, credentials, or internal references in the diff

@jingchaodev
jingchaodev requested a review from a team September 3, 2026 22:35
@jingchaodev
jingchaodev requested a review from a team as a code owner September 3, 2026 22:35
@jingchaodev
jingchaodev requested a review from buluoray September 3, 2026 22:35
@dwu96

dwu96 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated.

Missing sections:

  • ## Problem / Motivation
  • ## Why it matters
  • ## What changed
  • ## Tests

Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle.

1 similar comment
@iamwhatever

Copy link
Copy Markdown
Collaborator

👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated.

Missing sections:

  • ## Problem / Motivation
  • ## Why it matters
  • ## What changed
  • ## Tests

Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle.

@jingchaodev
jingchaodev force-pushed the feat/purposeless-pill-label branch from fdff9b2 to 537e2bc Compare September 3, 2026 22:55
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Sep 3, 2026
@jingchaodev

Copy link
Copy Markdown
Contributor Author

CI triage note (head 537e2bc97): the one red CI check, Backend Tests (Windows) (1), is base-branch breakage: the same five test_autonudge_stop_auth.py tests fail on the same Windows shard on #8307 (an unrelated backend diff), while this PR touches only website/ and the Linux shards pass the file. No commits touch that test or its subject between this PR's base and main's tip. Will wait it out / rebase once main is green there.

@jingchaodev
jingchaodev force-pushed the feat/purposeless-pill-label branch from 537e2bc to 16fc501 Compare September 4, 2026 02:48
@jingchaodev

Copy link
Copy Markdown
Contributor Author

CI triage note (head 16fc50100): backend tests and PR Hygiene are green after rebasing past #8317. The remaining red, Dependency Audit / Audit Production Dependencies, is npm audit timed out after 120s (fail-closed infra guard, no vulnerability named) — currently failing on all 8 open PRs in the repo, so it is a registry/runner outage, not this diff. Will re-trigger once the audit lane recovers.

@jingchaodev
jingchaodev force-pushed the feat/purposeless-pill-label branch from 16fc501 to e5d58a6 Compare September 4, 2026 05:11
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of 947a344965bd08db81a652c829f2fd9528d972e3 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

All checks complete. The design holds up: real observed harm, deterministic ground-truth re-label at the display layer (the right layer for a display-data problem), the LLM alternative considered and reasonably rejected, root cause filed upstream, no test pinning the old isShell: false as a decision, and both changed test pins preserve their tests' actual subjects (2>&1 handling, bookkeeping-line skipping) with richer labels. The committed screenshots and capture script follow an established repo convention. Two small design-level improvements surfaced.

Design-Verdict: PASS

Ground-truth re-label at the display layer is the right shape; deterministic, opt-scoped, and the restored-session isShell fix mirrors the live branch's existing contract.

Suggestions

  • When the pill is re-labeled from the command, set the hover title to the raw command instead of displayLabel: pillLabelTitle still surfaces the argument-fragment soup — the exact text this PR exists to hide — and the adjacent comment ("Hover reveals the verbatim command") becomes false on the new path.
  • The cmd !== label guard leaves only bare-command titles untouched; a Running: <cmd>-prefixed title with input present also re-labels to "Run {{cmd}}", wider than the described soup-title case — and the existing Running: git status pin survives only because its fixture omits input, which real sessions carry. Either skip when label === \Running: ${cmd}`or add a test fixture withinput` present so the pinned shape matches production.

[DESIGN-REVIEWED] 947a344

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

UX Review (Fable 5, fork) — 🟡 CONCERNS

UX-level review of 947a344965bd08db81a652c829f2fd9528d972e3 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

Good fix, but the hover tooltip on a re-labeled pill now shows the exact argument-soup this PR exists to remove.

Watch

  • Tooltip regression on the new path: pillLabelTitle = pillLabelText === displayLabel ? undefined : displayLabel — the re-label makes pillLabelText ("Run ledger.py ticket-log") differ from displayLabel, but displayLabel in this failure mode is the soup title ("--title, --text, Three, 1. ..."), not the command. A user hovering the derived pill to see the full command gets the unreadable fragment digest instead and must expand the row. Hits every purpose-less flood-length shell pill (the motivating case), every hover — friction, not failure. Fix: when the command re-label fires, set the pill title to cmd, not displayLabel.

Evidence gaps

  • The three pill states the PR renders (purpose kept, short command verbatim, flood-length digest) exist only in added screenshots pills-dark.png / pills-light.png, which are binary markers in a fork patch — unopenable here, and no blind read ran on them. Push the branch to this repository to close both.

[UX-REVIEWED] 947a344

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — 🟡 CONCERNS

Premise-level review of 947a344965bd08db81a652c829f2fd9528d972e3 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

All evidence is gathered and verified against the base tree. Producing the review.

First-Principles-Verdict: CONCERNS

The soup title this PR fixes still renders unfixed at two sibling pickToolLabel fallback sites — the fix covers only the transcript pill.

Not justified as shipped

All inventory items are justified; the concern is coverage, not existence — see Watch.

What this change ships

Intent: make shell tool-step rows readable when kiro-cli omits the agent-authored purpose and its auto-title is argument-fragment soup — a FIX (repro in description; new tests fail on base).

Inventory (6 items)
  1. Purpose-less shell pills now read "Run <command>" (verbatim short, digest long) instead of the fragment soup — justified
  2. Long shell digests everywhere now name the script behind wrappers/varrefs/interpreters and attach one subcommand (makemake build) — justified
  3. Restored/old sessions' shell rows now get shell labeling (base hardcoded isShell: false; persisted kind verified at chat_runner.py:2331) — justified
  4. New run_command catalog key in all 13 locale files — justified
  5. New exported commandFromToolInput helper, one consumer — justified
  6. Committed screenshot harness + two PNGs — justified

Watch

Point patch: grepped pickToolLabel — 2 other fallback sites render the same soup title for a purpose-less shell call: toolStatusLabel.ts:36 (session-row status; WS payload carries no input, so genuinely larger) and ChatInput.tsx:1080 (approval bar, where extractPreview in CollapsibleToolGroup.tsx:71 already reads meta.tool_input.command, so the fix is reachable there). The description ("Every session … renders unreadable step rows") never names this pill-only scope.
Clears when: the approval-bar label re-labels from tool_input.command, or the description states pill-only scope and what is left.

Subtractions

Shrink isBrowseCommand (browseCommand.ts:24-32): its inline JSON-parse-for-command (counted: 2 pre-existing inline spellings, there and CollapsibleToolGroup.tsx:71) is now commandFromToolInput; replace the inline parse with the helper so one spelling remains.

[FIRST-PRINCIPLES-REVIEWED] 947a344

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed 947a344965bd08db81a652c829f2fd9528d972e3 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 947a344

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Opus 4.8 Review (fork) — ✅ no blocking findings

Reviewed 947a344965bd08db81a652c829f2fd9528d972e3 via the fork AI-review pipeline; updated in place on each push.

Review details

No blocking issues; one advisory finding.

FINDING — website/src/pages/chat/ToolCallLine.tsx:742 — for a purpose-less execute row with a flood-length/multiline command, the new re-label branch sets pillLabelText to Run <digest> while the unchanged pillLabelTitle = pillLabelText === displayLabel ? undefined : displayLabel resolves displayLabel to the kiro-cli argument-fragment soup title, so hovering the substitute pill shows --title, --text, … instead of the verbatim command the adjacent invariant promises (command reachable only via expanded details) → Fix: in the re-label branch, carry cmd as the pill title (return it alongside the label) so the flood-length re-labeled pill reveals the verbatim command on hover.

[OPUS-REVIEWED] 947a344

@jingchaodev
jingchaodev force-pushed the feat/purposeless-pill-label branch from e5d58a6 to bffb326 Compare September 4, 2026 06:02
@jingchaodev

Copy link
Copy Markdown
Contributor Author

Disposition — GPT validation finding on e5d58a6fc (fixed on bffb3266f): correct — pillLabelText resolves the run_command frame through the catalog at call time, so uiLang belongs in the memo deps; without it a language switch left the pill in the previous language. Added with an exhaustive-deps disable (the linter cannot see through i18nT; same precedent as ActivityViewer/AssistantMessage). Tests 57/57, tsc/eslint/i18n clean.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 4, 2026
@bolichen97

Copy link
Copy Markdown
Collaborator

Open PR relationship audit

This is a consolidated, point-in-time code-level audit note. It compares complete merge-base diffs and current/merged code; it does not treat a shared topic as duplication or partial coverage as completion.

Relationship findings

  • This PR is PARTIALLY_COVERED with PR #6435. Coverage is explicitly incomplete; this finding is not a completion or closure claim. Recommended action for PR #8294: KEEP. PR #6435 is the merged foundation this PR builds on, not a substitute for it: the merged code covers the flood-length-title case only, and none of the primary's three behaviors (command-sourced label, interpreter/wrapper/varref stepping with subcommand attachment, historical shell-ness) exist in current origin/main. Files: website/src/pages/chat/ToolCallLine.tsx, website/src/utils/toolLabel.ts.

No PR, Issue, label, branch, or review state was changed by the relationship-note portion of this audit.

@bolichen97
bolichen97 force-pushed the feat/purposeless-pill-label branch from bffb326 to 947a344 Compare September 8, 2026 13:14
@bolichen97

Copy link
Copy Markdown
Collaborator

Rebased onto main 41dcadf2c by a maintainer as part of the 2026-09-08 open-PR audit. Old head bffb3266f, new head 947a34496.

Conflicts: none, clean rebase (no manual resolution, no behaviour change).

Gates run locally in an isolated worktree: npx tsc --noEmit -p website/tsconfig.json passed; vitest run src/test/ToolCallLine.test.tsx src/test/toolLabel.test.ts passed (57 tests); the src/i18n suite passed 664/665, with the single failure being navLabels.test.tsx unable to resolve yaml from a stale local node_modules (unrelated to this diff, and CI installs deps fresh).

Please review the rebased branch. Note that a maintainer push makes the maintainer the last pusher, so under this repo's last-push rule a second approver is needed. Reply here if anything looks wrong.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Sep 8, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants