feat(chat): derive readable summaries for purpose-less shell labels - #6435
Conversation
|
👋 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:
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
|
👋 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:
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. |
|
Check triage: the De-Amazon Scrub Lint hit was mine (an internal build-tool name in a comment and test fixture) — removed in the follow-up commit. The Frontend Lint & Type Check failure is jscpd flagging a 14-line clone between |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsFINDING -- website/src/pages/chat/ToolCallLine.tsx:670 -- |
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The gate implements "long label," not the stated "purpose-less label" — a long model-authored purpose on a shell call gets mangled into shell tokens. Watch
Suggestions
[DESIGN-REVIEWED] edebe40 |
UX Review (Fable 5, fork) — 🟡 CONCERNSUX-level review of I have what I need. The decision surfaces (approval bar, ghost pill, locked-open details panel) keep the verbatim command, so the digest never gates an approval. The remaining findings are about digest quality on specific command shapes and cross-surface parity. UX-Verdict: CONCERNS Wrapper-shaped commands digest to a bare wrapper name — "Running: bash" — strictly less informative than the truncated raw label it replaces. Watch
Suggestions
[UX-REVIEWED] edebe40 |
First Principles Review (Fable 5, fork) — 🟡 CONCERNSPremise-level review of I've completed the review: read the contract, the intent file, the authoritative patch, and verified against the base tree — First-Principles-Verdict: CONCERNS The digest fixes the transcript pill only; the same purpose-less raw shell command still renders in the session-row status — an unfixed, unnamed sibling. What this change shipsIntent: make the one visible line of a purpose-less shell tool pill say what the command ran. ADDITION, framed honestly as
Watch
Subtractions
[FIRST-PRINCIPLES-REVIEWED] edebe40 |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings block the merge. FINDING — website/src/pages/chat/ToolCallLine.tsx:41 — a long agent [OPUS-REVIEWED] edebe40 |
A tool call with no purpose falls back to its raw title, and a shell title is the command verbatim. kirodotdev#6152 pins the collapsed label to one line, which bounds how much is visible; this bounds what the visible part means. Observed in a real session: 126 of 126 shell calls carried no purpose, all as bare titles without the Running: prefix. In simplified mode, a purpose-less flood-length shell label is substituted with a deterministic command digest: quote-masked segment splitting, redirect masking, bookkeeping demotion, heredoc bodies excluded, binaries capped at 4, first redirect target as an arrow suffix. Bare titles derive too, gated on the tool log's is_shell. Verbatim command on hover and in the expanded panel; short labels render unchanged. Includes screenshot evidence under temp-screenshots.
4c82731 to
edebe40
Compare
Open PR relationship auditThis 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
No PR, Issue, label, branch, or review state was changed by the relationship-note portion of this audit. |
Problem / Motivation
A tool call that carries no
purposerenders its raw title as the pill label (pickToolLabelfallback), and a shell title is the command verbatim. #6152 pins the collapsed label to one line, which bounds how much of the command is visible — but the visible part of a clipped command is a wall of shell quoting that says almost nothing:cat > /tmp/desc.md <<'EOF' ### Notes Two changes that….This is the majority case for shell, not an edge case: in one real session, 328 of 442 tool messages carried no purpose — including 126 of 126 shell calls, all persisted as bare titles without the
Running:prefix.Why it matters
Anyone reading a transcript in simplified mode ("Simplified Tool Call Names" ON — the default) scans pill labels to follow what the agent did. For purpose-less shell calls, today's label is clipped raw code, so the reader must click every pill open to learn even which programs ran. Purposes are optional model output even where the tool schema declares the field, so this fallback path is permanent, not transitional — it needs to read well on its own.
What changed (motivation → approach → change)
Goal: make the one visible line meaningful for purpose-less shell calls.
Approach: a deterministic, render-time command digest, chosen over two alternatives — a render-time LLM summarizer (per-view token cost, async flicker, non-reproducible labels, and a prompt-injection surface) and a string clamp of the raw text (built first, then dropped: #6152's CSS truncate landed on main and already bounds visibility, and a string clamp would fight #6152's deliberate wrap-restore on expand). Substituting content composes cleanly with #6152's visibility bound.
Change: when Simplified Tool Call Names is ON and a purpose-less shell label is flood-length (>
DERIVE_LABEL_THRESHOLD_CHARSor multi-line), the pill substitutes a digest viaderiveShellSummary(new,website/src/utils/toolLabel.ts):Running: cat > /tmp/desc.md <<'EOF'+ 30-line body →Running: cat → /tmp/desc.mdRunning: export PATH=… cd …; ls -a | grep -i crux || echo none; git …; wc …→Running: ls, grep, echo, git …Mechanics: quote-masked segment splitting (
grep -E 'foo|bar'stays one command), redirect masking (2>&1contributes nothing), env-assignment skipping, bookkeeping demotion (export/cddropped when a meaningful binary exists, kept when alone), heredoc bodies excluded, binaries deduped and capped at 4, first redirect target shown as→ target. Bare titles derive too, gated on the tool log'sis_shellso a non-shell title (Editing AGENTS.md) can never be misparsed; unparseable labels returnnulland keep the raw text under #6152's truncate. The verbatim command moves to the row'stitle(hover) whenever a substitute is shown and remains unchanged in the expanded panel. Short labels (Running: git status) render byte-identically in every mode; raw mode (toggle OFF) always shows the exact command. Output is command names and paths only — script-neutral, no i18n catalog entry, zero model involvement. Labels are computed at render time, so existing transcripts improve on next view.Tests
deriveShellSummary(newsrc/test/toolLabel.test.ts): heredoc → binary + redirect target; pipeline binaries deduped/capped with bookkeeping demotion; lone-builtin retention; multi-line scripts read past a bookkeeping first line; heredoc bodies contribute no binaries; quoted operators not split;2>&1not a segment/target; env-assignment skipping; MCP/non-shell titles return null; bare-command gating on the caller's vouch;pickToolLabelfallback interplay.ToolCallLine.test.tsx: flood-length purpose-less shell call renders the derived digest (and none of the heredoc body); short shell label passes through untouched in simplified mode.ToolCallLine.labelClamp.test.tsxpasses unmodified alongside the substitution.tsc -bclean; eslint 0 errors on changed files.Manual verification
Verified in an isolated dev gateway (worktree source, own data home): a purpose-omitted heredoc call rendered the derived digest with the full command on hover and verbatim in the expanded panel; a purpose-carrying call still showed its purpose;
Running: git statusunchanged; toggle OFF showed the exact raw command. Hovertitleis the one behavior jsdom cannot assert, hence the manual pass.Screenshots / video
All captured on a live gateway running this branch, Simplified Tool Call Names ON, purposes deliberately omitted so the fallback path renders.
Redirect-target form — the original bug's shape (multi-line heredoc write; pill reads
cat → /tmp/screenshot-demo.md, diff card below is main's #5012 feature coexisting):Pipeline form (208-char chained command; pill reads
echo, tr, wc, git):No-regression (short command, still purpose-less; pill stays verbatim
git status):Baseline for comparison: with the toggle OFF (or on current main), the same calls render the raw command truncated to one line by #6152 — content identical to the
title/expanded-panel text visible above.Related Issues
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)