Repository navigation
feat(host-diff): describe an inline hook command by its structure, or say to open the config (#934) - #999
Merged
pengfei-threemoonslab merged 1 commit intoOct 8, 2026
Conversation
… say to open the config (#934) A hook row for a command that opens with an assignment, pipes or branches read two digests and no name. Each handler's command now publishes a shape (host-grants 0.9, extended in place) read by a bounded static reader: the plain-token programs at command positions, counts of commands, pipes, substitutions, control-flow keywords and quoted strings, file redirects and a script path. A command the reader refuses is shape_limit, and its row says the digest moved and the config has to be opened. Display only: no row, direction, severity, expansion signal or check decision moves.
pengfei-threemoonslab
force-pushed
the
claude/934-inline-hook-command-summary
branch
from
October 8, 2026 10:17
0b2de09 to
329e8dc
Compare
pengfei-threemoonslab
deleted the
claude/934-inline-hook-command-summary
branch
October 8, 2026 10:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #934
Problem
CirrusRedOrg/EntityFrameworkCore.Jet#303 printed
PreToolUse: command changed (<not-shown> sha256:f23acba4b10f → <not-shown> sha256:3f1dc36980b7): two digests, and no name because the script opens with an assignment. A reviewer could not tell whether the edit added a program or only text, and no row told an edit that explains itself from one that needs the config opened.Design
Both outcomes the issue asked for, display-only, in host-grants
0.9(unreleased, extended in place; no schema file present inv1.2.0changes).src/agents_shipgate/core/hook_command_shape.pyis a bounded, linear, static reader of the command asconfig_sha256's input holds it (never run). It accepts simple commands,| |& && || ; &and newlines, groups,if/while/until/for,[[ ]], assignments,$( ), quoting, redirects and a literalbash -c '…'(two levels), and refuses everything else whole.command.shapepublishes: plain-token programs at command positions (max 12, never a URL or a generated-looking token), counts of statements, pipes, substitutions, control-flow keywords and quoted strings, file redirects (target only for/dev/nullor a repo-relative path), and ascriptpath by theargsrule (Hook exec-form args changes are detected but hidden behind no difference in matcher, command or timeout #972).command.shape_limitistoo_long(> 8,192 chars),unsupported_syntax(here-doc, backquote,$((,case, functions, unterminated quote/group, word/nesting bound) orunsupported_shell(shellnotbash/sh). The row then saysnot described: …; the digest moved, open the config to read the change. A same-structure argument edit sayssame programs and structure; the change is in an argument or in quoted text this output does not show, open the config to read the change.hook edit; authority direction is unknown. The shape is a function of the sanitized text (a backslash-continued line is read joined and re-sanitized, because the string rule leaves--token \<newline>valueon the next line), so fix(privacy): withhold bearer tokens and curl user passwords in published values #987 shapes stay withheld and rotations stay quiet. The existing leak corpus caught that case and a URL-host-as-program case during development; both are pinned.handlers: no row, severity, direction,expands, expansion signal orcheckdecision moves.Surface discipline: extends an existing grant field in place, adds no command, schema version or report block. Headline metric: reviewer-checkable hook rows (#811 comprehension; content-free rows were the noise #819 targeted).
Before / after (the real pair)
Before:
PreToolUse: command changed (<not-shown> sha256:f23acba4b10f → <not-shown> sha256:3f1dc36980b7)After:
PreToolUse: command changed (<not-shown> sha256:f23acba4b10f → <not-shown> sha256:3f1dc36980b7; same programs (cat, printf, sed, grep, echo, true); simple commands 15 → 25; pipes 5 → 9; conditionals and loops 4 → 7; quoted strings 18 → 32)/hook edit; authority direction is unknownTests
New
tests/test_hook_command_shape.py(real pair as MIT fixtures undertests/fixtures/hook_command_shape/, grammar table, redirects, scripts, refusals, bounds, credential and #987 shapes, row wording, route parity for diff/verify/PR comment/check/drift, schema, fuzz). Existing hook-detail tests updated for the new text. Full CI mirror: only the two known machine-locallocal_settings_enabled_plugins-*failures and one wall-clock test (test_workflow_label_redactionlinear-time) which passes alone;tests/test_adapter_static_only.pypasses alone;ruff check .clean;generate_schemas.py --checkclean.🤖 Generated with Claude Code