Skip to content

th-6578ee: hook to steer agents from bare git push to scripts/ci/attest.sh - #336

Merged
brentrager merged 1 commit into
mainfrom
th-attest-hook
Aug 5, 2026
Merged

th-6578ee: hook to steer agents from bare git push to scripts/ci/attest.sh#336
brentrager merged 1 commit into
mainfrom
th-attest-hook

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Why

An agent won't adopt attestation from documentation alone. smooai's scripts/ci/attest.sh cuts an attested CI row from 5–38 min to ~8s, but only if something reminds you to run it instead of git push.

Same shape as th-curl-hint.sh: a PreToolUse Bash nudge.

Why not a git hook

Two independent reasons:

  • attest.sh pushes. That ordering is what stops the credit losing the race against the runner. A git pre-push hook calling it would re-enter itself forever.
  • smooai's pre-commit already 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:

  • a docs-only push doesn't need 10 minutes of checks
  • attesting test also skips its coverage artifact and sticky PR comment
  • a red local check may be the machine, not the code — two "test failures" chased on 2026-08-04 were load artifacts at load 61 (a 600ms mock timeout and a container-vs-host clock boundary), both green on a quiet box

Decline with # attest:ack reason=....

Repo-agnostic

Fires only where scripts/ci/attest.sh exists, 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

command
git push / -u origin b / --force-with-lease ASK
# attest:ack, --dry-run, --delete allow
git status, th pearls push allow
bash scripts/ci/attest.sh --all allow (no recursion)
git push in a repo without the script allow

…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
brentrager enabled auto-merge (squash) August 5, 2026 17:31
@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a05db63

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@smooai/smooth Patch

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

@brentrager
brentrager merged commit 0d29425 into main Aug 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant