Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(hooks): nudge trunk login to arm the merge-queue push guard (#87108)

Georges-Antoine Assi0ca0c00a5e3b
diff --git a/.husky/pre-push b/.husky/pre-push
index acee0733ac45..7aed0283f6d2 100755
--- a/.husky/pre-push
+++ b/.husky/pre-push
@@ -61,7 +61,13 @@ then
case "$trunk_out" in
# Deterministic auth/config errors: retrying cannot help, and most
# devs without a login would otherwise pay the retries on every push.
- *"not logged in"*|*"trunk login"*|*"trunk init"*) break ;;
+ *"not logged in"*|*"trunk login"*|*"trunk init"*)
+ if [ -z "$trunk_login_hint_shown" ]
+ then
+ trunk_login_hint_shown=1
+ echo "pre-push: trunk CLI is not logged in, so the merge-queue push guard is off. Run 'trunk login' once to enable it."
+ fi
+ break ;;
esac
sleep 1
done
diff --git a/AGENTS.md b/AGENTS.md
index a148f0cba197..05d3229715db 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -138,7 +138,7 @@ Never run `gh pr merge` or click the GitHub merge button — both are blocked by
Agents must not enqueue, merge, re-enqueue, or otherwise cause a PR to land without explicit user approval in the current conversation for the identified PR or stack. Do not infer that approval from requests to prepare a PR, move it toward merge, make it ready, monitor it, or resolve its blockers. Agents may inspect status, fix code and CI, apply `stamphog` when approval is missing, and report that a PR is ready; then they must wait for a direct instruction to merge or enqueue it.
- After explicit user approval: enqueue with `gh pr comment <number> --body "/trunk merge"`. Cancel: `gh pr comment <number> --body "/trunk cancel"`. Enqueueing a stacked PR also enqueues every unmerged layer below it — comment on the top PR to merge the whole stack. `--no-batch` opts the PR (or stack) out of batching.
-- The Trunk CLI is an alternative to the comments: `trunk merge <number>` enqueues, `trunk merge status <number>` inspects, `trunk merge cancel <number>` dequeues. It ships in the flox environment but needs a one-time interactive `trunk login`, so agents and headless environments should keep using the comments.
+- The Trunk CLI is an alternative to the comments: `trunk merge <number>` enqueues, `trunk merge status <number>` inspects, `trunk merge cancel <number>` dequeues. It ships in the flox environment and needs a one-time interactive `trunk login` — run it once even if you prefer the comments, because the same login arms the pre-push merge-queue guard that stops you from knocking a queued PR out of the queue. Agents and headless environments that can't complete the interactive login use the comments.
- Missing required approval: apply the `stamphog` label (`gh pr edit <number> --add-label stamphog`) to trigger the automated review-and-approve flow, and re-apply it whenever it was stripped (`REFUSED`/`ESCALATE` verdict) once the feedback is addressed — re-applying is always safe.
- After enqueueing, babysit the PR until it merges or fails — follow [`.agents/skills/merging-prs/SKILL.md`](./.agents/skills/merging-prs/SKILL.md) for the preflight, watch, and failure-handling loop.
- Queue progress is the `Trunk Merge Queue (master)` check run on the PR's head commit. The PR's own checks don't reflect the queue's testing — it runs CI on a `trunk-merge/**` branch.