Skip to content

/ship runs in the pull request's own thread, with no helper agent (GST-3466) - #4670

Merged
capy-ai[bot] merged 3 commits into
mainfrom
ship-runs-in-the-calling-thread
Nov 22, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
ship-runs-in-the-calling-thread

Conversation

@garrytan

@garrytan garrytan commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

On Capy, /ship now runs in the thread that owns the pull request, starting its reviewers as that thread's own subagents, instead of handing the whole run to a separate helper agent.
Why: a 30-run trial found no clear difference in cost or bugs caught, so the extra agent layer goes; the project owner chose this.
Nothing to do: /ship's review plan, review rounds, final sign-off and checks are unchanged.

What changed

"Make the in-thread way the default and only documented way to run /ship." Every place that told an agent to hand /ship to a helper agent, sleep, and then stop that helper now tells the thread that owns the pull request to run /ship itself, phase by phase, with its reviewers as its own subagents. The old instructions are removed, not kept beside the new ones.

The thread that owns the pull request now runs /ship itself, instead of handing it to a helper agent and sleeping

The thread that owns the pull request now runs /ship itself, instead of handing it to a helper agent and sleeping.

Before/after as text: The thread that owns the pull request now runs /ship itself, instead of handing it to a helper agent and sleeping
--- Before · capy/skill/gstack/SKILL.md § Plan, approve, ship at c2b4f0d · source text
+++ After · capy/skill/gstack/SKILL.md § Plan, approve, ship on this branch · source text
@@ ⋯ 3 unchanged ⋯ @@
 - **Plan first.** Run `/autoplan` on new functionality right after the install check. The lean run (the Capy default) is one reviewer over plan and draft code; `--full` adds every phase.
 - **ELI5, then the word.** Send the plan and gate to the person, or the Captain, in plain language: `gstack-owner-brief render --captain --out <run dir> --captain-name "<Captain name>"`, its choices as lettered lines in the ask format (`crew/docs/captain.md`) and "do it" taking every recommendation at full scope. Build only after their word is answered into the run and it reports `APPROVED`; then `gstack-approvals import --autoplan <run dir> --by "<owner>"`.
 - **/ship before ready.** Run /ship at the final pushed head before a PR is called ready; `SHIP_RECEIPT: pr=<n> head=<head>` must name that head, and a later push needs a new /ship. The review inside /ship, like the autoplan, is sized to the change.
