Skip to content

Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA

TypeScript

v1.92.13.0 fix: /ship's preflight skips git merge when the base is already in HEAD (GST-691) (#3774)

Garry Tan066ceb084a72
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 291359636..6b37464dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## [1.92.13.0] - 2026-11-01
+
+- `/ship`'s preflight no longer runs `git merge` when `origin/<base>` is already in HEAD. It checks `git merge-base --is-ancestor` first and reports `MERGE: up to date`, so a checkout whose guard refuses `git merge` (a shared machine) gets past Step 3 when there is nothing to merge. A moved base still merges (GST-691).
+
## [1.92.12.0] - 2026-11-01
**When the merge queue gets long, 3 to 6 PRs from one part of the code can now land as one wave PR: one /ship, one READY, one train slot and one version.** Every slot in a train pays for its own stamp commit, its own round of about 12 required workflow runs (about 15 minutes, one slot after another) and its own version. The last 10 merged trains landed 26 PRs this way, with 16 to 24 READY PRs waiting at every build (refs/notes/gstack-trains; gate runs 41165841909 to 41217563527). Garry's rule R46 (2026-10-31) asks every Captain to group functional areas into wave PRs when queues get long. `gstack-ship-queue wave` now does this inside gstack's own train tooling, so crews get it from gstack instead of from prose (GST-574).
diff --git a/VERSION b/VERSION
index a56519961..e506fa9c0 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.92.12.0
+1.92.13.0
diff --git a/agents-digest/gstack-AGENTS.md b/agents-digest/gstack-AGENTS.md
index f8ef69a2a..ba506c295 100644
--- a/agents-digest/gstack-AGENTS.md
+++ b/agents-digest/gstack-AGENTS.md
@@ -1,4 +1,4 @@
-# gstack digest v1.92.12.0 — regenerate/re-copy after upgrading gstack
+# gstack digest v1.92.13.0 — regenerate/re-copy after upgrading gstack
Behavioral rules from gstack (https://github.com/garrytan/gstack), compressed
for agent hosts without a full skill install. The full skills add workflows,
diff --git a/lib/ship-preflight.ts b/lib/ship-preflight.ts
index d52b90edb..487dc0a74 100644
--- a/lib/ship-preflight.ts
+++ b/lib/ship-preflight.ts
@@ -68,6 +68,8 @@ const forkPoint = (cwd: string, base: string) => git(cwd, ['merge-base', `origin
function merge(cwd: string, base: string, r: Report): boolean {
const policy = shipPolicy(cwd, base);
if (policy?.queue_mode === 'stamp-at-merge') r.add('MERGE: skipped (queue_mode stamp-at-merge: the slot stamp merges the base; docs/ship-policy.md#ship-before-ready)');
+ else if (!git(cwd, ['ls-files', '-u']).stdout.trim() && ['MERGE_HEAD', 'CHERRY_PICK_HEAD', 'REVERT_HEAD'].every(ref => git(cwd, ['rev-parse', '-q', '--verify', ref]).status !== 0)
+ && git(cwd, ['merge-base', '--is-ancestor', `origin/${base}`, 'HEAD']).status === 0) r.add('MERGE: up to date');
else {
const before = git(cwd, ['rev-parse', 'HEAD']).stdout.trim();
const m = git(cwd, ['merge', `origin/${base}`, '--no-edit'], 300_000);
diff --git a/package.json b/package.json
index b12bf086d..801844de6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "gstack",
- "version": "1.92.12",
+ "version": "1.92.13",
"description": "Garry's Stack — Claude Code skills + fast headless browser. One repo, one install, entire AI engineering workflow.",
"license": "MIT",
"type": "module",
diff --git a/test/ship-preflight-base-ancestor.test.ts b/test/ship-preflight-base-ancestor.test.ts
new file mode 100644
index 000000000..1e7fdd3c5
--- /dev/null
+++ b/test/ship-preflight-base-ancestor.test.ts
@@ -0,0 +1,63 @@
+/**
+ * gstack-ship-preflight's Step 3 merge when the base is already in HEAD (GST-691, GEVA-85): a shared-tree guard that
+ * refuses `git merge` stopped /ship's preflight even though origin/<base> was an ancestor of HEAD and the merge had
+ * nothing to do. A guard stands in as a `git` shim on PATH that refuses `merge` and logs every merge it sees.
+ */
+import { afterEach, describe, expect, setDefaultTimeout, test } from 'bun:test';
+import * as fs from 'node:fs';
+import * as path from 'node:path';
+import { lineOf, shipFixture, type ShipFx } from './helpers/ship-bin-fixture';
+
+setDefaultTimeout(60_000);
+const fixtures: ShipFx[] = [];
+afterEach(() => { while (fixtures.length) fixtures.pop()!.cleanup(); });
+const PREFLIGHT = path.join(import.meta.dir, '..', 'bin', 'gstack-ship-preflight');
+
+/** A fixture whose PATH puts a guard first: `git merge …` is logged and refused, every other git command runs the next git
+ * on PATH by name (a pinned path recurses when that git is itself a PATH-walking wrapper, as Capy's shared-tree guard is). */
+function guarded(): { f: ShipFx; merges: () => string[] } {
+ const f = shipFixture(); fixtures.push(f);
+ const log = path.join(f.root, 'merges.log');
+ const stub = path.join(f.root, 'stub');
+ fs.writeFileSync(path.join(stub, 'git'), `#!/bin/sh\nif [ "$1" = merge ]; then echo "$*" >> '${log}'; echo 'shared-tree guard: git merge is not allowed in this checkout' >&2; exit 1; fi\nPATH="\${PATH#${stub}:}" exec git "$@"\n`, { mode: 0o755 });
+ return { f, merges: () => (fs.existsSync(log) ? fs.readFileSync(log, 'utf8').split('\n').filter(Boolean) : []) };
+}
+
+describe('preflight merge when the base is already in HEAD (GST-691)', () => {
+ // Value: protects=/ship on a checkout whose guard refuses git merge gets past Step 3 when origin/<base> is already an ancestor of HEAD;
+ // fails_when=preflight runs git merge even though there is nothing to merge, and the guard's refusal stops the run;
+ // why_new=GEVA-85 hit it on gstack-evals; seam=git merge-base --is-ancestor; no_claim=what the guard allows otherwise
+ test('origin/main already in HEAD: no git merge runs and MERGE reports up to date', () => {
+ const { f, merges } = guarded();
+ const r = f.run(PREFLIGHT, ['--base', 'main']);
+ expect([r.status, lineOf(r.stdout, 'MERGE'), r.stdout.split('\n').find(l => l.startsWith('STOP:'))]).toEqual([0, 'MERGE: up to date', undefined]);
+ expect(merges()).toEqual([]);
+ });
+
+ // Value: protects=a base that moved is still merged, so tests and reviews keep covering the integrated code;
+ // fails_when=the ancestor check skips a merge that has work to do; seam=git merge; no_claim=conflict handling (test/ship-preflight.test.ts)
+ test('a moved base still runs git merge', () => {
+ const { f, merges } = guarded();
+ f.advanceBase({ 'docs/new.md': '# new\n' });
+ const r = f.run(PREFLIGHT, ['--base', 'main']);
+ expect(merges()).toEqual(['merge origin/main --no-edit']);
+ expect(r.stdout).toContain('STOP: git merge origin/main failed: shared-tree guard: git merge is not allowed in this checkout');
+ });
+
+ // Value: protects=an unfinished merge of another branch still stops at Step 3 with its conflicted files named, though the base is in HEAD;
+ // fails_when=the ancestor shortcut reports up to date over an index with unmerged paths and the run tests conflict markers;
+ // why_new=GST-691 /ship adversarial finding 1; seam=git ls-files -u; no_claim=how the agent resolves it
+ test('an unfinished merge with the base already in HEAD still stops, conflicted or resolved and staged', () => {
+ const { f } = guarded();
+ f.git('checkout', '-q', '-b', 'other', 'main'); f.write({ 'src/a.ts': 'export const a = 5;\n' }); f.commit('other edits a');
+ f.git('checkout', '-q', 'feat'); f.write({ 'src/a.ts': 'export const a = 6;\n' }); f.commit('feat edits a');
+ expect(f.git('merge', '--no-edit', 'other').status).not.toBe(0);
+ const r = f.run(PREFLIGHT, ['--base', 'main']);
+ expect([r.status, lineOf(r.stdout, 'MERGE')]).toEqual([3, '']);
+ expect(r.stdout).toMatch(/STOP: merge conflicts in src\/a\.ts/);
+ f.write({ 'src/a.ts': 'export const a = 7;\n' }); f.git('add', 'src/a.ts');
+ const staged = f.run(PREFLIGHT, ['--base', 'main']);
+ expect([staged.status, lineOf(staged.stdout, 'MERGE')]).toEqual([3, '']);
+ expect(staged.stdout).toContain('STOP: git merge origin/main failed:');
+ });
+});