Repository navigation
gstack-runaway prices each wake and marks it cold or warm (GST-2770) - #4385
Merged
Merged
Conversation
Each wake read is priced in warm model calls, with a cold call (after the 5-minute prompt cache lapsed) at 19.4. The scan line reports cold and empty wakes' share of spend, and scan --wakes lists each wake. A message sent to another thread now counts as action. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> # Conflicts: # test/fixtures/context-budget.json
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…nd ignores a null message target A cold wake no longer counts its first call twice, a call issued more than 5 minutes after the previous model call is cold whether or not an inbound item was recorded, and a report to the parent with an explicit null target stays a report. Review-Finding: p1/outside-voice#1 reader=outside-voice Review-Finding: p1/outside-voice#3 reader=outside-voice 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>
…of spend in docs/skills.md Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Merged
capy-ai Bot
added a commit
that referenced
this pull request
Nov 17, 2026
- /autoplan's approval page no longer hides a reviewer's product objection behind "keep your direction". (#4431) - Every skill that loads the shared preamble, on every host, now says to ask a question once and to check a file before handing it over. (#4383) - The Captain manuals now name the `Failed or skipped:` and `Also changed:` lines that READY and lane reports carry. (#4432) - gstack's shell locks hold again on Ubuntu 26.04, where `mkdir` reports success when another process won the race (GST-2247). (#4262) - `test/gstack-lock-race.test.ts` runs the old pattern and the helper against a PATH shim that behaves like uutils 0.8.0 `mkdir`, so it runs on any runner image: the old pattern lets two of four racers win, the helper admits exactly one in each of 60 races and never overlaps across take, hold and release loops, and parallel `gstack-config` writers keep every key. (#4262) - Windows Setup E2E now runs when `bin/gstack-lock.sh` changes. (#4433) - Claude Code's skill list now says when to use each gstack skill, so Opus loads /review and /plan-eng-review when a request fits. (#4387) - A pull request's merge head can no longer keep its `/ship` receipt without a full review. (#4365) - `/ship` now counts review rounds per pull request, and the head that merges always gets a full review. (#4360) - /ship's documentation audit no longer accepts a passing result when an earlier line from the same audit said "blocked". (#4434) - /ship's documentation audit no longer spends an attempt when the audit child writes text after its result. (#4285) - The README lists the two new guides, and the install doc counts its hooks right. (#4403) - docs/releases.md now says the stable release cut treats a failed commit status as red and a pending one as still going, as it has since #4257. (#4436) - /ship's `finish --docs-requested` now accepts a docs fix when the audit named the file with a line number. (#4437) - Document the `.gstack/approval-classes.json` schema, `gstack-approval-classes` CLI commands, and owner approval citation format in `docs/ship-policy.md#approval-classes`. (#4355) - `/eval-plan` now runs four result checks instead of leaving them to judgment. (#4384) - The /review coverage-audit eval no longer fails a run that really read the source file when zsh stops a command line at an `echo ====` separator. (#4364) - Sixteen in-repo documentation links reach their section again. (#4394) - gstack agents now open every status report with what failed, what they didn't verify and what else they changed. (#4273) - Two new short guides. (#4380) - A skill you wrote whose contract still lists `check_after_last_edit` keeps the rest of its contract. (#4439) - The ship policy guide now explains how to merge any pull request with `gstack-ship-queue land`, even in a repository with one maintainer. (#4377) - /ship's test step runs a large unit suite on Linux. (#4426) - Every skill that loads the shared preamble, on every host, now says never to print a whole environment, git config or process table. (#4382) - Pull requests from /ship now open with at most three plain lines, and every merge lands as one commit titled with the PR title. (#4438) - `gstack-pr-wait`, `gstack-ci-gate` and the release cut no longer call a commit green while a check on it failed. (#4257) - `gstack-runaway` now says what a thread's cold and empty wakes cost, not just how many there were (GST-2770). (#4385) - The optional Stop hook no longer checks for a test run after the last edit, and /verify asks for it in plain words instead. (#4428) - /ship's test step says when it ran out of time, and you can set its budget. (#4429) - The remote test command no longer puts every file on one command line. (#4429) - The stable release no longer waits on the nightly Windows tests (GST-2815). (#4400) - Ubicloud fan-outs can no longer overshoot the vCPU limit, and owners no longer delete each other's VMs. (#4430) - hono is pinned to 4.13.16, which fixes five advisories the weekly OSV scan found in 4.13.13 (gstack#4406). (#4408) - `package.json` overrides (#4408) - `test/dependency-security.test.ts`: the lockfile floor check now covers `hono >= 4.13.16`. (#4408) - The nightly Windows test run finishes again. (#4409) - A short write-up checklist in ETHOS.md. (#4381) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gstack-runawaynow says what a thread's quiet and wasted wakes cost, not just how many there were: each wake is marked cold or warm and priced, and the scan reports cold starts' and empty wakes' share of spend.Why: most of a busy coordinating agent's spend goes on wakes after the 5-minute prompt cache lapsed, and nothing showed that without a hand count.
Nothing to do: the tool stays read-only, and no threshold changed.
Agent notes
What changed
lib/runaway.ts:wakes()returns one record per wake (start, idle seconds, cold, calls, cold calls, empty, cost in warm calls). A cold call costsCOLD_CALL_PRICE= 19.4 warm calls (Opus 5.5, measured 2026-11-08: $2.42 against $0.125 per million counted tokens). A wake is cold when it starts more thanCACHE_TTL_S(300 s) after the thread's previous model call; any later call issued more than 300 s after the model call before it (the call after a long tool) is also priced cold, and a cold wake's first call is counted once. More than 300 s idle before a call inside a turn, less that call's own run time, starts a new wake (platform wakes leave no transcript item).wakes cold_wakes empty_wakes cold_extra_spend empty_spend; the empty-wake WARN adds the empty wakes' share of spend;scan --wakesprints a WAKE line per wake.message_agentsend to another thread (it names a non-nullto) is action even with state "working". Before, it counted as an empty wake, which put coordinating threads' empty share 4 to 12 points high. A report to the parent with an explicit"to": nullstays a report./runaway-stopperfetch keeps each message's target (with a fallback on the item's target text when the input is cut short) and each call's run time. Its context-budget ceiling alone moves 3841 → 4328 (fresh capture value).Measure: priced meter against the 2026-11-08 hand count, four coordinating agent threads, 2026-11-03T20:45Z to 2026-11-08T14:01:54Z, read-only transcripts:
Recounted with the meter as shipped at 97aa5e6; cold and empty shares within 1.3 points of the hand count.
Residual: the hand count's own turn-splitting script isn't readable from here, so the last points are unexplained, not fixed. The hand count's spend shares were themselves modelled from the same ratio.
Checks run locally:
bun test test/runaway.test.ts(24 pass, 140 expect calls; the two changed tests fail on the pre-fix code), typecheck, test-typecheck ratchet, module-size ratchet, gen-skill-docs freshness, parity suite, context-budget ratchet, host-config goldens and the skill-size guards.Plan: lean /autoplan, one reviewer: 1 High (a wrong "9 to 12" figure, corrected to 4 to 12), 3 Medium and 4 Low, all fixed or documented; gate answered
rec.Approvals
Approved: yes (record r-8a52294c3a83). The full approval record stays private.
Plan: approved (record r-787b1ecf5c01)
Plan check: approved (record r-787b1ecf5c01)
Pre-Landing Review
Pass 1 at 1dc33b7 (full panel: batched testing/security/state-machines specialist, red-team, targeted money reader, Claude adversarial pass, second-model review on GPT-6.1 Sol): 10 findings, 3 marked blocking by the second-model review, 0 by the others; the targeted money reader found nothing. One fix round (7c57510) fixed 4: a
"to": nullreport counted as a send, cache expiry after a long tool charged to the wrong call, and a cold wake's first call counted twice. Pass 2 on the fix range (specialist, red-team, targeted money reader): 0 blocking, 2 notes.REVIEW_LOOP: passes=2 blocking_found=3 deferred=0 noted=6 fixed=4 scope=frozen ledgers_read=3 dispatches=5 est_input_tokens=21036
Gate edits: none detected (5 listed, 3 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Second-model review (GPT-6.1 Sol): FINDINGS, 3 marked blocking; 2 fixed, 1 left open below.
Open note:
lib/runaway.ts:81sums the run times of anexecuteprogram's parallel calls, so overlapping calls can overstate run time and understate idle time (second-model review finding 2, also adversarial note 2). Left unfixed after the second round; the recount above at 97aa5e6 shows the published shares hold with it in place.Review notes
Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.
lib/runaway.ts:123a sleep inside an execute program past 300 s splits one turn and can add an empty wakelib/runaway.ts:81summing parallel call durations can push idle below zero and hide idle timelib/runaway.ts:118two inbound messages with no tool call between them share the first one's start and warm flaglib/runaway.ts:78the cut-short send fallback rests on an unconfirmed transcript text field for reports to the parentlib/runaway.ts:78the cut-short fallback in addressed() and its template copy can count a long report to the parent as a sendlib/runaway.ts:296gstack-runaway --help still says a wake is cold after the thread's previous item; the code now measures from the previous model callExploratory QA
One functional probe on
bin/gstack-runaway scan --wakeswith a synthetic two-wake fixture: a wake after 600 s quiet readscache=cold cold_calls=1 cost=20.4and the RUNAWAY line carries the wake and spend shares. Verdict: pass (1 capture).Documentation
Status: updated, with one factual correction to
docs/skills.mdand no blockers.Scope:
18652ccc..7c57510onprice-runaway-wakes(4 commits, 7 files:lib/runaway.ts,test/runaway.test.ts,runaway-stopper/SKILL.md(.tmpl),docs/skills.md,changelog.d/price-runaway-wakes.md,test/fixtures/context-budget.json). There were no uncommitted or new files.Documentation health:
docs/skills.md: Updated.cold_extra_spendandempty_spendare now described as shares of spend, andcold_extra_spendnow includes calls made after a tool that ran past 5 minutes.runaway-stopper/SKILL.md.tmpl: Current. It says only cold starts count towardcold_extra_spend. That is close enough, so I left it unedited.changelog.d/price-runaway-wakes.md: Current. It matches the code and was not edited.README.md,AGENTS.md: Current. The skill list is unchanged.Coverage debt: The new
scan --wakesflag and theWAKE:line have reference coverage indocs/skills.md, the skill template and the CLI usage text, but no how-to example.COLD_CALL_PRICEis documented only in a code comment and the changelog.Diagram drift: none.
Test plan
bun run test: free suite at 97aa5e6 from CI run 44058599585 (1672 files); macOS named regressions from the same run, Windows smoke from run 44049762314.Agent notes