Repository navigation
fix(name-grant): name the part a declined auto-approve could not model - #16082
Conversation
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 6140ee9 Description read[DESCRIPTION-READ] a803a340c44ad4b5e964abe0997e00bf0bd7097e4c13a70870442f6ffff19926 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 (Fable 5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify What this change shipsInventory (6 items) — 6 justifiedIntent: FIX — the untokenizable auto-approve decline notice names the part of the command the check gave up on, instead of a bare constant. Verified on base:
Detail flows display-only through [FIRST-PRINCIPLES-REVIEWED] 6140ee9 Description read[DESCRIPTION-READ] b029518b530336cd09a7021ca82984e667630ee5fef7d5d7a36910b952c79c37 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5 Review (fork) — ✅ no blocking findingsReviewed |
The 'could not be reduced to a known set of program names' notice gave no clue which part of the command tripped it. The walk now raises with the part it gave up on (a shell keyword, an unclosed quote, a trailing backslash, an operator, an execution-affecting assignment, or a PowerShell expression form), plus the line number for a multi-line command, and the refusal detail carries it. The refusal code, log text and the set of refused commands are unchanged; assignment values are never shown.
7903984 to
6140ee9
Compare
|
Rebased: main moved since this head went red (cfb4284 -> 5a70ce7). CI re-running. The four test failures on 7903984 touched no file in this PR:
|
|
|
All review lanes pass on 6140ee9 (GPT, Opus, Design, First Principles, UX, Security Scope). The only reds are two Windows test shards, and neither touches this PR's files (
Both shards passed these tests on the previous head (7903984) with the same |
Problem / Motivation
Goal: When an auto-approve grant is declined because the command "could not be reduced to a known set of program names", the notice says which part of the command caused it.
Today the notice reads:
It never says which part. One user's audit log holds 1,517 of these declines in three weeks, and each one meant reading the command by hand to guess the cause.
Why it matters
Without the part named, the only way to learn the cause is to read
name_grant.py. A user who wants fewer prompts cannot tell what to change in how they, or their agent, write commands. So the notice adds a chat row but no fact anyone can act on.Not a goal
$( )or a wrapper's arguments.What changed (motivation → approach → change)
The notice now ends with the part the check gave up on:
for f in a b; do grep x $f; done(the shell keyword 'for')python3 - <<'EOF'withprint(json.dumps({'a': 1}))on line 3(line 3: the operator '))')grep -n foo a.py \continued on the next line(line 1: a trailing backslash; this check does not follow a line continuation)PYTHONPATH=src python3 -m pytest x.py(the assignment 'PYTHONPATH=', which changes what runs)echo 'unterminated(an unclosed quote; this check tokenizes one line at a time)The program-name walk in
src/kiro_crew/name_grant.pygave up in nine places by returning a bareNone, so the refusal could only say that it gave up. Each place now raises a private_Unmodellederror naming its part, andname_grant_refusaladds that to theUNTOKENIZABLEdetail, with the line number for a multi-line command.program_namesstill returnsNone, so its other callers do not change.The part goes only into the display detail. Audit rows and log lines still use the constant
log_text. Nothing after an=is shown, since an assignment's value can be a secret, and a part over 40 characters is cut.Backwards compatibility
Compatible: the same commands are declined with the same refusal code and log text; only the human-readable detail gains a suffix.
_program_names_linenow raises instead of returningNone; its one other caller is a test, updated to expect the raise.Tests
test/test_name_grant.py::TestUntokenizableDetaillocks in that each POSIX give-up names its part, that a multi-line command names the line, that nothing after an=is shown, that a part is kept at 40 characters and cut at 41, and thatlog_textstays the constant.test/test_name_grant_windows.py::test_the_refusal_names_the_windows_partdoes the same for the five PowerShell-only give-ups, andtest_a_scriptblock_assignment_value_is_never_shownchecks that{$p="s3cret"}shows only{$p=.test_the_ci_blocking_case_no_longer_auto_approvesnow expects the walk to raise.Manual verification
Ran
name_grant_refusalon the five commands in the table above, shaped like the most common declines in a real audit log; each detail is exactly the suffix shown. The chat runner already showsRefusal.detailas-is, so no surface code changes.Related Issues
no linked issue: a small diagnostic change that no issue tracks.
Pattern harvest
Not generalizable: every other refusal code already carries a specific detail; this was the one give-up path that dropped its reason.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)