@sjawhar/pi-legion 10.0.0 → 10.1.0

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/dist/legion.js CHANGED
@@ -16148,7 +16148,7 @@ function onEnvoyRoleRegained(listener) {
16148
16148
  // package.json
16149
16149
  var package_default = {
16150
16150
  name: "@sjawhar/pi-legion",
16151
- version: "10.0.0",
16151
+ version: "10.1.0",
16152
16152
  license: "Apache-2.0",
16153
16153
  type: "module",
16154
16154
  omp: {
@@ -387,7 +387,7 @@ active phase worker.
387
387
  | `design-approved` | Its `version` is the approved one. A human approved the root spec document at its current version; the gate is open. Proceed to section 2 — except on a root whose catch-up said `handed_over`: its workers already run their phases, so start nothing; the approval releases any READY the gate refused. |
388
388
  | `design-changes-requested` | Its `version` and `reason`. A human asked for changes to the root spec at `version`, for `reason`. Revise the spec as the reason asks and request approval again as section 1 says; stay parked; the gate is closed. |
389
389
  | `phase-finished` | The daemon has already moved the issue to its next phase by its fixed table and started that phase's role; you start nothing. Read the committed handoff for the finishing phase; if it shows unresolved gaps, tell the role now working the issue (`envoy_publish` to its role topic). A `planner` notice that names a departure from the spec's design defers to section 1's full condition: when the approved Summary, Acceptance, scope and settled decisions still hold, the plan is the record; otherwise change the root spec and request approval again as section 1 says. A `reviewer` notice whose GitHub review is `CHANGES_REQUESTED` needs nothing from you: the daemon has returned the issue to `implementing` (Dispatch `in_progress`) and started the **implementer**, whose correction goes through the tester and the reviewer again, never straight to retro. A `reviewer` notice with an `APPROVED` review means the daemon has started retro (step 5). An `implementer` notice for `production_check` is its production report: read the record on the pull request and the issue, then run step 7. A `tester` notice with `verdict: "fail"` — its handoff carries `implementerProof.verdict: "rejected"`, or a failure naming the production-like proof — has gone back to the **implementer** by the daemon's table; never supply the proof from another role. A worker that reports no surface reaches the changed path sends that report instead of completing its phase, so the daemon starts nothing more on that issue and the worker stays idle in its session, not suspended: file a child issue in this tree to build the surface (infrastructure, tooling, or a skill), and when that child's `child-closed` arrives, tell the waiting worker to continue with `envoy_publish` to its role topic. That report is never a reason to advance the phase. |
390
- | `pr-blocked` | Its `reason` names the pull request and the `max_fix_attempts` it reached, or reads `Issue reached review_round_cap=<N>.` (the end of this row). The count is of heads pushed onto a red verdict that changed something outside `.legion/` — handoff-only pushes (`.legion/` paths only) never count, a push by the review App (a planner's, tester's, reviewer's or architect's) never counts, and the head after a red the tester's red tests earned (a review-App push that changed a path outside `.legion/`, however many handoff-only pushes follow it) does not count either — so after the tester's handoff-only push onto the implementer's red, the implementer's next push does count; a push the daemon cannot classify (a listener without `changed_paths`, a list the listener stopped at 100 paths or 32,768 runes of text, a push listing no commits) does. Published once per exhausted count, not on every later red verdict for that count. Read the failed CI evidence and recovery attempts. The notice moves nothing, and no later CI red within the attempt that ran the count out (the counted head, and every head pushed on top of it until a push lands on a head CI judged green, the tester's red tests and handoff onto the held red included) sends the work back from `testing` or `reviewing` either: the issue stays in its phase until you move it, or a worker's own decision does (a tester's `fail`, a reviewer's request for changes). A head pushed onto green CI leaves that attempt, so its red still comes as a `checks-red`. In `implementing`, give the implementer the failing checks (`envoy_publish` to its role topic). In any later phase a worker holds, tell that worker (`envoy_publish` to its role topic) to move the issue back to `implementing` with `request_backward_move`, naming the failing checks, and the daemon starts the implementer; or file a corrective child. In `awaiting_merge`, where no worker holds a phase and a backward move is refused, open a `dispatch ask` naming the failing checks for the human who merges, as section 6 does for a conflict there. Do not treat the blocked PR as final. A `review_round_cap` reason is the implementer's round count instead: every move back to an earlier phase counts one, and the notice comes again with each round past the cap. It moves nothing either, since the round that reached the cap has already started its worker. Tell the rounds apart by what announced each: a tester's fail by its `phase-finished` with `verdict: "fail"`; a request for changes by the reviewer's `phase-finished` over a `CHANGES_REQUESTED` review; the daemon's own move by a `checks-red` notice, whose reason names either a conflict (`the head conflicts with <base>`) or the required checks that failed (`CI is red at <head>`); a worker's `request_backward_move` by a `phase-finished` from the role that asked, whose reason reaches only the task of the worker the move started, so ask that worker. Judge the cap by the rounds that are not conflicts. Conflict returns need nothing from you beyond the next round. Tester fails, requests for changes and CI-red returns (a `checks-red` notice is raised for CI only when a required check fails on code the branch pushed) are the work going in circles: narrow it, re-plan it with the responsible worker, or ask a human with `dispatch ask`. Judge a worker's backward move by the reason that worker gives. A move you ordered for a conflict found before `awaiting_merge` (section 6) is a conflict return. The merger's move back to `reviewing` because its task names no approved head is not the work going in circles either. A move that sends back code found wrong counts with the tester fails. |
390
+ | `pr-blocked` | Its `reason` names the pull request and the `max_fix_attempts` it reached, or reads `Issue reached review_round_cap=<N>.` (the end of this row). The count is of heads pushed onto a red verdict that changed something outside `.legion/` — handoff-only pushes (`.legion/` paths only) never count, a push by the review App (a planner's, tester's, reviewer's or architect's) never counts, and the head after a red the tester's red tests earned (a review-App push that changed a path outside `.legion/`, however many handoff-only pushes follow it) does not count either — so after the tester's handoff-only push onto the implementer's red, the implementer's next push does count; a push the daemon cannot classify (a listener without `changed_paths`, a list the listener stopped at 100 paths or 32,768 runes of text, a push listing no commits) does. Published once per exhausted count, not on every later red verdict for that count. Read the failed CI evidence and recovery attempts. The notice moves nothing, and no later CI red within the attempt that ran the count out (the counted head, and every head pushed on top of it until a push lands on a head CI judged green, the tester's red tests and handoff onto the held red included) sends the work back from `testing`, `reviewing`, `retro` or `merging` either: the issue stays in its phase until you move it, or a worker's own decision does (a tester's `fail`, a reviewer's request for changes). A head pushed onto green CI leaves that attempt, so its red still comes as a `checks-red`. In `implementing`, give the implementer the failing checks (`envoy_publish` to its role topic). In any later phase a worker holds, tell that worker (`envoy_publish` to its role topic) to move the issue back to `implementing` with `request_backward_move`, naming the failing checks, and the daemon starts the implementer; or file a corrective child. In `awaiting_merge`, where no worker holds a phase and a backward move is refused, open a `dispatch ask` naming the failing checks for the human who merges, as section 6 does for a conflict there. Do not treat the blocked PR as final. A `review_round_cap` reason is the implementer's round count instead: every move back to an earlier phase counts one, and the notice comes again with each round past the cap. It moves nothing either, since the round that reached the cap has already started its worker. Tell the rounds apart by what announced each: a tester's fail by its `phase-finished` with `verdict: "fail"`; a request for changes by the reviewer's `phase-finished` over a `CHANGES_REQUESTED` review; the daemon's own move by a `checks-red` notice, whose reason names either a conflict (`the head conflicts with <base>`) or the required checks that failed (`CI is red at <head>`); a worker's `request_backward_move` by a `phase-finished` from the role that asked, whose reason reaches only the task of the worker the move started, so ask that worker. Judge the cap by the rounds that are not conflicts. Conflict returns need nothing from you beyond the next round. Tester fails, requests for changes and CI-red returns (a `checks-red` notice is raised for CI only when a required check fails on code the branch pushed) are the work going in circles: narrow it, re-plan it with the responsible worker, or ask a human with `dispatch ask`. Judge a worker's backward move by the reason that worker gives. A move you ordered for a conflict found before `awaiting_merge` (section 6) is a conflict return. The merger's move back to `reviewing` because its task names no approved head is not the work going in circles either. A move that sends back code found wrong counts with the tester fails. |
391
391
  | `pr-merged` | Its `reason` names the pull request. The PR merged, under the repository's rules, before the issue reached `awaiting_merge`. The workflow runs on and asks no one to merge it: the daemon starts the **implementer** on the production check once the issue gets there, and you start nothing. Its `phase-finished` for `production_check` is what brings you to step 7: verify the record on the pull request and this issue first, then sign off naming it with `sign_off`. A merge is not the close. |
392
392
  | `pr-closed-unmerged` | Decide from current scope whether the work is reopened, started over (`park_child` then `rerun_child`, for a child), or ended with a reason. Delegate the repository action to the responsible phase worker and keep ownership. |
393
393
  | A reply on an ask you follow | Interpret the reply in the issue's design context. Answer in its thread (`dispatch comment --reply-to <comment id>`; under an open ask whose next move is yours, such as the approval request you must revise or hand back, `--reply-to-ask <ask id> --turn agent`, since a default-turn reply hands that request back to the human and a corrected `--summary` is then refused), then adjust the plan or relay it via `envoy_publish` to the responsible worker's role token; scope and product decisions remain with you. |
@@ -118,9 +118,12 @@ turn, including one an Envoy question starts: you are kept alive to answer quest
118
118
  editing. Do not create new commits, run `jj -R "$LEGION_WORKSPACE" new`, or touch tracked files
119
119
  once your own handoff is committed and pushed — a code change belongs to
120
120
  whichever phase is active now. The same holds once the Go daemon has taken your phase back without
121
- your completion: CI settling red while you tested, or reviewed a round you had not completed,
122
- moves the issue to `implementing` and interrupts your turn, and the implementer starts only once
123
- that turn has ended. Do not resume the interrupted work afterward.
121
+ your completion: CI settling red while you tested, reviewed a round you had not completed, or
122
+ built READY, moves the issue to `implementing` and interrupts your turn, and the implementer starts
123
+ only once that turn has ended. Do not resume the interrupted work afterward. From retro the
124
+ issue moves the same way with nothing interrupted: you are the implementer, handed the implementing
125
+ task once your turn ends; a retro completion started after the move is refused, and one in flight
126
+ when the red lands can be taken as your implementing completion, caught by the tester's CI read.
124
127
 
125
128
  On every start, and especially after revival or re-creation, read the issue and then the
126
129
  committed predecessor handoffs in lifecycle order, with the `read` tool from
@@ -437,8 +440,8 @@ record of this issue's active phase. Do not add pipeline labels, run a controlle
437
440
  invent a different completion protocol — this is the whole contract.
438
441
 
439
442
  A reviewer's phase ends with its completion, not with its review; the order of a review round
440
- (the handoff push; for an approval, CI settled green at that head; the review of that head; then
441
- the completion) is in `skill://legion-worker/references/merge-gate.md`.
443
+ (the read of the code commit's checks on GitHub; the handoff push; the review of the head that
444
+ push made; then the completion) is in `skill://legion-worker/references/merge-gate.md`.
442
445
 
443
446
  **A refused completion is information, not a retry loop.** The daemon attributes your report to
444
447
  the run whose task you took, and answers with what it found. What each answer carries, and what to
@@ -20,7 +20,33 @@ the head voids it.
20
20
  - The reviewer verifies the `CI`, `Threads`, and `E2E` facts against GitHub directly —
21
21
  never from a handoff — then runs `task(agent="thermonuclear-deep-review")` and
22
22
  `task(agent="thermonuclear-code-quality")` once at that head — the head the round reviews —
23
- and records the verdict.
23
+ and records the verdict. The `CI` fact is the checks that stand for the code under review:
24
+ those GitHub ran for the newest push of the branch that started `pull_request` workflows, when
25
+ every commit above that push's head changes only `.legion/` (a push that changes only
26
+ `.legion/` carries `skip-checks: true`, so GitHub runs no workflow for it). With `<o>/<r>`,
27
+ `<n>`, `<base>`, `<headRefName>` and `<headRefOid>` from
28
+ `gh pr view <n> --json baseRefName,headRefOid,headRefName`, four reads. The required set, from
29
+ the base branch's rulesets
30
+ (`gh api repos/<o>/<r>/rules/branches/<base> --jq '.[] | select(.type=="required_status_checks") | .parameters.required_status_checks[].context'`)
31
+ and its branch protection, when it has any
32
+ (`gh api repos/<o>/<r>/branches/<base> --jq '.protection.required_status_checks.checks[].context'`);
33
+ a read GitHub refuses is reported to the architect, never guessed. The CI head, the head of the
34
+ branch's newest `pull_request` run
35
+ (`gh api 'repos/<o>/<r>/actions/runs?branch=<headRefName>&event=pull_request&per_page=30' --jq '.workflow_runs[0].head_sha'`,
36
+ newest first); the PR body's `CI:` line names runs at that same commit
37
+ (`gh run view <run-id> --json headSha,status,conclusion`), or the line is stale and the review
38
+ says so. That commit's check-runs
39
+ (`gh api repos/<o>/<r>/commits/<ci head>/check-runs --paginate --jq '.check_runs[] | [.name, .status, .conclusion] | @tsv'`):
40
+ every required name present, `completed` and `success` (GitHub counts `neutral` and `skipped`
41
+ as passing for a required check). And the compare proving only `.legion/` changed since
42
+ (`gh api repos/<o>/<r>/compare/<ci head>...<headRefOid> --jq '[.files[].filename] | all(startswith(".legion/"))'`
43
+ prints `true`; `false` means code was pushed since CI ran, so wait for the new push's runs and
44
+ read the CI head again). A required check `queued` or `in_progress`: wait. One `completed` as
45
+ `cancelled`, or absent: `gh run rerun <run-id>` once, then wait; when nothing will run it (a
46
+ check only a commit status reports, a workflow another repository defines), tell the architect
47
+ and do not approve. `gh pr checks <n>` is not the read: it reads only the current head, which
48
+ at a handoff head shows only the `pr-title` runs the review events start (measured on
49
+ sjawhar/legion#1944 at 0220b94fc2 on 2026-10-14).
24
50
  Approval is refused while either `E2E (implementer)` or `E2E (tester)` is missing: `REQUEST_CHANGES` naming the missing line.
25
51
  Skip the `Thermo` line entirely on a docs-only PR. Submit **one review per round** —
26
52
  `REQUEST_CHANGES` when any correctness finding stands, otherwise `APPROVE` of the head you
@@ -42,25 +68,17 @@ the head voids it.
42
68
  when every thread is settled enough to approve, and resolving one never gates your approval.
43
69
 
44
70
  A reviewer's phase ends with its completion, not with its review. Every round writes a handoff
45
- and takes this order: write, commit and push the handoff; submit the review of the head that push
46
- made, by its SHA; then complete. An approval waits for the CI verdict to settle green at that head
47
- before you submit it, since an approval stands only on green checks and GitHub can dismiss one
48
- once the head moves, and a verdict that settles red there makes the round's decision a request for
49
- changes naming the failing checks, unless only review workflows the project declares
50
- (`projects.<KEY>.review_workflows`) are red on their own findings: then you answer their threads,
51
- name the ones you accepted to the implementer, who resolves them with its own `gh` as the pull
52
- request's author, and re-run the failed run once they are resolved, as your role prompt says, and
53
- approve once it passes. Any other red required workflow is a failing check like any other. A
54
- request for changes does not wait, since it stands whatever CI says and the issue leaves
55
- reviewing with it. The verdict is of the checks and workflows the base branch requires, the set
56
- READY checks: red when one of them failed, and never red for a check the base branch does not
57
- require. A required check that was cancelled, or that the head's checks
58
- settled without, leaves no verdict until a later settlement decides it, since a run can be
59
- cancelled or not yet queued when the head settles; a required workflow's run on the head that is
60
- still going or has not happened leaves none either. A review of a head the handoff push
61
- then replaces names a head the pull request no longer has. The daemon moves the issue
62
- once both are in — the decision GitHub reports and your completion, in either order — so a
63
- review posted without a completion leaves the issue in reviewing until you finish.
71
+ and takes this order: read CI as above; write, commit and push the handoff; submit the review of
72
+ the head that push made, by its SHA; then complete. A red at the code is a `REQUEST_CHANGES`
73
+ naming the check, never an approval. A request for changes does not wait, since it stands
74
+ whatever CI says and the issue leaves reviewing with it. The approval waits on nothing at the
75
+ handoff commit either: it ends the round whatever CI says there, since the round reads no CI
76
+ verdict, and a red the daemon reads later — at that commit or any above it — is the code's red
77
+ and resumes the implementer from wherever the issue is (reviewing, retro or merging) without the
78
+ reviewer. A review of a head the handoff push then replaces names a head the pull request no
79
+ longer has. The daemon moves the issue once both are in — the decision GitHub reports and your
80
+ completion, in either order — so a review posted without a completion leaves the issue in
81
+ reviewing until you finish.
64
82
 
65
83
  ## Retro
66
84
 
@@ -67,11 +67,8 @@ opened that is none of Legion's role Apps, with one reply in your own words. A b
67
67
  cannot accept becomes your own: say what stands and request changes. Approve once each of those
68
68
  threads carries your answer and no finding stands, read in `gh api graphql` — quote those answers
69
69
  in the approval. Your approval never waits on a resolution: resolution is the pull request author's
70
- App's, except when a review workflow the project declares (`projects.<KEY>.review_workflows`) is
71
- red on its findings. Such a workflow starts again only on a push, so neither a reply nor a
72
- resolution re-runs it, and it passes on a re-run only once its threads are resolved: answer its
73
- threads, name the ones you accepted to the implementer with `envoy_publish` to its role topic, and
74
- read the listing above until each shows `isResolved` true before you push your handoff, so the run
75
- that push starts reads the threads as the implementer left them; then re-run the failed run once,
76
- as your role prompt says, before you approve. The merger resolves nothing: READY requires no thread
77
- state beyond what your approval already judged.
70
+ App's. A review bot that is red while a thread it opened still stands is CI like any other, and
71
+ you re-run nothing: when the base branch requires its check, that red sends the work back to the
72
+ implementer, who answers or fixes each of the bot's threads, resolves them with its own `gh` (the
73
+ ones you named to it, above, and its own), and pushes, and the bot runs again on that push. The
74
+ merger resolves nothing: READY requires no thread state beyond what your approval already judged.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion",
3
- "version": "10.0.0",
3
+ "version": "10.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {