Skip to content

Keep crew threads on their PR to the end and cap finished PRs at 10 before new fix threads (GST-2192) - #4240

Merged
capy-ai[bot] merged 1 commit into
mainfrom
capy/keep-crew-threads-on
Nov 9, 2026
Merged

capy-ai[bot] merged 1 commit into
mainfrom
capy/keep-crew-threads-on

Conversation

@garrytan

@garrytan garrytan commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Agent threads that work on a pull request now keep it until it merges or closes, and no new fix thread starts in a repo while more than 10 finished pull requests wait there to merge. This is a wording change to gstack's own rules pages; no tool changes.

What changed

  • factory.md (read by every gstack session on Capy): point 12 drops "past 500M tokens, rotate" for every thread. A thread keeps its PR until it merges or closes and hands off only then, never mid-PR on a token count, and checks in with its Captain once past 1B own tokens. Standing threads that wake on every event (merge lanes, watchers) still rotate at 500M tokens or 3 days. New point 14: no new fix thread in a repo while more than 10 finished PRs (green, reviewed, waiting only to merge) sit in its queue; severe hotfixes (security, data loss, red main, a broken install) are exempt. Its byte budget in test/capy-skill-wrapper.test.ts rises from 3,650 to 4,200 for these two rules, with the reason recorded beside it as for earlier rule additions.
  • crew/docs/captain.md: a "Keep the PR to the end" bullet under Lane context and a "Finish before starting" paragraph under New threads join the crew.
  • lane-card.md: the same keep-the-PR line for lanes.
  • /runaway-stopper (template and generated SKILL.md): the limits now apply rotation to standing threads only; a ROTATE or own-tokens WARN on a crew thread holding a PR needs no action; Step 3 rotates standing threads only; Step 4 gains the keep-the-PR brief line. Subagent limits (look past 100M, never reuse one across PRs) are unchanged.
  • README.md, docs/skills.md: the /runaway-stopper summaries say the same.

Why

Per-thread token stops forced handoffs in the middle of a PR. One PR went through four threads in eight hours and is still a draft. Every handoff wakes the Captain, whose tokens cost about 1.7 times a crew thread's, and handoffs are where orphaned PRs came from. The cap on finished PRs keeps them from piling up behind new fix threads.

Blast radius

Prose only. gstack-runaway scan (lib/runaway.ts) still flags every non-Captain thread past 500M as ROTATE and warns at 400M. The skill now tells the reader how to act on that for a crew thread, and the tool is untouched under the tooling freeze.

Test Coverage

Coverage: deterministic. Each of the 3 changed runtime files (crew/docs/captain.md, runaway-stopper/SKILL.md and its template) has a changed test naming it. The free suite ran in CI at this exact tree and was carried: LANE: free carried run=42690432152/1 tests_ran=1655 (files).

Pre-Landing Review

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=1 fixed=0 scope=frozen ledgers_read=1 dispatches=2

Pre-Landing Review: 2 issues — 0 auto-fixed, 1 asked (0 fixed, 1 skipped), 0 deferred, 1 noted

Gate edits: none detected (GATE_SCAN tagged=0 at 1a111aa)

Plan: full panel on one pass (the "money" line in crew/docs/captain.md raised the depth): batched specialist (testing, security, state machines), red team, native adversarial, outside voice (openai/gpt-6.1-sol, certified configuration) and the targeted money reader. Nothing is at or above the blocking floor. Open notes, all informational:

  • runaway-stopper/SKILL.md.tmpl:75 (red team, adversarial): a crew thread whose PR has merged or closed, or a lane that never had one, matches neither ROTATE case, and Step 3 now rotates only standing threads. Not fixed in this run.
  • lib/runaway.ts:146 (red team, adversarial): the scan still flags PR-holding crew threads as ROTATE, counts them in SWEEP rotate= and has no 1B check-in detector. A tooling change, frozen through 2026-11-21.
  • runaway-stopper/SKILL.md.tmpl:75 (adversarial): a merge lane that carries PRs matches both ROTATE readings.
  • crew/docs/captain.md:193 (adversarial): the 1B-token check-in sits next to "spend is the credit meter, never a token count"; the $330 figure is approximate.
  • crew/docs/captain.md:226 (adversarial): PRs that wait on an outside approver (yc-software/qm, R62) count toward the cap of 10.

Exploratory QA

Functional smoke (report-only, 4 captures): the generator is FRESH for all 198 Claude-host files including runaway-stopper/SKILL.md; test/capy-skill-wrapper.test.ts passes 62/62 with factory.md at 4,178 bytes; the Codex-host render of the edited template succeeds in an owned worktree. The Codex dry-run in the main checkout was setup-blocked because .agents/ is gitignored and was never generated there, so the tool's overall verdict is blocked on that one optional probe.

Eval Results

evals: none owed at the PR tier. bun run eval:select --base origin/main picked the pr profile (full fallback, from crew/docs/captain.md) with no quality judges and no quick live coverage; its behaviors stay scheduled and release coverage. CI's route skipped eval-slices.

