fix(#2752): make tool_input.path authoritative over model-controlled file_path in gsd-phase-boundary.sh (#2860)
* test(#2752): path is authoritative over model-controlled file_path in phase-boundary hook Rewrite the #2304 precedence test (which pinned the buggy file_path-wins behavior with an impossible no-tool_name {file_path,path} payload) to assert the correct precedence with realistic Kimi-shaped payloads: a real .planning/ write with a decoy file_path must still fire the reminder (suppression repro), and a write elsewhere with a decoy .planning/ file_path must NOT fabricate one (fabrication repro). Update the parity vocabulary alarm to the new expression. * fix(#2752): make tool_input.path authoritative over model-controlled file_path in gsd-phase-boundary.sh The hook consulted file_path first, path second. kimi-cli executes on path and sends path only; file_path on a Kimi payload is always model-supplied. So a model-supplied decoy file_path could suppress the reminder for a real .planning/ write or fabricate one for a file never touched. Flip the precedence so path is authoritative and file_path is the fallback (Claude Code emits file_path and no path, so the fallback must remain). Mirrors the #2595 JS-guard fix. * chore(#2752): changeset fragment * chore(#2752): clarify comment/changeset — JS guards use upstream normalization, shell hook applies precedence directly (review minor 1) * chore(#2752): backfill changeset PR number (2860) --------- Co-authored-by: Test <test@example.com>
This commit is contained in:
@@ -159,12 +159,13 @@ describe('Kimi shell-guard vocabulary parity (#2304)', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('gsd-phase-boundary.sh falls back to Kimi\'s tool_input.path field', () => {
|
||||
test('gsd-phase-boundary.sh prefers Kimi\'s authoritative tool_input.path, falls back to file_path (#2752)', () => {
|
||||
const src = readHook('hooks/gsd-phase-boundary.sh');
|
||||
assert.ok(
|
||||
src.includes('i.file_path||(typeof i.path===\'string\'?i.path:\'\')'),
|
||||
'gsd-phase-boundary.sh no longer falls back to tool_input.path — ' +
|
||||
'the hook reads an empty path on Kimi (#2304)'
|
||||
src.includes('(typeof i.path===\'string\'&&i.path)||(typeof i.file_path===\'string\'&&i.file_path)||\'\''),
|
||||
'gsd-phase-boundary.sh no longer prefers tool_input.path over file_path — ' +
|
||||
'path is the authoritative field (kimi-cli executes on it); a model-supplied ' +
|
||||
'decoy file_path must not suppress or fabricate a reminder (#2752, mirrors #2595)'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user