Skip to content

On Capy, /ship no longer edits or comments on pull requests as you (GST-3183) - #4517

Closed
garrytan wants to merge 3 commits into
mainfrom
capy-ship-writes-through-host-pr-tool
Closed

garrytan wants to merge 3 commits into
mainfrom
capy-ship-writes-through-host-pr-tool

Conversation

@garrytan

@garrytan garrytan commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

On Capy, /ship's PR body edits, comments and new PRs no longer go out through gh under the machine owner's GitHub account.
Each write now runs its checks, saves the exact text to a private file and prints a HOST_PUBLISH: line, so the agent publishes it with Capy's own PR tool.
Nothing changes outside Capy (GSTACK_CAPY unset).

Why

During an unattended /ship on garrytan/gbrain-evals#523 (gstack 1.101.0.0), gstack-ship-receipt stub recorded its review rounds by running gh pr edit, so another system's PR body was edited as garrytan even though the brief said to publish only through the PR tool. The rule is that GitHub writes from Capy go only through Capy's PR tools.

What changed

  • lib/host-publish.ts (new): hostPublishes() is true under GSTACK_CAPY=1; handOff() writes each part to <state root>/publish/<op>-<target>.<part>.md (mode 0600) and returns one HOST_PUBLISH: line naming the files and the host tool to use.
  • The commands that record /ship's review rounds in the PR body hand off on Capy instead of running gh pr edit (details in Agent notes).
  • gstack-post: every write op (pr-body, pr-title, pr-comment, issue-comment, reply, pr-create, issue-create) runs its plain-title, plain-body, security and secret checks as before, then hands off instead of calling gh. A HIGH finding still refuses with no file written.
  • gstack-greptile-early open says the draft went to the host tool instead of "did not print the new PR URL".
  • Prose: the Capy PR section and Step 19's "mark it ready" line say to use the host's PR tool; docs/troubleshooting.md#host-publish explains the line.

Blast radius

Only runs with GSTACK_CAPY=1 change; the --body <file> paths and every non-Capy path are byte-identical (the existing round-recording and gstack-post suites pass unchanged). Reads through gh (pr view, repo view, api GETs) are unchanged.

Agent notes

Agent notes

Round-recording commands. gstack-ship-receipt stub, stop, claim and carry with --pr share one postBody, which hands off on Capy. claim can't read its marker back before the host publishes, so on Capy it trusts its own write; a double claim is still caught by the next history read.

Tests. test/capy-host-publish.test.ts puts a recording gh shim on PATH and asserts zero write calls under GSTACK_CAPY=1 for receipt stub, stop, claim, carry and all seven gstack-post write ops, plus a negative control showing the shim records gh pr comment when GSTACK_CAPY is unset. On main (12bd33b) the stub, stop/claim, carry and gstack-post cases fail with recorded pr edit/POSTED: writes.

gh write inventory (/ship, review and ship-queue paths)

Fixed here (can run under GSTACK_CAPY=1):

  • bin/gstack-ship-receipt:1069 postBody (gh pr edit), used by stub (:1165), stop (:1123), claim (:1142) and carry (:976, which had its own gh pr edit)
  • lib/gstack-post.ts:654-660 (gh pr comment, gh issue comment, gh api --method=POST reply, gh pr edit title/body, gh pr create, gh issue create) and :677-678 (gh api --method=PATCH fallback); hand-off at :840. Reached from /ship Step 5 (early draft PR), Step 6.5 (Greptile draft and trigger comment, lib/greptile-early.ts:198/208), Step 19 (body and title) and the stop comment.
  • ship/sections/pr-body.md.tmpl:295 gh pr ready (prose): now names the host's PR tool on Capy.

Left as is, with reason:

  • crew/lib/ship-queue-wave.ts:411 (pr comment) and :579 (pr close), crew/lib/ship-queue-train-land.ts:226 (pr edit --add-label), lib/ship-queue-land.ts:309 (pr create for a drift repair): all run inside gstack-ship-queue land / wave and train landing, the merge action the brief keeps out of scope (and gstack itself is merge: direct, so the wave and train paths don't run here). Worth a follow-up if a Capy Captain lands a wave or train repo.
  • lib/squash-message.ts:90, crew/lib/ship-queue-train-land.ts:147 (pr merge): the land merge, out of scope.
  • crew/lib/ship-queue-dispatch-ci.ts:61, crew/lib/ship-queue-train-gate.ts:267/565, crew/lib/ship-queue-train.ts:485, crew/lib/release-gate.ts:177 (gh workflow run): CI dispatches that post no text, and Capy has no tool for them.
  • lib/release-stamp.ts:169 (pr create for the release PR): release path, not /ship.
  • scripts/resolvers/preamble/generate-test-failure-triage.ts:96 (gh issue create, prose): only on the interactive "assign a GitHub issue" answer in a collaborative repo; Capy has no GitHub issue tool, and editing the shared preamble regenerates every skill.

Size ledger: test/size-ledger/ship/capy-ship-writes-through-host-pr-tool.json (+251 bytes, the two prose lines).

Open in Capy

{"head":"e4361515e0cf6707d112baee02d466042822e32b","run":"ship-4517","status":"started","review_loop":{"passes":1,"blocking_found":0,"deferred":0,"noted":0,"fixed":2,"scope":"frozen","rounds":1,"dispatches":{"specialist":3}}}
{"head":"a3f4de0905c5163d7ba45ac235b512cd1b07d468","run":"ship-4517-r3","status":"started","review_loop":{"passes":1,"blocking_found":0,"deferred":0,"noted":1,"fixed":0,"scope":"frozen","rounds":1,"est_input_tokens":19571,"dispatches":{"specialist-batched":1,"red-team":1}}}
{"head":"a3f4de0905c5163d7ba45ac235b512cd1b07d468","run":"ship-4517-r3","mark":"stop","tree":"3df01fdf1cbe6cefb9fa6dfadcaaeace29e5ab06"}

…ST-3183)

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

trunk-io Bot commented Nov 19, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

garrytan and others added 2 commits November 19, 2026 09:31
…se branch and draft state

Review-Finding: p1/specialist-batched#1 reader=specialist-batched
Review-Finding: p1/specialist-batched#3 reader=specialist-batched
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…never lands in another's file

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

capy-ai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Superseded by #4518, which landed as e95cea8. It carries these commits plus the fix for the missing repo in hand-offs, so this PR is closing.

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