@sjawhar/claude-envoy 2.6.0 → 2.7.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/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/AGENTS.md +13 -3
- package/dist/envoy-channel.js +68 -27
- package/legion/skills/legion-architect/SKILL.md +1 -1
- package/legion/skills/legion-architect/references/acceptance.md +49 -52
- package/legion/skills/legion-architect/references/design-gate.md +4 -5
- package/legion/skills/legion-architect/references/wake-routing.md +7 -16
- package/legion/skills/legion-controller/SKILL.md +2 -2
- package/legion/skills/legion-controller/references/admission.md +4 -5
- package/legion/skills/legion-controller/references/backlog-stewardship.md +3 -4
- package/legion/skills/legion-controller/references/escalation.md +8 -7
- package/legion/skills/legion-controller/references/finding-asks.md +1 -1
- package/legion/skills/legion-controller/references/session.md +1 -1
- package/legion/skills/legion-controller/references/slack-mentions.md +1 -1
- package/legion/skills/legion-controller/references/triage.md +1 -1
- package/legion/skills/legion-controller/references/wakes.md +6 -4
- package/legion/skills/legion-retro/SKILL.md +13 -19
- package/legion/skills/legion-worker/SKILL.md +12 -8
- package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +3 -3
- package/legion/skills/legion-worker/references/merge-gate.md +110 -151
- package/legion/skills/legion-worker/references/pr-body.md +15 -14
- package/legion/skills/legion-worker/references/review-threads.md +4 -4
- package/package.json +2 -2
- package/src/legion-phase-hook.ts +25 -11
- package/legion/skills/legion-architect/references/merge-notices.md +0 -104
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
# The merge gate: review, acceptance, retro,
|
|
1
|
+
# The merge gate: review, acceptance, retro, the merge, and the production check
|
|
2
2
|
|
|
3
3
|
Part of `skill://legion-worker`. Read it when you are the reviewer submitting a review or an
|
|
4
|
-
approval, the tester on a look of its closed issue's production check, or the merger
|
|
5
|
-
|
|
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
6
|
|
|
7
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
|
|
9
|
-
issue → the production check after the close, which the project's `production_check`
|
|
10
|
-
gives to a role or takes away. Every handoff is a record on the
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
confirmation or a new round, as the fingerprint decides (*The reviewer*, below, and
|
|
18
|
-
`skill://legion-worker/references/conflicts-and-rewrites.md`), unless READY refused it, and any
|
|
19
|
-
other change to the head voids it.
|
|
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 for a confirmation or a new round,
|
|
15
|
+
as the fingerprint decides (*The reviewer*, below, and
|
|
16
|
+
`skill://legion-worker/references/conflicts-and-rewrites.md`).
|
|
20
17
|
|
|
21
18
|
## The reviewer
|
|
22
19
|
|
|
@@ -82,8 +79,21 @@ other change to the head voids it.
|
|
|
82
79
|
reviewed — always named by SHA — carrying every inline comment in that single
|
|
83
80
|
call: `gh api --method POST repos/{owner}/{repo}/pulls/{number}/reviews --input body.json`
|
|
84
81
|
with `commit_id`, `event` (`REQUEST_CHANGES` or `APPROVE`), `body` (with the
|
|
85
|
-
Legion footer
|
|
82
|
+
Legion footer, which names the head the review read:
|
|
83
|
+
`<!-- legion: {"session":"<session-id>","phase":"review","head":"<the head you reviewed>"} -->`),
|
|
84
|
+
and a `comments[]` array of `{path, line, side, body}`, one entry per
|
|
86
85
|
finding — never one `pr review` call per finding (each submission fires a `pr-review` wake).
|
|
86
|
+
That `head` is the full 40-character SHA of the head whose diff and checks you read, which is
|
|
87
|
+
the `commit_id` you submit with, and never the head GitHub shows at the moment you submit:
|
|
88
|
+
read `gh pr view <n> --repo <owner>/<repo> --json headRefOid --jq .headRefOid` before you
|
|
89
|
+
submit, and where it names another head a push landed under you, so review that head and
|
|
90
|
+
submit at it rather than renaming the footer to a head you have not read.
|
|
91
|
+
The daemon takes that head as the review's own word for the code it read, and cannot take GitHub's
|
|
92
|
+
`commit_id` for the review instead, which GitHub rewrites onto the pull request's current head,
|
|
93
|
+
so its record of a review can name a head the review never saw.
|
|
94
|
+
A review whose footer names another head, or no head, decides no round:
|
|
95
|
+
it is set aside, the round stays open and the
|
|
96
|
+
architect is told the reason when the review's own webhook arrived, so the reviewer submits again at the head it read.
|
|
87
97
|
A `COMMENT` decides nothing. After a
|
|
88
98
|
forward merge, compute the fingerprint (*The unchanged-diff check* in
|
|
89
99
|
`skill://legion-worker/references/conflicts-and-rewrites.md`) at the
|
|
@@ -92,10 +102,7 @@ other change to the head voids it.
|
|
|
92
102
|
and the fingerprint — a confirmation, not a round; no thermo pass, no thread pass. Equal and
|
|
93
103
|
that review was `COMMENT` or `REQUEST_CHANGES`: continue that round against the new head;
|
|
94
104
|
nothing restarts. Different, or either run printed no fingerprint: a new round — thermo again,
|
|
95
|
-
one review.
|
|
96
|
-
after a forward merge, and a no-fix `REQUEST_CHANGES` that answered one is never continued: the round
|
|
97
|
-
after it reviews the refused change in full from the last `APPROVE` (*Retro's commits do not
|
|
98
|
-
void the reviewer's approval* below).
|
|
105
|
+
one review.
|
|
99
106
|
- Answer every thread you opened, and every thread a bot opened that is none of Legion's role
|
|
100
107
|
Apps, as `skill://legion-worker/references/review-threads.md` says; the same reference says
|
|
101
108
|
when every thread is settled enough to approve, and resolving one never gates your approval.
|
|
@@ -108,17 +115,14 @@ other change to the head voids it.
|
|
|
108
115
|
`stuckApprovedOtherCode` in `packages/daemon/internal/workflow/review.go`, and the cases "the
|
|
109
116
|
approval, then a push" and "a push, then the approval of the head before it" in
|
|
110
117
|
`packages/daemon/internal/workflow/review_test.go`). GitHub runs the branch's workflows on that
|
|
111
|
-
push, as on every push. Wait for that head's required checks to be
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
push, as on every push. Wait for that head's required checks to be green, and approve only
|
|
119
|
+
then: nothing but your own read catches a check your prose broke, since the daemon moves the
|
|
120
|
+
issue for no check at all. A red you approve over reaches nobody who will act on it: the tree
|
|
121
|
+
runs on to the merge, where GitHub holds the pull request under the base branch's required
|
|
122
|
+
checks until someone reads them. A red there is a
|
|
116
123
|
`REQUEST_CHANGES` when the code is at fault, and your own commit to fix when your prose broke
|
|
117
124
|
it. The architect reads your prose commits at its acceptance (*The architect's acceptance*,
|
|
118
|
-
below), and that read is no new round.
|
|
119
|
-
approval needs the tester's results to be at the head, or at an ancestor with only paths
|
|
120
|
-
under `.legion/` changed since. So there you fix no prose yourself, and you name each prose
|
|
121
|
-
finding in a `REQUEST_CHANGES`.
|
|
125
|
+
below), and that read is no new round.
|
|
122
126
|
|
|
123
127
|
A reviewer's phase ends with its completion, not with its review. Every round records a handoff
|
|
124
128
|
and takes this order: read CI as above; write the handoff and record it with
|
|
@@ -126,13 +130,17 @@ and takes this order: read CI as above; write the handoff and record it with
|
|
|
126
130
|
code is a `REQUEST_CHANGES` naming the check, never an approval. A request for changes does not
|
|
127
131
|
wait, since it stands whatever CI says and the issue leaves reviewing with it. The approval waits
|
|
128
132
|
on nothing either: it ends the round whatever CI says at the head it names, since the round reads
|
|
129
|
-
no CI verdict, and a
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
no CI verdict, and a settlement the daemon reads later — at that head or any above it — moves the
|
|
134
|
+
issue nowhere. The daemon names each check GitHub reported, with the conclusion GitHub gave it,
|
|
135
|
+
in one message to the tree's architect, the worker of the issue's current phase and the
|
|
136
|
+
implementer, and judges none of them: a red is the implementer's to fix or re-run, the
|
|
137
|
+
architect's to decide on, and GitHub's to hold the merge for. So the reviewer's own read before
|
|
138
|
+
it approves is the only read that decides anything. A review that names an older head reviews
|
|
139
|
+
code the pull request no longer has. The daemon moves the issue once all three are in — the
|
|
140
|
+
decision GitHub reports, your completion, in either order, and GitHub's own answer that the
|
|
141
|
+
approved head is one the issue may advance on — so a review posted without a completion leaves
|
|
142
|
+
the issue in reviewing until you finish, and an approved head GitHub answers `blocked` for leaves
|
|
143
|
+
it there until that answer comes clean.
|
|
136
144
|
|
|
137
145
|
## The architect's acceptance
|
|
138
146
|
|
|
@@ -158,28 +166,22 @@ reviewing until you finish.
|
|
|
158
166
|
a root's checks are proven at its own head, in its last round. No `after_merge` result is
|
|
159
167
|
asked here: it is recorded after the close, where the project opens a check (*The production
|
|
160
168
|
check after the close*, below).
|
|
161
|
-
CI red at the head in `accepting`
|
|
162
|
-
|
|
163
|
-
|
|
169
|
+
CI red at the head in `accepting` moves nothing, as it moves nothing anywhere: the daemon names
|
|
170
|
+
the checks GitHub reported and leaves the decision to the roles it told. Read the head's checks
|
|
171
|
+
on GitHub yourself before you accept, and send a red head back with `request_backward_move`.
|
|
164
172
|
|
|
165
173
|
## Retro
|
|
166
174
|
|
|
167
175
|
- **Retro commits nothing.** It reads the evidence, writes what the work taught as a
|
|
168
176
|
`dispatch comment` on the issue for the skill librarian, brings the PR body up to date and
|
|
169
|
-
completes (`skill://legion-retro` gives the steps), so the approved head is the head
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
with each remedy, is the merger's own role prompt part.
|
|
178
|
-
A conflict merge pushed above the approved head with no review round after it
|
|
179
|
-
brings the base's paths above that head, so READY refuses it the same way; one sent back through
|
|
180
|
-
`implementing` by the conflict procedure gets its confirmation before READY runs. A READY
|
|
181
|
-
refusal's return reaches the reviewer as a new round, never a fingerprint confirmation. Retro
|
|
182
|
-
removes nothing.
|
|
177
|
+
completes (`skill://legion-retro` gives the steps), so the approved head is the head the merger
|
|
178
|
+
merges. Nothing in Legion compares that head with the one the approval named either: a
|
|
179
|
+
repository that wants a push made after the approval reviewed says so in its own rulesets (a
|
|
180
|
+
stale review dismissed, a review required again), and GitHub holds the merge to them. A
|
|
181
|
+
conflict merge pushed above the approved head still goes back to the reviewer for a
|
|
182
|
+
confirmation or a new round, as the fingerprint decides
|
|
183
|
+
(`skill://legion-worker/references/conflicts-and-rewrites.md`), because the branch's own
|
|
184
|
+
procedure says so and not because any Legion check refuses the head. Retro removes nothing.
|
|
183
185
|
- **Retro brings the PR body's path-derived content up to date before it completes.** Whatever the
|
|
184
186
|
repository's instructions derive from the pull request's changed paths (a checklist named for
|
|
185
187
|
each class of path, read by a required check), retro recomputes for the whole diff at its head
|
|
@@ -189,97 +191,54 @@ reviewing until you finish.
|
|
|
189
191
|
|
|
190
192
|
## The merger
|
|
191
193
|
|
|
192
|
-
- The merger resolves no review thread: the reviewer's approval already judged them, and
|
|
193
|
-
requires no thread state beyond it. It
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
request
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
`
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
ends the row and is told to the architect once
|
|
241
|
-
(`merge-removed`). Two removals are submitted again: the implement App's own disarm sent before
|
|
242
|
-
READY that GitHub applied late (auto-merge `manually_disabled`, or a `manual` dequeue, by that
|
|
243
|
-
App), and auto-merge a close turned off, which the reopen at READY's head undid. GitHub's
|
|
244
|
-
rules decide each answer: the daemon bypasses
|
|
245
|
-
none, and a person may merge it first. A refusal a retry would meet again (squash merges disabled,
|
|
246
|
-
a permission the App lacks) ends the row and is told to the architect once (`merge-refused`), with
|
|
247
|
-
GitHub's message. While the record still awaits READY's head, GitHub showing the pull request
|
|
248
|
-
closed or at another head is a webhook not yet applied, so the row waits for the two to agree.
|
|
249
|
-
Only once GitHub's last change to the pull request is more than 10 minutes old, however long the
|
|
250
|
-
row waited before, does the row end and tell the architect once (`merge-stalled`). A merge the
|
|
251
|
-
daemon submitted that GitHub has not completed within an hour of READY's acceptance tells the
|
|
252
|
-
issue's architect once (`merge-waiting`) and goes on waiting: nothing is withdrawn, the merge
|
|
253
|
-
stands, the issue stays in `awaiting_merge`, and the architect reads the pull request for what
|
|
254
|
-
GitHub waits on — a required check that never ran or failed, a review only a person can give, a
|
|
255
|
-
queue that has not landed it — and asks a person for what no worker can do. A reopen at
|
|
256
|
-
READY's head reuses the row, starts it over as though nothing had been armed, and takes it from a
|
|
257
|
-
run that read the record before the reopen. Any other failure retries.
|
|
258
|
-
No role runs `gh pr merge`. When the answer's `note` begins `MANUAL_MERGE_REQUIRED:` (the pull
|
|
259
|
-
request touches a path the project's `merge.by_hand` names), READY stands but the daemon submits
|
|
260
|
-
nothing: the merger tells the architect the note and the head, and a person merges under the
|
|
261
|
-
repository's rules. While an earlier auto-merge disarm for that pull request remains unfinished,
|
|
262
|
-
a by-hand READY refuses `READY_DISARM_PENDING`; retry it once the disarm finishes, so a stale
|
|
263
|
-
ordinary arm cannot merge the person-only head. Ordinary READY does not wait for the disarm. The
|
|
264
|
-
daemon tells that READY with the note at its head and the packet's `Merge:` line replaced, so the
|
|
265
|
-
issue and the merge queue role are never asked to arm it. A READY the design gate refused is
|
|
266
|
-
submitted by the daemon once every gated step of the root's design gate is open, when the
|
|
267
|
-
approval that opens the last closed one moves the issue to `awaiting_merge`; the refusal named
|
|
268
|
-
one step and the version to approve, and no second READY is asked for however many steps held
|
|
269
|
-
it. A push that moves the head past a READY the gate holds voids it before then:
|
|
270
|
-
the architect is told `READY_HEAD_MOVED` and has the merger build a new READY at the new head.
|
|
271
|
-
The packet's second line records the step,
|
|
272
|
-
`Merge: the daemon submits pull request #<n> at <head> once READY is accepted`.
|
|
273
|
-
- **The daemon disarms a merge no READY covers.** Auto-merge stays enabled across pushes, and the
|
|
274
|
-
expected head is checked only when it is enabled, so the daemon itself disables the pull
|
|
275
|
-
request's auto-merge and takes it out of a merge queue, as the implement App, on any push or
|
|
276
|
-
reopen but one landing on an awaiting READY's head, when READY is withdrawn (a push or reopen
|
|
277
|
-
moved the head past it, its CI turned red, or it conflicts with its base, each of which sends the
|
|
278
|
-
issue back to `implementing`), when a child is set back to `todo`, and when the issue leaves the
|
|
279
|
-
workflow. A by-hand READY covers no arm, so whoever arms it is undone. A `ready_merge` row whose
|
|
280
|
-
READY the record has left, or whose pull request the record holds closed, submits nothing; a pull
|
|
281
|
-
request reopened at an awaiting READY's head gets that head's merge submitted again. No role runs
|
|
282
|
-
a disarm.
|
|
194
|
+
- The merger resolves no review thread: the reviewer's approval already judged them, and the
|
|
195
|
+
merge requires no thread state beyond it. It writes no file, commits nothing and pushes
|
|
196
|
+
nothing.
|
|
197
|
+
- **The merge is the merger's own act, at the head it read.** It reads the pull request
|
|
198
|
+
(`gh pr view <n> --json number,title,url,state,baseRefName,headRefOid,mergeStateStatus`), and
|
|
199
|
+
every step below names that `headRefOid`:
|
|
200
|
+
- *The message, before the merge.* GitHub's default squash message,
|
|
201
|
+
`squash_merge_commit_message` of `COMMIT_MESSAGES`, joins every commit message of the pull
|
|
202
|
+
request, which puts the tree's `Dispatch:` keys and its `Omp-Session:` trailers on the
|
|
203
|
+
default branch. So the merger writes the message itself,
|
|
204
|
+
`--subject '<pull request title> (#<n>)' --body ''`, on every merge, whatever the repository's
|
|
205
|
+
setting says. It reads that setting first all the same
|
|
206
|
+
(`gh api "repos/<o>/<r>" --jq '[.squash_merge_commit_title, .squash_merge_commit_message] | @tsv'`),
|
|
207
|
+
because the merge-queue path below can pass no message.
|
|
208
|
+
- *The merge.*
|
|
209
|
+
`gh pr merge <n> --squash --match-head-commit <head> --subject '<pull request title> (#<n>)' --body ''`,
|
|
210
|
+
as the implement App, so
|
|
211
|
+
GitHub refuses the merge once the head has moved under it: merging at a named head is how bors
|
|
212
|
+
and Prow's Tide merge only what they tested. On a base with a merge queue — a `merge_queue`
|
|
213
|
+
rule among the base branch's rules — it enqueues the pull request instead, with GraphQL
|
|
214
|
+
`enqueuePullRequest` and the same head as `expectedHeadOid`, because `gh pr merge` on such a
|
|
215
|
+
base turns auto-merge on while a required check is pending, which arms the pull request rather
|
|
216
|
+
than queueing it. `enqueuePullRequest` takes no message, so where that base's
|
|
217
|
+
`squash_merge_commit_message` reads `COMMIT_MESSAGES` the queue would commit the branch's
|
|
218
|
+
messages and nothing the merger passes can stop it: it enqueues nothing, completes nothing,
|
|
219
|
+
and tells the architect, naming the setting and that only a person can change it to `PR_BODY`
|
|
220
|
+
or `BLANK`. It never turns auto-merge on; the daemon submits no merge and changes no
|
|
221
|
+
merge setting of any pull request.
|
|
222
|
+
- *The watch.* On a merge-queue base it reads the pull request until GitHub merges it or takes
|
|
223
|
+
it out of the queue, and acts on a removal: a head the queue took out over its own
|
|
224
|
+
`merge_group` checks is work to fix, so the issue goes back; a person's dequeue is that
|
|
225
|
+
person's decision, reported to the architect. A removal is never a merge.
|
|
226
|
+
- *A failed merge is the merger's decision.* Wait for what GitHub waits for (a required check
|
|
227
|
+
still running, a required review only a person can give) and merge again; merge again at the
|
|
228
|
+
head it re-reads when a push moved it, or when GitHub refused while it was still computing
|
|
229
|
+
mergeability; send the issue back with `request_backward_move` when the head itself must
|
|
230
|
+
change (a conflict with the base, a check that failed); or tell the architect what no
|
|
231
|
+
worker can do — a repository setting or an App permission only a person can change — with
|
|
232
|
+
GitHub's own answer quoted. The repository's required reviews and checks decide what may
|
|
233
|
+
merge: Legion bypasses none, and a review only a person can give is waited for.
|
|
234
|
+
- *The completion* is `handoff_complete` with the ordinary two-sentence `summary`, which names the
|
|
235
|
+
pull request, the head merged and the merge commit. It records the merger's phase row and moves
|
|
236
|
+
nothing: no Dispatch message, no publish, no phase. What moves the issue is the daemon's own
|
|
237
|
+
reading of the merged pull request, which writes `done` — before the completion or after it,
|
|
238
|
+
whichever comes second. The daemon refuses that completion only as it refuses any phase
|
|
239
|
+
worker's: `HANDOFF_NOT_CURRENT_PHASE` (the issue left `merging`), `HANDOFF_STALE_GENERATION`,
|
|
240
|
+
`HANDOFF_NO_RUN`, `HANDOFF_ALREADY_RECORDED` and `TREE_LINGERING`. It reads neither the head,
|
|
241
|
+
nor its checks, nor the approval: every one of those reads is the merger's own, above.
|
|
283
242
|
|
|
284
243
|
## The production check after the close
|
|
285
244
|
|
|
@@ -287,16 +246,16 @@ reviewing until you finish.
|
|
|
287
246
|
after the close.** `projects.<KEY>.production_check` in the project's `legion.yaml` takes `off`
|
|
288
247
|
or `tester`, and a project that names no key gets `tester`, so by default the tester works the
|
|
289
248
|
check; the loader refuses every other value, naming the key and the value it read. Where the
|
|
290
|
-
setting names the tester, the
|
|
291
|
-
the tester's live session. Where it is `off` nothing is opened at all — no record, no
|
|
249
|
+
setting names the tester, the daemon reads that merge, writes `done` and hands the check task
|
|
250
|
+
to the tester's live session. Where it is `off` nothing is opened at all — no record, no
|
|
292
251
|
bound and no look — and the merged close is like any other done: every claim of the issue is
|
|
293
252
|
retired and its pod released with the disk it ran on. A merged root still lingers its tree with
|
|
294
253
|
every claim suspended, as before. On a root whose tree still runs, the merge is recorded and
|
|
295
|
-
the root
|
|
296
|
-
the check opening with that close. Its first line, which tells it from a
|
|
297
|
-
resumed session, is `Production check of <KEY>: <title>.`, naming the
|
|
298
|
-
request, the merge commit, the look's number, its wake (`the merge`, for
|
|
299
|
-
it is the last.
|
|
254
|
+
the root stays in `merging` on its merged pull request until the last other issue of its tree
|
|
255
|
+
is done or parked, the check opening with that close. Its first line, which tells it from a
|
|
256
|
+
phase task in a resumed session, is `Production check of <KEY>: <title>.`, naming the
|
|
257
|
+
repository, the pull request, the merge commit, the look's number, its wake (`the merge`, for
|
|
258
|
+
the first) and whether it is the last.
|
|
300
259
|
- **The check's record holds the role that works it, written when the check opened.** Changing the
|
|
301
260
|
setting moves no check already open: a check keeps the role it opened with, and a check open
|
|
302
261
|
before this release carries the implementer. Only that role may report on it, so a report from
|
|
@@ -19,7 +19,7 @@ later phase keeps it current rather than replacing it:
|
|
|
19
19
|
**Look at first:** <one to three `path:line` places where a wrong decision would hurt> (the reviewer writes this line)
|
|
20
20
|
**Proven by:** <the surface and the run of the check the change turns on, one line>
|
|
21
21
|
**Not proven / risk:**
|
|
22
|
-
- <one line per claim recorded as unproven before
|
|
22
|
+
- <one line per claim recorded as unproven before the merge>, or the single word `none` (the reviewer writes this line; `none` is invalid while such a claim stands)
|
|
23
23
|
**Size:** <files changed, +added/−removed>
|
|
24
24
|
|
|
25
25
|
## Verification
|
|
@@ -51,15 +51,17 @@ then pushes and completes. It never waits for, watches or polls the pull request
|
|
|
51
51
|
(the step's spaced reads of the pull request's head after a push are the one sleep this rule
|
|
52
52
|
allows, and they read no check; `skill://legion-worker`, *Every role pushes its own commits*,
|
|
53
53
|
gives them).
|
|
54
|
-
Under the Go daemon a check
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
Under the Go daemon a check that settles red on the head moves the issue nowhere: the daemon names
|
|
55
|
+
every check GitHub reported, with the conclusion GitHub gave it, in one message to the tree's
|
|
56
|
+
architect, the worker of the issue's current phase and the implementer, and judges none of them.
|
|
57
|
+
That message is the implementer's to act on while it still works the issue: a red that failed on
|
|
58
|
+
its own is re-run once (`gh run rerun <run-id> --failed`), woken by the pull request's checks
|
|
59
|
+
event (`skill://envoy`, *Wait for CI or a merge*: subscribe, then end the turn) and never by a
|
|
60
|
+
sleep loop; a red at the code is fixed, which the reviewer asks for anyway, since it reads the
|
|
61
|
+
head's checks on GitHub before it approves; and a red only GitHub can settle is GitHub's, which
|
|
62
|
+
holds the merge for it under the base branch's own rules.
|
|
63
|
+
A merge-group run is never re-run: the implementer finishes its round instead, and the pull request
|
|
64
|
+
is tested again when it is queued again.
|
|
63
65
|
|
|
64
66
|
A pull-request body edit re-runs a check that judges the body at once, on the head as it is. While
|
|
65
67
|
the pull request conflicts with its base (GitHub shows it `CONFLICTING`), no workflow triggered
|
|
@@ -77,11 +79,10 @@ push; `Outcome` is a sentence a user of the repository would recognise, never "f
|
|
|
77
79
|
name, and `Why` ends with the Dispatch key, never a URL. The reviewer writes `Look at first` and
|
|
78
80
|
`Not proven / risk` at each round, into the live body (`gh api
|
|
79
81
|
repos/{owner}/{repo}/pulls/{number} --jq .body`, edit, then `--method PATCH ... -F body=@body.md`);
|
|
80
|
-
`Not proven / risk` copies every claim recorded as unproven before
|
|
82
|
+
`Not proven / risk` copies every claim recorded as unproven before the merge — the tester's
|
|
81
83
|
`failures`, the reviewer's own review, any proof-check comment already on the pull request —
|
|
82
|
-
word for word, and `none` is a finding while one stands. The merger
|
|
83
|
-
`Not proven / risk` from the body at the head
|
|
84
|
-
(*The READY packet* in `skill://legion-worker/references/merge-gate.md`); a stale `Outcome` that no
|
|
84
|
+
word for word, and `none` is a finding while one stands. The merger reads `Outcome` and
|
|
85
|
+
`Not proven / risk` from the body at the head it merges, and a stale `Outcome` that no
|
|
85
86
|
longer describes the diff is a finding against the implementer, not a line the merger rewrites.
|
|
86
87
|
|
|
87
88
|
## What a result is
|
|
@@ -70,8 +70,8 @@ opened that is none of Legion's role Apps, with one reply in your own words. A b
|
|
|
70
70
|
cannot accept becomes your own: say what stands and request changes. Approve once each of those
|
|
71
71
|
threads carries your answer and no finding stands, read in `gh api graphql` — quote those answers
|
|
72
72
|
in the approval. Your approval never waits on a resolution: resolution is the pull request author's
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
implementer
|
|
73
|
+
you re-run nothing: that red moves the issue nowhere, but the base branch holds the merge for a
|
|
74
|
+
check it requires, so the
|
|
75
|
+
implementer answers or fixes each of the bot's threads, resolves them with its own `gh` (the
|
|
76
76
|
ones you named to it, above, and its own), and pushes, and the bot runs again on that push. The
|
|
77
|
-
merger resolves nothing:
|
|
77
|
+
merger resolves nothing: the merge requires no thread state beyond what your approval already judged.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjawhar/claude-envoy",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Claude Code plugin for Legion's Envoy bus",
|
|
6
6
|
"type": "module",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"AGENTS.md"
|
|
20
20
|
],
|
|
21
21
|
"legion": {
|
|
22
|
-
"daemonApiVersion":
|
|
22
|
+
"daemonApiVersion": 86
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
package/src/legion-phase-hook.ts
CHANGED
|
@@ -41,6 +41,15 @@ import { configuredValue } from "./claude-session"
|
|
|
41
41
|
* appended to that turn as its next step (`deliver`/`step` in
|
|
42
42
|
* `packages/daemon/internal/claudebridge/bridge.go`), which would destroy the turn boundary the
|
|
43
43
|
* whole split exists for.
|
|
44
|
+
*
|
|
45
|
+
* A turn Claude Code ended on an API error fires `StopFailure` rather than `Stop`, and that is
|
|
46
|
+
* the provider refusing the turn: it earns no continuation, since the host would turn one into
|
|
47
|
+
* another turn at once and the provider would refuse that one the same way. It does arm one
|
|
48
|
+
* timer, because the task that refused turn carried ended with it and nothing else would wake
|
|
49
|
+
* this worker, so a single transient refusal would otherwise leave the issue idle. What stops
|
|
50
|
+
* the reminding for good is the runner's record check, which drops every reminder once the
|
|
51
|
+
* daemon has failed this role's claim — the refused turns themselves are counted by the bridge,
|
|
52
|
+
* which reports each turn's outcome to the daemon (INFRA-714).
|
|
44
53
|
*/
|
|
45
54
|
|
|
46
55
|
/** The tool's name: Claude Code shows it as `mcp__legion__legion_phase_hook`, and a hook entry
|
|
@@ -516,7 +525,9 @@ export function createPhaseHookEndpoint(deps: PhaseHookDeps): PhaseHookEndpoint
|
|
|
516
525
|
stopHookActive: event.stopHookActive ?? "",
|
|
517
526
|
backgroundWork,
|
|
518
527
|
})
|
|
519
|
-
const reminded = await reminder.settle(
|
|
528
|
+
const reminded = await reminder.settle({
|
|
529
|
+
kind: "settle",
|
|
530
|
+
lastAssistantText: event.lastAssistantMessage ?? "",
|
|
520
531
|
backgroundWork,
|
|
521
532
|
})
|
|
522
533
|
// After the settle, so the report carries the wake that settle armed. The daemon
|
|
@@ -526,13 +537,17 @@ export function createPhaseHookEndpoint(deps: PhaseHookDeps): PhaseHookEndpoint
|
|
|
526
537
|
return reminded === undefined ? {} : { decision: "block", reason: reminded }
|
|
527
538
|
}
|
|
528
539
|
case "StopFailure": {
|
|
529
|
-
//
|
|
530
|
-
//
|
|
531
|
-
//
|
|
532
|
-
//
|
|
533
|
-
//
|
|
534
|
-
// else
|
|
535
|
-
|
|
540
|
+
// Claude Code runs this instead of `Stop` when the turn ended on an API error, and
|
|
541
|
+
// `${last_assistant_message}` is then the error text itself rather than anything the
|
|
542
|
+
// worker said ("Hooks reference", code.claude.com/docs/en/hooks). So this is the
|
|
543
|
+
// provider refusing the turn, and the machine takes it as one: it earns no
|
|
544
|
+
// continuation, because the next turn would be refused the same way, and one timer,
|
|
545
|
+
// because nothing else would wake this worker once the task that turn carried ended
|
|
546
|
+
// with it. What ends a session the provider keeps refusing is the daemon failing its
|
|
547
|
+
// claim on the outcomes the bridge reports, which the timer's own record check reads.
|
|
548
|
+
// Claude Code ignores whatever this hook returns, which costs nothing now that there
|
|
549
|
+
// is nothing to return.
|
|
550
|
+
await reminder.settle({ kind: "refused", message: event.lastAssistantMessage ?? "" })
|
|
536
551
|
return {}
|
|
537
552
|
}
|
|
538
553
|
case "PostToolUse":
|
|
@@ -550,9 +565,8 @@ export function createPhaseHookEndpoint(deps: PhaseHookDeps): PhaseHookEndpoint
|
|
|
550
565
|
// Claude Code's stdin from the bridge and never this process, so what a turn means is
|
|
551
566
|
// read from the prompt itself. The turn is declared first, which makes every armed
|
|
552
567
|
// timer stale, and the pending one is dropped outright: the runner's generation guard
|
|
553
|
-
// answers the same for the timers it armed, and the one this
|
|
554
|
-
//
|
|
555
|
-
// guard of its own.
|
|
568
|
+
// answers the same for the timers it armed, and dropping the one timer this server
|
|
569
|
+
// holds is the plainest way to say the same thing.
|
|
556
570
|
reminder.turnStarted()
|
|
557
571
|
dropTimer()
|
|
558
572
|
const prompt = event.prompt ?? ""
|