th-6578ee: hook to steer agents from bare git push to scripts/ci/attest.sh - #336
Merged
Conversation
…test.sh An agent won't adopt attestation from documentation alone. This is the same shape as th-curl-hint.sh: a PreToolUse Bash nudge, exit 1 (ask) not 2 (block). Deliberately NOT a git hook. attest.sh pushes — that ordering is what stops the credit losing the race against the runner — so a git pre-push hook calling it would re-enter itself forever. And smooai's pre-commit chain already decided this: it 'drops the full test suite (PR Checks owns that)', and attestation IS that suite. Ask, not block, because attesting is frequently wrong: a docs-only push doesn't need 10 minutes of checks, attesting `test` costs the coverage comment, and a red local check may be the machine (two 'failures' chased on 2026-08-04 were load artifacts at load 61). The hint says all three so the agent can decline with a reason via ` # attest:ack reason=...`. Repo-agnostic: fires only where scripts/ci/attest.sh exists, and reads the available check names from the directory rather than a list that could drift. Verified against 10 cases — fires on push/-u/--force-with-lease; silent on :ack, --dry-run, --delete, git status, 'th pearls push', attest.sh itself, and any repo without the script.
brentrager
enabled auto-merge (squash)
August 5, 2026 17:31
🦋 Changeset detectedLatest commit: a05db63 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Why
An agent won't adopt attestation from documentation alone. smooai's
scripts/ci/attest.shcuts an attested CI row from 5–38 min to ~8s, but only if something reminds you to run it instead ofgit push.Same shape as
th-curl-hint.sh: aPreToolUseBash nudge.Why not a git hook
Two independent reasons:
attest.shpushes. That ordering is what stops the credit losing the race against the runner. A gitpre-pushhook calling it would re-enter itself forever.pre-commitalready decided this — it explicitly "drops the full test suite (PR Checks owns that)". Attestation is that suite.Ask, not block (exit 1, not 2)
Attesting is frequently the wrong call, and the hint says so:
testalso skips its coverage artifact and sticky PR commentDecline with
# attest:ack reason=....Repo-agnostic
Fires only where
scripts/ci/attest.shexists, so it activates itself in any repo adopting the convention and stays silent everywhere else — including this one. Available check names are read from the directory, not a list that could drift.Verified — 10 cases
git push/-u origin b/--force-with-lease# attest:ack,--dry-run,--deletegit status,th pearls pushbash scripts/ci/attest.sh --allgit pushin a repo without the script