Skip to content

Stop the runaway scan from telling Captains to rotate crew threads that hold a PR (GST-2226) - #4250

Merged
capy-ai[bot] merged 3 commits into
mainfrom
capy/stop-the-runaway-scan
Nov 9, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
capy/stop-the-runaway-scan

Conversation

@garrytan

@garrytan garrytan commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

gstack-runaway scan no longer tells you to rotate or warn about an agent thread that still has an open pull request. Only threads marked as long-running get rotation advice, and only after every pull request they hold is merged or closed.

What changed

  • Crew threads (every thread not marked standing) get no ROTATE and no own-token WARN. Past 1 billion own tokens they get one FLAG: CHECK_IN line, and they keep their PR.
  • Standing threads (a merge lane, a watcher, an automation's standing thread) still get FLAG: ROTATE at 500M own tokens or 3 active days, with the 400M warn line.
  • A standing thread that holds an open PR gets DEFER: holds an open PR; rotate after every PR merges or closes (R91) instead of ROTATE. A file whose pull_requests list is missing or shorter than pull_requests_total counts as holding one.
  • SWEEP: gains a check_in= count. /runaway-stopper's fetch program gets a standing list, its line table gets a CHECK_IN row, and --help and docs/skills.md say the same. The skill stays inside its 3,841-token context budget.

Why

The scan was pointing Captains at rotating crew threads that still held unmerged PRs, which the archive rules forbid. This keeps the factory's own tooling in line with those rules.

Blast radius

The change is limited to the scan's printed advice in lib/runaway.ts and the /runaway-stopper skill text. The scan never acts on its own, and archive-check (#4244) still refuses to archive a thread with an open PR.

Documentation

Status: current. No documentation edits were needed, and there are no blockers.

Scope: base 83bfdc5 to head 431253f (3 commits, 6 files: lib/runaway.ts, test/runaway.test.ts, runaway-stopper/SKILL.md.tmpl and its generated SKILL.md, docs/skills.md and one changelog.d fragment). The working tree has no staged, unstaged or new files.

Documentation health:

  • docs/skills.md: current (it already says that only a standing thread rotates, a crew thread gets CHECK_IN past 1B, and an open PR blocks rotation)
  • runaway-stopper/SKILL.md.tmpl and SKILL.md: current (its line table has the CHECK_IN row and the DEFER-on-PR wording, and the generated file matches the template)
  • README.md: current
  • AGENTS.md: current
  • capy/skill/gstack/factory.md: current
  • crew/docs/captain.md: current
  • docs/troubleshooting.md: current (it has RUNAWAY_USAGE and RUNAWAY_INPUT entries)

Coverage debt: the new FLAG: CHECK_IN line and the DEFER: holds an open PR line are explained in the skill's line table and in docs/skills.md, but docs/troubleshooting.md has no entry for either. That's a common gap. Diagram drift: none, because no diagram names the changed modules.

Issues

Refs #4244

Test plan

  • CI free-tests run 42718695901 is green at this head, with 1657 test files carried and 0 failing.
  • bun test test/runaway.test.ts covers crew, standing, open, draft, unlisted and unknown PR cases.

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 runaway-stopper/SKILL.md.tmpl:30 The automation run messages the Captain on ROTATE, STOP, REPORT or RUNAWAY_INPUT, not CHECK_IN.

Review notes

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

  • INFORMATIONAL runaway-stopper/SKILL.md.tmpl:42 The fetch program's standing list defaults to empty, so a forgotten standing thread gets no ROTATE/WARN until CHECK_IN past 1B.
  • INFORMATIONAL lib/runaway.ts:190 A WARN or STOP verdict outranks a hold, so SWEEP defer= undercounts held rotations (the DEFER line still prints).
  • INFORMATIONAL runaway-stopper/SKILL.md.tmpl:42 The default standing list is empty, so nothing rotates unless the Captain fills it in.
  • INFORMATIONAL runaway-stopper/SKILL.md.tmpl:78 CHECK_IN repeats on every sweep; the scan keeps no state.
  • INFORMATIONAL lib/runaway.ts:158 A missing pull_requests_total counts as a complete list (same root as outside-voice#1).
  • INFORMATIONAL test/runaway.test.ts:1 The draft-PR test case goes down the unlisted path, so it does not prove a draft PR blocks rotation.
Agent notes
  • Bug fix under R65 (GST-2226). Plan: exempt: bug fix.
  • Pre-Landing Review: 10 issues, 0 auto-fixed, 3 asked (0 fixed, 3 skipped), 1 deferred, 6 noted. The 3 skipped findings were judged below the blocking floor (no failing test, no production break, no data loss). The missing pull_requests_total case is a follow-up the Captain is queuing.
  • Gate edits: none detected (GATE_SCAN tagged=0).
  • Evals: none affected (eval:select profile pr).

Open in Capy

Agent notes
{
  "schema_version": 1,
  "pr": 4250,
  "head": "431253ff00f5059d4b58bdee83f7367d25e5d31d",
  "version": "1.98.0.0",
  "base": "main",
  "gate": {
    "ship": {
      "pass": 1657,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "ship",
      "run": 42718695901,
      "attempt": 1,
      "tree": "4e8454a4e9813f7e1bf69f970f88b02a21997481"
    }
  ],
  "session_kind": "unattended",
  "head_tree": "4e8454a4e9813f7e1bf69f970f88b02a21997481",
  "product_patch_id": "5e748e0045c40c88fb4c0e49d49495692509ec1f",
  "gstack_version": "1.98.0.0",
  "review_depth": {
    "depth": "full",
    "class": "code",
    "runtime_lines": 77,
    "rules": "66e5174161eecc2c",
    "base": "01e398051ccef990a35270fd7505f0b8ff741836",
    "registry": "01e398051ccef990a35270fd7505f0b8ff741836",
    "gate_scan": {
      "tagged": 0,
      "head": "431253ff00f5059d4b58bdee83f7367d25e5d31d"
    },
    "reasons": [
      "risk:money",
      "runtime=77"
    ],
    "risk": [
      "money"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @4e8454a4e981 (8 checks, current for 431253ff00f5)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/42711112791/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/42711112728/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=4e8454a4e981 tests=36915 skipped=105 runs=42718695901/1 profiles=ci-reuse/free-tests heads=431253ff00f5 verified=2026-11-09T23:37:00.733Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [
      4244
    ],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, runaway-stopper/SKILL.md(.tmpl), changelog.d (read-only audit)"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 3,
    "deferred": 0,
    "noted": 0,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "unrecorded": 3,
    "ledgers_read": 2,
    "unbound": 1,
    "dispatches": {
      "specialist": 1,
      "red-team": 1
    }
  },
  "review_targeted": {
    "classes": [
      "money"
    ],
    "rules": "8811fd300bf305f0",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "5e748e0045c40c88fb4c0e49d49495692509ec1f",
    "status": "done",
    "findings": 1,
    "raised_by": "targeted"
  }
}

@trunk-io

trunk-io Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 9, 2026 21:51
…at hold a PR (GST-2226)

Only a thread marked standing rotates, and never while it holds an open PR or its PR list is missing; a crew thread gets one CHECK_IN past 1B own tokens (R70 as amended, R91).

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

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@garrytan
garrytan force-pushed the capy/stop-the-runaway-scan branch from a491521 to 62f4ea7 Compare November 9, 2026 21:51
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 7dace1f into main Nov 9, 2026
77 of 78 checks passed
@capy-ai capy-ai Bot mentioned this pull request Nov 9, 2026
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