Scope Drift

Scope Check: CLEAN. One commit (1a111aa); the 9 files match its stated intent.

Plan Completion

Plan completion audit: not run (no plan is bound to this branch).

Issues

ISSUE_LINKS: none

Verification Results

CI_CARRY: accepted ci-carry tree=a17d486dd70d tests=36878 runs=42690432152/1 profiles=ci-reuse/free-tests heads=1a111aa60269 verified=2026-11-09T20:17:32.814Z

PREGATE_VERIFY: ok pregate requires-remote cleared is current for tree a17d486dd70d (macos-named-regressions from run 42690432152/1, windows-smoke from run 42690431946/1, remote gate from the CI carry)

TODOS

No TODOS.md changes.

Documentation

Status: current. Every doc the diff touches states the same rule, so no edits were needed.

Scope: the 9 committed files from f75ce6f to 1a111aa (none staged, unstaged or untracked), plus a search of docs/unattended.md, docs/ship-budget.md, docs/captain.md, capy/skill/gstack/captain.md, SKILL.md and the runaway-stopper templates for older token-handoff wording.

Documentation health:

  • README.md: current. The /runaway-stopper row covers standing threads and crew threads keeping their PR.
  • capy/skill/gstack/factory.md: current. Points 12 and 14 match the Captain manual, the cited anchor resolves, and the file is 4,178 bytes against the 4,200-byte budget.
  • capy/skill/gstack/lane-card.md: current.
  • crew/docs/captain.md: current. It has the new "Keep the PR to the end" and "Finish before starting" rules.
  • docs/skills.md: current.
  • runaway-stopper/SKILL.md and SKILL.md.tmpl: current, and they match each other.
  • changelog.d fragment: reviewed, not edited.

Coverage debt: none new. The rule change has reference coverage in the Captain manual, factory.md and the skill, and that is enough for a policy change. One gap is known and disclosed: the gstack-runaway scan can't tell a crew thread from a standing thread, so the docs tell the reader to ignore its ROTATE flag for a crew thread holding a PR.

Diagram drift: none.

Test plan

  • Free suite carried from CI run 42690432152/1 at tree a17d486dd70d (1,655 files)
  • Pregate stage 1 and guards (typecheck, skill size, parity suite, context budget, goldens, conflict markers) on this tree
  • bun run gen:skill-docs --dry-run: FRESH
  • bun test test/capy-skill-wrapper.test.ts: 62 pass, 0 fail
Agent notes

GST-2192 (GSTA-463). Rules R70 as amended and R89, approved by Garry 2026-11-09 ("do it"), relayed by FOUN-32. /ship ran unattended at 1a111aa (run ship-4240). The plan line is missing (PLAN warn): no autoplan ran for this rules change and none of the listed exemptions fits. gstack: ok 1.98.0.0 for=ship.

Agent notes
{
  "schema_version": 1,
  "pr": 4240,
  "head": "1a111aa60269dfbc1fb015bf386770afcb18ae6c",
  "version": "1.98.0.0",
  "base": "main",
  "gate": {
    "free": {
      "pass": 1655,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 42690432152,
      "attempt": 1,
      "tree": "a17d486dd70df9ebbb43bae6745d6e32cdbb5426"
    }
  ],
  "session_kind": "unattended",
  "head_tree": "a17d486dd70df9ebbb43bae6745d6e32cdbb5426",
  "product_patch_id": "5a8eb96eeb0a37323f6a9c76d38758dc5a732e94",
  "gstack_version": "1.98.0.0",
  "review_depth": {
    "depth": "full",
    "class": "code",
    "runtime_lines": 30,
    "rules": "66e5174161eecc2c",
    "base": "f75ce6fdcc14e6398b00645c1608e834d766a922",
    "registry": "f75ce6fdcc14e6398b00645c1608e834d766a922",
    "gate_scan": {
      "tagged": 0,
      "head": "1a111aa60269dfbc1fb015bf386770afcb18ae6c"
    },
    "reasons": [
      "risk:money",
      "runtime=30"
    ],
    "risk": [
      "money"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @a17d486dd70d (8 checks, current for 1a111aa60269)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/42690432152/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/42690431946/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=a17d486dd70d tests=36878 skipped=105 runs=42690432152/1 profiles=ci-reuse/free-tests heads=1a111aa60269 verified=2026-11-09T20:22:21.328Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "README.md, docs/, crew/docs/, capy/skill/gstack/, runaway-stopper/SKILL.md"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 1,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "ledgers_read": 1,
    "dispatches": {
      "specialist": 1,
      "red-team": 1
    }
  },
  "review_targeted": {
    "classes": [
      "money"
    ],
    "rules": "8811fd300bf305f0",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "5a8eb96eeb0a37323f6a9c76d38758dc5a732e94",
    "status": "done",
    "findings": 0,
    "raised_by": "targeted"
  }
}

…efore new fix threads (GST-2192)

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

trunk-io Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

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