Repository navigation
v1.91.252.0 feat(retro): factory scorecard (lead time, gate cost, red-train and flaky rates) and the recommended-harness adoption doc - #3471
Merged
Conversation
…nd flaky rates) and the recommended-harness adoption doc 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>
… read and a bad --now Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review pass 1 (core checklist, testing, maintainability, security, performance, simplification, state-machines, red team) over the whole diff: - the flaky line and cost-per-merge depend on every input they read, so a failed free-run or PR read prints unavailable (...) on its half instead of 0 - a PR verdict-comment cost backs one gate run per PR; a READY comment after the merge is ignored - one unreadable artifact leaves its run without cost or flake data instead of dropping the gate section - --repo defaults to the origin owner/name and is required without one (no built-in repository) - --max-artifact-runs, --pass-cap and --pass-marker are validated; --csv creates its directory - one artifact listing per gate run; PR comments are paged; issues use the exact window instant - every run appends its rows to trend.csv in --out-dir - new row: review passes per PR (median, p90, PRs at the cap) from the ship receipt or a comment marker - /retro: report format gains the Factory scorecard slot; the Step 7.5 fence quotes its placeholder - tests for each; <window-days> joins the placeholder allowlist Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…tHub-host origin parsing, idempotent trend.csv - usage() strips the header comment decoration again; --help text asserted - passCount takes the first all-digit capture group; --pass-marker without a capture group exits 2 - --repo falls back to the origin remote only on github.com or GH_HOST; a local-path origin exits 2 - trend.csv keeps one row set per repo and window (a rerun replaces its rows) and always carries its header - /retro Step 7.5 points at SCORECARD_TREND for the weeks; the doc cites the per-PR baseline CSV Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…case The case removed the first .md readdirSync returned under gstack-qa/sections. qa-patterns.md and system-functional.md are referenced only in table form, which setup --status does not count as section links, so on an ext4 directory order that listed one of them first the deleted file broke nothing and --status exited 0: deterministic red on remote-gate VMs, green on Actions. Delete scope.md, which every host's rendered SKILL.md reads. Closes #3479 Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Contributor
|
6 of 7 tasks
garrytan
added a commit
that referenced
this pull request
Oct 26, 2026
…nk case A test repair the remote gate requires, not a review finding. The case deleted the first .md readdirSync listed under gstack-qa/sections, and on the remote-gate VM's ext4 that was a file setup --status does not count, so the case was deterministically red there (#3479) while green locally and on Actions. The same one-line change ships in #3471 (fd468eb); this copy carries no CHANGELOG line so the two merge cleanly. Refs #3479 Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…card Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
4 tasks done
3 tasks done
capy-ai Bot
added a commit
that referenced
this pull request
Oct 27, 2026
…forget/prune --stale, verify --post-merge, ready --dispatch-ci, --stack-tests (#3484) * feat(ship-queue): screens read from the run, train watch/forget/prune --stale, verify --post-merge, ready --dispatch-ci, --stack-tests Operating merge trains on 2026-10-26 showed the gaps this closes. A dispatched screen's verdict is read from the run's gate-binding and report-verdict artifacts (lib/ship-queue-screen.ts) and recorded in the READY receipt: a RED screen refuses ready under either choice and is never re-dispatched at the same merge SHA (QUEUE_SCREEN_RED); a run that concluded success with no slice is NOT-RUN (QUEUE_SCREEN_NOT_RUN), never followed, and counted as unscreened by train build. When refs/pull/<n>/merge lags or is missing the screen is planned on a scratch merge pushed as screen/<pr>-<head12> (#3465); QUEUE_SCREEN_STALE_REF means a real conflict only. train watch --train is the resumable follow command; train prune --stale settles a merging/green train whose PRs all merged or closed elsewhere; train forget removes one record with an exact lease on refs/notes/gstack-trains; verify --post-merge <sha> watches main's push workflows until they settle; ready --dispatch-ci <wf,…> dispatches the free workflows on a conflicting PR, waits, and clears the matching requires-remote pregate lanes with the run URLs; train build --dry-run --stack-tests runs each PR's new test files on its integrated prefix before anything is dispatched (QUEUE_TRAIN_STACK_RED). Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * Regenerate gstack-doctor-components.sh for the four new QUEUE_* result codes The committed Bash render was four case lines behind its generator, so test/doctor-components.test.ts failed at c75ec3a. Output of bun run gen:skill-docs; no hand edits. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * Restore the exact stderr line count in the POLICY_SOURCE_UNAVAILABLE test RH-15: toBeGreaterThan(0) after a toMatch is vacuous; the refusal is one deterministic line, so toBe(1) holds and is restored. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs(ship-policy): a lagging merge ref is a scratch merge, not QUEUE_SCREEN_STALE_REF Three passages still described the pre-scratch-merge refusal; they now match screenMerge: a missing or lagging refs/pull/<n>/merge gets a screen/<pr>-<head12> scratch merge, and QUEUE_SCREEN_STALE_REF is a real conflict with the base only. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * stack-tests: drop the dead detail clause and assert the worktree is gone r.detail === 'pass' can never hold when r.ok is false; the dry-run test now checks git worktree list instead of a state-dir name that was never written. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * ready --dispatch-ci: fail closed on fork or unreadable PRs, surface gh errors, keep screen: after READY dispatchCi now uses prInfo (a fork head or an unreadable PR is refused instead of dispatched), reads gh's error text when the workflow run call fails, and calls runsAt once. The screen: line is inserted after the READY line instead of at index 1, which with --dispatch-ci put it before READY and after the first CI_DISPATCH line. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * verify --post-merge: honour commit statuses in the settled and red verdicts settled and red were computed from check runs only while ci.green also counted commit statuses, so a pending status was called settled and a failed status was reported as 'red: ' with no name. Pending statuses now keep the verdict pending; a red status with no failed check run is named as such. The fixture gains a statuses knob to drive both. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * train watch: reject a malformed --free-timeout as usage instead of taking the default Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * train forget: restore the local notes ref on a rejected lease and refuse every in-flight state forgetNotes removed the note locally before the leased push, so a rejected lease left a local notes ref without the note that the next plain persist pushed without a lease. It now snapshots the ref and restores it on rejection, reporting failed removals separately. forget refused only merging/gate-pending/free-pending; built, pushed, free-green, dispatch-unknown and dispatch-absent are in flight too and are refused the same way. CHANGELOG and ship-policy say so. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * train build --dry-run: never persist or push the read screen verdict admitSlots recorded a verdict that differed from the receipt and pushed refs/notes/gstack-trains before the dryRun branch printed 'nothing written, pushed or dispatched'. It now takes dryRun and skips the persist, matching trainReady's guard. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * stack-tests: only bun test files count as new tests, passed as paths TEST_FILE matched every .ts under test/, so a PR whose only added file was a helper or fixture ran 'bun test test/helpers/x.ts', which exits 1 (the filter matches no test file) and was reported QUEUE_TRAIN_STACK_RED. A bare positional is also a substring filter that picks up unrelated files. The rule is now bun's own (.test, _test_, .spec, _spec_ in the name) and each file is passed as ./<path>, which bun treats as the exact file. The fixture PR 3 now adds a helper and is still 'no new test files'. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * screen: page the run's artifact list before picking the newest binding One page of 100 artifacts can miss gate-binding/report-verdict on a broad or rerun screen (three artifacts per slice plus reruns), which read as 'bound no verdict' and bought a fresh screen. newestArtifact now follows page= until a short page. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * stack-tests: match bun's _test and _spec suffixes too Bun discovers a file whose name ends in .test, _test, .spec or _spec before the extension. The previous rule missed the underscore forms (b_test.ts, e_spec.ts), so a PR adding only such files got no stack check, and it matched names bun ignores. PR 1 in the fixture now adds test/pr-1_test.ts to prove the underscore form is run. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs: ship-policy and troubleshooting match the shipped train commands Step 14.5 documentation audit: the stack-tests naming rule is bun's own (.test, _test, .spec, _spec); prune --stale deletes every merged or closed PR's screen/<pr>-* branch; verify --post-merge takes the full SHA and counts commit statuses; train watch --free-timeout and ready --dispatch-ci --timeout defaults; PENDING/UNKNOWN/INCOMPLETE screen verdicts; QUEUE_SCREEN_STALE_REF's Meaning no longer contradicts its Fix; one sentence each for the new QUEUE_NOT_READY, QUEUE_TRAIN_UNTRUSTED and QUEUE_TRAIN_PENDING triggers. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * changelog: prune --stale scope, post-merge commit statuses, STALE_REF vs POLICY_SOURCE_UNAVAILABLE Three details the documentation audit found wrong against the code; the entry stays under [Unreleased] (stamp-at-merge). Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs: RED screens are not seated; QUEUE_PROOF_MISSING and POLICY_SOURCE_UNAVAILABLE name the train-command causes Step 14.5 re-audit: ship-policy.md says train build does not seat a RED screen and its NEXT names the build without that PR; troubleshooting.md lists train forget, train watch, verify --screen and the scratch-branch push under QUEUE_PROOF_MISSING, and the origin/<base> fetch under POLICY_SOURCE_UNAVAILABLE. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(host-conformance): delete the named scope.md in the C3 broken-link case A test repair the remote gate requires, not a review finding. The case deleted the first .md readdirSync listed under gstack-qa/sections, and on the remote-gate VM's ext4 that was a file setup --status does not count, so the case was deterministically red there (#3479) while green locally and on Actions. The same one-line change ships in #3471 (fd468eb); this copy carries no CHANGELOG line so the two merge cleanly. Refs #3479 Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * v1.91.263.0 stamp Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- 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.
What changed
Before:
/retroreports git-only metrics. Nothing says how many PRs merged, how long they took, how many review passes they took, what the gates cost, how often a train went red or how many cases flaked, and there is no page that takes a new team from zero to a first merged train on gstack + Capy.After:
bin/gstack-factory-scorecardprints this table (plus this window's CSV and an accumulatingtrend.csv) for any window; each line carries its counting rule and what one of the best factories would show, so the gap is visible next to the number. The highlighted row is the review-pass count the convergence rule adds. This is a real run against garrytan/gstack for 2026-10-19 to 2026-10-26 (read-only, under 3 minutes with a warm artifact cache).Why
Two crews ran gstack under a Capy Captain for a week (about 100 merges each) and nobody could say from one place whether the factory was getting better: lead time, cost per merge, the red-train rate and the flaky rate lived in train verdicts, PR comments, artifacts and a hand-kept ledger. At the same time three more Captains adopted the same model on their own repositories and hit the same install, receipt and review problems because the operating model was only in one Captain's Drive. Garry's words for the plan: "Do it and also improve it: fix the issues all the captains have seen in this Capy project." This PR gives
/retrothe numbers and gives a new team the page.bin/gstack-factory-scorecard(lib/factory-scorecard.ts): merged PRs (crew vs outside by--crewlogins or author association), lead time created → merged and READY → merged (median, p90; a READY comment after the merge is ignored), review passes per PR (median, p90 and how many PRs sat at--pass-cap, read from the ship receipt's"passes": Nin the PR body once /ship writes it, else apasses=N/REVIEW_PASSES: Ncomment, both behind--pass-marker), gate runs green / red / cancelled with known cost (the run'sreport-verdict-a*artifact, else the**$N** rule/judge cost/cost=$Nline of the PR's verdict comment, used by one run per PR), cost per merge, red-train rate (head branch under--train-prefix), flaky events fromflake-records-a*andflake-ledger-*artifacts (the daily flaky pass's two sources), issues opened vs closed, releases cut. Markdown + CSV (+--json), and every run appends its rows totrend.csvin--out-dir(one row set per repo and window). A line whose input cannot be read printsunavailable (<reason>)on that line, never 0, and one unreadable artifact leaves its run without cost or flake data instead of dropping the gate section.--repodefaults to the origin remote's owner/name on github.com (orGH_HOST) and is required without one; there is no built-in repository.--fixturesreplays recorded gh responses. Every repo-specific name (gate and free workflow, train prefix, READY and pass markers, base, crew) is a flag./retroStep 7.5 runs it whenghis authenticated and pastes the table, third column included; the report format gains a Factory scorecard slot. The retro skeleton stays under its parity cap (73,432 of 73,450 bytes; 73,400 after merging today's main).docs/recommended-harness.md: zero to first merged train on gstack + Capy: the user-scope skill and its install check, the repository files, the Captain and its Drive layout (templates anddocs/captain.mdland with the/captainskill in v1.91.253.0 feat(captain): /captain skill (also /crew), crew templates and docs/captain.md for running a crew from one controller #3473; linked, not duplicated), the lane and controller steps of the first train, the daily flaky pass as a Capy automation, the weekly release, the scorecard with gstack's own numbers against the bar, a Capy-specific vs harness-generic table, the options where the two crews differ (shipped as options, not one crew's habit), and the known Capy limits from the five Captains' issue files dated 2026-10-26. Linked from the README docs table;docs/standalone-binaries.mdlists the CLI.Where gstack stands this week, honestly: lead time (median 7.9h, p90 23.7h), green rate (95%), red-train rate (4%) and issues (50 opened / 56 closed) are inside the bar; READY → merged and review passes have no number yet because the crew reports READY and the pass count in-thread rather than on the PR (the doc's step 6 and the receipt's
passesfield fix that); flakiness is the line that is not inside the bar (21 paid flaky cases across 77 gates, 17 of 103 free runs retried).Approvals
Source: gstack-approvals record for harness/factory-scorecard (display only; not an approval citation).
Review
/ship pre-landing review, converging per the crew's three-pass rule: 3 passes.
2219c78: per-input unavailability on every line, comment cost used by one gate run per PR, post-merge READY comments ignored, per-run artifact failures contained, no built-in repository fallback,--max-artifact-runs/--csvvalidation, one artifact listing per run, paged PR comments, exact-instant issue window,trend.csv, the Factory scorecard report slot, and the<window-days>fence placeholder that failed INV-3 on the first CI run.cacc600:--helptext, pass-marker capture-group handling and validation, GitHub-host-anchored origin parsing, idempotenttrend.csv, Step 7.5 wording.test/host-conformance.test.tsC3 failed deterministically on two remote-gate VMs while green on Actions, because it deleted whichever sectionreaddirSynclisted first and two gstack-qa sections are referenced only in table form. It now deletes the namedscope.md(fd468eb, Closes test(host-conformance): the C3 broken-section-link case depends on readdir order (fails on ext4 VMs, passes on Actions) #3479; reproduced locally by naming the file).Named and not fixed, by design or deferred (none blocking): the shared-code advisory to reuse
listWorkflowRunsfor the gate query (the gate query filters by event and the shared helper does not); the default artifact cache underos.tmpdir()(--cache-diroverrides it; the cache holds public CI artifacts); READY and cost markers are read from any commenter (the markers are configurable regexes; restricting by author association is a follow-up if a repository needs it); the--repo/ workflow flags are interpolated intogh apipaths unencoded (operator-supplied, documented); the per-PR comment reads and per-run artifact reads are sequentialghcalls (bounded by the page cap and--max-artifact-runs; a warm cache makes a week under 3 minutes).Gate edits: none detected (3 listed, 0 read; the diff adds a fixture registration in
test/helpers/free-fixtures-data.tsand a placeholder intest/helpers/placeholder-allowlist.ts, no CI, runner or golden change). State-machine check:STATE_MATRIX_CHECK: ok machines=0(no real state machine; the detector matched the words hold/release in prose).Exploratory QA
Report-only probes on the fixture and live: the bin against the recorded fixture prints every row and writes the CSV, MD, JSON and trend files; two degraded fixture copies (free-tests runs removed; pulls removed) print
unavailable (...)on exactly the affected halves;--helpprints the usage text clean; a local-path origin without--repoexits 2; the live run against this repository (103 merged PRs, 77 gate runs) completes with exit 0 and every row populated. All passed on the current head.Evidence
bun run typecheck: zero errors.bun run typecheck:test: 819 known diagnostics, none new.bun test test/factory-scorecard.test.ts: 20 pass (recorded fixturetest/fixtures/factory-scorecard/recorded.json, no network).gstack-pregate runcomplete on the head; the free tier's requires-remote lanes are cleared by the remote gate (Ubicloud us-east-a2, 607 files) and the two dispatched CI runs (receipt above). Remote-gate spend for this PR: $0.34 over four attempts (one capacity timeout with no tests, two reds on test(host-conformance): the C3 broken-section-link case depends on readdir order (fails on ext4 VMs, passes on Actions) #3479, one green).test/gstack-retro-metrics.test.tsfails on this Capy machine on main too (Capy's git wrapper forces the linked author identity, so the fixture'sGIT_AUTHOR_NAMEis ignored); it passes in CI and is listed in the doc's known Capy limits.Issues
Fixes #3479
Related: #3473 (the /captain skill, templates and docs/captain.md this doc links to)