@krysoworks/kryso 0.0.0-stage → 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +152 -2
- package/bin/kryso +31 -0
- package/bin/ship-it-status +14 -0
- package/bin/ship-ledger +14 -0
- package/bin/ship-loop +14 -0
- package/bin/ship-pass +14 -0
- package/bin/warden +14 -0
- package/dist/answer.d.ts +38 -0
- package/dist/answer.js +48 -0
- package/dist/bytes.d.ts +5 -0
- package/dist/bytes.js +35 -0
- package/dist/cleanup.d.ts +1 -0
- package/dist/cleanup.js +629 -0
- package/dist/commands.d.ts +48 -0
- package/dist/commands.js +293 -0
- package/dist/completions.d.ts +24 -0
- package/dist/completions.js +239 -0
- package/dist/daemon.d.ts +15 -0
- package/dist/daemon.js +23 -0
- package/dist/diagnose.d.ts +47 -0
- package/dist/diagnose.js +314 -0
- package/dist/doctor.d.ts +1 -0
- package/dist/doctor.js +241 -0
- package/dist/env.d.ts +9 -0
- package/dist/env.js +17 -0
- package/dist/evidence.d.ts +39 -0
- package/dist/evidence.js +327 -0
- package/dist/home.d.ts +3 -0
- package/dist/home.js +27 -0
- package/dist/install.d.ts +59 -0
- package/dist/install.js +137 -0
- package/dist/isolate.d.ts +28 -0
- package/dist/isolate.js +402 -0
- package/dist/leftovers.d.ts +5 -0
- package/dist/leftovers.js +156 -0
- package/dist/machine.d.ts +6 -0
- package/dist/machine.js +185 -0
- package/dist/palette.d.ts +147 -0
- package/dist/palette.js +167 -0
- package/dist/plan.d.ts +1 -0
- package/dist/plan.js +133 -0
- package/dist/proc.d.ts +23 -0
- package/dist/proc.js +23 -0
- package/dist/read.d.ts +1 -0
- package/dist/read.js +297 -0
- package/dist/readiness.d.ts +5 -0
- package/dist/readiness.js +64 -0
- package/dist/remote.d.ts +6 -0
- package/dist/remote.js +85 -0
- package/dist/self-update.d.ts +1 -0
- package/dist/self-update.js +224 -0
- package/dist/semver.d.ts +7 -0
- package/dist/semver.js +42 -0
- package/dist/style.d.ts +71 -0
- package/dist/style.js +187 -0
- package/dist/update.d.ts +47 -0
- package/dist/update.js +190 -0
- package/dist/work.d.ts +25 -0
- package/dist/work.js +449 -0
- package/dist/workflows.d.ts +4 -0
- package/dist/workflows.js +73 -0
- package/docker/entrypoint.sh +44 -0
- package/docker/runner.Dockerfile +39 -0
- package/package.json +65 -4
- package/scripts/install-skills.sh +607 -0
- package/skills/code-review/SKILL.md +231 -0
- package/skills/kryso/SKILL.md +107 -0
- package/skills/kryso/golden/help.rounded.ansi +23 -0
- package/skills/kryso/golden/help.square.ansi +23 -0
- package/skills/kryso/golden/help.txt +23 -0
- package/skills/kryso/golden/table-narrow.json +11 -0
- package/skills/kryso/golden/table-narrow.rounded.ansi +4 -0
- package/skills/kryso/golden/table-narrow.square.ansi +4 -0
- package/skills/kryso/golden/table.ansi +5 -0
- package/skills/kryso/golden/table.json +11 -0
- package/skills/kryso/ledger.sh +2146 -0
- package/skills/kryso/palette.json +57 -0
- package/skills/kryso/reference/resuming.md +30 -0
- package/skills/kryso/reference/routing.md +23 -0
- package/skills/kryso/reference/stage-1-claim.md +79 -0
- package/skills/kryso/reference/stage-2-build.md +133 -0
- package/skills/kryso/reference/stage-3-prove.md +51 -0
- package/skills/kryso/reference/stage-4-pr.md +76 -0
- package/skills/kryso/reference/stage-5-reconcile.md +81 -0
- package/skills/kryso/reference/stage-6-merge-or-park.md +73 -0
- package/skills/kryso/reference/stage-7-close-out.md +62 -0
- package/skills/kryso/reference/terminal.md +7 -0
- package/skills/kryso/ship-it-status.sh +1503 -0
- package/skills/kryso/ui.py +274 -0
- package/skills/kryso/ui.sh +609 -0
- package/skills/kryso-build/SKILL.md +168 -0
- package/skills/kryso-shift/SKILL.md +167 -0
- package/skills/kryso-shift/archive.py +2784 -0
- package/skills/kryso-shift/archive_checker.py +462 -0
- package/skills/kryso-shift/archive_checker_lambda.py +155 -0
- package/skills/kryso-shift/archive_health.py +364 -0
- package/skills/kryso-shift/archive_launchd.py +140 -0
- package/skills/kryso-shift/archive_remote.py +990 -0
- package/skills/kryso-shift/archiving-checker.md +140 -0
- package/skills/kryso-shift/archiving-keep.md +115 -0
- package/skills/kryso-shift/archiving-recovery.md +112 -0
- package/skills/kryso-shift/archiving-remote.md +166 -0
- package/skills/kryso-shift/archiving.md +146 -0
- package/skills/kryso-shift/coverage.schema.json +225 -0
- package/skills/kryso-shift/deadline.sh +254 -0
- package/skills/kryso-shift/feedback.schema.json +35 -0
- package/skills/kryso-shift/feedback.sh +228 -0
- package/skills/kryso-shift/history-manifest.schema.json +331 -0
- package/skills/kryso-shift/keep-after.sh +55 -0
- package/skills/kryso-shift/measure.sh +611 -0
- package/skills/kryso-shift/merge-ready.sh +207 -0
- package/skills/kryso-shift/outcome.schema.json +16 -0
- package/skills/kryso-shift/pass-rules.md +8 -0
- package/skills/kryso-shift/profile.schema.json +42 -0
- package/skills/kryso-shift/reader.sh +692 -0
- package/skills/kryso-shift/reads.sh +151 -0
- package/skills/kryso-shift/reference/allowance.md +21 -0
- package/skills/kryso-shift/reference/driver.md +95 -0
- package/skills/kryso-shift/reference/measuring.md +67 -0
- package/skills/kryso-shift/reference/outputs.md +21 -0
- package/skills/kryso-shift/reference/pass-script.md +115 -0
- package/skills/kryso-shift/reference/reconcile-and-merge.md +55 -0
- package/skills/kryso-shift/reference/second-reader.md +9 -0
- package/skills/kryso-shift/reference/sweeps.md +83 -0
- package/skills/kryso-shift/repair.schema.json +14 -0
- package/skills/kryso-shift/report-template.html +679 -0
- package/skills/kryso-shift/report.py +389 -0
- package/skills/kryso-shift/report_fixture.py +65 -0
- package/skills/kryso-shift/reporting.md +58 -0
- package/skills/kryso-shift/result.sh +91 -0
- package/skills/kryso-shift/runner.sh +1178 -0
- package/skills/kryso-shift/ship-loop.sh +3977 -0
- package/skills/kryso-shift/ship-pass.sh +4987 -0
- package/skills/kryso-shift/steps.jq +19 -0
- package/skills/kryso-shift/workflow.mjs +830 -0
- package/skills/kryso-shift/workflows/default.json +22 -0
- package/skills/kryso-shift/workflows/ralph.json +13 -0
- package/skills/kryso-watch/SKILL.md +100 -0
- package/skills/kryso-watch/answer.schema.json +23 -0
- package/skills/kryso-watch/base-refs.sh +44 -0
- package/skills/kryso-watch/board.sh +58 -0
- package/skills/kryso-watch/reference/config.md +23 -0
- package/skills/kryso-watch/reference/outputs.md +30 -0
- package/skills/kryso-watch/reference/report.md +29 -0
- package/skills/kryso-watch/reference/scheduler.md +32 -0
- package/skills/kryso-watch/reference/settlement.md +29 -0
- package/skills/kryso-watch/reference/shift.md +44 -0
- package/skills/kryso-watch/reference/shim-limits.md +22 -0
- package/skills/kryso-watch/reference/triage.md +26 -0
- package/skills/kryso-watch/schema.jq +40 -0
- package/skills/kryso-watch/settle.schema.json +36 -0
- package/skills/kryso-watch/stage-common.sh +187 -0
- package/skills/kryso-watch/stages/report.sh +525 -0
- package/skills/kryso-watch/stages/settle.sh +722 -0
- package/skills/kryso-watch/stages/shift.sh +466 -0
- package/skills/kryso-watch/stages/triage.sh +379 -0
- package/skills/kryso-watch/tracker.sh +27 -0
- package/skills/kryso-watch/triage.schema.json +77 -0
- package/skills/kryso-watch/warden.launchd.plist +50 -0
- package/skills/kryso-watch/warden.schema.json +98 -0
- package/skills/kryso-watch/warden.sh +1004 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Reconciliation, merge and closeout
|
|
2
|
+
|
|
3
|
+
The script engine's stages after the pull request. The stages before it, and the checkpoint a resume reads, are in [The pass script](pass-script.md).
|
|
4
|
+
|
|
5
|
+
## The reconciliation context
|
|
6
|
+
|
|
7
|
+
A red check after the PR, and review feedback that needs a decision, are the two places the script engine starts a model process past the build. Both count against one cap of three contexts per issue. The pass reads the failed checks, reads the failed run's log with `--log-failed` and a tail into `logs/ci.log`, and digests the failed checks' names and that log, timestamps stripped, into an evidence fingerprint, so the same failure after a push reads as the same evidence and a different one as new. A context is started only when all of these hold. A check failed with a log to read, which a cancelled check or an empty log is not. The evidence differs from what the last accepted repair addressed. Fewer than three contexts have been spent on the issue. At least sixty seconds of the allowance remain. Otherwise the pass parks with the reason on the line, `reconcile parked ci-red <n> check(s) on <pr> (logs/ci.log) repairs=<n>/3 <why>`, and a resume reads the checks again. The green path never starts one.
|
|
8
|
+
|
|
9
|
+
### Feedback
|
|
10
|
+
|
|
11
|
+
The feedback is read before the checks, so a fix rides one push and one CI run, and again after them, so a finding left while they ran is not missed. The read is [feedback.sh](../feedback.sh)'s, whole: every page of the reviews, the conversation and the inline comments, every review thread's resolution, and the PR head the findings stand against, each read kept as `logs/feedback-read-<n>.json`. A page that cannot be read, a payload of the wrong shape or a failed thread query parks on `reconcile parked feedback-unreadable <why>`, because an empty set nobody could read is not evidence. Each item is sorted by the module's rule table and nothing else, never by its author, and each harmless rule matches a whole body or a whole state. The table is `feedback_classify` in [feedback.sh](../feedback.sh), pinned by `test-feedback.sh`. Everything else is a finding, an approval with a request in its body and a deleted account's question included, and the read's line names the findings, their authors and an evidence digest of the actionable set's ids and text. A green PR with only harmless feedback reaches the merge gate with no context started.
|
|
12
|
+
|
|
13
|
+
Findings under the cap and the allowance get a context with the brief `logs/feedback-<n>-prompt.md` and the findings as JSON beside it: it may fix inside the worktree, with related tests and never the full suite or a gate command, and it returns one decision per finding through `feedback.schema.json`: `fixed` with the commit, `deferred` with the tracking issue's title and body, or `rejected` with the fact it checked. The pass validates the set before anything is written: every finding decided once and nothing decided that was not asked, a reason on each, a title on each deferral, each fix's commit on the branch past the head the context started from, contained in HEAD, with changed code and a `feedback committed` line naming it, a clean tree on the branch, the reported head equal to HEAD, and every commit past the starting head named by a fixed decision. A set that fails is `reconcile rejected feedback <n> <why>` and parks on `feedback-open` with the rejection on the line, nothing written. The decisions that stand are kept as `logs/feedback-<n>-decisions.json`.
|
|
14
|
+
|
|
15
|
+
The writes are the pass's, never the context's, and each is looked for before it is made. A PR head the worktree does not hold parks on `feedback-stale` before any context starts. The PR head is read again before the writes: a head that is neither the one the findings were read at nor this pass's own push, every commit past the read head a fix the ledger names, means someone else pushed, and the pass parks on `feedback-stale` with no decision applied. The feedback is read again, and a decision whose finding changed or went since is dropped with a `reconcile stale` line, never applied to what replaced it, and the finding as it now reads gets the next context. A deferral opens its tracking issue, whose body ends in `<!-- ship-it: tracks finding=<id> pr=<url> -->`, and replies with the link, and a rejection replies with the reason. Each reply opens with `<!-- ship-it: finding=<id> decision=<word> digest=<digest> pass=<issue> -->`, the digest the finding's text as decided, so an edit to the finding reopens it. The reply goes in the thread for an inline finding, to the thread's first comment, and on the conversation, naming the finding, otherwise. The fixes ride one proof and one push, the whole gate to fresh receipts and then `reconcile pushed`, with their replies after the push, naming the commit on the remote. Each write is two ledger lines, `reconcile op intended <key> (logs/...)` then `reconcile op done <key> <url>`, keyed `issue:<finding>` or `reply:<finding>`. A response that is lost is read back: the ledger's done line, then the tracker's recent issues and a search, for the tracking marker, and the PR re-read for the reply marker, and what landed is `op recovered`. A tracker that cannot be read fails the pass, resumable, rather than open an issue nobody looked for. A restart that finds an `intended` with no `done` applies the recorded decisions again through the same path, which finds what landed and writes the rest: it cannot open a second issue or post a second reply, cannot answer a finding that changed, and starts no context to manufacture a decision it does not have. With no decisions on disk, each pending write is `op dropped` by name, once, and its finding is decided afresh. A round of replies that leaves the head where it was keeps the green read the pass already has, `reconcile ci kept`, and cancels nothing. Feedback still open at the cap parks on `feedback-exhausted`, and too little allowance parks on `feedback-open` with the reason.
|
|
16
|
+
|
|
17
|
+
The context is a fresh top-level session on the pass's profile, host, model, effort and budget, under the allowance, with no earlier transcript and no resumed session. A repair context gets the reviewer agents the build fork does, and a feedback context gets none. A repair's prompt is `logs/repair-<n>-prompt.md`: what failed and where the evidence is, the issue's own brief verbatim, what it may do, the review of its commit, what it never does, and the result shape. It may diagnose, edit the worktree, run related tests to receipts through the ledger module, reproducing a failure that shows only under load with parallel copies of the failing suite inside one receipt, because separate receipts take the gate lock in turn, and commit. It records the commit with a `repair committed <sha>` ledger line and its related receipts with a `repair tested <receipts>` line. The word is its own because `ledger.sh read` builds the gate's verdict from the last `gate passed` line, which stays the build fork's under [ADR 0007](../../../docs/adr/0007-a-pass-runs-the-full-suite-once-and-a-repository-runs-one-receipt-at-a-time.md), and from the pass's `prove` lines, which prove the repair's head. It never runs the full suite or a gate command, because the pass proves its commit with the whole gate before the push. It never pushes, opens or edits a PR, touches the tracker, creates an issue, widens the change past the brief, switches branches, rewrites history, parks, writes the checkpoint or extends its own count or allowance.
|
|
18
|
+
|
|
19
|
+
It returns a structured result, `outcome`, `head` and `reason`, through `repair.schema.json`, and the pass validates a `repaired` claim against the disk before anything else happens: the worktree on its branch, a clean tree, HEAD past the head the context started from and containing it, the reported head equal to HEAD, the `repair committed` line naming it, and a review of it that stands. A claim the disk does not show is `reconcile rejected repair <n> <why>` and the pass parks on `ci-red` with the rejection on the line, nothing pushed. A result with no block or an outcome the schema does not name is rejected the same way. `not-repaired` is a rejection too, `no repair found`. `needs-decision` and `out-of-scope` park under those words, and a resume refuses them, because the context has handed the failure to a person.
|
|
20
|
+
|
|
21
|
+
An accepted repair is proved and pushed by the pass, never by the context: the whole gate runs again on the new head to fresh receipts, `prove-<name>-2.log` beside the first, because the receipts behind the PR were over the head before, and the related receipts on the context's `repair tested` line prove nothing about the whole gate. A red gate parks on `reconcile parked gate-red <name> <log> after repair <n>`, unpushed, and a void one on `reconcile parked tree-moved <name> <log> <why> after repair <n>`, under [the gate's rule](pass-script.md#the-config). A resume of either reads the feedback and the checks again and does not rerun that proof by itself. Green pushes the branch, records `reconcile pushed <sha>`, refreshes the PR body, keeps the read that led to the repair as `logs/ci-repair-<n>.log`, and polls the checks again under `ci_wait`, so `logs/ci.log` is always the latest read. Each read takes the PR's head before its checks and counts only the checks on the head the pass last pushed. `gh pr checks` names no commit, so this rests on GitHub moving a PR's head only forward: checks read after the head are taken to be on it. For a few seconds after a push GitHub still reports the head before it and that head's checks, so such a read counts none and waits for the pushed head until `ci_wait` runs out, then parks on `ci-timeout` with both heads on the line. Every `ci-timeout` park follows a `reconcile ci timeout after <s>s on <pr> head=<sha>` line in the ledger module's grammar, because the module refuses a `ci-timeout` park until a wait on HEAD has run out, from either engine. It never reads the lag as no CI. A PR head that is not an ancestor of the pushed head is someone else's push. The poll ends at once on `reconcile ci moved`, and the merge stage does not merge it: a PR into the default branch stays open as always, and on any other base the stage's own read of the PR head refuses the merge. Red again with the same evidence is `reconcile parked ci-unchanged`, since another context would read what the one before it read. Red with new evidence gets the next context under the cap, and the fourth failure is `reconcile parked repairs-exhausted`.
|
|
22
|
+
|
|
23
|
+
A read gh refuses, of the head or of the checks, is a `reconcile refused <read> exit=<n> at <time>: <gh's line>` line on the ledger and in `logs/ci.log`, and the poll reads again after a wait until `ci_wait` runs out. GitHub's API answers a server error now and then, and the next read usually gets through, so one refusal does not end a pass whose checks may all be green. A read still refused when the wait runs out fails the pass at reconcile, resumable, with gh's last line. Rejected credentials, a token refused the resource, and a PR or repository GitHub does not have are refusals no wait fixes, so those fail it at the first read. `gh_refusal_final` in [merge-ready.sh](../merge-ready.sh) is the list.
|
|
24
|
+
|
|
25
|
+
The review runs inside the repair context, before it returns, as [ADR 0038](../../../docs/adr/0038-a-repair-is-reviewed-by-the-context-that-made-it-and-the-pass-refreshes-only-its-own-pr-body-text.md) decides. It is `/code-review`, as the build's is, over everything the push would carry: from the newest commit origin has on the branch, so a commit an earlier context left unpushed is reviewed too. Its spec is `logs/review-repair-<n>-spec.md`, the failure and the issue's brief, its report and triage are `logs/review-repair-<n>.md`, and the context writes the build's review lines under `repair`: `repair recorded head=<sha>`, `repair context <axis> <id>`, `repair restored <paths>` and `repair triaged <counts>`. The pass holds it to [the checks the build's review gets](pass-script.md), against `logs/repair-<n>-diff.patch`, the diff up to the recorded head. That head has to be past the pull request's and hold the branch as the context found it, a reviewer and the triage have to be recorded after it, every commit past it has to be one a `fixed` row names by its sha, and one axis at least has to be more than void. A review that fails any of these rejects the repair, with the check's name on the line. A commit that only lacked a review is accepted by the next context's review of it, with no commit of its own. One that stands is `reconcile reviewed repair <n> from=<sha> head=<sha> missing=<axes, or none> (logs/review-repair-<n>.md)`, and a void axis is `reconcile axis-missing repair <n> <axis>`. A rejected repair can leave its commit on the branch. Feedback then parks on `feedback-open` with `repair <n> left <sha> unreviewed` and starts no context, because a feedback fix would push that commit with its own. A commit of a repair that was accepted and then proved red is reviewed, and is not one.
|
|
26
|
+
|
|
27
|
+
The body is refreshed after every push this stage makes, a feedback fix's included, once the replies are posted and the repair's evidence is kept, so its gate table cites the receipts the proof of the pushed head names and its Review section carries each accepted repair's counts, deferred rows and missing axes. Only the pass's own text is replaced, as `pr-body.md` kept it: the change summary, each row of the gate table and the review, each on its own. What a person or a bot put around them stays, a piece someone edited is left as it is and named on the line, `reconcile body refreshed head=<sha> kept <parts> as edited on the PR`, and `pr-body.md` keeps that piece's old text, so one put back is refreshed next time, and a body the pass did not write is not touched, `reconcile body kept head=<sha>`. A body `gh` will not read or edit fails the pass, resumable, with the push standing, and the resume refreshes it before anything else.
|
|
28
|
+
|
|
29
|
+
Each context is one line of the ledger, `reconcile dispatched repair <n> of 3 (fresh start, profile, host, prompt, evidence, allowance left) reviewers <restriction>` or `reconcile dispatched feedback <n> of 3 (...)`, then `reconcile repair <n> exit=<n> ... (logs/repair-<n>.json)` or `reconcile feedback-context <n> ...` with what the host reported, and one entry of the pass record with the role `repair` or `feedback`, its usage and cost summed into the pass's totals once and left `null` where the host reported none. A rate limit or a budget stop in a context ends the pass with the same exit codes as in the fork, exit 2 or 3, the checkpoint `reconcile interrupted` with the count kept. A host error is `reconcile failed`, exit 1, resumable. A context the allowance stops is counted, because the count goes onto the checkpoint before the context starts.
|
|
30
|
+
|
|
31
|
+
The cap is per issue and never resets, across resumes, restarts, adoptions, handoffs and later sweeps. The count every resume reads is `ledger.sh read`'s `reconciliations.used`: the higher of the `repairs` this engine stamps on the checkpoint and the numbered `reconcile attempt` lines `/kryso` writes, one per fix-and-rerun, so a continuation under either engine starts the next context, never the first again. A person's commit, a push the pass did not make, a new sweep and a new host session all leave it where it is, and a rate-limit retry keeps what it consumed. Only the fork cap has a tree-moved rule. A ledger from before the count existed reads as its checkpoint says, or zero with no checkpoint count. The ledger's table types the new words: `needs-decision` and `out-of-scope` are `human-decision`, as is `pr-closed`, a PR a person closed without merging while the pass was stopped, and `ci-unchanged`, `repairs-exhausted` and `feedback-exhausted` are `retry-exhausted`, which the driver reads as `failed` for the shift, the way a spent fork cap is. The table cannot see the count, so the driver's own rule makes a `ci-red`, `gate-red` or `feedback-open` park with all three used `failed` too, because a continuation could only park on the cap again. None of these is continued. `feedback-open`, `feedback-stale` and `feedback-unreadable` are resumable. The engine's defaults do not change: `--timeout`, `--grace`, `retries`, `ci_wait` and the profiles are as before, and the fork cap of two is a separate count.
|
|
32
|
+
|
|
33
|
+
### The moved base
|
|
34
|
+
|
|
35
|
+
A pass in a shift of several on one integration branch can find the base moved under it by the time it reconciles. GitHub runs no pull-request workflow on a PR that conflicts with its base, so no checks on such a PR say nothing about the change, and a merge after them can only be refused (#677). So the reconcile stage fetches the base before each read of the checks, and a branch that lacks the base's tip has it merged in, `reconcile behind` and then `reconcile caught-up`, so CI runs on what will land.
|
|
36
|
+
|
|
37
|
+
A conflict is `reconcile conflict <files>`, and it is a repair under the same cap of three, because resolving it is a change to review like any other. Its brief lists both sides' commits, and its review reads from the base's tip, so the reviewers see the change as it will land. A conflict nothing here resolves parks `reconcile parked conflict <files>`, resumable, with the branch back where it was before the merge, so a resume merges the base again rather than trust a half-made merge. A red gate on a merged tree puts the branch back the same way before its `gate-red` park. No checks on a PR that GitHub reads as `CONFLICTING` is a `conflict` park as well, never `no-ci`. The record's change size and the merge's `.kryso/` rule measure from the merged tip, so what the base brought in is not counted as this change.
|
|
38
|
+
|
|
39
|
+
## The merge and the closeout
|
|
40
|
+
|
|
41
|
+
The merge is a person's where `/kryso`'s stage 6 says so and the pass's everywhere else. A pass whose base is the repository's default branch, read live from GitHub, parks at merge as `merge parked pr-open <pr> base=<base>`, and so does any pass started with `--park-at-merge`. Those parks are terminal and read no merge evidence. Any other base, an integration branch or the upstream branch of a plain stacked queue, is merged by the pass.
|
|
42
|
+
|
|
43
|
+
Immediately before the merge the pass reads every piece of evidence again and trusts none of the reads the reconcile stage made. The reads are the merge rule in [merge-ready.sh](../merge-ready.sh), the module a stacked sweep reads a dependent's blocker with, and the ledger's `read` document gives them the proof head and the CI state the reconcile recorded. The worktree is on its branch and clean. A `proved head=<sha>` line, which the prove stage and every reconciliation proof write after a green gate, names the current head, and the ledger's gate verdict is green. Origin's branch is at that head. The PR is open, from that branch into the base, at that head, and `MERGEABLE`. Every check is in the `pass` or `skipping` bucket, with none pending, and no checks at all only when the reconcile stage recorded `no-ci`. The feedback, read whole through [feedback.sh](../feedback.sh), holds nothing actionable and stands on that head. The repository allows a merge method: a merge commit where it can, then squash, then rebase. A default branch that cannot be read fails the pass at the merge, resumable, rather than park, because a resume may find the PR already merged. A refused read of the checks is made again inside `ci_wait`, under the poll's rule, each refusal a `merge refused` line. The stacked sweep's read waits for none, because its next sweep reads again. A read that fails or disagrees parks as `merge parked merge-unready <what it found>`, terminal, with the PR open, nothing merged and nothing closed, and the driver reads it as review-ready. Otherwise the pass writes `merge evidence` and `merge intended <pr> head=<sha> method=<m>`, then runs `gh pr merge <n> --<method> --match-head-commit <sha>`, so a push between the read and the merge is refused by GitHub rather than merged unread.
|
|
44
|
+
|
|
45
|
+
A merge is not taken on GitHub's word. The pass reads the PR back as `MERGED` with a merge commit, fetches the base from origin and checks the commit is on it, and the proved head too under a merge commit. Only then does it write `merge merged <pr> into <base> at <sha>` and the checkpoint `merge done`. A merge GitHub reports that origin does not hold fails the pass at the merge, resumable, with a reason that says GitHub reports it merged, so the pass calls it neither shipped nor unmerged. A `gh pr merge` whose answer is lost is read back: a PR that reads `MERGED` is verified and recorded as `merge recovered`, an open one parks as blocked, and one that cannot be read fails resumable. A resume at the merge reads the PR before anything else, so a merge that landed while its answer was lost, or while the allowance ran out, is recovered and never asked for twice.
|
|
46
|
+
|
|
47
|
+
The closeout follows only a verified merge. It takes `/kryso`'s stage 7 steps in stage 7's order, the tracker and origin before the worktree, so the worktree stays the resume point until the tracker is done, and the issue closes before the card moves. The issue is read, closed with a comment naming the PR, the base and the merge commit, and read back `CLOSED` before the ledger says `closeout issue closed`. The card moves to Done. The branch is deleted on origin. Then `.kryso/pass/` is copied to `.claude/kryso/shipped/` through `ledger.sh archive`, the worktree is removed and the local branch deleted, and the last lines land in the copy. The copy's checkpoint reads `closeout done`, terminal, once the branch is gone, so no reader of the archive takes a merged pass for a running one. Each tracker and origin step looks for its effect first, so a close or a delete that already happened is recorded rather than repeated. A step that fails stops the closeout there. The outcome is still `shipped`, because the merge stands, and the block's `closeout` field and the reason name the incomplete step. While the worktree is still there the checkpoint is `closeout failed`, resumable, and `--resume` re-enters the closeout with no merge, no fork and no PR. A local branch that will not delete after its worktree is gone is left to a person, named in the reason and in the copied ledger.
|
|
48
|
+
|
|
49
|
+
A tracker blocker is closed by this closeout and by nothing else. Without `--stack` a shipped pass's dependents stay blocked until the next sweep's read shows the issue closed.
|
|
50
|
+
|
|
51
|
+
## Rationalisations
|
|
52
|
+
|
|
53
|
+
| Excuse | Reality |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| "The checks were green at the reconcile a minute ago, so merge" | The merge reads the head, the checks, the feedback and the proof again, just before, and pins the merge to that head. A read from before is what a push in between makes stale. |
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# The second reader and the seam call
|
|
2
|
+
|
|
3
|
+
The second reader is off unless the repository or the caller says otherwise. With it set to `on`, `jev` or `llm` through `kryso.secondReader` in git config, `PLAYBOOK_SECOND_READER` in the environment or `--second-reader` on either script, in the order [Options](driver.md#options) gives, stage 4 runs `reader.sh audit` before it writes the body. The reader is asked one boolean question per deferred row, whether the brief asks for what the finding asks for, and per rejected row, whether the evidence names a checked fact. Fixed rows are left alone. A row read the other way from the fork, past the threshold `reader.sh` names for its outcome, is a dispute. The body's Review section gains a Second reader subsection after the deferred rows: a table of disputes, a no-disputes line with the row count and cost, a nothing-to-read line, or a skip with the reason. The ledger gets `review second-read reader=<backend> <n> rows, <d> disputes, $<cost> <log>` or `review second-read skipped <reason>`. A dispute changes nothing about the pass, and only a person acts on it. An unknown value is refused as a skip. [Playbook ADR 0017](../../../docs/adr/0017-a-second-reader-is-opt-in-answers-through-jev-first-and-decides-nothing.md) records why the reader is opt-in, why Jev answers first, and why it decides nothing.
|
|
4
|
+
|
|
5
|
+
Two backends answer. Under `on` or `jev`, Jev (`typesafe-ai/jev` over the Vercel AI Gateway, with `AI_GATEWAY_API_KEY` from the environment, or from the macOS Keychain service `kryso.jevKeychain` in git config names when that is unset) is asked first, and its probability is a measured one. When Jev cannot answer, because no key is set, the state is over its budget, the gateway still returns 429 or 503 after four attempts, it returns 403 or any other error, or its reply is garbled, a bare LLM context is asked the same state and questions and returns the same shape, so the audit and every later reader of the log still get an answer. The subsection's line and the ledger line then name the backend that answered and what Jev did: `llm read 2 deferred or rejected rows and disputes 1 ($0.002), after jev failed: gateway returned 429 after 4 attempts`. Under `llm` the LLM is asked alone and curl is never called. The context starts through the runner's bare classification mode on the pass's profile and host, on the subscription, with the host's keys and the gateway key stripped: no tools, no settings sources, no MCP servers, the rules, the brief and the rows as its system prompt, the questions answered through a structured-output schema with one probability per row, and at most 90 s of wall time. Its probability is the model's own word, and the request log marks it `self-reported`. The model is `kryso.secondReaderModel` in git config, else `claude-haiku-4-5` on the Claude host and the profile's model on any other. The LLM context is one context of the pass: it goes into the pass record with the role `second-reader`, and its usage and cost into the pass's totals, once. Both backends failing is a skip line naming both failures, and the pass's outcome, park word and exit code are what they would be with the reader off. The Jev key reaches curl on stdin and is never written. The reader sets no base-URL variable and hands the runner nothing but the prompt, the schema and the model.
|
|
6
|
+
|
|
7
|
+
The same switch gives the cut stage its seam call. The order is the `--seam` flag, then a `no-seam` label, then the reader, then `tdd`. When the flag and the label are silent and the reader is on, the cut runs `reader.sh seam` on the brief it has just written, one boolean question with stage 2's predicate as the criteria: does the brief describe behaviour a test can observe, where a dependency bump, a config or workflow YAML edit, a copy change and a pure rename do not. The call is `no-seam` only when the probability is at or under the threshold `reader.sh` names (`seam_no_seam_at`, 0.1). Anything higher, a skip, a failure, a refused switch value or no `reader.sh` installed is `tdd`, because a wrong `no-seam` ships testable code without tests.
|
|
8
|
+
|
|
9
|
+
The header's `seam:` line keeps its two values, since a resume reads and validates it and asks the reader nothing, and where the call came from goes on its own ledger line under the cut: `cut seam-call no-seam flag`, `cut seam-call no-seam label no-seam`, `cut seam-call tdd reader=jev probability=0.62 logs/seam-call.jsonl`, or `cut seam-call tdd default (reader skipped: the reader is off)`. The requests are `logs/seam-call.jsonl` in the worktree, and when the LLM answered it is one more context of the pass, in the record under the role `seam-reader`, with its usage and cost in the totals.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Sweeps, adoption and stacked sweeps
|
|
2
|
+
|
|
3
|
+
The mechanism behind `--sweeps`, `--adopt` and `--stack` under `--sweeps`. The terms, when to use each, and the limits on the flags are in [SKILL.md](../SKILL.md#sweeps).
|
|
4
|
+
|
|
5
|
+
## Sweeps
|
|
6
|
+
|
|
7
|
+
Each sweep takes one snapshot and processes it in order, and the two kinds of queue are discovered differently. An epic is live discovery: the first read walks every page of the sub-issues connection and fixes the shift's scope, the children open at that moment, in GitHub's order. Before every later sweep the driver reads the epic again, every page, and places the read against that scope: each in-scope child's state, assignment, worktree and open blockers are read afresh, a child added to the epic after the shift started is named and left for a later shift, one closed when the shift started stays out, and one the epic no longer lists is named as gone and not continued. A workset is a bounded set the caller supplied: one query for the named issues alone, one alias per number, in the caller's order, and the same filter. A workset never expands beyond the issues the caller named, even when they share an epic, because a list of issues is not authority to read their siblings.
|
|
8
|
+
|
|
9
|
+
The filter is open, unassigned, not locked by a worktree this shift does not own, and not blocked by an open issue. Without `--stack`, only the tracker can satisfy a blocker: a pass that reports its issue shipped does not free the children it blocks until GitHub shows the blocker closed, and the manifest keeps naming the block until then. With `--stack`, a blocker this shift owns can satisfy a dependent on evidence, under the rule in "Stacked sweeps". The shift's own record comes before the tracker's view. A child this shift worked to a terminal state is out with that state, `done in pass 2` or `review-ready in pass 1`, whatever the tracker shows. A child this shift owns and can prove resumable stays eligible although the tracker now shows the assignment its own claim made and the worktree its own pass cut, because the ownership, typed-state and fingerprint rules below are what admit a continuation. Whose assignment it is the pass reads for itself: a continuation of an issue since assigned to someone else is refused there, and the child is `not-taken` for the shift. An issue the filter drops is not spent on, and the manifest says why: `closed`, `assigned`, `foreign lock <worktree>`, `blocked by #N`, with each open blocker listed, `added after the shift started`, `reopened after the shift started`, `no longer a child of the epic`, `not found`, or named earlier in the workset. Without `--sweeps` an epic is one live discovery and a workset runs as given, and a taken or closed issue is that pass's own `nothing-to-take` or `locked`, as it always was.
|
|
10
|
+
|
|
11
|
+
The frontier is fixed for the sweep. A pass that closes an issue, opens a PR or unblocks a sibling changes nothing in the queue that is running: the child it freed is seen by the next sweep's read and enters there. The bounds are two caps. `--max` caps the distinct issues admitted across the whole shift, and its default under `--sweeps` is the scope rather than the first frontier, because a later sweep may admit an issue the first excluded. `--sweeps` caps the traversals, and an admitted issue gets at most one pass in each. The worst case is therefore `max × sweeps` driver passes, and the dry run prints it with the model starts it allows: one per pass under the `ship-it` engine and two under the script engine, which reruns its fork at most once, plus up to three reconciliation contexts for each issue `--max` admits under the script engine, a cap the issue keeps across passes, sweeps and shifts. Most shifts stop well short of it: the next sweep is taken only after every candidate in the current snapshot has an outcome, and a sweep whose plan is empty, nothing owned and resumable and nothing newly eligible with room under the cap, ends the shift there rather than spend the sweeps that remain.
|
|
12
|
+
|
|
13
|
+
Within a sweep the order is fixed. First the owned resumable issue that blocks another in-scope issue, earliest first, because finishing it is what unblocks the frontier. Then the other owned resumable issues, in the order they were admitted. Then the newly eligible issues in the snapshot's order, admitted while `--max` has room. One past the cap is held, and the manifest names it with the reason. Everything worked before and now terminal is excluded with its state, `done in pass 2` or `review-ready in pass 1`.
|
|
14
|
+
|
|
15
|
+
The driver stamps `shift owned shift=<id> pass=<n>` into the ledger of a worktree that appeared during its pass, the one line it ever writes there, and a worktree that was there before the pass is another pass's: a foreign lock, never continued and never stamped. The typed state is the supervisor's, read by the shell off the outcome block and the ledger, and the model cannot grant it: a pass that asks to be continued is continued only when the evidence agrees. Resumable means an owned worktree whose ledger last parked at `reconcile` on a word the table reads as resumable, which leaves out `tree-moved`, a reconciliation context's `needs-decision` or `out-of-scope`, and `ci-unchanged`, `repairs-exhausted` or `feedback-exhausted`, or parked with no park line, or a host that died after durable work and wrote no outcome block. Everything else is terminal for the shift: a `build needs-decision` or `no-feedback-loop` park, or a `pr over-budget` park, is a human decision, a `prove no-gate`, `cut install-failed` or `tree-moved` park is a missing prerequisite, a park with its PR open against the base is `review-ready` and waits at the human merge gate, `failed`, `build check-failed` and `prove gate-red` are the pass's own verdict after its own rerun, and the three reconcile words after its own reconciliation contexts, a script pass that shipped with its closeout stopped part-way is `closeout-incomplete` and the rest of its closeout a person's, and a resumable child the tracker shows closed is `done`, or `out-of-scope` when the epic no longer lists it.
|
|
16
|
+
|
|
17
|
+
A continuation is a fresh host session. Under the `ship-it` engine it is a new `claude -p` or `codex exec` whose prompt names the issue, its branch, the recorded stage and a brief: `Continue issue #N on branch B from stage S. Base branch: X. Continuation brief: <path>`. The only host-session resume the driver ever does is a rate-limit retry inside one pass, and no session id crosses a pass boundary. Under the script engine the continuation is the pass script with `--resume`, which re-enters the stage its checkpoint names, and its fork, when that stage is the build, is a fresh context. The typed states, the fingerprint, the stall rule and the summary are the same under both engines: the driver reads the ledger, and the ledger has one grammar. The brief, `continue-<issue>-<pass>.md`, is a page of facts read off the ledger, the gate logs' exit lines, git and the tracker: issue, branch, worktree, base, stage, the last ledger line as the checkpoint, commits past the base, tree state, each gate's exit code, the PR's state and checks, the review triage counts, the failure that parked it, and the attempt number with the fingerprint before it. No earlier transcript, child summary or log tail goes in, because those are the context the fresh session exists to be without.
|
|
18
|
+
|
|
19
|
+
Progress is a fingerprint the shell computes from durable evidence, and it costs no model context: the commit, the working-tree status and diff, the last ledger event that is progress, the PR's head, state and mergeability, its checks, the actionable feedback on it, and the issue's open blockers in the current snapshot. The feedback goes in as the evidence digest [feedback.sh](../feedback.sh) computes over the actionable set, the same reading the pass script makes, so a repeated notice, a fresh approval or an edited timestamp does not move it, and a new or an answered finding does. The ledger event is `ledger.sh read`'s `progress`: the last event with its time left off, passing over bookkeeping, which is a checkpoint line, a dispatch, a resume line, a reconciliation attempt, an interruption and a handoff. A continuation that only restarted, counted, dispatched or changed hands has made no progress. It is taken before a continuation and again after. A continued issue whose fingerprint did not change is stalled at once: it is not continued again this shift, and no further sweep is spent on it. A rate limit or a host interruption keeps whatever the pass committed and wrote to the ledger, and the next pass starts from that, not from the transcript that was cut off.
|
|
20
|
+
|
|
21
|
+
A shift that omits `--sweeps` is one sweep too, and leaves the same evidence: its commands, ordering, exit codes and result normalization are unchanged, and the manifest records the workset as given, or that a label shift takes no snapshot, because each pass picks its own issue.
|
|
22
|
+
|
|
23
|
+
## Adopting a stopped shift
|
|
24
|
+
|
|
25
|
+
What `--adopt` takes over, and why it needs a queue, is in [SKILL.md](../SKILL.md#adopting-a-stopped-shift).
|
|
26
|
+
|
|
27
|
+
Stopped is confirmed, never assumed. Every driver holds `driver.lock` in its shift directory through `ledger.sh lock`, a kernel lock that its passes and everything they start inherit, so the lock comes free only once the driver and all of those have exited. The adoption also reads each owned issue's pass authority. A lock or an authority still held, a shift id with no directory, or a shift from before the lock that never wrote its `summary.json` stops the new shift in the preflight with one `preflight: --adopt` line, before anything is written or started. The selection has to match as well. `shift.json` records the profile, host, billing, effort, model and passthrough arguments a shift ran, and an adopting shift that would run any of them differently is refused, so an engine change never selects another provider or moves billing to an API key. Its `model` is what `--model` named, null for the profile's default. `model_run` is the model the passes ran, the profile's when `--model` named none, and is there for people reading the record; the adoption compares `model`. A shift from before `shift.json` is compared on what the first line of its log records, which is all of them but the model: it is taken to have run the profile's default, so an adopting shift that passes `--model` is refused.
|
|
28
|
+
|
|
29
|
+
Each worktree the stopped shift owns is then typed off its ledger by the classifier a pass's outcome goes through. A resumable one inside the new shift's scope and under `--max` is adopted. A human decision, a PR at the merge gate, a spent fork cap, a spent reconciliation cap, an unknown disposition, an unsafe tree, and a worktree outside the scope or excluded from it are not: they stay the stopped shift's, and the new shift reads them as foreign locks. A worktree some third shift has since taken over is that shift's, never the stopped one's to give. Adopted issues count toward `--max` and are planned first, as owned resumable issues are, so the scope, the once-per-sweep snapshots, the order and the bounds playbook ADR 0003 fixes do not change.
|
|
30
|
+
|
|
31
|
+
The handoff is one ledger line per adopted worktree, written through `ledger.sh handoff` once the new shift has its id:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
2026-09-27T09:00:04Z shift handoff stage=reconcile from=script/20260927T010203Z to=ship-it/20260927T090000Z reconciliations=1/3 forks=1 consumed=2400s profile=claude host=claude billing=subscription effort=high
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
It carries the stage the continuation resumes at, the engine and shift it leaves and the ones it goes to, which is the change of owner, the reconciliation contexts used out of three, the forks the pass spent, the allowance its last pass consumed across its rate-limit retries or `unknown`, and the selection kept. The engine line in the header is never rewritten. `ledger.sh read` returns the last handoff as `handoff` and its destination as `owner`, with `via: "handoff"`, and the line is not an event, so the status tool, the stall rule and every reader of `last` see the ledger they always saw.
|
|
38
|
+
|
|
39
|
+
Both engines apply one rule before continuing a ledger: `ledger.sh authorized <worktree> <engine> <shift>`. When the latest ownership line is a handoff, it authorizes the engine and shift that handoff names and no other shift or engine, the engine that cut the tree included. A person at a terminal, outside any shift, names no shift and may continue what was handed to their engine, because the pass authority already refuses a second live pass. Without one, the engine in the header may continue its own ledger as it always could. The pass script reads its shift from `KRYSO_SHIFT`, which the driver exports, and `/kryso` reads it off the continuation brief, which gains three lines: `shift:`, `reconciliations:` with what the issue has used, and for an adopted worktree `handoff:`. When the pass script resumes a ledger `/kryso` opened, it derives what that header lacks, the merge-base with the base on the origin and the cut's default seam, and says so on one `resume handoff` line.
|
|
40
|
+
|
|
41
|
+
The dry run prints the adoption before anything is spent: the shift and how its stop was confirmed, each worktree taken over with its stage and the limits left, each one left behind with its reason, and what the adopted issues add. They count toward `--max`, so the pass bound holds. Under the script engine each reconciliation context they have left is a model start, and the line says how many are left. The start bound already counts three per issue, so they add nothing to it. Under `/kryso` the attempts they have left run inside each continuation's session. The summary's `adopted` object lists what was taken and what was refused, and the new shift's `shift.json` names the shift it adopted. A shift that adopted several, which only a bare `--adopt` starts, records a list in both: the shift ids in `shift.json`, and one such object per shift in the summary. Readers of the single-shift string and object read those unchanged.
|
|
42
|
+
|
|
43
|
+
### A bare `--adopt`
|
|
44
|
+
|
|
45
|
+
A bare `--adopt` names no shift and needs `--issues`, because it reads the owners before the tracker is read. For each queued issue with a worktree, the owner is the shift on the ledger's last `shift owned` or `shift handoff` line. Each shift found goes through the checks above: a directory, a free driver lock or a summary from before the lock, and no pass on its worktrees holding its issue's authority. A selection flag given on the command line is compared with each shift's record, and one that differs stops the preflight with a line naming the shift, the issue whose worktree it owns, and the field. A flag left out takes each shift's value. Every refusal comes before any group starts, so a refusal writes nothing.
|
|
46
|
+
|
|
47
|
+
The shifts are then grouped by selection, the profile, host, billing, effort, model and passthrough arguments, so two stopped shifts that ran one selection make one group. Each group runs as its own shift, `ship-loop.sh --issues "<its issues>" --adopt <each shift>` with the group's selection flags and the command's other options, in queue order of its first issue, one after the other. That shift makes every check a named `--adopt` makes, so the classifier, the scope, `--max` and the handoff are unchanged. The queued issues with no worktree a shift owns run last, in a shift under the command line's selection. Each group's shift takes the command's other options as they are, so `--max` and `--sweeps` bound each group rather than the whole command, and the pass bound above holds per group. A group that stops on a rate limit stops the groups after it, since they would meet the same limit, and the driver exits with the worst exit of the groups it ran.
|
|
48
|
+
|
|
49
|
+
`--dry-run` prints one line per group, its adopted shifts, its selection and its issues, and starts nothing:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
ship-loop: group 1 of 3: adopt shift 20261101T001643Z, profile claude, host claude, billing subscription, effort medium, issues #236 #326
|
|
53
|
+
ship-loop: group 2 of 3: adopt shift 20261101T081525Z, profile claude, host claude, billing subscription, effort high, issues #274
|
|
54
|
+
ship-loop: group 3 of 3: no stopped shift's worktree, profile claude, host claude, billing subscription, effort high, issues #400
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
A script-engine pass that ends `locked` on a ledgered worktree whose owning shift has stopped, its driver lock free or its summary written before the lock, ends the reason with the command that continues it, such as `Its shift 20261101T001643Z has stopped, so continue it with kryso shift --adopt --issues "236"`. A worktree a running shift holds, one no shift owns, and one whose shift directory is gone get no such sentence, since none of them can be adopted.
|
|
58
|
+
|
|
59
|
+
## Stacked sweeps
|
|
60
|
+
|
|
61
|
+
What a stacked sweep is, and what it never does, is in [SKILL.md](../SKILL.md#stacked-sweeps).
|
|
62
|
+
|
|
63
|
+
Before every sweep from the second on, the driver reads the evidence of every issue it has admitted, live, and sorts each into one of two lists. An issue is merge-ready when its state is review-ready, parked at the merge gate with its PR open, and every read agrees. The reads are the dependent rule in [merge-ready.sh](../merge-ready.sh), pinned by `test-merge-ready.sh`. The pass's own merge makes the same reads under the module's merge rule, and the five where the rules differ on purpose are named in the module's header: the proof head, origin's branch, the base, mergeability and a PR with no checks. The worktree is this shift's and sits on the branch the ledger names, with nothing uncommitted outside `.kryso/pass/`. The PR is open, its head is that branch, and its head commit is the worktree's, so a push from anyone else fails the read. The PR does not conflict with its base. The ledger's last `gate passed` line names logs that each end `exit=0`, and the last `prove <name> exit=<n> (logs/...)` line of every gate is green, whichever engine wrote it: the pass script's prove stage and `/kryso`'s stage 3 leave the same line. A read of the reviews, comments or review threads that fails keeps the issue rejected, the same as a check it cannot see. Every check on the PR is in the `pass` or `skipping` bucket, at least one of them passed, with nothing pending, failed or cancelled. The feedback on the PR stands on that head and holds nothing actionable by [feedback.sh](../feedback.sh)'s rule table, the reading the pass script makes: a finding nobody answered keeps the issue rejected whoever wrote it, and an answered, resolved or harmless item does not. A shipped issue, which under a stacked base means merged into the branch it was based on, satisfies its dependents from that branch, whatever its closeout reached. Everything else is rejected with the reason: a pending, red or absent check, a timed-out reconcile that is still resumable, a park without a PR, a human decision, a stale head, a missing gate line, or a state this driver does not read as done.
|
|
64
|
+
|
|
65
|
+
The filter then treats a merge-ready or shipped blocker as satisfied. A dependent whose every open blocker is satisfied is eligible, and it enters that sweep's snapshot, the one after the evidence was made, never the one running. Its base is the one branch that carries its satisfied blockers: the merge-ready blocker's branch, or for a shipped blocker the branch it merged into, and when two satisfied blockers sit on branches where one was cut from the other, the tip. Two branches neither of which carries the other leave no base to choose, so the dependent is held with `stacked on more than one branch` and named in the manifest, because a base picked from two is the guess the chain exists to prevent. A dependent whose blocker is rejected stays excluded as `blocked by #N (not merge-ready: <reason>)`, and never falls back to the shift base. A blocker the shift did not work is the tracker's to satisfy, as without `--stack`.
|
|
66
|
+
|
|
67
|
+
The order within a sweep is unchanged: the earliest owned resumable issue that blocks another in-scope issue, then the other owned resumable issues, then the newly eligible in the snapshot's order, which is where a freshly unblocked dependent lands. A stacked sweep never ends the shift on a missing link the way a stacked queue does: a child that parks without a PR, fails or stops on a decision keeps its dependents blocked, the summary names them, and the shift goes on with what it can run. The bounds are [the sweep bounds](#sweeps), plus a few `gh` reads per admitted issue per sweep for the evidence, which cost no model context.
|
|
68
|
+
|
|
69
|
+
Under the `ship-it` engine a pass based on an upstream branch merges into it, as in [A stacked queue](driver.md#a-stacked-queue), and a later dependent bases on that same upstream branch. Under the script engine the driver starts every pass of a stacked sweep with `--park-at-merge`, so each parks with its PR targeting the branch it was cut from whatever that branch is, and the stack is a chain of open PRs, each merge-ready on its own evidence. The Claude and Codex profiles run the same rule, because the driver reads the evidence and the profile only starts the pass.
|
|
70
|
+
|
|
71
|
+
A stacked sweep that runs out of sweeps with a dependent the next snapshot would admit stops as `sweep-limit`, and the reason names the dependent and the blocker whose evidence is merge-ready, so a person reruns the shift rather than merges. The last lines print one `stack:` line: what is merge-ready with its branch and PR, what shipped and into which branch, what is still blocked and by which reason, and what was held for want of one branch.
|
|
72
|
+
|
|
73
|
+
## Rationalisations
|
|
74
|
+
|
|
75
|
+
| Excuse | Reality |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| "The blocker's PR is open and its gate passed, so its dependent can start" | Open is not merge-ready. Every check green on the head this shift pushed, every gate log ending zero, no actionable feedback by the same rules the pass reads it with, and the tree on the branch the ledger names. One read short, and the dependent stays blocked with the reason. |
|
|
78
|
+
| "The blocker is merge-ready, so close its issue and let the tracker unblock the rest" | The satisfaction is the shift's, in its manifest and summary. The issue closes when a person merges the PR, and the next shift reads the tracker, not this shift's record. |
|
|
79
|
+
| "The pass said it is resumable, so continue it next sweep" | The pass's word is not evidence. The shell types the state from the ledger and the outcome block, and only an owned worktree at a stage the driver continues gets a second pass. |
|
|
80
|
+
| "The fingerprint did not change, but a third try might" | The same evidence in a fresh session produced the same evidence. A third session gets the same brief. Stalled, and a person reads the worktree. |
|
|
81
|
+
| "The workset's issues share an epic, so sweep the rest of the epic while we are there" | A workset is the issues the caller named. Reading their siblings widens the caller's scope without asking. `--epic` is how a caller authorizes that. |
|
|
82
|
+
| "The pass shipped the blocker, so run the child it blocked now" | The running snapshot is fixed, and a pass's word is not the tracker's state. The next sweep reads the epic again, and the child enters when GitHub shows the blocker closed. |
|
|
83
|
+
| "A child was added to the epic overnight, so take it while the shift is up" | The scope is the open children at the first read. A child added later waits for a later shift, and the manifest says so, because a scope that grows under the shift is one nobody bounded. |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"outcome": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"enum": ["repaired", "not-repaired", "out-of-scope", "needs-decision"],
|
|
7
|
+
"description": "repaired: a commit on the branch fixes the failed check. not-repaired: no fix was found within the allowance. out-of-scope: the fix needs changes the brief does not cover. needs-decision: the failure turns on a choice a person should make."
|
|
8
|
+
},
|
|
9
|
+
"head": { "type": "string", "description": "The worktree's HEAD after the commit, from git rev-parse HEAD, or the head the brief named when nothing was committed." },
|
|
10
|
+
"reason": { "type": "string", "description": "One paragraph: what the failure was, what changed, and where the evidence is." }
|
|
11
|
+
},
|
|
12
|
+
"required": ["outcome", "head", "reason"],
|
|
13
|
+
"additionalProperties": false
|
|
14
|
+
}
|