@sjawhar/pi-legion 19.22.1 → 19.23.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
@@ -28847,7 +28847,7 @@ import { logger as logger3 } from "@oh-my-pi/pi-utils";
28847
28847
  // package.json
28848
28848
  var package_default = {
28849
28849
  name: "@sjawhar/pi-legion",
28850
- version: "19.22.1",
28850
+ version: "19.23.0",
28851
28851
  license: "Apache-2.0",
28852
28852
  type: "module",
28853
28853
  omp: {
@@ -28859,7 +28859,7 @@ var package_default = {
28859
28859
  ]
28860
28860
  },
28861
28861
  legion: {
28862
- daemonApiVersion: 133
28862
+ daemonApiVersion: 137
28863
28863
  },
28864
28864
  repository: {
28865
28865
  type: "git",
@@ -65,7 +65,7 @@ The reviewer's `phase-finished` with an `APPROVED` review puts the issue in `acc
65
65
 
66
66
  - the tester's handoff, `dispatch handoff-read --issue <issue> --phase test`;
67
67
  - `dispatch results --issue <issue>`: each check, every result recorded against it with the commit it was recorded at, and the check's own line saying whether a pass stands and from which roles;
68
- - the reviewer's approval of that head by SHA (`gh api --paginate repos/<o>/<r>/pulls/<n>/reviews`);
68
+ - the reviewer's approval of that head by SHA, the head its Legion footer names and never its `commit_id`, which GitHub can move onto a later head (`gh api --paginate repos/<o>/<r>/pulls/<n>/reviews`; `skill://legion-worker/references/merge-gate.md` gives the read of each review's footer head, and what stands for a footer that names none);
69
69
  - each claim the reviewer's prose makes, checked against the code at that head and command output, never against the finding it ruled on or its own verdict: no other agent reads it.
70
70
 
71
71
  A tree often brings its own shortfall written up; that is no permission: your job is the goal. Accept only when a pass stands for every `before_merge` check of this issue at the approved head, each requirement the spec states has a check, and no criterion left the tree; on a parent, that head is section 4's last round. A pass stands is the check's own answer, which `dispatch results` prints under it: a pass at another commit, a pass recorded under an older wording of the check and a retracted pass are each printed and none of them is a pass that stands, while a fail recorded after a pass leaves that pass standing until someone retracts it.
@@ -109,8 +109,8 @@ fingerprint=$(set -o pipefail; jj -R "$LEGION_WORKSPACE" diff --from "fork_point
109
109
  unaffected.
110
110
 
111
111
  Where each role gets its two heads: the implementer — the tip before and after its own forward merge;
112
- the tester — the commit its latest results name and the new head; the reviewer — the `commit_id` of
113
- its last submitted review (`gh api --paginate repos/{owner}/{repo}/pulls/{n}/reviews --jq '.[] | {commit_id, state, user: .user.login, body}'`, whose pages concatenate in order, so the last line is the last submitted review)
112
+ the tester — the commit its latest results name and the new head; the reviewer — the head its last
113
+ submitted review read, which that review's Legion footer names, never that review's `commit_id`, which GitHub can move onto a later head (*The reviewer* in `skill://legion-worker/references/merge-gate.md` gives the read, what stands for a footer that names no head, and the measurement)
114
114
  and the new head; the merger never computes a fingerprint — it merges the head it read, and no
115
115
  Legion check compares that head with the approved one.
116
116
 
@@ -137,8 +137,39 @@ as the fingerprint decides (*The reviewer*, below, and
137
137
  architect is told the reason when the review's own webhook arrived, so the reviewer submits again at the head it read.
138
138
  A `COMMENT` decides nothing. After a
139
139
  forward merge, compute the fingerprint (*The unchanged-diff check* in
140
- `skill://legion-worker/references/conflicts-and-rewrites.md`) at the
141
- `commit_id` of your last submitted review and at the new head. Equal and that review was
140
+ `skill://legion-worker/references/conflicts-and-rewrites.md`) at the head your last submitted
141
+ review read and at the new head.
142
+ 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: on cybermonklabs/legion#3516, review 5908357397 was submitted at 01:10:46Z at `e9a820cf`, and on 2026-11-15 its `commit_id` read `6019bdc9`, the forward merge committed at 05:20:10Z whose first parent is `e9a820cf`, so a fingerprint taken at `commit_id` compares the new head with itself.
143
+ 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.
144
+ 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.
145
+ Where it prints no line, your session submitted no review on this pull request, which leaves no head to take the fingerprint at: a new round.
146
+
147
+ ```bash
148
+ 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'
149
+ ```
150
+
151
+ A footer that names no head, as none of the reviewer's seven footers on #3516 does, leaves the head named by that review's own `review` handoff, which the reviewer records before it submits each review, a confirmation's included.
152
+ That handoff is the newest version your session wrote at or before that review's `submitted_at`, and not the issue's newest: on #3516 the approval 5908357397, submitted at 01:10:46Z, has INFRA-1520's version 6, written at 01:10:08Z, which names `e9a820cf`, while version 7, written at 08:30:56Z for the confirmation, names `6019bdc9`.
153
+ `dispatch handoff-read` prints, on its first line, the version, the session that wrote it and when; this reads down from the newest until it finds that handoff, and prints the head it names, `head`, or `headReviewed` in a record an earlier reviewer prompt wrote:
154
+
155
+ ```bash
156
+ issue=<issue> sid=<your session id> at=<that review's submitted_at>; v=
157
+ while out=$(dispatch handoff-read --issue "$issue" --phase review ${v:+--version "$v"}) || { printf '%s\n' "$out"; false; }; do
158
+ line=$(printf '%s\n' "$out" | head -n 1); v=${line#*, version }; v=${v%% *}; written=${line##* at }
159
+ case $line in *" session $sid at "*)
160
+ if [ "$(jq -rn --arg w "$written" --arg a "$at" '$w[0:19] <= $a[0:19]')" = true ]; then
161
+ printf '%s\n' "$out" | tail -n +2 | jq -r '.head // .headReviewed // "no head"'; break; fi;;
162
+ esac
163
+ [ "$v" -gt 1 ] || { echo "no review handoff of this session at or before $at"; break; }; v=$((v - 1))
164
+ done
165
+ ```
166
+
167
+ Its last line says which case holds.
168
+ A full SHA is the head.
169
+ `no head` (a handoff that names none), `no review handoff of this session at or before …` or `HANDOFF_NOT_FOUND: …` says no handoff names the head for that review, as for a review made outside Legion's workflow: the head is then the one full SHA its body names as the head it reviewed or approved, and a confirmation's is the new head it approves.
170
+ Any other line, `Dispatch at … is unreachable` or another refusal (in a script `dispatch` prints its refusal on standard output, which the loop prints as it leaves), is Dispatch not answering, never "no handoff": run it again, and while it does not answer there is no head to take the fingerprint at, which is a new round.
171
+ A body that names more than one such SHA and does not say which it read, or names none, leaves no head to take the fingerprint at, which is a new round.
172
+ Equal and that review was
142
173
  `APPROVE`: submit one more `APPROVE` naming the new head by SHA, its body naming both SHAs
143
174
  and the fingerprint — a confirmation, not a round; no thermo pass, no thread pass. Equal and
144
175
  that review was `COMMENT` or `REQUEST_CHANGES`: continue that round against the new head;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion",
3
- "version": "19.22.1",
3
+ "version": "19.23.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {
@@ -12,7 +12,7 @@
12
12
  ]
13
13
  },
14
14
  "legion": {
15
- "daemonApiVersion": 133
15
+ "daemonApiVersion": 137
16
16
  },
17
17
  "repository": {
18
18
  "type": "git",