+- **Run /ship yourself, then keep the PR.** The thread that owns the PR runs /ship phase by phase (`ship/DRIVER.md`), with its reviewers as its own subagents. Once /ship prints its receipt, the thread reads the PR's checks and comments once, runs `gstack-ship-queue ready` and owns the PR thereafter: slot stamp, re-READY, receipt carry (`crew/docs/captain.md`, the lane's /ship sequence).
-- **Sleep while /ship runs, then stop it.** After dispatching /ship the parent ends its turn with no PR watch until /ship completes (a re-READY drops a held watch first). On that wake it subscribes to the PR (renewed on expiry, cancelled at merge or close), reads its checks and comments once, stops the subagent, runs `gstack-ship-queue ready` and owns the PR thereafter: slot stamp, re-READY, receipt carry (`crew/docs/captain.md`, the lane's /ship sequence). A stopped /ship subagent woken by a check, review or merge notice, not its parent, reports what woke it, its pin and the PR head (`gh pr view <n> --json headRefOid --jq .headRefOid`) in one line and ends the turn without acting, even if the head moved. A message from its parent is an instruction it carries out.
 - **No merge without the owner's word.** A thread never merges on its own; under a Captain the controller merges on a recorded standing approval, and a thread with no Captain asks the person.
 
 Exempt from the plan step: read-only work, the daily flaky pass's repairs, slot stamps, CHANGELOG-only resolves, cap re-pins under a written grant, S1 emergencies (a broken install or upgrade, a red main, a security bug) and fixes from an already-diagnosed, audited problem list. Other bug fixes skip plan review (`--kind fix`, R65) but carry a repro on current main or a failing test written first; features get the lean run (`--kind feature`).

One code change keeps /ship's spending guard: a /ship run that reads its own thread's token counter (--reading-from own, or no reading flag on a non-tree meter) still gets the 50M default token cap that the helper agent used to get. Without it, moving /ship into the calling thread would have silently dropped the default cap.

What the trial found (#4667): ten cases, three runs each way, on Claude Opus 5.5. Arm C handed /ship to one fresh helper agent (the old way); arm F ran /ship in the calling thread.

  • Cost a run, F minus C: +$0.07 (95% interval -$1.42 to +$1.57); mean $11.47 for C, $11.54 for F.
  • Planted bugs caught: 22 of 30 for F, 21 of 30 for C (F minus C +0.03, -0.18 to +0.24). No case was a structural loss.
  • Real problems found: F minus C -0.003 (-0.21 to +0.20).
  • Wall time F minus C: -1.9 minutes (-8.1 to +4.4).
  • Only 9 of 60 runs reached /ship's final sign-off (4 C, 5 F), so this compares the review and fix phases, not the release steps after them.

The verdict depends on a scoring ruling made after seeing data. One F run (F7t3) stopped at /ship's own round cap before the step where its two named second-model reviewers run. Counting a named reviewer only if /ship reached its step, reader fidelity is 30 of 30 and every bar passes; read literally, it is 29 of 30 and the plan's decision would keep the helper agent with one fix cycle. The results page reports both readings; the owner chose the first.

Files changed:

  • ship/DRIVER.md.tmpl, ship/DRIVER.md: /ship runs in the pull request's own thread, never in a subagent.
  • ship/sections/budget-handoff.md.tmpl, ship/sections/budget-handoff.md: the token reading is the thread that runs /ship, reviewers included.
  • capy/skill/gstack/SKILL.md, capy/skill/gstack/lane-card.md, capy/skill/gstack/captain.md: run /ship yourself, then keep the PR; no helper-agent titles or task-row metering.
  • crew/docs/captain.md, captain/templates/brief.md: the steps before a PR is ready no longer start, sleep on, or stop a /ship helper.
  • runaway-stopper/SKILL.md.tmpl, runaway-stopper/SKILL.md, runaway-stopper/templates/successor-brief.md: "/ship runs in the PR's own thread"; the mid-run stop hold names /ship's reviewers.
  • docs/ship-budget.md, docs/skills.md: the same rule; the default cap is described by its flag.
  • lib/ship-budget-cli.ts, lib/ship-budget.ts: the 50M default cap also applies to a run reading its own counter, and its note says so.
  • test/ship-budget-meter-scope.test.ts: checks the skill has the thread read its own counter and start no /ship helper, and checks the default cap for own-counter runs.
  • test/size-ledger/ship/ship-runs-in-the-calling-thread.json, changelog.d/ship-runs-in-the-calling-thread.md: size record and release note.

Not changed: docs/ship-policy.md (no helper-agent text in it). The --reading-from task and --subagent budget flags stay in code for older runs.

Why

"The extra agent layer costs a whole context and buys nothing we could measure." The trial in #4667 found no clear difference in cost, bugs caught or wall time between handing /ship to a helper agent and running it in the calling thread, so agents now run /ship where the pull request lives, which is simpler to follow and to resume.

Blast radius

This touches the agent-facing instructions every thread loads (the Capy skill, its start card, the team manual, /runaway-stopper and the /ship driver) and one budget default in lib/ship-budget-cli.ts:254. It is safe because /ship's review plan, rounds, final sign-off and checks code are unchanged, and the default-cap change only widens which observe runs get the existing 50M cap: test/ship-budget-meter-scope.test.ts covers both the instructions and the cap, and the full free suite passed in CI at 452f845 (script ran).

Pre-Landing Review

The full review found 4 small items, all fixed. A follow-up check of those fixes found 2 problems that would fail a test or drop /ship's default token cap; both were fixed, and a second check of that fix came back clean. The second-model review (GPT-6.2 Sol) and an adversarial read raised 10 notes between them; none fails a test, breaks production, or loses data or secrets, so they ship as open notes below, and a follow-up PR fixes the reviewer-subscription sentence, the own-plus-tree cap scope and mid-/ship detection between reviewer batches.

Second-model review: ran (GPT-6.2 Sol); 4 notes it marked blocking were ruled below the blocking floor and listed here.

The full list of open notes, with the one deferred finding in code this PR did not change, is in the Agent notes section at the end.

Exploratory QA

Smoke probes only: the budget-meter tests passed, and a search of the tree found no remaining instruction to start a /ship helper agent. The deeper method reads did not run.

Design Review

No frontend files changed — design review skipped.

Eval Results

No eval ran in this PR. The change is to agent instructions and one budget default; the decision rests on the 60-run trial in #4667.

Review bot comments

No review bot comments.

Issues

Refs #4667
Refs fc/fix-check#1
Refs fc/targeted#1
Refs p1/red-team#1
Refs p1/red-team#2
Refs p1/specialist-batched#1
Refs p1/specialist-batched#2

Documentation

Status: current. The docs already match what shipped, so no edits were needed.

Scope: base c2b4f0d2 to head 452f845, 3 commits and 19 files, with no staged, unstaged or untracked content. The audit covered the Capy gstack skill, its start card, the team-lead notes, the team manual, the brief template, the /runaway-stopper template and successor brief, the /ship driver and budget-handoff templates, docs/ship-budget.md, docs/skills.md and README.md, and swept the whole tree for stale mentions of a /ship subagent.

Documentation health:

  • capy/skill/gstack/SKILL.md: current (/ship runs in the thread that owns the PR)
  • capy/skill/gstack/captain.md: current
  • capy/skill/gstack/lane-card.md: current
  • crew/docs/captain.md: current (the table of duties before a PR is ready, and who owns each, matches)
  • captain/templates/brief.md: current
  • runaway-stopper/SKILL.md.tmpl and templates/successor-brief.md: current
  • ship/DRIVER.md.tmpl and ship/sections/budget-handoff.md.tmpl: current
  • docs/ship-budget.md: current (the --reading-from own default cap matches lib/ship-budget-cli.ts)
  • docs/skills.md: current
  • README.md: current (no change needed)

Coverage debt: --reading-from own appears in reference docs only (docs/ship-budget.md); it has no how-to example. That is a common gap, not a critical one. No diagram drift.

Tests
  • bun run test (free suite, CI run 44990730753 at 452f845): exit 0, 1743 test files ran, 7 skipped as not owed on this runner
  • bun test test/ship-budget-meter-scope.test.ts: pass
  • Release checks at tree 56737d3: typecheck, skill size, parity suite, context budget, module size, goldens and conflict markers passed
Agent notes

Refs GST-3466, GST-3003. Follow-up: GST-3498.

Deferred findings

Blocking findings in code this PR did not change (review scope: frozen). They stay on this PR and are not filed as issues.

  • Deferred: CRITICAL ship/DRIVER.md:13 A failed pass can leave unfinished readers running as the lane's own subagents

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • Medium lib/ship-budget-cli.ts:254 Default cap now meters the whole lane thread, unmeasured for large contexts
  • Medium lib/runaway.ts:230 Same as outside-voice#3
  • Low lib/ship-budget-cli.ts:254 --reading-from this on a root thread gets no default
  • Low crew/docs/captain.md:541 PR notices now wake the lane mid-run
  • Low test/ship-budget-meter-scope.test.ts:127 Edited test takes ~5.3s, over bun's 5s default outside the shard runner
  • Low docs/ship-budget.md:146 Task-row and --subagent guidance remain for legacy runs

REVIEW_LOOP: passes=1 blocking_found=6 deferred=1 noted=12 fixed=6 scope=frozen ledgers_read=4 fix_checks=2 dispatches=3

Ruled note: crew/docs/captain.md:540:pr-watch at 452f845 ruled by GSTA-36 (relayed from GSTA-36:2026-11-22T06:05:39.562Z) at 2026-11-22T06:05:40.349Z: no automatic watch only when another thread opened the PR; land still needs every check green at the pin (approval a-646eea810a06)
Ruled note: ship/DRIVER.md:13:reader-cleanup at 452f845 ruled by GSTA-36 (relayed from GSTA-36:2026-11-22T06:05:39.562Z) at 2026-11-22T06:05:40.455Z: unfinished readers after an early stop cost spend only; the code is outside this PR (approval a-c6fb10bc3287)
Ruled note: runaway-stopper/SKILL.md:226:rotation-guard at 452f845 ruled by GSTA-36 (relayed from GSTA-36:2026-11-22T06:05:39.562Z) at 2026-11-22T06:05:40.544Z: only standing threads rotate and crew lanes do not; detection fix in the follow-up PR (approval a-91e8794210cf)
Ruled note: lib/ship-budget-cli.ts:254:default-cap-scope at 452f845 ruled by GSTA-36 (relayed from GSTA-36:2026-11-22T06:05:39.562Z) at 2026-11-22T06:05:40.628Z: no caller passes own with tree; scope fix in the follow-up PR (approval a-8cdfe284bdbc)
Ruled note: capy/skill/gstack/captain.md:171:money at 527d9a7 ruled by GSTA-36 (relayed from GSTA-36:2026-11-22T05:45:00Z) at 2026-11-22T06:12:49.511Z: fixed by the 50M default for own-counter runs in lib/ship-budget-cli.ts at 452f845, which the granted clean fix-check read; the line it names needed no edit (approval a-2cffed6b2405)

Approvals

Approved: yes (record r-ab907bfd0e18). The full approval record stays private.
Plan: approved (record r-69b98ef6a11a)
Plan check: approved (record r-69b98ef6a11a)

{
  "schema_version": 1,
  "pr": 4670,
  "head": "452f84572085f06f5edd78dc1ab600057c4230b4",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "free": {
      "pass": 1743,
      "fail": 0,
      "skip": 7
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 44990730753,
      "attempt": 1,
      "tree": "56737d36733091125184f1395cf40880645f10fe"
    }
  ],
  "calls": 35,
  "session_kind": "unattended",
  "head_tree": "56737d36733091125184f1395cf40880645f10fe",
  "product_patch_id": "01306bae6f1308b454ff96f9471f5a569fd3c3e3",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "full",
    "class": "code",
    "runtime_lines": 85,
    "rules": "630fd3101899e28e",
    "base": "c2b4f0d2adfa66e11143b95d9a42023a09380212",
    "registry": "c2b4f0d2adfa66e11143b95d9a42023a09380212",
    "gate_scan": {
      "tagged": 0,
      "head": "452f84572085f06f5edd78dc1ab600057c4230b4"
    },
    "reasons": [
      "risk:money",
      "runtime=85"
    ],
    "risk": [
      "money"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @56737d367330 (8 checks, current for 452f84572085)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44990730753/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44990730571/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=56737d367330 tests=38815 skipped=104 runs=44990730753/1 profiles=ci-reuse/free-tests heads=452f84572085 verified=2026-11-22T06:09:10.993Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [
      4667
    ],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs, crew/docs, README.md and the Capy skill, lane card, brief template, runaway-stopper and /ship driver prose this PR changed"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 6,
    "deferred": 1,
    "noted": 12,
    "fixed": 6,
    "scope": "frozen",
    "fix_checks": 2,
    "rounds": 1,
    "ledgers_read": 4,
    "dispatches": {
      "specialist": 3
    }
  },
  "review_round_grants": [
    {
      "kind": "fix-check",
      "head": "527d9a7d146f48eadada59782556cde927e46fee",
      "pr": 4670,
      "by": "GSTA-36",
      "reason": "Both fixes are needed: the generic-wording test fails without the first, and the second puts back /ship's 50M default cap that moving /ship in-thread dropped. One fix-check, then finish.",
      "at": "2026-11-22T05:46:31.295Z",
      "approval": "a-870503e1661f",
      "stop_run": "ship-gst3466",
      "findings": [
        "fc/fix-check#1",
        "fc/targeted#1"
      ]
    }
  ],
  "ruled_notes": [
    {
      "finding": "crew/docs/captain.md:540:pr-watch",
      "head": "452f84572085f06f5edd78dc1ab600057c4230b4",
      "by": "GSTA-36",
      "reason": "no automatic watch only when another thread opened the PR; land still needs every check green at the pin",
      "at": "2026-11-22T06:05:40.349Z",
      "approval": "a-646eea810a06",
      "relayed": "GSTA-36:2026-11-22T06:05:39.562Z"
    },
    {
      "finding": "ship/DRIVER.md:13:reader-cleanup",
      "head": "452f84572085f06f5edd78dc1ab600057c4230b4",
      "by": "GSTA-36",
      "reason": "unfinished readers after an early stop cost spend only; the code is outside this PR",
      "at": "2026-11-22T06:05:40.455Z",
      "approval": "a-c6fb10bc3287",
      "relayed": "GSTA-36:2026-11-22T06:05:39.562Z"
    },
    {
      "finding": "runaway-stopper/SKILL.md:226:rotation-guard",
      "head": "452f84572085f06f5edd78dc1ab600057c4230b4",
      "by": "GSTA-36",
      "reason": "only standing threads rotate and crew lanes do not; detection fix in the follow-up PR",
      "at": "2026-11-22T06:05:40.544Z",
      "approval": "a-91e8794210cf",
      "relayed": "GSTA-36:2026-11-22T06:05:39.562Z"
    },
    {
      "finding": "lib/ship-budget-cli.ts:254:default-cap-scope",
      "head": "452f84572085f06f5edd78dc1ab600057c4230b4",
      "by": "GSTA-36",
      "reason": "no caller passes own with tree; scope fix in the follow-up PR",
      "at": "2026-11-22T06:05:40.628Z",
      "approval": "a-8cdfe284bdbc",
      "relayed": "GSTA-36:2026-11-22T06:05:39.562Z"
    },
    {
      "finding": "capy/skill/gstack/captain.md:171:money",
      "head": "527d9a7d146f48eadada59782556cde927e46fee",
      "by": "GSTA-36",
      "reason": "fixed by the 50M default for own-counter runs in lib/ship-budget-cli.ts at 452f845, which the granted clean fix-check read; the line it names needed no edit",
      "at": "2026-11-22T06:12:49.511Z",
      "approval": "a-2cffed6b2405",
      "relayed": "GSTA-36:2026-11-22T05:45:00Z"
    }
  ],
  "gate_dispositions": [],
  "review_targeted": {
    "classes": [
      "money"
    ],
    "rules": "b3f6f8b4843c0c30",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "01306bae6f1308b454ff96f9471f5a569fd3c3e3",
    "status": "done",
    "findings": 0,
    "raised_by": "targeted"
  }
}

The thread that owns the pull request now runs /ship itself, one phase at a
time from ship/DRIVER.md, and starts /ship's reviewers as its own subagents.
The Capy skill, lane card, crew manual, lane brief template and
/runaway-stopper stop telling agents to hand /ship to a subagent. Garry chose
this (A1, 2026-11-22) after gstack's trial of both ways (GST-3003, #4667).

Refs: GST-3466
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 22, 2026 05:31
Review-Finding: p1/specialist-batched#1 reader=testing
Review-Finding: p1/specialist-batched#2 reader=testing
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
A /ship run that meters its own thread's counter now gets the same 50M default cap the helper agent's task-row reading had, and the crew manual names the owner instead of a person, so the generic-skill test passes.

Review-Finding: fc/fix-check#1 reader=fix-check
Review-Finding: fc/targeted#1 reader=targeted
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot marked this pull request as ready for review November 22, 2026 06:19
@capy-ai
capy-ai Bot merged commit 540da9b into main Nov 22, 2026
54 of 55 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