Repository navigation
fix(tool-titles): decode percent-escaped paths in channel tool titles - #38644
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level concerns. This ports the dashboard's display-only Notes
[DESIGN-REVIEWED] b9745d1 Description read[DESCRIPTION-READ] 9f377e212c536d67eccccf9cf571481948d10331c1b9059b809cd1b3eb144c5b That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The fix decodes inside What this change shipsInventory (3 items) — 3 justifiedIntent: chat-channel users see the same decoded file path in a tool title that the dashboard shows. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] b9745d1 Description read[DESCRIPTION-READ] 2812ae87c40a0b1d7c1f6647534935eea047718d21f4f2514b7fea1de96b6e8d That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
|
Rebased: main moved in src/kiro_crew/messaging/driver.py and src/kiro_crew/dashboard/chat_turn/tool_rows.py (the two callers of the changed title function) and about 5,500 other files since this head's CI ran (d155058 -> d38cadb). CI's SAST (Semgrep) job baselines on the merge-base, so on the old base it was scanning 4,777 files that main changed rather than this diff. The new head also splits and joins path segments on the module's [operator: bolichen97] |
5972ed7 to
4858bf1
Compare
The Python title mirror in tool_call_title.py passed native tool paths to rel_display_path as written. A path such as drafts/The%20Power%20of%20Running.md showed as Edit drafts/The%20Power%20of%20Running.md in Slack and Discord task labels. The dashboard already decodes it through decodePathForDisplay in pathBasename.ts. Add decode_path_for_display, a port of decodePathForDisplay, and call it in classify_native's rel helper. Each segment decodes on its own. A segment keeps its encoded form when it has a malformed escape, is not valid UTF-8, or would decode to a separator, a control or a bidi character. The escape check walks each "%" and tests the next two characters against a hex-digit set. The unsafe check tests each decoded character against C0 controls, DEL and an explicit set of separators and bidi controls. No regex is used. New shared fixture cases pin the decoded titles and both guards on the Python and TypeScript sides. Closes #29871
4858bf1 to
b9745d1
Compare
|
[operator: bolichen97] Rebased onto current The three red Windows backend shards on the previous head were not caused by this change, so there was nothing to fix in this PR:
Formatting, lint, the related Python and TypeScript tests, the flake-pattern ratchet and semgrep were re-run on the rebased tree. CI is re-running. |
Code change approver recommendation: A person should decideWhy: the decider estimates a 7% chance that this change introduces a defect, within the 12% limit for approving on its own, but it is held at tier pending: being reviewed. This PR ports the dashboard's
The output is display-only. Its consumers are the channel driver ( Tier: pending: being reviewed. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Reviewed head b9745d1. The new decode_path_for_display matches the dashboard's decodePathForDisplay segment for segment: the same malformed-escape, invalid UTF-8, separator, control and bidi guards. A randomized differential comparison of the two implementations found no divergence. The decoded text only feeds the display title and its action path. Nothing opens or probes a file with it, and title redaction still runs on the result. The tool title tests and facade tests pass on this head, and I found no defect that blocks merging.
Problem / Motivation
Goal: A chat channel's tool titles show a percent-encoded file path decoded, the way the dashboard shows the same call.
When a tool names a file by its URL-encoded spelling, the task label a chat channel shows (Discord, for one) spells every space as
%20:Edit drafts/The%20Power%20of%20Running.md. The dashboard shows the same call asEdit drafts/The Power of Running.md.Why it matters
Channel users read an escaped path that the dashboard hides, for every file a tool names by its encoded spelling. The Python title module exists so that a channel and the dashboard show one label for the same call.
Not a goal
What changed (motivation → approach → change)
Channel task labels show
a b.mdwhere they showeda%20b.md, the same as the dashboard.The cause:
classify_nativeintool_call_title.pyhanded native tool paths torel_display_pathas written, while its TypeScript twin decodes them first withdecodePathForDisplay.tool_call_title.pygainsdecode_path_for_display, a port of that function, andclassify_native'srelhelper calls it. Each path segment decodes on its own and keeps its encoded form when it has a malformed escape, is not valid UTF-8, or would decode to a separator, a control or a bidi character. The checks walk the characters; there is no regex. New cases in the sharedtest/fixtures/tool_call_titles.jsonpin the same titles on the Python and TypeScript sides.Backwards compatibility
Compatible: only the display title of a native tool call whose path holds a percent-escape changes, with the action path it is rendered from; nothing is rejected, renamed or removed.
Removes nothing: the change adds a display decode and keeps every input, field and title shape.
Tests
Proof: PROVEN test/test_tool_call_title.py::test_fixture_conformance[fs_write percent-encoded path is decoded for display], test/test_tool_call_title.py::test_fixture_conformance[fs_read percent-encoded path is decoded before cwd is stripped], test/test_tool_call_title.py::test_native_titles_decode_percent_escaped_paths_like_the_dashboard, test/test_tool_call_title.py::test_read_title_decodes_each_segment_like_decodePathForDisplay[x/a%20b.md-x/a b.md], test/test_tool_call_title.py::test_read_title_decodes_each_segment_like_decodePathForDisplay[ok%20dir/50%off.md-ok dir/50%off.md] (head 4858bf1)
test_fixture_conformance, four new shared cases: two decoded titles (an edit, and a read whose cwd is stripped after decoding) and two kept-encoded guards (%2F, a malformed%of). The TypeScript suite runs the same cases.test_native_titles_decode_percent_escaped_paths_like_the_dashboard: the issue's edit title and a read title.test_read_title_decodes_each_segment_like_decodePathForDisplay: per-segment decoding and each guard (separator, backslash, control, bidi, malformed escape, not UTF-8).Determinism:
test/test_tool_call_title.pypassed 20 of 20 runs at-n0, 10 of 10 at-n 4 --dist loadgroup --max-worker-restart=2withtest/test_tool_call_title_facade.pyandtest/test_messaging_transport.pyas co-tenants, and one shuffled-order run (seed 2039, 289 ids). The TypeScript half,website/src/utils/toolCallTitle.test.ts, passes on the same fixture.Manual verification
Reproduced and smoke-tested on a Linux (Ubuntu 24.04) host. A throwaway script drove the real channel
TurnDriver(messaging/driver.py) with a scripted provider that yields one nativefs_writeedit ofdrafts/The%20Power%20of%20Running.mdand a recording renderer, and printed thetitleof theTOOL_CALLevent the renderer received, and called the dashboard-to-channel mirror's_mirror_task_labelon the same event.Before the fix (base):
After the fix (this head):
A plain path is unchanged, a segment that would gain a separator or has a malformed escape stays encoded, and the same script's direct
derive_tool_call_titlecall for anfs_readofa%20b.mdinside its session cwd printedRead a b.md(the channel driver itself passes no cwd). No live chat workspace was connected; the renderer received exactly the title a channel posts.Screenshots / video
N/A — the diff touches no frontend file; a channel task label is plain text.
Related Issues
Closes #29871
Builds on #29875 by @rohnkum.
Sibling sweep
Swept: git grep -n 'rel_display_path|short_display_path' -- src/kiro_crew, plus the TypeScript classifyNative and readFromKiroCliTitle in website/src/utils/toolCallTitle.ts
Sibling: src/kiro_crew/tool_call_title.py -- changed here
Sibling: src/kiro_crew/tool_call_title_shell_classify.py -- not affected -- shell titles use short_display_path, which the TypeScript side does not decode either
Sibling: src/kiro_crew/tool_call_title_shell_parse.py -- not affected -- it defines and uses short_display_path for shell titles, which the TypeScript side does not decode either
Sibling: website/src/utils/toolCallTitle.ts -- not affected -- it already decodes through decodePathForDisplay
Pattern harvest
Rule candidate: review-prompt
Pattern: When a fix lands in one half of a mirrored TypeScript and Python module, port it to the other half and add a shared fixture case.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)