@sjawhar/claude-envoy 4.10.0 → 4.11.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/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/AGENTS.md +43 -497
- package/dist/codex-hook.js +9 -3
- package/dist/dispatch.js +9 -3
- package/dist/envoy-channel.js +10 -4
- package/dist/session-hook.js +9 -3
- package/legion/skills/legion-architect/SKILL.md +88 -66
- package/legion/skills/legion-architect/references/acceptance.md +89 -258
- package/legion/skills/legion-architect/references/decomposition.md +94 -213
- package/legion/skills/legion-architect/references/design-gate.md +88 -353
- package/legion/skills/legion-architect/references/wake-routing.md +51 -43
- package/legion/skills/legion-controller/SKILL.md +50 -181
- package/legion/skills/legion-controller/references/admission.md +25 -54
- package/legion/skills/legion-controller/references/backlog-stewardship.md +23 -119
- package/legion/skills/legion-controller/references/consolidation.md +9 -93
- package/legion/skills/legion-controller/references/daily-report.md +21 -99
- package/legion/skills/legion-controller/references/escalation.md +16 -118
- package/legion/skills/legion-controller/references/finding-asks.md +31 -162
- package/legion/skills/legion-controller/references/park-asks.md +33 -0
- package/legion/skills/legion-controller/references/parked-decisions.md +20 -264
- package/legion/skills/legion-controller/references/session.md +26 -84
- package/legion/skills/legion-controller/references/slack-mentions.md +18 -134
- package/legion/skills/legion-controller/references/triage.md +18 -89
- package/legion/skills/legion-controller/references/wakes.md +22 -549
- package/legion/skills/legion-controller/references/weekly-audit.md +9 -90
- package/legion/skills/legion-oracle/SKILL.md +19 -28
- package/legion/skills/legion-retro/SKILL.md +54 -93
- package/legion/skills/legion-retro/references/learnings.md +21 -33
- package/legion/skills/legion-retro/references/pr-body-content.md +21 -37
- package/legion/skills/legion-worker/SKILL.md +50 -64
- package/legion/skills/legion-worker/references/ci-checks.md +16 -84
- package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +34 -93
- package/legion/skills/legion-worker/references/default-branch-check.md +22 -60
- package/legion/skills/legion-worker/references/findings.md +25 -180
- package/legion/skills/legion-worker/references/foreign-path.md +14 -22
- package/legion/skills/legion-worker/references/gvisor.md +20 -0
- package/legion/skills/legion-worker/references/merge-gate.md +43 -419
- package/legion/skills/legion-worker/references/plan-tests.md +8 -28
- package/legion/skills/legion-worker/references/pr-body.md +19 -218
- package/legion/skills/legion-worker/references/review-threads.md +16 -70
- package/legion/skills/legion-worker/references/tools.md +31 -578
- package/legion/skills/legion-worker/references/withheld-capability.md +12 -163
- package/legion/skills/simplify-settled-diff/SKILL.md +23 -41
- package/legion/skills/simplify-settled-diff/references/personas/code-quality-reviewer.md +14 -14
- package/legion/skills/simplify-settled-diff/references/personas/code-reuse-reviewer.md +4 -4
- package/legion/skills/simplify-settled-diff/references/personas/efficiency-reviewer.md +8 -8
- package/package.json +1 -1
- package/skills/agent-secrets/SKILL.md +46 -312
- package/skills/agent-secrets/references/store-a-secret.md +9 -0
- package/skills/approval-review/SKILL.md +20 -76
- package/skills/asd-ste100/SKILL.md +43 -85
- package/skills/asd-ste100/examples/before-after.md +18 -53
- package/skills/dispatch/SKILL.md +1 -1
- package/skills/dispatch-writing-specs/SKILL.md +1 -1
- package/skills/envoy/SKILL.md +56 -126
- package/skills/envoy/references/check-settlement.md +26 -43
- package/skills/envoy/references/deliveries.md +26 -144
- package/skills/envoy/references/legion.md +12 -45
- package/skills/envoy/references/roles.md +11 -9
- package/skills/envoy/references/sources.md +13 -25
- package/skills/outside-message/SKILL.md +24 -81
- package/skills/plain-words/SKILL.md +24 -55
- package/skills/thermonuclear-code-quality/SKILL.md +16 -26
- package/skills/thermonuclear-deep-review/SKILL.md +22 -31
- package/legion/skills/legion-worker/references/cleanup-deletion.md +0 -22
- package/legion/skills/legion-worker/references/systematic-rename.md +0 -19
- package/skills/asd-ste100/references/writing-rules.md +0 -59
- package/skills/plain-words/references/mechanics.md +0 -49
|
@@ -1,437 +1,61 @@
|
|
|
1
|
-
# The merge gate: review
|
|
1
|
+
# The merge gate: review and the production check
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
approval, the tester on a look of its closed issue's production check, or the merger merging
|
|
5
|
-
the pull request. Every path it cites is in cybermonklabs/legion.
|
|
6
|
-
|
|
7
|
-
The order, in full: the tester's evidence green → the reviewer's approval of the head → the
|
|
8
|
-
architect's acceptance, in `accepting` → retro → the merger's merge of the head it read, which
|
|
9
|
-
closes the issue → the production check after the close, which the project's `production_check`
|
|
10
|
-
setting gives to a role or takes away. Every handoff is a record on the Dispatch issue, never a
|
|
11
|
-
commit, so the head that merges carries none. Retro commits nothing (*Retro*, below), so the
|
|
12
|
-
approved head is the head that merges, and no Legion check holds the head that merges to the head
|
|
13
|
-
the review approved in any case: a repository that wants its newest push reviewed says so in its
|
|
14
|
-
own rulesets. A conflict-forced merge goes back to the reviewer, who reviews what the merge
|
|
15
|
-
changed (*The reviewer*, below), and the issue keeps its phase while the implementer makes it
|
|
16
|
-
(`skill://legion-worker/references/conflicts-and-rewrites.md`, *The daemon's ask*).
|
|
3
|
+
Read it when you review or approve, or work a look of a closed issue's production check. Your role prompt gives the review submission, its footer, the thread rule, the CI read and the forward-merge confirmation; this page gives what it does not. The merger's steps are all in its role prompt.
|
|
17
4
|
|
|
18
5
|
## The reviewer
|
|
19
6
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
answers. The CI it reads is the head's own checks: no handoff is a
|
|
36
|
-
commit, so every push to the branch is work whose head gets GitHub's workflow runs of its own.
|
|
37
|
-
With `<o>/<r>`, `<n>`, `<base>` and `<headRefOid>` from
|
|
38
|
-
`gh pr view <n> --json baseRefName,headRefOid`, two reads. The required set is the
|
|
39
|
-
base branch's rulesets' required checks and its branch protection's, when it has any.
|
|
40
|
-
A check the base does not require holds no approval. You neither wait for it nor re-run it for the approval, and the daemon reads no verdict from it either. Read its result all the same. A red one whose log shows that the change breaks something is a correctness finding like any other. A red one that shows no fault of the change is named in the review body and decides nothing.
|
|
41
|
-
Both
|
|
42
|
-
branch endpoints take the base as a URL path, each segment escaped and each `/` kept (a raw `#`
|
|
43
|
-
or `%` reads another branch), built in the same command from the name GitHub returns, never
|
|
44
|
-
pasted or carried over from an earlier command:
|
|
7
|
+
1. Read CI on GitHub and the issue's results with `dispatch results --issue <issue>`, never from a handoff.
|
|
8
|
+
2. When the diff the round reads touches runtime code (the whole change, or the difference from the commit your task names), run `task(agent="thermonuclear-deep-review")` and `task(agent="thermonuclear-code-quality")` once at the head the round reviews, and `wait` for each result: each runs as a job of its own. Each agent reviews only the diff its task supplies, so name in each task the commit, the head and `git diff <sha> <head>` as the diff, or the whole change. The last two sentences of your task, `Last reviewed commit: <sha>.` and `Review entry: <n>.`, are the daemon's; your role prompt says how to read them.
|
|
9
|
+
3. A result that carries no report, or that names another place for it, is a failed run, not a verdict: run that agent again, or read its transcript. Reading the agent's diff yourself and recording that in its place is the same as answering the rubric from a bare verdict. When you can do neither, that half of the round has no review: tell the architect, do not approve, and wait with a `WAITING` line naming what you wait on until it answers.
|
|
10
|
+
|
|
11
|
+
### What the base requires
|
|
12
|
+
|
|
13
|
+
Read the base's required checks with the base name escaped in the same command (a raw `#` or `%` reads another branch):
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
base=$(gh pr view <n> -R <o>/<r> --json baseRefName -q .baseRefName) && \
|
|
17
|
+
base_path=$(jq -rn --arg b "$base" '$b | split("/") | map(@uri) | join("/")') && \
|
|
18
|
+
echo rulesets: && gh api --paginate "repos/<o>/<r>/rules/branches/$base_path" --jq '.[] | select(.type=="required_status_checks") | .parameters.required_status_checks[].context' && \
|
|
19
|
+
echo protection: && gh api "repos/<o>/<r>/branches/$base_path" --jq '.protection.required_status_checks.checks[].context' && \
|
|
20
|
+
echo code_scanning: && gh api --paginate "repos/<o>/<r>/rules/branches/$base_path" --jq '.[] | select(.type=="code_scanning") | .parameters'
|
|
21
|
+
```
|
|
45
22
|
|
|
46
|
-
|
|
47
|
-
base=$(gh pr view <n> -R <o>/<r> --json baseRefName -q .baseRefName) && \
|
|
48
|
-
base_path=$(jq -rn --arg b "$base" '$b | split("/") | map(@uri) | join("/")') && \
|
|
49
|
-
echo rulesets: && gh api --paginate "repos/<o>/<r>/rules/branches/$base_path" --jq '.[] | select(.type=="required_status_checks") | .parameters.required_status_checks[].context' && \
|
|
50
|
-
echo protection: && gh api "repos/<o>/<r>/branches/$base_path" --jq '.protection.required_status_checks.checks[].context' && \
|
|
51
|
-
echo code_scanning: && gh api --paginate "repos/<o>/<r>/rules/branches/$base_path" --jq '.[] | select(.type=="code_scanning") | .parameters'
|
|
52
|
-
```
|
|
23
|
+
A `code_scanning` rule requires an analysis that no status-check list names. A read GitHub refuses leaves the required set unknown: report it to the architect, do not approve, and wait with a `WAITING` line naming the read.
|
|
53
24
|
|
|
54
|
-
|
|
55
|
-
With that read refused, the required set is unknown, so no required item can be judged: do not approve, and wait with a `WAITING` line naming the refused read. The architect has the read made with a credential that can make it, or asks a person (a child's own architect asks through the architect above it), and the review goes on from the answer.
|
|
56
|
-
The head's check-runs
|
|
57
|
-
(`gh api repos/<o>/<r>/commits/<headRefOid>/check-runs --paginate --jq '.check_runs[] | [.name, .status, .conclusion] | @tsv'`):
|
|
58
|
-
every required name present, `completed` and `success` (GitHub counts `neutral` and `skipped`
|
|
59
|
-
as passing for a required check).
|
|
60
|
-
When the list holds more than one run of a required name, the newest run decides, the one with the latest `started_at`. An older run of that name, whatever its conclusion, is no result: never re-run a job for a `cancelled` row that a newer run of the same name has superseded. Read the whole list before you choose. `--paginate` runs `--jq` once per page, so take the newest of each name over the merged list, not inside the `--jq`. A commit status is read the same way: the newest status of each context decides.
|
|
61
|
-
A required check
|
|
62
|
-
`queued`, `requested`, `waiting`, `pending` or `in_progress`: wait. One `completed` as `cancelled`, or absent from a run at the
|
|
63
|
-
head that holds its job: on a `pull_request` run, re-run that run's
|
|
64
|
-
failed and cancelled jobs, once, then wait — never the whole run, which runs again every job that
|
|
65
|
-
succeeded too. A merge-group run is never re-run: the implementer finishes its round instead,
|
|
66
|
-
and the pull request is tested again when it is queued again.
|
|
67
|
-
Find the run and job at the head: the head's runs
|
|
68
|
-
(`gh api 'repos/<o>/<r>/actions/runs?head_sha=<headRefOid>&per_page=100' --jq '.workflow_runs[] | [.id, .name, .event, .status, .conclusion] | @tsv'`),
|
|
69
|
-
then each candidate run's jobs
|
|
70
|
-
(`gh api repos/<o>/<r>/actions/runs/<run-id>/jobs --jq '.jobs[] | [.id, .name, .status, .conclusion] | @tsv'`).
|
|
71
|
-
A cancelled job of a pull-request run: `gh run rerun <run-id> --failed`, which GitHub applies to
|
|
72
|
-
the run's failed and
|
|
73
|
-
cancelled jobs and the jobs that depend on them, and to nothing that succeeded. Never
|
|
74
|
-
`--job <job-id>` alone: under a routing workflow, re-running only the final job reads the
|
|
75
|
-
cancelled results again and stays red. GitHub refuses a re-run while an attempt of that run is
|
|
76
|
-
still in progress: wait for it. When no run at the head holds the job, or nothing here will run
|
|
77
|
-
it (a check run another App made or a workflow posted, a workflow another repository defines, a
|
|
78
|
-
commit status), tell the architect, do not approve, and wait with a `WAITING` line naming what
|
|
79
|
-
you wait on, except in the remedy's own case below, which the sort that follows tells apart.
|
|
80
|
-
A required item with no run at the head at all is sorted below, with the reads that tell its
|
|
81
|
-
cases apart, and in every case but the remedy's own you tell the architect, do not approve, and
|
|
82
|
-
wait with a `WAITING` line naming what you wait on: never approve a head while a required item
|
|
83
|
-
has no run, since GitHub will not merge it and an approval only moves the round to wait on
|
|
84
|
-
GitHub's merge state, which the daemon reports stuck once a CI settlement has brought it runs
|
|
85
|
-
on the head and every one of them has concluded, and of which it tells nobody while no run on
|
|
86
|
-
the head has settled.
|
|
87
|
-
For such an item, what the base requires is more than its status checks: a `code_scanning` rule, which the read above prints under `code_scanning:`, requires an analysis no status-check list names.
|
|
88
|
-
Read the merge state first, whatever the head's other runs show (`gh pr view <n> --repo <o>/<r> --json mergeable,mergeStateStatus`): a head that conflicts with its base (`DIRTY`) has no merge ref, so GitHub starts no `pull_request` run for it, while a `pull_request_target` run, which GitHub builds from the base with no merge ref, can be green beside the missing item.
|
|
89
|
-
A merge state of `UNKNOWN` is one GitHub has not computed yet: read it again after a minute, and for up to five minutes. A state still `UNKNOWN` after that, or a read that fails twice, is reported to the architect with the answer GitHub gave, as a refused read is: do not approve, and wait with a `WAITING` line naming the read. A read that GitHub answers with a rate limit waits for the reset the answer names, and is then made again.
|
|
90
|
-
Count the head's runs: `gh api repos/<o>/<r>/commits/<headRefOid>/check-runs --jq .total_count`.
|
|
91
|
-
A head GitHub computes no merge for (`DIRTY`) takes a merge of its base forward, which is the implementer's push, and never the remedy below. The daemon asks the implementer for that merge while the issue keeps its phase: at once when a check the base requires has no green result on the head, the base requires a current branch, or the daemon could not read the base's rules, and otherwise once the issue enters `accepting`. So a `DIRTY` head whose required checks are green on it is approved or not as any head is: an approval of it ends the round, and once the merge lands the daemon asks you to read the merge and approve the new head (*A merge of the base is reviewed for what it changed*, below).
|
|
92
|
-
A commit status is no check run, so read the head's commit statuses as well as the check-runs list above, every page: `gh api --paginate 'repos/<o>/<r>/commits/<headRefOid>/status?per_page=100' --jq '.statuses[] | [.context, .state] | @tsv'`.
|
|
93
|
-
A required item in either list is reported: a check run whose status is `queued`, `requested`, `waiting`, `pending` or `in_progress`, or a commit status whose state is `pending`, is running, not missing, and a check run concluded `failure`, `timed_out`, `cancelled` or `startup_failure`, or a commit status in state `failure` or `error`, is red; read the status list, never that endpoint's top-level `state`, which reads `pending` for a head with no status at all.
|
|
94
|
-
Only a required item in neither list has no run, and it falls in one of the named cases below.
|
|
95
|
-
A fork head whose workflow runs wait for a maintainer's approval (`action_required`) takes the maintainer's approval of its runs, which is a person's: tell the architect, do not approve, and wait with a `WAITING` line naming what you wait on, and never close and reopen it.
|
|
96
|
-
A check only a commit status would report, or a workflow another repository defines, is one nothing in this repository will start: tell the architect, do not approve, and wait with a `WAITING` line naming what you wait on, and never close and reopen it.
|
|
97
|
-
A required workflow whose own `paths` or `paths-ignore` filter skips every file of the change gets no run from GitHub at all, and a close and a reopen send the same event.
|
|
98
|
-
So while the base still carries that filter the reopen does nothing, and the head takes a change to the workflow or to the head: tell the architect, do not approve, and wait with a `WAITING` line naming what you wait on.
|
|
99
|
-
When the base dropped that filter after the pull request opened, the head is the remedy's own case below.
|
|
100
|
-
The remedy's own case is a `BLOCKED` head, whatever its count, whose required workflow no event started on a pull request that was already open, and its test has three parts.
|
|
101
|
-
First, the pull request is not from a fork (`gh pr view <n> --repo <o>/<r> --json isCrossRepository`) and no workflow run of the head stands `action_required` (`gh api --paginate 'repos/<o>/<r>/actions/runs?head_sha=<headRefOid>&per_page=100' --jq '.workflow_runs[] | select(.conclusion == "action_required") | .id'` prints nothing).
|
|
102
|
-
Second, a workflow file under `.github/workflows/`, as the pull request's merge commit holds it, which is the base's own unless the change edits that file, has a job that reports the required item, and its `on:` runs it for `pull_request` with no `types` list that leaves out `reopened`, no `branches` filter that excludes the base, and no path filter that skips every file of the change.
|
|
103
|
-
A job reports its `name:`, an expression there evaluated for each matrix entry, or else its key, with ` (<matrix values>)` after it for a matrix job; a job of a reusable workflow reports `<calling job> / <job>` and runs on the calling file's `on:`; and for a `code_scanning` rule the jobs that run the tool's analysis report under their own names, while the tool's own check run (`CodeQL`) is the code-scanning App's, made when an analysis uploads, so a head whose analysis jobs ran with no `CodeQL` run is no head this test matches.
|
|
104
|
-
Third, neither list holds a run of it.
|
|
105
|
-
That head takes the remedy.
|
|
106
|
-
A head with more than one required item that has no run takes the remedy when its first part holds for the head and at least one item meets the second and third parts: the close and reopen is one act for the whole head. Before you close, tell the architect about every other such item in the same message, by its case. Each of them is then waited for as its own case says, and none of them is a reason to reopen a second time. A head with any item in a case that says never close and reopen it takes no remedy for any of its items.
|
|
107
|
-
A head that matches none of these cases takes no remedy: tell the architect, do not approve, and wait with a `WAITING` line naming what you wait on; the architect takes it to a person, since GitHub has more cases than these, so an unknown case costs a person's look rather than a wrong action.
|
|
108
|
-
So does a head whose required item still has no run once every run the reopen started has concluded (before then the item is missing only because its run has not started): tell the architect, do not approve, and wait with a `WAITING` line naming what you wait on, and never reopen it a second time.
|
|
109
|
-
Close the pull request, wait a minute, and reopen it at the same head: in cybermonklabs/legion a reopen within about a minute of the close can have its new CI run cancelled by the close's own run, which leaves a failing `ci-ok` (`.github/workflows/tests-closed.yaml`).
|
|
110
|
-
The reopen delivers the event the workflow needs, and the head and any approval already given stand.
|
|
111
|
-
It costs two things: the close writes a `pr-closed-unmerged` notice to the architect, and the reopen starts the head's other checks again.
|
|
112
|
-
So tell the architect before you close, and say why.
|
|
113
|
-
Do not approve until the required item's run at the head has concluded green: the remedy is how it gets a run, not a reason to approve without one.
|
|
114
|
-
It is for no other state: not a check that is running, not a check that is red, and not a head GitHub holds for a review the repository requires.
|
|
115
|
-
A head whose required checks are still running is waited for, unapproved: in the two lists above, a check run whose status is `queued`, `requested`, `waiting`, `pending` or `in_progress`, or a commit status whose state is `pending`, is running, not missing.
|
|
116
|
-
For a GitHub Actions job, GitHub ends that wait itself: a job still queued for a self-hosted runner after 24 hours is cancelled, a running job ends at its own `timeout-minutes` or at GitHub's execution limit, 6 hours on a GitHub-hosted runner and 5 days on a self-hosted one, which fails it, and every workflow run ends at 35 days, its waiting included (GitHub's Actions limits page); the settlement of that conclusion moves the round.
|
|
117
|
-
A run `waiting` on an environment's approval waits on a person, up to 30 days, and a check run no Actions job owns, another GitHub App's or one a workflow created through the API, or a commit status left `pending`, has no such bound and ends only when whoever made it ends it: one that stands longer than its CI usually takes is the architect's to raise with a person, so tell the architect, naming the run, do not approve, and wait with a `WAITING` line naming what you wait on.
|
|
118
|
-
The daemon's own count in the issue's `mergeWait`, `checkRuns`, is only the runs a CI settlement applied, so a zero there is no evidence of what GitHub holds: read the two lists on GitHub before you act.
|
|
119
|
-
Approval is refused while any `before_merge` check of the issue's own Verification document has no pass standing at the head being reviewed: `REQUEST_CHANGES` naming each such check by its block id, and `dispatch results --issue <issue>` is the read that decides it, under the check's own line saying whether a pass stands and from which roles. That answer leaves out a pass at another commit, a pass recorded under an older wording of the check and a retracted pass, each of which the command still prints; a fail recorded after a pass leaves that pass standing until someone retracts it.
|
|
120
|
-
A check carrying `ci_check` is CI's: the one result that `dispatch results` derives from the named run decides it (`skill://legion-worker/references/ci-checks.md`). While that run has not concluded, wait for it by its name, and do not approve or request changes for that check. Wait the same way where GitHub could not be read. When no run of that name answers after the head's checks settle, tell the architect as a finding and request no changes for it.
|
|
121
|
-
A check whose `run` is a whole test suite and has no pass standing at the head has wrong words, which the architect rewrites: tell the architect as a finding, wait for the rewrite with a `WAITING` line naming it, and request no changes for it. One that has a pass standing at the head is a finding for the architect too, and its pass decides the check, so the review goes on.
|
|
122
|
-
An issue with no Verification document, or whose Verification document holds no `before_merge` check, is a gap you name in the review body, never a review that asks for changes: say which of the two it is, and tell the architect, who writes the checks. Your own findings and the checks that do exist still decide the review, and on an issue that has none the architect's acceptance is the gate.
|
|
123
|
-
A result proves the head it was recorded at. A result a child recorded against a root's check proves nothing for the root, since it was recorded at the child's head, and a child never records the result that proves a root's check. A child that carries part of a root's requirement proves it with a check on the child's own Verification document whose `serves` names that requirement, at the child's own head. A root's own checks are proven at the root's own head, or, for an `after_merge` check, on the branch the root's pull request merged into or on the repository's default branch, in the root's last round.
|
|
124
|
-
On a docs-only PR the `Thermo` line still records the simplify pass and the defects it
|
|
125
|
-
reported, and its pair half reads `thermonuclear pair: not run (docs-only)`.
|
|
126
|
-
In a later round whose difference touches no runtime code, on a PR that does touch it, the pair
|
|
127
|
-
half reads as `skill://legion-worker/references/pr-body.md` gives it for that round.
|
|
128
|
-
Submit **one review per round** —
|
|
129
|
-
`REQUEST_CHANGES` when any correctness finding stands, otherwise `APPROVE` of the head you
|
|
130
|
-
reviewed — always named by SHA — carrying every inline comment in that single
|
|
131
|
-
call: `gh api --method POST repos/{owner}/{repo}/pulls/{number}/reviews --input body.json`
|
|
132
|
-
with `commit_id`, `event` (`REQUEST_CHANGES` or `APPROVE`), `body` (with the
|
|
133
|
-
Legion footer, which names the head the review read and the entry of your round:
|
|
134
|
-
`<!-- legion: {"session":"<session-id>","phase":"review","head":"<the head you reviewed>","entry":"<entry>"} -->`),
|
|
135
|
-
and a `comments[]` array of `{path, line, side, body}`, one entry per
|
|
136
|
-
finding — never one `pr review` call per finding (each submission fires a `pr-review` wake).
|
|
137
|
-
That `head` is the full 40-character SHA of the head whose diff and checks you read, which is
|
|
138
|
-
the `commit_id` you submit with, and never the head GitHub shows at the moment you submit:
|
|
139
|
-
read `gh pr view <n> --repo <owner>/<repo> --json headRefOid --jq .headRefOid` before you
|
|
140
|
-
submit, and where it names another head a push landed under you, so review that head and
|
|
141
|
-
submit at it rather than renaming the footer to a head you have not read.
|
|
142
|
-
The daemon takes that head as the review's own word for the code it read, and cannot take GitHub's
|
|
143
|
-
`commit_id` for the review instead, which GitHub rewrites onto the pull request's current head,
|
|
144
|
-
so its record of a review can name a head the review never saw.
|
|
145
|
-
A review whose footer names another head, or no head, decides no round:
|
|
146
|
-
it is set aside, the round stays open and the
|
|
147
|
-
architect is told the reason when the review's own webhook arrived, so the reviewer submits again at the head it read.
|
|
148
|
-
That `entry` is the number of the newest `Review entry: <n>.` sentence that is the last sentence of a task or a wake of your session (the daemon part of your role prompt gives the rule whole), written in quotes as a string of digits: by it the daemon tells a review of this round from a review of an earlier round, and only a review of this round moves the commit a later round reads from (the next item).
|
|
149
|
-
It is in quotes because a footer that is not valid JSON, such as one with an unquoted `<entry>` left in it, loses its session and its head too, and the daemon then sets the review aside, while a quoted value that is no number costs the entry alone.
|
|
150
|
-
A review with no entry, or with another one, still decides the round, and the next round then reads more: from an older commit, or the whole change.
|
|
151
|
-
A `COMMENT` decides nothing.
|
|
152
|
-
- **A merge of the base is reviewed for what it changed.** After a forward merge of the base,
|
|
153
|
-
read what changed since the head your last submitted review read.
|
|
154
|
-
That head is the `head` of that review's Legion footer, never the review's `commit_id`, because GitHub can move a review's `commit_id` onto a later head, such as a forward merge whose first parent is the head the review read.
|
|
155
|
-
This read lists the reviews your session submitted, each with the head its last Legion footer names, and its pages concatenate oldest first, so its last line is your last submitted review.
|
|
156
|
-
Put in it the session id your own footers carry: another reviewer session, a side review among them, writes `"phase":"review"` footers on the same pull request too.
|
|
157
|
-
Where it prints no line, or its last line names no head, your session holds no review of an earlier head on this pull request, so the change is the branch's whole diff.
|
|
25
|
+
### The head's checks
|
|
158
26
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
27
|
+
- Read the check runs and, every page, the commit statuses: `gh api --paginate 'repos/<o>/<r>/commits/<headRefOid>/status?per_page=100' --jq '.statuses[] | [.context, .state] | @tsv'`. Read the status list, never that endpoint's top-level `state`, which reads `pending` for a head with no status.
|
|
28
|
+
- The newest run of a name (latest `started_at`) decides, and the newest status of a context. `--paginate` runs `--jq` once per page, so choose over the merged list.
|
|
29
|
+
- A check run `queued`, `requested`, `waiting`, `pending` or `in_progress`, or a status `pending`, is running: wait, unapproved. A run waiting on an environment's approval, another App's check run, or a status left `pending` has no bound; when it stands longer than its CI usually takes, tell the architect and wait.
|
|
30
|
+
- A check the base does not require holds no approval. A red one whose log shows the change breaks something is a finding; any other is named in the review body.
|
|
31
|
+
- The daemon's `checkRuns` count in the issue's `mergeWait` is only the runs a settlement applied: read GitHub before you act.
|
|
162
32
|
|
|
163
|
-
|
|
164
|
-
A check those files or the resolution can reach runs again, and a check the merge was made for has no pass to carry.
|
|
165
|
-
Review the resolution and this change's own commits since your earlier head, and read the base's files only for where they meet this change.
|
|
166
|
-
Where that review was `APPROVE` and the merge raises no finding, submit one more `APPROVE`
|
|
167
|
-
naming the new head by SHA, its body naming both heads — no new round: the thermonuclear pair
|
|
168
|
-
reads the resolution alone, and no thread pass; where
|
|
169
|
-
it was `COMMENT` or `REQUEST_CHANGES`, continue that round against the new head. A finding the
|
|
170
|
-
merge raises is a `REQUEST_CHANGES` like any other.
|
|
171
|
-
The daemon asks this of you in a merge-forward message when the merge lands while the issue
|
|
172
|
-
stands past its review (`accepting`, `retro` or `merging`), where no review round is open: read
|
|
173
|
-
the merge as this item says, then approve the new head by its SHA with the Legion footer
|
|
174
|
-
naming that head, or request changes; write no handoff and make no completion; then tell the
|
|
175
|
-
architect and the worker of the phase the issue stands in (the implementer in `retro`, the
|
|
176
|
-
merger in `merging`; the architect alone in `accepting`) on their role topics what you
|
|
177
|
-
decided. A request for changes there goes back through that role's `request_backward_move`.
|
|
178
|
-
- **A later round reads from the commit its task names.**
|
|
179
|
-
The task of a later round names `Last reviewed commit: <sha>`, the head read by the newest of your own deciding reviews whose footer named the entry of its round, the number its task named as `Review entry: <n>.` (the daemon part of your role prompt gives the whole rule and where the commit comes from).
|
|
180
|
-
The last two sentences of each task you are given are always the daemon's: `Last reviewed commit: <sha>.` or `Last reviewed commit: none.`, then `Review entry: <n>.` or `Review entry: none.`.
|
|
181
|
-
`Last reviewed commit: none.` means this task names no commit, so you read the whole change.
|
|
182
|
-
`Review entry: none.` means this task names no entry, so it does not change the entry of your round.
|
|
183
|
-
A sentence of the same words earlier in the task, such as one a retry's reason quotes, is not the daemon's.
|
|
184
|
-
Read the difference from that commit to the head (`git diff <sha> <head>`), and each thread: you need not read again what you read before that commit.
|
|
185
|
-
Each agent of the pair reviews only the diff its task supplies, so name in each task the commit, the head and `git diff <sha> <head>` as the diff to review.
|
|
186
|
-
The commit limits what you must read, never what you report: a defect you see outside the difference is a finding like any other, and *No deferrals* in `skill://legion-worker` holds for it.
|
|
187
|
-
Read the whole change again, and give the pair the whole change, in two cases: the task names no commit, or the commit is not an ancestor of the head (`git merge-base --is-ancestor <sha> <head>` does not exit 0). After a forward merge of the base, read the merge as the item above says rather than the whole `git diff <sha> <head>`, which holds every file the base brought in.
|
|
188
|
-
- Answer every thread you opened, and every thread a bot opened that is none of Legion's role
|
|
189
|
-
Apps, as `skill://legion-worker/references/review-threads.md` says; the same reference says
|
|
190
|
-
when every thread is settled enough to approve, and resolving one never gates your approval.
|
|
191
|
-
- **The reviewer pushes nothing to the branch it reviews**, a prose fix included: it names a
|
|
192
|
-
prose fault (wording, a count, a tense, a citation) in its review, as any other finding. A
|
|
193
|
-
commit of the reviewer's is a new head, so the passes the tester and the checks recorded at the
|
|
194
|
-
head before it do not stand at it, and on a base whose rules want each change approved by
|
|
195
|
-
someone other than its author, the reviewer's approval cannot cover a commit it wrote, so
|
|
196
|
-
GitHub holds the merge.
|
|
33
|
+
### A required item with no run at the head
|
|
197
34
|
|
|
198
|
-
|
|
199
|
-
and takes this order: read CI as above; write the handoff and record it with
|
|
200
|
-
`dispatch handoff-write`; submit the review of the head, by its SHA; then complete. A red at the
|
|
201
|
-
code is a `REQUEST_CHANGES` naming the check, never an approval. A request for changes does not
|
|
202
|
-
wait, since it stands whatever CI says and the issue leaves reviewing with it. The approval waits
|
|
203
|
-
on nothing either: it ends the round whatever CI says at the head it names, since the round reads
|
|
204
|
-
no CI verdict, and a settlement the daemon reads later — at that head or any above it — moves the
|
|
205
|
-
issue nowhere. The daemon names each check GitHub reported, with the conclusion GitHub gave it,
|
|
206
|
-
in one message to the architect that owns the issue (the one your `Legion addressing` line
|
|
207
|
-
names), the worker of the issue's current phase and the implementer, and judges none of them: a
|
|
208
|
-
red is the implementer's to fix or re-run, the architect's to decide on, and GitHub's to hold the
|
|
209
|
-
merge for. So the reviewer's own read before it approves is the only read that decides anything.
|
|
210
|
-
A review that names an older head reviews
|
|
211
|
-
code the pull request no longer has. The daemon moves the issue once all three are in — the
|
|
212
|
-
decision GitHub reports, your completion, in either order, and GitHub's own answer that the
|
|
213
|
-
approved head is one the issue may advance on — so a review posted without a completion leaves
|
|
214
|
-
the issue in reviewing until you finish, and an approved head GitHub answers `blocked` for leaves
|
|
215
|
-
it there until that answer comes clean.
|
|
35
|
+
Never approve a head while a required item has no run. Sort it, in this order. Cases 2, 3, 4 and 6 end: tell the architect, do not approve, and wait with a `WAITING` line naming what you wait on.
|
|
216
36
|
|
|
217
|
-
|
|
37
|
+
1. Read `gh pr view <n> --repo <o>/<r> --json mergeable,mergeStateStatus` first. `DIRTY` takes a forward merge, which is the implementer's: the daemon asks for it and tells you the new head when it lands. `UNKNOWN`: read again each minute for up to five minutes, then report it to the architect as a refused read.
|
|
38
|
+
2. A fork head whose runs stand `action_required` waits on a maintainer. Never close and reopen it.
|
|
39
|
+
3. A check only a commit status reports, or a workflow another repository defines: nothing here starts it. Never close and reopen it.
|
|
40
|
+
4. A required workflow whose `paths` or `paths-ignore` filter, as the base holds it, skips every file of the change: a reopen sends the same event, so the head or the workflow must change.
|
|
41
|
+
5. The remedy's case: a `BLOCKED` head, not from a fork (`--json isCrossRepository`), with no run `action_required`, where a workflow under `.github/workflows/` (as the merge commit holds it) has a job reporting the item whose `on:` runs it for `pull_request` with no `types` that leave out `reopened`, no `branches` filter that excludes the base and no path filter that skips the whole change, and neither list holds a run of it. A job reports its `name:` or its key, with ` (<matrix values>)` for a matrix job and `<calling job> / <job>` for a reusable workflow's; for `code_scanning`, the analysis jobs report under their own names and the `CodeQL` run is the code-scanning App's. Tell the architect why, close the pull request, wait a minute, and reopen it at the same head (a quicker reopen can have its run cancelled by the close's own run). Approve only once the item's run concluded green. One close and reopen covers every item of the head: name the others to the architect in the same message. A head with any item in case 2 or 3 takes no remedy, and an item still with no run after the reopen's runs concluded is never reopened again.
|
|
42
|
+
6. Anything else: tell the architect, do not approve, and wait.
|
|
218
43
|
|
|
219
|
-
|
|
220
|
-
`needs_review`), where no worker is started: the architect that owns the issue, the one each
|
|
221
|
-
phase worker's `Legion addressing` line names, reads the evidence (the tester's handoff,
|
|
222
|
-
`dispatch results --issue <issue>` at the approved head and the reviewer's
|
|
223
|
-
approval of the head by SHA; the daemon refuses the sign-off while an issue beneath it is still
|
|
224
|
-
in the workflow, `SIGNOFF_CHILD_IN_WORKFLOW`, so a parent is accepted after its children, on
|
|
225
|
-
the head of its last round, `skill://legion-architect`, section 4) and accepts with the
|
|
226
|
-
`legion` tool's `sign_off`, which moves the issue to retro, or sends it back to `implementing`
|
|
227
|
-
or `testing` with `request_backward_move` and a reason, which reaches the started worker's task
|
|
228
|
-
as its `Reason:` line and counts a review round. The acceptance comment names each check with
|
|
229
|
-
its result. An issue with no Verification document, or none holding a `before_merge` check,
|
|
230
|
-
is a gap the tester and the reviewer named and neither refused, so that comment is its only
|
|
231
|
-
gate: it names the gap and decides how each delivered item is proven at this head, never
|
|
232
|
-
whether one stays unmet; checks it writes close the root's `criteria` step where the
|
|
233
|
-
deployment gates it, since that step records the root's Verification document, and a child's
|
|
234
|
-
is gated by nothing. It does
|
|
235
|
-
not accept while the issue holds a finding ask no controller took (`findings.md`, "When no
|
|
236
|
-
controller takes it"). Approval is gated by the `before_merge` checks of the issue's own
|
|
237
|
-
Verification document at its head, so a child's result against a root's check proves nothing:
|
|
238
|
-
a root's checks are proven at its own head, in its last round. No `after_merge` result is
|
|
239
|
-
asked here: it is recorded after the close, where the project opens a check (*The production
|
|
240
|
-
check after the close*, below).
|
|
241
|
-
CI red at the head in `accepting` moves nothing, as it moves nothing anywhere: the daemon names
|
|
242
|
-
the checks GitHub reported and leaves the decision to the roles it told. Read the head's checks
|
|
243
|
-
on GitHub yourself before you accept, and send a red head back with `request_backward_move`.
|
|
44
|
+
### The issue's checks
|
|
244
45
|
|
|
245
|
-
|
|
46
|
+
- Approval is gated by the issue's own `before_merge` checks, as your role prompt says; a `ci_check` check as `skill://legion-worker/references/ci-checks.md` says. A check whose `run` is a whole test suite with no pass standing is a finding for the architect: wait for its rewrite, and request no changes for it.
|
|
246
47
|
|
|
247
|
-
|
|
248
|
-
`dispatch comment` on the issue for the skill librarian, brings the PR body up to date and
|
|
249
|
-
completes (`skill://legion-retro` gives the steps), so the approved head is the head the merger
|
|
250
|
-
merges. Nothing in Legion compares that head with the one the approval named either: a
|
|
251
|
-
repository that wants a push made after the approval reviewed says so in its own rulesets (a
|
|
252
|
-
stale review dismissed, a review required again), and GitHub holds the merge to them. A
|
|
253
|
-
conflict merge pushed above the approved head still goes back to the reviewer, who reviews
|
|
254
|
-
what the merge changed (*The reviewer*, above): the daemon asks it to when the merge lands,
|
|
255
|
-
because the branch's own procedure says so and not because any Legion check refuses the head.
|
|
256
|
-
Retro removes nothing.
|
|
257
|
-
- **Retro brings the PR body's path-derived content up to date before it completes.** Whatever the
|
|
258
|
-
repository's instructions derive from the pull request's changed paths (a checklist named for
|
|
259
|
-
each class of path, read by a required check), retro recomputes for the whole diff at its head
|
|
260
|
-
and writes into the live body before it completes (`skill://legion-retro`), since the merger
|
|
261
|
-
reports a stale body rather than rewriting it. A body edit changes no commit, so the approval
|
|
262
|
-
stands.
|
|
48
|
+
### A merge of the base is reviewed for what it changed
|
|
263
49
|
|
|
264
|
-
|
|
50
|
+
After a forward merge of the base, read the merge (`skill://legion-worker/references/conflicts-and-rewrites.md`) and this change's own commits since the head your last submitted review read, its Legion footer's `head`. This lists your session's reviews, oldest first, so the last line is your last review; no line, or `no head` on it, means you read the branch's whole diff:
|
|
265
51
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
- **The merge is the merger's own act, at the head it read.** It reads the pull request
|
|
270
|
-
(`gh pr view <n> --json number,title,url,state,baseRefName,headRefOid,mergeStateStatus`), and
|
|
271
|
-
every step below names that `headRefOid`:
|
|
272
|
-
- *The message, before the merge.* GitHub's default squash message,
|
|
273
|
-
`squash_merge_commit_message` of `COMMIT_MESSAGES`, joins every commit message of the pull
|
|
274
|
-
request, which puts the tree's `Dispatch:` keys and its `Omp-Session:` and `Legion-Role:`
|
|
275
|
-
trailers on the default branch. So the merger writes the message itself,
|
|
276
|
-
`--subject '<pull request title> (#<n>)' --body ''`, on every merge, whatever the repository's
|
|
277
|
-
setting says. It reads that setting first all the same
|
|
278
|
-
(`gh api "repos/<o>/<r>" --jq '[.default_branch, .allow_merge_commit, .squash_merge_commit_title, .squash_merge_commit_message] | @tsv'`),
|
|
279
|
-
because the merge-queue path below can pass no message.
|
|
280
|
-
- *The merge.*
|
|
281
|
-
`gh pr merge <n> --squash --match-head-commit <head> --subject '<pull request title> (#<n>)' --body ''`,
|
|
282
|
-
as the implement App, so
|
|
283
|
-
GitHub refuses the merge once the head has moved under it: merging at a named head is how bors
|
|
284
|
-
and Prow's Tide merge only what they tested. Into a base that is not the default branch it
|
|
285
|
-
passes `--merge` in place of `--squash` where the repository allows merge commits
|
|
286
|
-
(`allow_merge_commit`) and the base's rules require no linear history
|
|
287
|
-
(`required_linear_history`), since a squash there leaves each open pull request built on the
|
|
288
|
-
merged branch a conflict of history alone; otherwise it squashes and tells the architect its
|
|
289
|
-
addressing line names which open pull requests of the tree build on the merged branch. Each one
|
|
290
|
-
whose issue stands past `implementing` and that GitHub then reports `CONFLICTING` on two reads
|
|
291
|
-
a minute apart stays in its phase, and the daemon asks its implementer to merge the base
|
|
292
|
-
forward (a merge-forward message) once the next step needs a mergeable head
|
|
293
|
-
(`skill://legion-worker/references/conflicts-and-rewrites.md`, *The daemon's ask*); the
|
|
294
|
-
architect that owns its issue hears of that ask by a `checks-red` notice that names the phase
|
|
295
|
-
the issue stays in. The architect the
|
|
296
|
-
merger told tells the implementer of each of those pull requests whose issue is still in
|
|
297
|
-
`implementing` and is an issue it owns to expect the conflict and to merge the base forward in
|
|
298
|
-
that implementing round. The implementer of one whose issue that architect does not own merges
|
|
299
|
-
the base forward once GitHub reports its pull request `CONFLICTING`, as its role prompt says
|
|
300
|
-
(*Reintegrating the base* in
|
|
301
|
-
`skill://legion-worker/references/conflicts-and-rewrites.md`). On a base with a merge queue —
|
|
302
|
-
a `merge_queue`
|
|
303
|
-
rule among the base branch's rules — it enqueues the pull request instead, with GraphQL
|
|
304
|
-
`enqueuePullRequest` and the same head as `expectedHeadOid`, because `gh pr merge` on such a
|
|
305
|
-
base turns auto-merge on while a required check is pending, which arms the pull request rather
|
|
306
|
-
than queueing it. `enqueuePullRequest` takes no message, so where that base's
|
|
307
|
-
`squash_merge_commit_message` reads `COMMIT_MESSAGES` the queue would commit the branch's
|
|
308
|
-
messages and nothing the merger passes can stop it: it enqueues nothing, completes nothing,
|
|
309
|
-
and tells the architect, naming the setting and that only a person can change it to `PR_BODY`
|
|
310
|
-
or `BLANK`. It never turns auto-merge on; the daemon submits no merge and changes no
|
|
311
|
-
merge setting of any pull request.
|
|
312
|
-
- *The watch.* On a merge-queue base it reads the pull request until GitHub merges it or takes
|
|
313
|
-
it out of the queue, and acts on a removal: a head the queue took out over its own
|
|
314
|
-
`merge_group` checks is work to fix, so the issue goes back; a person's dequeue is that
|
|
315
|
-
person's decision, reported to the architect. A removal is never a merge.
|
|
316
|
-
- *A failed merge is the merger's decision*, made on the blocker GitHub's state shows and not
|
|
317
|
-
on its message alone, which can name another cause: before it decides, it reads the pull
|
|
318
|
-
request's `mergeStateStatus` and `reviewDecision` and the base's rules that apply, and names
|
|
319
|
-
that blocker with GitHub's message quoted beside it. Wait for what GitHub waits for (a
|
|
320
|
-
required check still running, a required review only a person can give) and merge again;
|
|
321
|
-
merge again at the head it re-reads when a push moved it, or when GitHub refused while it was
|
|
322
|
-
still computing mergeability; send the issue back with `request_backward_move` when the head
|
|
323
|
-
itself must change for a reason the daemon's merge forward does not cover (a check that
|
|
324
|
-
failed); wait for the daemon's merge forward when the head conflicts with the base (`DIRTY`),
|
|
325
|
-
which keeps the issue in `merging` and tells you to merge or enqueue nothing until the new
|
|
326
|
-
head lands and the reviewer has approved it; or tell the architect
|
|
327
|
-
what no worker can do — a repository setting, a rule or an App permission only a person can
|
|
328
|
-
change — with the blocker and GitHub's own answer quoted. The repository's required reviews
|
|
329
|
-
and checks decide what may merge: Legion bypasses none, and a review only a person can give
|
|
330
|
-
is waited for.
|
|
331
|
-
- *The completion* is `handoff_complete` with the ordinary two-sentence `summary`, which names the
|
|
332
|
-
pull request, the head merged and the merge commit. It records the merger's phase row and moves
|
|
333
|
-
nothing: no Dispatch message, no publish, no phase. What moves the issue is the daemon's own
|
|
334
|
-
reading of the merged pull request, which writes `done` — before the completion or after it,
|
|
335
|
-
whichever comes second. The daemon refuses that completion only as it refuses any phase
|
|
336
|
-
worker's: `HANDOFF_NOT_CURRENT_PHASE` (the issue left `merging`), `HANDOFF_STALE_GENERATION`,
|
|
337
|
-
`HANDOFF_NO_RUN`, `HANDOFF_ALREADY_RECORDED` and `TREE_LINGERING`. It reads neither the head,
|
|
338
|
-
nor its checks, nor the approval: every one of those reads is the merger's own, above.
|
|
52
|
+
```bash
|
|
53
|
+
gh api --paginate repos/<o>/<r>/pulls/<n>/reviews --jq '.[] | {id, state, submitted_at, footer: ([.body // "" | scan("<!-- legion: (\\{.*?\\}) -->")] | last | .[0]? // "" | try fromjson catch {})} | select(.footer.phase == "review" and .footer.session == "<your session id>") | [.id, .state, .submitted_at, (.footer.head // "no head")] | @tsv'
|
|
54
|
+
```
|
|
339
55
|
|
|
340
56
|
## The production check after the close
|
|
341
57
|
|
|
342
|
-
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
setting names the tester, the daemon reads that merge, writes `done` and hands the check task
|
|
347
|
-
to the tester's live session. Where it is `off` nothing is opened at all — no record, no
|
|
348
|
-
bound and no look — and the merged close is like any other done: every claim of the issue is
|
|
349
|
-
retired and its pod released with the disk it ran on. A merged root still lingers its tree with
|
|
350
|
-
every claim suspended, as before. On a root whose tree still runs, the merge is recorded and
|
|
351
|
-
the root stays in `merging` on its merged pull request until the last other issue of its tree
|
|
352
|
-
is done or parked, the check opening with that close. Its first line, which tells it from a
|
|
353
|
-
phase task in a resumed session, is `Production check of <KEY>: <title>.`, naming the
|
|
354
|
-
repository, the pull request, the merge commit, the look's number, its wake (`the merge`, for
|
|
355
|
-
the first) and whether it is the last.
|
|
356
|
-
- **The check's record holds the role that works it, written when the check opened.** Changing the
|
|
357
|
-
setting moves no check already open: a check keeps the role it opened with, and a check open
|
|
358
|
-
before this release carries the implementer. Only that role may report on it, so a report from
|
|
359
|
-
any other role is refused (`CHECK_ROLE_MISMATCH`). The check carries no phase and no handoff: a
|
|
360
|
-
look ends with `handoff_complete` carrying a `verdict` and a `summary` and no commit, and the
|
|
361
|
-
daemon refuses a report with no open check (`CHECK_NOT_OPEN`), on an ended look
|
|
362
|
-
(`CHECK_LOOK_NOT_OPEN`) or with no verdict
|
|
363
|
-
(`CHECK_VERDICT_REQUIRED`).
|
|
364
|
-
One refusal is about the turn rather than the report: a completion sent from a turn that is not
|
|
365
|
-
a look's own task is refused `CHECK_LOOK_NOT_SERVED` and records nothing, so report again in the
|
|
366
|
-
turn of the look's task.
|
|
367
|
-
- **Each look does three things.** Do what the deployment instructions say to reach the deploy:
|
|
368
|
-
when they name an agent or role for it, `envoy_publish` the merge commit to that role's topic
|
|
369
|
-
with `expects_reply: false`, and await no reply. Read whether production carries the merge, and
|
|
370
|
-
with it every requirement only the deploy can show, each as the requirement names it, since
|
|
371
|
-
observing something else is never that requirement observed. Then
|
|
372
|
-
report one of three outcomes:
|
|
373
|
-
- `pass`, once you drove the changed path and those requirements in production through the
|
|
374
|
-
user's own access path and
|
|
375
|
-
recorded the result: `dispatch result` against the issue's `after_merge` check, at the merge
|
|
376
|
-
commit, its `observed` ending `woken by <event>`, the printed line in the PR body's `Checks`
|
|
377
|
-
block and one pull-request comment with the Legion footer. A closed issue takes a result for
|
|
378
|
-
an `after_merge` or `default_branch` check, a comment and a message, and refuses every other
|
|
379
|
-
write. A staging pass is not this: staging does not run every resource production does.
|
|
380
|
-
- `pending`, when production does not carry the merge yet (a shared profile still holding the
|
|
381
|
-
previous release, a daemon still running the previous commit, a deploy nobody has run), or a
|
|
382
|
-
requirement's observation has not happened: the summary names what is missing and what you
|
|
383
|
-
will look for next, `wake_at` names your next look (below), nothing is recorded, and the
|
|
384
|
-
check's line in the body stays at
|
|
385
|
-
`- Check <block id> (after_merge): not yet run`.
|
|
386
|
-
- `fail`, for a requirement observed as not met, one still unobserved at the last look, or a
|
|
387
|
-
defect: record the failing result with `dispatch result --verdict fail`, file no issue, and
|
|
388
|
-
take the path `skill://legion-worker/references/findings.md` gives it — a clear fix to the
|
|
389
|
-
controller topic, with its evidence comment on the controller's report issue; one needing a
|
|
390
|
-
decision as a `dispatch ask` there, whose reference you publish to that topic. Either names
|
|
391
|
-
this issue, the pull request, the merge commit, what you drove and what failed, and the
|
|
392
|
-
result's `observed` and the summary name it (`dispatch://<REPORT KEY>/ask/<id>`).
|
|
393
|
-
- **Numbers the daemon holds are read with the `legion` tool.** Where the verdict rests on what a
|
|
394
|
-
deployment's idle release has done, `read_release_records` answers a window of the daemon's own
|
|
395
|
-
records of its releases, resumes and holds: its one argument `since` is the RFC 3339 instant
|
|
396
|
-
the window starts at, and the tool's own description says what the answer carries. It reads
|
|
397
|
-
them with this session's own claim, so there is no credential to fetch and none on disk.
|
|
398
|
-
- **You name your own next look, and nothing else wakes the check.** A `pending` on any look but
|
|
399
|
-
the check's last carries `wake_at`, an RFC 3339 time: when you want to look again. Name a time
|
|
400
|
-
you have a reason for — when the deploy you asked for should have run, when the next release
|
|
401
|
-
lands — and say in the summary what you are waiting for, since that summary is what the next
|
|
402
|
-
look's task tells you woke it. A `pending` with no `wake_at` on a look that is not the last is
|
|
403
|
-
refused (`CHECK_WAKE_REQUIRED`): nothing is recorded, the look stays open, and the same report
|
|
404
|
-
with a time is taken. A `wake_at` that no look follows is refused (`CHECK_WAKE_UNEXPECTED`): on
|
|
405
|
-
a `pass`, on a `fail`, and on a `pending` on the last look, each of which ends the check. A time
|
|
406
|
-
less than 60 seconds ahead becomes 60 seconds ahead, and a time at or after the check's own
|
|
407
|
-
bound starts no look of its own, since the look at that bound already stands. No deploy run, no
|
|
408
|
-
Dispatch `issue.deployed`, no Dispatch build and no daemon boot wakes a check: the daemon reads
|
|
409
|
-
no deployment's production workflows at all, and your `wake_at` is the only thing that starts
|
|
410
|
-
the look after this one.
|
|
411
|
-
- **Nothing waits in the session for a deploy.** A `pending` ends the look: the daemon stops the
|
|
412
|
-
checking role's process, keeps its session and releases the issue's pod, whose Sandbox goes with
|
|
413
|
-
its disk, and at the time you named a new pod comes back and your session resumes with the next
|
|
414
|
-
look's task. So end the turn with the report: never poll, never wait on a reply, never ask for
|
|
415
|
-
approval to deploy. Open a `dispatch ask` only where the instructions name nobody: the
|
|
416
|
-
production gap and why it matters, then the required install or restart step, its risk, and
|
|
417
|
-
outcome-named options; the look still ends `pending`.
|
|
418
|
-
- **The bounds.** A look is bounded at 2 hours, and a look nobody reported — its 2 hours, an
|
|
419
|
-
operator's hold, or a claim that failed to start — starts the next look two hours later; on the
|
|
420
|
-
last look it closes the check as not run. The check is bounded by the project's
|
|
421
|
-
`production_check_hours` (336, 14 days, by default) from the close; the look that bound starts
|
|
422
|
-
is the last, so told in its task
|
|
423
|
-
(`the bound: production did not carry the merge within <N days>`). A `pass` or `fail` there
|
|
424
|
-
closes the check as any look's would, and a requirement still unobserved there is that `fail`;
|
|
425
|
-
only production not carrying the merge ends it `pending`, which carries no `wake_at` and
|
|
426
|
-
closes the check as not run, written first on the pull request — its check line and a comment
|
|
427
|
-
— because production did not carry the merge within the bound.
|
|
428
|
-
- **The record lives on the pull request and in the result.** Dispatch takes a comment, a message
|
|
429
|
-
and a result for an `after_merge` or `default_branch` check on a closed issue, and refuses an
|
|
430
|
-
ask there (`ISSUE_CLOSED`), so the deployment instructions' "on the pull request and the issue"
|
|
431
|
-
is the pull request and that result, and a defect reaches Dispatch by the `fail` verdict's two
|
|
432
|
-
paths alone — the message to the controller, which gives it to the tree that owns that code,
|
|
433
|
-
and the ask on the controller's report issue. The architect accepted before the
|
|
434
|
-
merge and is asked nothing after. `pass` or
|
|
435
|
-
`fail` closes the check: your claim is retired and the issue's Sandbox goes with its pod and
|
|
436
|
-
disk, for a root as for a child. Neither ending retires or suspends anything of an issue back in
|
|
437
|
-
the workflow (a root reopened inside its linger): its claim and pod are the new run's.
|
|
58
|
+
- `projects.<KEY>.production_check` in `legion.yaml` is `tester` (the default) or `off`. Under `off` the close opens no check at all. A check keeps the role it opened with, and only that role may report on it (`CHECK_ROLE_MISMATCH`).
|
|
59
|
+
- Reach the deploy as the deployment instructions say. When they name an agent or a role for it, `envoy_publish` the merge commit to that topic with `expects_reply: false`, and await no reply. Open a `dispatch ask` only where the instructions name nobody; the look still ends `pending`.
|
|
60
|
+
- A staging pass is no production pass: staging does not run every resource production does.
|
|
61
|
+
- Report each look's verdict as your role prompt says. A `fail` follows `skill://legion-worker/references/findings.md`: file no issue.
|
|
@@ -1,40 +1,20 @@
|
|
|
1
1
|
# Tests named before code
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Read it when you write a plan or review one: the planner, and the plan reviewer the planner runs.
|
|
5
|
-
|
|
6
|
-
A review that finds the cases of a requirement one at a time costs one round for each case.
|
|
7
|
-
A plan that names the test of each case before the code lets the implementer meet every case in one round.
|
|
3
|
+
Read it when you write a plan or review one: the planner, and the plan reviewer the planner runs. A plan that names each case's test before the code lets the implementer meet every case in one round, rather than one review round per case.
|
|
8
4
|
|
|
9
5
|
## The trace
|
|
10
6
|
|
|
11
|
-
The plan traces each clause of each requirement to the test rows that prove it: a test file and a test's name, or a row of a table test.
|
|
12
|
-
A clause is one thing the requirement says is true, so "each surface shows the stored text, and an empty one shows a dash" has two clauses.
|
|
13
|
-
A clause with no test row is not planned yet.
|
|
7
|
+
The plan traces each clause of each requirement to the test rows that prove it: a test file and a test's name, or a row of a table test. A clause is one thing the requirement says is true: "each surface shows the stored text, and an empty one shows a dash" is two clauses. A clause with no test row is not planned yet.
|
|
14
8
|
|
|
15
9
|
## Four kinds that name their list first
|
|
16
10
|
|
|
17
|
-
For each of these
|
|
18
|
-
|
|
19
|
-
- **A requirement over a class** ("every surface", "each form", "all six commands").
|
|
20
|
-
The plan names an inventory test that lists every member of the class, written first and failing.
|
|
21
|
-
A member the code leaves out then fails a test, and a member someone adds later goes into the list.
|
|
22
|
-
For example: a test that walks the router's table of routes and fails for each route that does not set the new header, written before any route sets it.
|
|
23
|
-
|
|
24
|
-
- **Parsing another system's output** (a database, a command, an API, a CI log).
|
|
25
|
-
The plan names fixtures captured from the real system, each with the command that captured it, so the parser meets the shapes the system really gives and not a shape someone imagined.
|
|
26
|
-
For example: the output of `psql -c "select ts_headline('english', body, q) from …"` on a real database, saved as one fixture for each shape it takes (one match, two matches, a match at the end of the text).
|
|
27
|
-
|
|
28
|
-
- **UI state with timing** (a save in place, a delay before a request, a reply that arrives late).
|
|
29
|
-
The plan names a state table: one row for each state and event, and each row is a test.
|
|
30
|
-
For example: "editing, Enter pressed", "editing, one second with no key", "saving, the reply arrives after the next edit".
|
|
11
|
+
For each of these, the plan names the list before any task that writes code:
|
|
31
12
|
|
|
32
|
-
- **A
|
|
33
|
-
|
|
34
|
-
|
|
13
|
+
- **A requirement over a class** ("every surface", "all six commands"): an inventory test that lists every member, written first and failing. Example: a test that walks the router's route table and fails for each route without the new header.
|
|
14
|
+
- **Parsing another system's output** (a database, a command, an API, a CI log): fixtures captured from the real system, each with the command that captured it, one per shape the output takes.
|
|
15
|
+
- **UI state with timing** (a save in place, a debounce, a late reply): a state table, one row per state and event, each row a test.
|
|
16
|
+
- **A changed shared data shape** (a record field, a message, a file format): each reader and each writer of the shape, each with the test that holds it.
|
|
35
17
|
|
|
36
18
|
## What the plan reviewer asks for
|
|
37
19
|
|
|
38
|
-
The plan reviewer reads the plan against the requirement text, clause by clause.
|
|
39
|
-
It asks for changes when a clause has no test row, or when a requirement of one of the four kinds has no inventory test, fixtures, state table or list of readers and writers.
|
|
40
|
-
A list the plan says a later task will write is no list: the list exists before the code, so the code is written against it.
|
|
20
|
+
The plan reviewer reads the plan against the requirement text, clause by clause. It asks for changes when a clause has no test row, or when a requirement of one of the four kinds has no inventory test, fixtures, state table or list of readers and writers. A list the plan says a later task will write is no list.
|