Repository navigation
D268 — the pre-push hook fetches the default branch before refusing (#484) - #496
Merged
napkinstack-agent[bot] merged 2 commits intoNov 23, 2026
Merged
Conversation
…484) A merge of main made in another clone and fetched into FETCH_HEAD carried a squash merge the forge committed, through no ref the identity check reads; origin/main was stale, so the push was refused as another's identity. D264 covered claim's fetch only. On the refusal path only, .nstack/fitness-before-push.sh fetches the default branch of the remote it pushes to into refs/nstack-remote/base, as claim does, and counts again. A clean push fetches nothing; no remote-tracking branch moves; a failed fetch leaves the refusal as it was. Agent-Session: napkinstack-os-77 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…TCH_HEAD kept The refusal said the hook had fetched even when the fetch failed; it now gives the plain git fetch Action then. The fetch no longer writes FETCH_HEAD, which the agent may push again, and runs ssh in batch mode. Two surviving mutants are killed: a fetch on every push, the remote's name ignored. Agent-Session: napkinstack-os-77 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
napkinstack-admin
approved these changes
Nov 23, 2026
napkinstack-agent
Bot
deleted the
d268-push-hook-fetches-before-refusing
branch
November 23, 2026 07:15
This was referenced Nov 23, 2026
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.
Workstream
D268, from #484 (its CONFIRM failed on v0.34.5). Its row is in
docs/governance/workstreams.md.What it changes
In an agent's session, the pre-push hook refuses any commit the remote does not hold yet whose author or committer is not the agent. D264 counted what
nstack claimfetched (refs/nstack-remote/base) as the remote's. Downstream, a forge's squash merge took another route: a merge of main made in agit clone --shared, fetched into the agent's clone asFETCH_HEAD, then pushed by its sha.origin/mainwas stale, so the forge's commit (committernoreply@github.com) counted as unpublished and foreign:Now, on the refusal path only,
.nstack/fitness-before-push.shfetches the default branch of the remote it pushes to (PRE_COMMIT_REMOTE_NAME,originby default) intorefs/nstack-remote/base, which is the same ref claim writes, and counts again. Properties:FETCH_HEADmoves (--no-write-fetch-head).GIT_TERMINAL_PROMPT=0and ssh in batch mode: the fetch never asks for a credential.git fetchAction.The refusal's Action now says this fetch was already made, so that only a forge merge on another branch needs a
git fetch.Not taken: following each route by which a forge's commit can arrive. One fetch on the refusal path covers all of them.
Fresh verifier
Findings fixed in the second commit:
FETCH_HEAD, the very ref of the downstream route;Checked fine: pre-commit sets
PRE_COMMIT_REMOTE_NAME(a URL when the push names one, whichgit fetchaccepts); POSIX sh;refs/nstack-remote/baseis rewritten by claim's own fetch before every read inhold.py.What a project receives
One file:
.nstack/fitness-before-push.sh. Nothing that was green turns red. A push that was refused only because of a staleorigin/mainnow passes.Definition of Done
--sharedclone →FETCH_HEAD→ push by sha,origin/mainstale) was refused with the downstream message, and passes now. A second test checks that a made-up identity on top of a staleorigin/mainis still refused after the fetch.uv run bash platform/tests/run.shgreen, on a committed treeuv run nstack fitnessgreen🤖 Generated with Claude Code