/ship's push step ends with one line that says whether it pushed (GST-3053) (#4474)

/ship's push step now always ends with one line that says what happened:
`PUSH: pushed …`, `PUSH: already_pushed …` or `PUSH: failed reason=`,
with the remote, branch and full commit.

Why: an eval grader looked for a `git push` call and counted 48 real
/ship pushes as "no push"; scripts and graders can now match this one
line instead.

If a script of yours matched the old `PUSH: ALREADY_PUSHED ` or `PUSH:
pushed to origin/` lines, update it; the exit status is unchanged.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-18 03:56:41 +00:00
1 parent 9222485040
commit 33b1a965ba
19 files changed
+224 -61

No files matched your search

+3
View File
@@ -373,6 +373,9 @@ gstack_result_anchor() {
FETCH_VIOLATION) printf '%s' 'fetch-violation' ;;
FETCH_RERUN_BLOCKED) printf '%s' 'fetch-rerun-blocked' ;;
FETCH_RERUN_SPENT) printf '%s' 'fetch-rerun-spent' ;;
PUSH_REFUSED) printf '%s' 'push-refused' ;;
PUSH_REJECTED) printf '%s' 'push-rejected' ;;
PUSH_GIT_FAILED) printf '%s' 'push-git-failed' ;;
APPROVAL_RECORD_INVALID) printf '%s' 'approval-record-invalid' ;;
APPROVAL_RECORD_SECRET) printf '%s' 'approval-record-secret' ;;
APPROVAL_RECORD_NO_BRANCH) printf '%s' 'approval-record-no-branch' ;;
@@ -0,0 +1 @@
- **/ship's push step now always ends with one line that says whether it pushed (GST-3053).** `gstack-ship-release push` (Step 17) finishes with exactly one of `PUSH: pushed remote=origin ref=<branch> head=<full sha>`, `PUSH: already_pushed remote=origin ref=<branch> head=<full sha>` or `PUSH: failed reason=PUSH_REFUSED|PUSH_REJECTED|PUSH_GIT_FAILED`, so a script or eval grader can tell that /ship pushed by matching that line instead of looking for a `git push` call. Exit status is unchanged. Each reason code has a troubleshooting entry, and the format is documented in docs/unattended.md#push-line. An eval had graded 48 real /ship pushes as "no push" because it searched for the git command. The line's shape changed. The old `PUSH: ALREADY_PUSHED <short sha>` and `PUSH: pushed <short sha> to origin/<branch>` lines are gone, so update anything that matched them.
+34
View File
@@ -5788,6 +5788,40 @@ origin cannot be reached, from its local stable ref and release tags.
**Fix.** Run `git fetch origin --tags` in the gstack checkout, or point
`GSTACK_STABLE_REPO` at a gstack checkout that has the tags, then rerun.
<a id="push-refused"></a>
### `PUSH_REFUSED`
**Meaning.** `gstack-ship-release push` stopped before `git push` ran and
ended with `PUSH: failed reason=PUSH_REFUSED`: a usage error, HEAD on another
branch than Step 1 saved, the unanswered one-time pre-push offer, open gate
findings on a ready PR, sealed output, the early secrets scan, the pre-push
guards, or a never-pushed branch name that is not plain words. Nothing was
pushed. [The push line](unattended.md#push-line).
**Fix.** Follow the `STOP:` line printed just above it, then rerun
`gstack-ship-release push`.
<a id="push-rejected"></a>
### `PUSH_REJECTED`
**Meaning.** `git push` was rejected: the remote branch has commits this
branch lacks (non-fast-forward), or the remote refused the update. Nothing
was pushed.
**Fix.** Fetch and inspect the remote, merge it under Step 3's conflict
rules, run Steps 5-16 again, then rerun push. Never force-push.
<a id="push-git-failed"></a>
### `PUSH_GIT_FAILED`
**Meaning.** `git ls-remote` could not read the remote branch, or
`git push` failed for a reason other than a rejection: authentication, a
pre-push hook or the network. Nothing was pushed.
**Fix.** Repair the cause git printed in the `STOP:` line, repeat Step 16
(even when the content is unchanged), then rerun push. Never bypass a failed
guard.
<a id="queue-not-ready"></a>
### `QUEUE_NOT_READY`
+27
View File
@@ -167,6 +167,33 @@ generated tests), the parent pushes those commits itself, then reruns the
receipt write, the body post and `result` at the pushed head: a receipt for an
unpushed head is `QUEUE_RECEIPT_STALE` to the queue.
<a id="push-line"></a>
### The push line: `PUSH:`
Step 17's `gstack-ship-release push` (early or final) always ends with exactly
one line saying whether the branch reached the remote, so a parent, a report or
an outside probe can tell that `/ship` pushed without looking for a
`git push` call:
```
PUSH: pushed remote=origin ref=<branch> head=<full sha>
PUSH: already_pushed remote=origin ref=<branch> head=<full sha>
PUSH: failed reason=<code>
```
`pushed` means this run's `git push` updated the branch; `already_pushed`
means the remote branch already pointed at HEAD, so nothing was sent. `failed`
means nothing was pushed, with one of three codes:
[`PUSH_REFUSED`](troubleshooting.md#push-refused) (a check stopped it before
`git push` ran), [`PUSH_REJECTED`](troubleshooting.md#push-rejected)
(non-fast-forward, or the remote refused the update) and
[`PUSH_GIT_FAILED`](troubleshooting.md#push-git-failed) (git could not read
the remote, or `git push` failed on authentication, a hook or the network).
The line is the last one printed, after any `STOP:` or `NEXT:` line, on
stdout (stderr for a usage error), and the exit status keeps its meaning: 0
for `pushed` and `already_pushed`, 3 for a stop, 2 for a usage error. Match
`^PUSH: (pushed|already_pushed) ` for "this run's branch is on the remote".
### The review loop's counters
The receipt's `review_loop` object, written from `gstack-review-scope summary
+16
View File
@@ -607,4 +607,20 @@ export const RELEASE_RESULT_CODES = {
summary: 'the stage\'s one rerun fetched too, so the pass stopped with its readers quarantined, resuming it starts no later stage and returns no reader output, and verify refuses',
fix: 'deal with the printed paths, find out why readers keep fetching, then start a fresh pass under a new --pass and --out; a third attempt is never automatic',
},
// GST-3053: gstack-ship-release push's last line, `PUSH: failed reason=<code>` (docs/unattended.md#push-line).
PUSH_REFUSED: {
anchor: 'push-refused',
summary: 'gstack-ship-release push stopped before git push ran (a usage error, the wrong branch, the unanswered pre-push offer, open gate findings on a ready PR, sealed output, the secrets scan, the pre-push guards or a branch name that is not plain words), so nothing was pushed',
fix: 'follow the STOP: line above it, then rerun gstack-ship-release push',
},
PUSH_REJECTED: {
anchor: 'push-rejected',
summary: 'git push was rejected: the remote branch has commits this branch lacks (non-fast-forward) or the remote refused the update, so nothing was pushed',
fix: 'fetch and merge the remote under Step 3\'s conflict rules, run Steps 5-16 again, then rerun push; never force-push',
},
PUSH_GIT_FAILED: {
anchor: 'push-git-failed',
summary: 'git could not read the remote branch or git push failed for another reason (authentication, a pre-push hook or the network), so nothing was pushed',
fix: 'repair the cause git printed in the STOP: line, repeat Step 16, then rerun push; never bypass a guard',
},
} as const satisfies Record<string, ResultCode>;
+31 -21
View File
@@ -737,7 +737,7 @@ export async function accept(argv: readonly string[], cwd: string): Promise<Repo
* final, so a stale golden, a size ratchet or a type error fails here instead of a CI round. A pass recorded at HEAD's
* exact tree by this step or by finish's preflight (both under .git, which no commit can carry) is reused, never rerun.
*/
function prepushGuards(cwd: string, branch: string, base: string | undefined): { line: string; stop?: string } {
function prepushGuards(cwd: string, branch: string, base: string | undefined): { line: string; stop?: string; code?: PushFailure } {
const gitPath = (name: string) => path.resolve(cwd, git(cwd, ['rev-parse', '--git-path', `gstack/${name}`]).stdout.trim() || `.git/gstack/${name}`);
const tree = git(cwd, ['rev-parse', 'HEAD^{tree}']).stdout.trim();
const out = gitPath('pregate-guards.json');
@@ -752,7 +752,7 @@ function prepushGuards(cwd: string, branch: string, base: string | undefined): {
let res: { status?: string; verdict?: string; tree?: string; code?: string; detail?: string; fix?: string; checks?: { id: string; status: string; detail?: string; fix?: string }[] } = {};
try { res = JSON.parse(pg.stdout.trim().split('\n').pop() ?? ''); } catch { /* unreadable: stops below */ }
const heads = res.status === 'refused' && res.code === 'POLICY_SOURCE_UNAVAILABLE' ? git(cwd, ['ls-remote', '--heads', 'origin'], 120_000) : null;
if (heads && heads.status !== 0) return { line: 'GUARDS: not run (origin unreachable)', stop: `cannot verify the remote branch (${firstLine(heads.stderr)}): restore access before pushing` };
if (heads && heads.status !== 0) return { line: 'GUARDS: not run (origin unreachable)', stop: `cannot verify the remote branch (${firstLine(heads.stderr)}): restore access before pushing`, code: 'PUSH_GIT_FAILED' };
if (heads && heads.stdout.split('\n').every(l => !l.trim() || l.trim().endsWith(`\trefs/heads/${branch}`))) return { line: `GUARDS: not run (origin has no branch but ${branch}, so no base to read guards from)` };
if (res.status === 'refused') return { line: `GUARDS: refused ${res.code}`, stop: `the pre-push guards could not run (${res.detail}; fix: ${res.fix}): repair it, then rerun push` };
const bad = (res.checks ?? []).filter(c => c.status !== 'pass' && c.status !== 'warn').map(c => `${c.id}: ${c.fix ?? c.detail ?? c.status}`).join('; ');
@@ -764,60 +764,70 @@ function prepushGuards(cwd: string, branch: string, base: string | undefined): {
return { line, stop: `the pre-push guards did not pass (${bad || firstLine(pg.stderr || pg.stdout)}): fix it, commit, then rerun push` };
}
/** Every push run's last line (docs/unattended.md#push-line): outside observers match it instead of a git push call. */
export type PushFailure = 'PUSH_REFUSED' | 'PUSH_REJECTED' | 'PUSH_GIT_FAILED';
export const pushFailedLine = (code: PushFailure) => `PUSH: failed reason=${code}`;
export function push(argv: readonly string[], cwd: string): Report {
const { flag, has } = flagReader(argv);
const r = new Report();
return r.add(pushOnce(argv, cwd, r));
}
function pushOnce(argv: readonly string[], cwd: string, r: Report): string {
const { flag, has } = flagReader(argv);
const refuse = (what: string, code: PushFailure = 'PUSH_REFUSED') => { r.stop(what); return pushFailedLine(code); };
const branch = git(cwd, ['branch', '--show-current']).stdout.trim();
if (!branch) return r.stop('detached HEAD: push needs the feature branch');
if (branch !== flag('--branch')) return r.stop(`HEAD is on ${branch}, not the branch Step 1 saved (${flag('--branch')}): check out the saved branch, then rerun push`);
if (!branch) return refuse('detached HEAD: push needs the feature branch');
if (branch !== flag('--branch')) return refuse(`HEAD is on ${branch}, not the branch Step 1 saved (${flag('--branch')}): check out the saved branch, then rerun push`);
const guard = bin(cwd, 'gstack-config', ['get', 'redact_prepush_hook'], 30_000).stdout.trim() || 'false';
const prompted = fs.existsSync(path.join(resolveStateRoot(process.env), '.redact-prepush-prompted'));
const deferred = guard !== 'true' && !prompted && process.env.GSTACK_SESSION_KIND === 'unattended';
r.add(`REDACT_PREPUSH: ${guard} prompted=${prompted ? 'yes' : 'no'}${deferred ? ' deferred=unattended' : ''}`);
if (guard !== 'true' && !prompted && !deferred) return r.stop('Step 17\'s one-time pre-push guard offer is unanswered: run the guard block and ask it, then rerun push');
if (guard !== 'true' && !prompted && !deferred) return refuse('Step 17\'s one-time pre-push guard offer is unanswered: run the guard block and ask it, then rerun push');
const gateOpen = Number(flag('--gate-open') ?? '0');
if (gateOpen > 0) {
if (!hostedOrigin(cwd)) return r.stop('open-PR lookup unavailable: origin is a local path, not a hosted remote gh can map; it must succeed before pushing open gate findings');
if (!hostedOrigin(cwd)) return refuse('open-PR lookup unavailable: origin is a local path, not a hosted remote gh can map; it must succeed before pushing open gate findings');
const pr = gh(cwd, ['pr', 'list', '--head', branch, '--state', 'open', '--json', 'number,isDraft', '--jq', '[.[] | select(.isDraft | not) | .number] | first // empty']);
if (pr.status !== 0) return r.stop(`open-PR lookup failed (${firstLine(pr.stderr)}): it must succeed before pushing open gate findings`);
if (pr.stdout.trim() && !has('--gate-open-approved')) return r.stop(`${gateOpen} open gate finding(s) and ready PR #${pr.stdout.trim()}: spawned/headless sessions stop here; otherwise ask (resolve now, or publish with the banner and rerun with --gate-open-approved)`);
if (pr.status !== 0) return refuse(`open-PR lookup failed (${firstLine(pr.stderr)}): it must succeed before pushing open gate findings`);
if (pr.stdout.trim() && !has('--gate-open-approved')) return refuse(`${gateOpen} open gate finding(s) and ready PR #${pr.stdout.trim()}: spawned/headless sessions stop here; otherwise ask (resolve now, or publish with the banner and rerun with --gate-open-approved)`);
}
const sealed = bin(cwd, 'gstack-pregate', ['sealed'], 120_000);
r.add(`SEALED: ${sealed.status === 0 ? 'clear' : sealed.status === 1 ? 'refused' : `not checked (exit ${sealed.status})`}`);
if (sealed.status === 1) return r.stop(`sealed output would be published: ${firstLine(sealed.stderr)}; remove it from the commits, then repeat Step 16`);
if (sealed.status !== 0) return r.stop(`the sealed-output guard did not run (exit ${sealed.status}: ${firstLine(sealed.stderr || sealed.stdout)}); repair it, then rerun push`);
if (sealed.status === 1) return refuse(`sealed output would be published: ${firstLine(sealed.stderr)}; remove it from the commits, then repeat Step 16`);
if (sealed.status !== 0) return refuse(`the sealed-output guard did not run (exit ${sealed.status}: ${firstLine(sealed.stderr || sealed.stdout)}); repair it, then rerun push`);
if (has('--early')) {
const out = path.resolve(cwd, git(cwd, ['rev-parse', '--git-path', 'gstack/pregate-early-push.json']).stdout.trim() || '.git/gstack/pregate-early-push.json');
const scan = bin(cwd, 'gstack-pregate', ['--stage', 'preflight', '--only', 'secrets', '--out', out, ...(flag('--base') ? ['--base', flag('--base')!] : [])], 600_000);
const verdict = /^PREGATE: (.+?) tree=/m.exec(scan.stdout + scan.stderr)?.[1] ?? `unreadable (exit ${scan.status})`;
r.add(`SECRETS: ${verdict} (early push)`);
if (scan.status !== 0 || !/^(pass|warn)/.test(verdict)) return r.stop(`the secrets scan did not pass before the early push (${firstLine(scan.stderr) || verdict}): remove the finding from the commits, then rerun push --early`);
if (scan.status !== 0 || !/^(pass|warn)/.test(verdict)) return refuse(`the secrets scan did not pass before the early push (${firstLine(scan.stderr) || verdict}): remove the finding from the commits, then rerun push --early`);
}
const guards = prepushGuards(cwd, branch, flag('--base'));
r.add(guards.line);
if (guards.stop) return r.stop(guards.stop);
if (guards.stop) return refuse(guards.stop, guards.code);
const local = git(cwd, ['rev-parse', 'HEAD']).stdout.trim();
const remote = git(cwd, ['ls-remote', '--heads', 'origin', `refs/heads/${branch}`], 120_000);
if (remote.status !== 0) return r.stop(`cannot verify the remote branch (${firstLine(remote.stderr)}): restore access before pushing`);
if (remote.stdout.split(/\s/)[0] === local) return r.add(`PUSH: ALREADY_PUSHED ${local.slice(0, 12)}`).next('Step 18');
if (remote.status !== 0) return refuse(`cannot verify the remote branch (${firstLine(remote.stderr)}): restore access before pushing`, 'PUSH_GIT_FAILED');
if (remote.stdout.split(/\s/)[0] === local) { r.next('Step 18'); return `PUSH: already_pushed remote=origin ref=${branch} head=${local}`; }
let plain: PlainFinding[] = [];
try { if (!remote.stdout.trim()) plain = checkBranch(branch, loadPlainTitlePolicy(git(cwd, ['rev-parse', '--show-toplevel']).stdout.trim())); }
catch (e: any) { return r.stop(`.gstack/plain-titles.json is invalid (${e.message}): fix it, then rerun push`); }
if (plain.length) return r.add(`BRANCH: refused ${plain.map(f => `"${f.match}"`).join(', ')}`).stop(`the branch name ${branch} is not plain words (docs/ship-policy.md#plain-titles): rename it with git branch -m <plain words>[-<issue code>], then rerun push --branch <new name>`);
catch (e: any) { return refuse(`.gstack/plain-titles.json is invalid (${e.message}): fix it, then rerun push`); }
if (plain.length) { r.add(`BRANCH: refused ${plain.map(f => `"${f.match}"`).join(', ')}`); return refuse(`the branch name ${branch} is not plain words (docs/ship-policy.md#plain-titles): rename it with git branch -m <plain words>[-<issue code>], then rerun push --branch <new name>`); }
const p = git(cwd, ['push', '-u', 'origin', branch], 600_000);
if (p.status !== 0) {
const nff = /non-fast-forward|fetch first|rejected/.test(p.stderr);
return r.stop(nff ? 'non-fast-forward: fetch and merge the remote under Step 3\'s conflict rules, run Steps 5-16, then push again; never force-push'
: `push failed (${firstLine(p.stderr)}): repair the auth, hook or network cause, repeat Step 16, then push; never bypass a guard`);
return nff ? refuse('non-fast-forward: fetch and merge the remote under Step 3\'s conflict rules, run Steps 5-16, then push again; never force-push', 'PUSH_REJECTED')
: refuse(`push failed (${firstLine(p.stderr)}): repair the auth, hook or network cause, repeat Step 16, then push; never bypass a guard`, 'PUSH_GIT_FAILED');
}
return r.add(`PUSH: pushed ${local.slice(0, 12)} to origin/${branch}`).next('Step 18');
r.next('Step 18');
return `PUSH: pushed remote=origin ref=${branch} head=${local}`;
}
export async function release(argv: readonly string[], cwd: string): Promise<{ text: string; exit: number }> {
const [cmd, ...rest] = argv;
const { flag, has } = flagReader(rest);
if (!cmd || cmd === '--help' || cmd === '-h' || has('--help')) return { text: RELEASE_HELP + '\n', exit: cmd ? 0 : 2 };
const usage = (m: string) => ({ text: `gstack-ship-release: ${m}\n`, exit: 2 });
const usage = (m: string) => ({ text: `gstack-ship-release: ${m}\n${cmd === 'push' ? `${pushFailedLine('PUSH_REFUSED')}\n` : ''}`, exit: 2 });
if (cmd !== 'push' && !flag('--base')) return usage(`${cmd} needs --base <base>`);
if (cmd === 'push' && !flag('--branch')) return usage('push needs --branch <the branch Step 1 saved>');
if (cmd === 'accept' && !(lanes(rest) as unknown[]).length) return usage('accept needs at least one --lane <label>=<command> (the Step 5 lanes)');
+3 -3
View File
@@ -109,9 +109,9 @@ One re-audit at most.
Commit bisectably; `gstack-ship-release finish --base <base> --reviewed-tree <t> --reviewed-base <b>
--docs-post <post> --lane ... [--build <cmd>] --trailer '<t>' [--plan <line>]`: `PLAN:`, `ROUTE:`, `DOCS:`, `EVIDENCE:` (FRESH;
STALE or MISSING reruns once), `PREGATE:`; print them, the last `Gate edits:` and each `tests_ran`. Then
`gstack-ship-release push --branch <branch> [--gate-open <n>]`: `REDACT_PREPUSH:`, `SEALED:`, `GUARDS:`, `PUSH:`
(pushed, ALREADY_PUSHED). `EVIDENCE: DEFERRED`: the `accept` its `NEXT:` names; final-head
repo gates run beside CI. Unattended, push defers the pre-push offer; else its STOP runs Step 17's guard block (`HOOK_STATE:`, `HOOKS_IN_GIT_DIR:`, `PREPUSH_PROMPTED:`). Never force-push.
`gstack-ship-release push --branch <branch> [--gate-open <n>]`: `REDACT_PREPUSH:`, `SEALED:`, `GUARDS:`, `PUSH:` last:
pushed|already_pushed|failed. `EVIDENCE: DEFERRED`: the `accept` `NEXT:` names; final-head
repo gates run with CI. Unattended, push defers the pre-push offer; else its STOP runs Step 17's guard block (`HOOK_STATE:`, `HOOKS_IN_GIT_DIR:`, `PREPUSH_PROMPTED:`). Never force-push.
## 8. Publish: Steps 18, 19, 19-C, 20, 21, 22
+3 -3
View File
@@ -107,9 +107,9 @@ One re-audit at most.
Commit bisectably; `gstack-ship-release finish --base <base> --reviewed-tree <t> --reviewed-base <b>
--docs-post <post> --lane ... [--build <cmd>] --trailer '<t>' [--plan <line>]`: `PLAN:`, `ROUTE:`, `DOCS:`, `EVIDENCE:` (FRESH;
STALE or MISSING reruns once), `PREGATE:`; print them, the last `Gate edits:` and each `tests_ran`. Then
`gstack-ship-release push --branch <branch> [--gate-open <n>]`: `REDACT_PREPUSH:`, `SEALED:`, `GUARDS:`, `PUSH:`
(pushed, ALREADY_PUSHED). `EVIDENCE: DEFERRED`: the `accept` its `NEXT:` names; final-head
repo gates run beside CI. Unattended, push defers the pre-push offer; else its STOP runs Step 17's guard block (`HOOK_STATE:`, `HOOKS_IN_GIT_DIR:`, `PREPUSH_PROMPTED:`). Never force-push.
`gstack-ship-release push --branch <branch> [--gate-open <n>]`: `REDACT_PREPUSH:`, `SEALED:`, `GUARDS:`, `PUSH:` last:
pushed|already_pushed|failed. `EVIDENCE: DEFERRED`: the `accept` `NEXT:` names; final-head
repo gates run with CI. Unattended, push defers the pre-push offer; else its STOP runs Step 17's guard block (`HOOK_STATE:`, `HOOKS_IN_GIT_DIR:`, `PREPUSH_PROMPTED:`). Never force-push.
## 8. Publish: Steps 18, 19, 19-C, 20, 21, 22
+5 -4
View File
@@ -865,16 +865,17 @@ A new PR or an existing draft needs no question: Step 19 creates or keeps the dr
~/.claude/skills/gstack/bin/gstack-ship-release push --branch <branch-name>
```
It checks the branch, the offer, the gate above (`--gate-open <n>`; `--gate-open-approved` is B)
`gstack-pregate sealed` and push guards, then `git ls-remote --heads origin refs/heads/<branch-name>` against HEAD: a failed lookup STOPs, a match prints
`PUSH: ALREADY_PUSHED` (go to Step 18), else it runs `git push -u origin <branch-name>`.
It checks the branch, the offer, the gate above (`--gate-open <n>`; `--gate-open-approved` is B),
the sealed and push guards, then `git ls-remote --heads origin refs/heads/<branch-name>` against HEAD: a failed lookup STOPs,
a match is `already_pushed` (Step 18), else `git push -u`. It ends with
`PUSH: pushed|already_pushed|failed …`; quote it.
**If the push fails, STOP.** No Step 19 or publication claim. Report the error:
- **Non-fast-forward push:** fetch and inspect the remote, then merge under Step 3's
conflict rules. Run Steps 5–16 before returning to Step 17. Never rewrite history.
- **Authentication, hook or network failure:** repair the cause, then repeat Step 16
even with unchanged content before returning to Step 17. Never bypass failed guards.
Never force-push. Only a successful push or verified `ALREADY_PUSHED` proceeds.
Never force-push. Only a successful push or `already_pushed` proceeds.
After `EVIDENCE: DEFERRED`, run Step 5's `gstack-ship-release accept`; a `STOP:` there
is a failed lane (stage 4). Continue to Step 18. No documentation writer runs after push.
+5 -4
View File
@@ -586,16 +586,17 @@ A new PR or an existing draft needs no question: Step 19 creates or keeps the dr
~/.claude/skills/gstack/bin/gstack-ship-release push --branch <branch-name>
```
It checks the branch, the offer, the gate above (`--gate-open <n>`; `--gate-open-approved` is B)
`gstack-pregate sealed` and push guards, then `git ls-remote --heads origin refs/heads/<branch-name>` against HEAD: a failed lookup STOPs, a match prints
`PUSH: ALREADY_PUSHED` (go to Step 18), else it runs `git push -u origin <branch-name>`.
It checks the branch, the offer, the gate above (`--gate-open <n>`; `--gate-open-approved` is B),
the sealed and push guards, then `git ls-remote --heads origin refs/heads/<branch-name>` against HEAD: a failed lookup STOPs,
a match is `already_pushed` (Step 18), else `git push -u`. It ends with
`PUSH: pushed|already_pushed|failed …`; quote it.
**If the push fails, STOP.** No Step 19 or publication claim. Report the error:
- **Non-fast-forward push:** fetch and inspect the remote, then merge under Step 3's
conflict rules. Run Steps 5–16 before returning to Step 17. Never rewrite history.
- **Authentication, hook or network failure:** repair the cause, then repeat Step 16
even with unchanged content before returning to Step 17. Never bypass failed guards.
Never force-push. Only a successful push or verified `ALREADY_PUSHED` proceeds.
Never force-push. Only a successful push or `already_pushed` proceeds.
After `EVIDENCE: DEFERRED`, run Step 5's `gstack-ship-release accept`; a `STOP:` there
is a failed lane (stage 4). Continue to Step 18. No documentation writer runs after push.
+5 -4
View File
@@ -867,16 +867,17 @@ A new PR or an existing draft needs no question: Step 19 creates or keeps the dr
~/.gemini/antigravity-cli/skills/gstack/bin/gstack-ship-release push --branch <branch-name>
```
It checks the branch, the offer, the gate above (`--gate-open <n>`; `--gate-open-approved` is B)
`gstack-pregate sealed` and push guards, then `git ls-remote --heads origin refs/heads/<branch-name>` against HEAD: a failed lookup STOPs, a match prints
`PUSH: ALREADY_PUSHED` (go to Step 18), else it runs `git push -u origin <branch-name>`.
It checks the branch, the offer, the gate above (`--gate-open <n>`; `--gate-open-approved` is B),
the sealed and push guards, then `git ls-remote --heads origin refs/heads/<branch-name>` against HEAD: a failed lookup STOPs,
a match is `already_pushed` (Step 18), else `git push -u`. It ends with
`PUSH: pushed|already_pushed|failed …`; quote it.
**If the push fails, STOP.** No Step 19 or publication claim. Report the error:
- **Non-fast-forward push:** fetch and inspect the remote, then merge under Step 3's
conflict rules. Run Steps 5–16 before returning to Step 17. Never rewrite history.
- **Authentication, hook or network failure:** repair the cause, then repeat Step 16
even with unchanged content before returning to Step 17. Never bypass failed guards.
Never force-push. Only a successful push or verified `ALREADY_PUSHED` proceeds.
Never force-push. Only a successful push or `already_pushed` proceeds.
After `EVIDENCE: DEFERRED`, run Step 5's `gstack-ship-release accept`; a `STOP:` there
is a failed lane (stage 4). Continue to Step 18. No documentation writer runs after push.
+5 -4
View File
@@ -865,16 +865,17 @@ A new PR or an existing draft needs no question: Step 19 creates or keeps the dr
~/.claude/skills/gstack/bin/gstack-ship-release push --branch <branch-name>
```
It checks the branch, the offer, the gate above (`--gate-open <n>`; `--gate-open-approved` is B)
`gstack-pregate sealed` and push guards, then `git ls-remote --heads origin refs/heads/<branch-name>` against HEAD: a failed lookup STOPs, a match prints
`PUSH: ALREADY_PUSHED` (go to Step 18), else it runs `git push -u origin <branch-name>`.
It checks the branch, the offer, the gate above (`--gate-open <n>`; `--gate-open-approved` is B),
the sealed and push guards, then `git ls-remote --heads origin refs/heads/<branch-name>` against HEAD: a failed lookup STOPs,
a match is `already_pushed` (Step 18), else `git push -u`. It ends with
`PUSH: pushed|already_pushed|failed …`; quote it.
**If the push fails, STOP.** No Step 19 or publication claim. Report the error:
- **Non-fast-forward push:** fetch and inspect the remote, then merge under Step 3's
conflict rules. Run Steps 5–16 before returning to Step 17. Never rewrite history.
- **Authentication, hook or network failure:** repair the cause, then repeat Step 16
even with unchanged content before returning to Step 17. Never bypass failed guards.
Never force-push. Only a successful push or verified `ALREADY_PUSHED` proceeds.
Never force-push. Only a successful push or `already_pushed` proceeds.
After `EVIDENCE: DEFERRED`, run Step 5's `gstack-ship-release accept`; a `STOP:` there
is a failed lane (stage 4). Continue to Step 18. No documentation writer runs after push.
+5 -4
View File
@@ -873,16 +873,17 @@ A new PR or an existing draft needs no question: Step 19 creates or keeps the dr
$GSTACK_ROOT/bin/gstack-ship-release push --branch <branch-name>
```
It checks the branch, the offer, the gate above (`--gate-open <n>`; `--gate-open-approved` is B)
`gstack-pregate sealed` and push guards, then `git ls-remote --heads origin refs/heads/<branch-name>` against HEAD: a failed lookup STOPs, a match prints
`PUSH: ALREADY_PUSHED` (go to Step 18), else it runs `git push -u origin <branch-name>`.
It checks the branch, the offer, the gate above (`--gate-open <n>`; `--gate-open-approved` is B),
the sealed and push guards, then `git ls-remote --heads origin refs/heads/<branch-name>` against HEAD: a failed lookup STOPs,
a match is `already_pushed` (Step 18), else `git push -u`. It ends with
`PUSH: pushed|already_pushed|failed …`; quote it.
**If the push fails, STOP.** No Step 19 or publication claim. Report the error:
- **Non-fast-forward push:** fetch and inspect the remote, then merge under Step 3's
conflict rules. Run Steps 5–16 before returning to Step 17. Never rewrite history.
- **Authentication, hook or network failure:** repair the cause, then repeat Step 16
even with unchanged content before returning to Step 17. Never bypass failed guards.
Never force-push. Only a successful push or verified `ALREADY_PUSHED` proceeds.
Never force-push. Only a successful push or `already_pushed` proceeds.
After `EVIDENCE: DEFERRED`, run Step 5's `gstack-ship-release accept`; a `STOP:` there
is a failed lane (stage 4). Continue to Step 18. No documentation writer runs after push.
+5 -4
View File
@@ -875,16 +875,17 @@ A new PR or an existing draft needs no question: Step 19 creates or keeps the dr
$GSTACK_ROOT/bin/gstack-ship-release push --branch <branch-name>
```
It checks the branch, the offer, the gate above (`--gate-open <n>`; `--gate-open-approved` is B)
`gstack-pregate sealed` and push guards, then `git ls-remote --heads origin refs/heads/<branch-name>` against HEAD: a failed lookup STOPs, a match prints
`PUSH: ALREADY_PUSHED` (go to Step 18), else it runs `git push -u origin <branch-name>`.
It checks the branch, the offer, the gate above (`--gate-open <n>`; `--gate-open-approved` is B),
the sealed and push guards, then `git ls-remote --heads origin refs/heads/<branch-name>` against HEAD: a failed lookup STOPs,
a match is `already_pushed` (Step 18), else `git push -u`. It ends with
`PUSH: pushed|already_pushed|failed …`; quote it.
**If the push fails, STOP.** No Step 19 or publication claim. Report the error:
- **Non-fast-forward push:** fetch and inspect the remote, then merge under Step 3's
conflict rules. Run Steps 5–16 before returning to Step 17. Never rewrite history.
- **Authentication, hook or network failure:** repair the cause, then repeat Step 16
even with unchanged content before returning to Step 17. Never bypass failed guards.
Never force-push. Only a successful push or verified `ALREADY_PUSHED` proceeds.
Never force-push. Only a successful push or `already_pushed` proceeds.
After `EVIDENCE: DEFERRED`, run Step 5's `gstack-ship-release accept`; a `STOP:` there
is a failed lane (stage 4). Continue to Step 18. No documentation writer runs after push.
+1 -1
View File
@@ -87,7 +87,7 @@ describe('ship/DRIVER.md covers the skeleton', () => {
...[...body.matchAll(/`[A-Z][A-Z0-9_]+: ([A-Z][A-Z0-9_]+)`/g)].map(m => m[1]!),
...Object.keys(RESULT_CODES).filter(k => new RegExp(`\\b${k}\\b`).test(body)),
]);
for (const code of ['STOP:', 'NEXT:', 'CARRY:', 'GSTACK_RESULT:', 'ALREADY_BUMPED', 'NO_VERSION', 'FRESH', 'ZERO-RUN', 'ALREADY_PUSHED', 'QUEUE_RECEIPT_STALE']) expect(codes).toContain(code);
for (const code of ['STOP:', 'NEXT:', 'CARRY:', 'GSTACK_RESULT:', 'ALREADY_BUMPED', 'NO_VERSION', 'FRESH', 'ZERO-RUN', 'PUSH:', 'QUEUE_RECEIPT_STALE']) expect(codes).toContain(code);
expect([...codes].filter(c => !doc.includes(c) && !bins.includes(c))).toEqual([]);
});
+4 -3
View File
@@ -239,15 +239,16 @@ test('push idempotency requires the live remote SHA and fails closed on transpor
expect(step17).toContain('gstack-ship-release push');
expect(step17).toContain('a failed lookup STOPs');
const push = () => spawnSync(path.join(SHIP_DIR, '..', 'bin', 'gstack-ship-release'), ['push', '--branch', 'feature'], { cwd, env, encoding: 'utf8', timeout: 60_000 });
expect(push().stdout).toMatch(/PUSH: pushed [0-9a-f]{12} to origin\/feature/);
expect(push().stdout).toContain('PUSH: ALREADY_PUSHED');
expect(push().stdout).toMatch(/PUSH: pushed remote=origin ref=feature head=[0-9a-f]{40}/);
expect(push().stdout).toContain('PUSH: already_pushed remote=origin ref=feature head=');
fs.appendFileSync(path.join(cwd, 'app'), 'new\n'); git('commit', '-am', 'new');
expect(push().stdout).toMatch(/PUSH: pushed /);
fs.renameSync(remote, remote + '-offline');
const unavailable = push();
expect(unavailable.status).toBe(3);
expect(unavailable.stdout).not.toContain('ALREADY_PUSHED');
expect(unavailable.stdout).not.toContain('already_pushed');
expect(unavailable.stdout).toContain('STOP: cannot verify the remote branch');
expect(unavailable.stdout.trimEnd().split('\n').pop()).toBe('PUSH: failed reason=PUSH_GIT_FAILED');
} finally { fs.rmSync(cwd, { recursive: true, force: true }); fs.rmSync(state, { recursive: true, force: true }); }
}, 120_000);
+66 -5
View File
@@ -6,6 +6,7 @@
import { afterEach, describe, expect, setDefaultTimeout, test } from 'bun:test';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { RESULT_CODES } from '../lib/result-codes';
import { BUMP_NEVER_KEY_VERSION } from '../lib/ship-policy';
import { lineOf, RELEASE, shipFixture, type ShipFx } from './helpers/ship-bin-fixture';
@@ -262,7 +263,7 @@ describe('finish (Steps 15-16)', () => {
});
describe('push (Step 17)', () => {
// Value: protects=push refuses a branch other than Step 1's saved one, waits for the one-time guard offer, refuses open gate findings on a ready PR without approval, then pushes once and reports ALREADY_PUSHED after; fails_when=it pushes past an unanswered offer or a ready PR with open gate findings, or pushes twice;
// Value: protects=push refuses a branch other than Step 1's saved one, waits for the one-time guard offer, refuses open gate findings on a ready PR without approval, then pushes once and reports already_pushed after; fails_when=it pushes past an unanswered offer or a ready PR with open gate findings, or pushes twice;
// why_new=moved from Step 17's idempotency block; seam=gstack-config, gh, git ls-remote, gstack-pregate sealed; no_claim=the guard block's hook install
test('an unanswered guard offer stops; open gate findings on a ready PR stop; then it pushes once', () => {
const f = fx();
@@ -281,8 +282,8 @@ describe('push (Step 17)', () => {
expect(gate.stdout).toContain('STOP: 2 open gate finding(s) and ready PR #12');
const pushed = f.run(RELEASE, ['push', '--branch', 'feat']);
expect(pushed.status).toBe(0);
expect(lineOf(pushed.stdout, 'PUSH')).toMatch(/^PUSH: pushed [0-9a-f]{12} to origin\/feat$/);
expect(lineOf(f.run(RELEASE, ['push', '--branch', 'feat']).stdout, 'PUSH')).toMatch(/^PUSH: ALREADY_PUSHED /);
expect(lineOf(pushed.stdout, 'PUSH')).toMatch(/^PUSH: pushed remote=origin ref=feat head=[0-9a-f]{40}$/);
expect(lineOf(f.run(RELEASE, ['push', '--branch', 'feat']).stdout, 'PUSH')).toMatch(/^PUSH: already_pushed remote=origin ref=feat head=[0-9a-f]{40}$/);
});
// Value: protects=an unattended push defers the one-time guard offer instead of stopping, and leaves the offer open for the next interactive session (no marker, no hook); fails_when=unattended push stops on the offer (replays 8G #34, 8G #36 and 9G each spent calls on it), writes .redact-prepush-prompted, or installs a hook;
@@ -292,7 +293,7 @@ describe('push (Step 17)', () => {
const r = f.run(RELEASE, ['push', '--branch', 'feat'], { GSTACK_SESSION_KIND: 'unattended' });
expect(r.status, r.stdout + r.stderr).toBe(0);
expect(lineOf(r.stdout, 'REDACT_PREPUSH')).toBe('REDACT_PREPUSH: false prompted=no deferred=unattended');
expect(lineOf(r.stdout, 'PUSH')).toMatch(/^PUSH: pushed [0-9a-f]{12} to origin\/feat$/);
expect(lineOf(r.stdout, 'PUSH')).toMatch(/^PUSH: pushed remote=origin ref=feat head=[0-9a-f]{40}$/);
expect(fs.existsSync(path.join(f.state, '.redact-prepush-prompted'))).toBe(false);
expect(fs.existsSync(path.join(f.work, '.git', 'hooks', 'pre-push'))).toBe(false);
});
@@ -326,7 +327,67 @@ describe('push (Step 17)', () => {
f.git('branch', '-m', 'faster-checks-gst-1825');
const ok = f.run(RELEASE, ['push', '--branch', 'faster-checks-gst-1825'], { GSTACK_SESSION_KIND: 'unattended' });
expect(ok.status, ok.stdout + ok.stderr).toBe(0);
expect(lineOf(ok.stdout, 'PUSH')).toMatch(/^PUSH: pushed [0-9a-f]{12} to origin\/faster-checks-gst-1825$/);
expect(lineOf(ok.stdout, 'PUSH')).toMatch(/^PUSH: pushed remote=origin ref=faster-checks-gst-1825 head=[0-9a-f]{40}$/);
});
});
describe('push: one stable PUSH line outside tools can match (GST-3053)', () => {
// Value: protects=every push run ends with exactly one PUSH: line, pushed or already_pushed with remote, branch and full head, or failed with a registered reason code, so a probe or report can tell that /ship pushed without seeing a git push call;
// fails_when=a push prints no line, two lines, a short sha, or a reason code with no troubleshooting row; why_new=harness-evals#487 graded 48 real /ship pushes as no push; seam=git push and ls-remote against the fixture's bare origin; no_claim=hosted remotes
const UNATTENDED = { GSTACK_SESSION_KIND: 'unattended' };
const pushLines = (out: string) => out.split('\n').filter(l => l.startsWith('PUSH: '));
const last = (out: string) => out.trimEnd().split('\n').pop();
const remoteHead = (f: ShipFx) => f.git('ls-remote', '--heads', 'origin', 'refs/heads/feat').stdout.split(/\s/)[0];
const failed = (out: string, code: string) => {
expect(Object.keys(RESULT_CODES)).toContain(code);
expect(pushLines(out)).toEqual([`PUSH: failed reason=${code}`]);
expect(last(out)).toBe(`PUSH: failed reason=${code}`);
};
test('a push ends with PUSH: pushed naming the remote, the branch and the full head', () => {
const f = fx();
const head = f.git('rev-parse', 'HEAD').stdout.trim();
const r = f.run(RELEASE, ['push', '--branch', 'feat'], UNATTENDED);
expect(r.status, r.stdout + r.stderr).toBe(0);
expect(pushLines(r.stdout)).toEqual([`PUSH: pushed remote=origin ref=feat head=${head}`]);
expect(last(r.stdout)).toBe(`PUSH: pushed remote=origin ref=feat head=${head}`);
expect(remoteHead(f)).toBe(head);
});
test('a rerun at the pushed head ends with PUSH: already_pushed and pushes nothing new', () => {
const f = fx();
const head = f.git('rev-parse', 'HEAD').stdout.trim();
expect(f.run(RELEASE, ['push', '--branch', 'feat'], UNATTENDED).status).toBe(0);
const again = f.run(RELEASE, ['push', '--branch', 'feat'], UNATTENDED);
expect(again.status, again.stdout + again.stderr).toBe(0);
expect(pushLines(again.stdout)).toEqual([`PUSH: already_pushed remote=origin ref=feat head=${head}`]);
expect(last(again.stdout)).toBe(`PUSH: already_pushed remote=origin ref=feat head=${head}`);
expect(remoteHead(f)).toBe(head);
});
test('a refused, rejected or failed push ends with PUSH: failed and its reason code, with the exit status unchanged', () => {
const f = fx();
const usage = f.run(RELEASE, ['push']);
expect(usage.status).toBe(2);
failed(usage.stderr, 'PUSH_REFUSED');
const moved = f.run(RELEASE, ['push', '--branch', 'other'], UNATTENDED);
expect(moved.status).toBe(3);
failed(moved.stdout, 'PUSH_REFUSED');
expect(remoteHead(f)).toBe('');
fs.writeFileSync(path.join(f.work, '.git', 'hooks', 'pre-push'), '#!/bin/sh\nexit 1\n', { mode: 0o755 });
const hooked = f.run(RELEASE, ['push', '--branch', 'feat'], UNATTENDED);
expect(hooked.status).toBe(3);
expect(hooked.stdout).toContain('STOP: push failed');
failed(hooked.stdout, 'PUSH_GIT_FAILED');
expect(remoteHead(f)).toBe('');
fs.rmSync(path.join(f.work, '.git', 'hooks', 'pre-push'));
expect(f.run(RELEASE, ['push', '--branch', 'feat'], UNATTENDED).status).toBe(0);
f.git('reset', '-q', '--hard', 'HEAD~1');
f.write({ 'src/z.ts': 'export const z = 1;\n' }); f.commit('diverge');
const rejected = f.run(RELEASE, ['push', '--branch', 'feat'], UNATTENDED);
expect(rejected.status).toBe(3);
expect(rejected.stdout).toContain('STOP: non-fast-forward');
failed(rejected.stdout, 'PUSH_REJECTED');
});
});
+1 -1
View File
@@ -166,7 +166,7 @@ test('late verified outputs are committed before push, without tags', () => {
expectOrdered(compact(between(entryTemplate, '### 5. Report, then push', '## Step 17:')), [/commit/i, 'continue to Step 17'], 'ship Step 16.5');
expectMentions(entry, [['not', 'git tag']], 'ship entry');
expectOrdered(pushFlow, ['**Non-fast-forward push:**', '**Authentication, hook or network failure:**'], 'ship Step 17');
expectTokens(pushFlow, ['`ALREADY_PUSHED`'], 'ship Step 17');
expectTokens(pushFlow, ['`already_pushed`', '`PUSH: pushed|already_pushed|failed …`'], 'ship Step 17');
});
test('Step 18 resolves open PR state before preparing the title file Step 19 posts', () => {
@@ -0,0 +1,4 @@
{
"bytes": -1,
"why": "Step 17 names the PUSH: line gstack-ship-release push always ends with (GST-3053)"
}