@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.
Files changed (69) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.omp-plugin/plugin.json +1 -1
  3. package/AGENTS.md +43 -497
  4. package/dist/codex-hook.js +9 -3
  5. package/dist/dispatch.js +9 -3
  6. package/dist/envoy-channel.js +10 -4
  7. package/dist/session-hook.js +9 -3
  8. package/legion/skills/legion-architect/SKILL.md +88 -66
  9. package/legion/skills/legion-architect/references/acceptance.md +89 -258
  10. package/legion/skills/legion-architect/references/decomposition.md +94 -213
  11. package/legion/skills/legion-architect/references/design-gate.md +88 -353
  12. package/legion/skills/legion-architect/references/wake-routing.md +51 -43
  13. package/legion/skills/legion-controller/SKILL.md +50 -181
  14. package/legion/skills/legion-controller/references/admission.md +25 -54
  15. package/legion/skills/legion-controller/references/backlog-stewardship.md +23 -119
  16. package/legion/skills/legion-controller/references/consolidation.md +9 -93
  17. package/legion/skills/legion-controller/references/daily-report.md +21 -99
  18. package/legion/skills/legion-controller/references/escalation.md +16 -118
  19. package/legion/skills/legion-controller/references/finding-asks.md +31 -162
  20. package/legion/skills/legion-controller/references/park-asks.md +33 -0
  21. package/legion/skills/legion-controller/references/parked-decisions.md +20 -264
  22. package/legion/skills/legion-controller/references/session.md +26 -84
  23. package/legion/skills/legion-controller/references/slack-mentions.md +18 -134
  24. package/legion/skills/legion-controller/references/triage.md +18 -89
  25. package/legion/skills/legion-controller/references/wakes.md +22 -549
  26. package/legion/skills/legion-controller/references/weekly-audit.md +9 -90
  27. package/legion/skills/legion-oracle/SKILL.md +19 -28
  28. package/legion/skills/legion-retro/SKILL.md +54 -93
  29. package/legion/skills/legion-retro/references/learnings.md +21 -33
  30. package/legion/skills/legion-retro/references/pr-body-content.md +21 -37
  31. package/legion/skills/legion-worker/SKILL.md +50 -64
  32. package/legion/skills/legion-worker/references/ci-checks.md +16 -84
  33. package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +34 -93
  34. package/legion/skills/legion-worker/references/default-branch-check.md +22 -60
  35. package/legion/skills/legion-worker/references/findings.md +25 -180
  36. package/legion/skills/legion-worker/references/foreign-path.md +14 -22
  37. package/legion/skills/legion-worker/references/gvisor.md +20 -0
  38. package/legion/skills/legion-worker/references/merge-gate.md +43 -419
  39. package/legion/skills/legion-worker/references/plan-tests.md +8 -28
  40. package/legion/skills/legion-worker/references/pr-body.md +19 -218
  41. package/legion/skills/legion-worker/references/review-threads.md +16 -70
  42. package/legion/skills/legion-worker/references/tools.md +31 -578
  43. package/legion/skills/legion-worker/references/withheld-capability.md +12 -163
  44. package/legion/skills/simplify-settled-diff/SKILL.md +23 -41
  45. package/legion/skills/simplify-settled-diff/references/personas/code-quality-reviewer.md +14 -14
  46. package/legion/skills/simplify-settled-diff/references/personas/code-reuse-reviewer.md +4 -4
  47. package/legion/skills/simplify-settled-diff/references/personas/efficiency-reviewer.md +8 -8
  48. package/package.json +1 -1
  49. package/skills/agent-secrets/SKILL.md +46 -312
  50. package/skills/agent-secrets/references/store-a-secret.md +9 -0
  51. package/skills/approval-review/SKILL.md +20 -76
  52. package/skills/asd-ste100/SKILL.md +43 -85
  53. package/skills/asd-ste100/examples/before-after.md +18 -53
  54. package/skills/dispatch/SKILL.md +1 -1
  55. package/skills/dispatch-writing-specs/SKILL.md +1 -1
  56. package/skills/envoy/SKILL.md +56 -126
  57. package/skills/envoy/references/check-settlement.md +26 -43
  58. package/skills/envoy/references/deliveries.md +26 -144
  59. package/skills/envoy/references/legion.md +12 -45
  60. package/skills/envoy/references/roles.md +11 -9
  61. package/skills/envoy/references/sources.md +13 -25
  62. package/skills/outside-message/SKILL.md +24 -81
  63. package/skills/plain-words/SKILL.md +24 -55
  64. package/skills/thermonuclear-code-quality/SKILL.md +16 -26
  65. package/skills/thermonuclear-deep-review/SKILL.md +22 -31
  66. package/legion/skills/legion-worker/references/cleanup-deletion.md +0 -22
  67. package/legion/skills/legion-worker/references/systematic-rename.md +0 -19
  68. package/skills/asd-ste100/references/writing-rules.md +0 -59
  69. package/skills/plain-words/references/mechanics.md +0 -49
@@ -1,285 +1,116 @@
1
- # Acceptance, retro, the merge and the close
1
+ # Acceptance, the merge and the close
2
2
 
3
- Part of `skill://legion-architect`, sections 3, 5, 6 and 7. Read the section for the step you are
4
- at. Where it tells you to ask a person, a child's own architect sends the question to the
5
- architect above it instead (`skill://legion-architect`, "Every turn").
3
+ Read the section for your step of `skill://legion-architect`, sections 4 to 7. Where it says to
4
+ ask a person, a child's own architect sends the question to the architect above it.
6
5
 
7
6
  ## Retro's result
8
7
 
9
- Retro output is one `dispatch comment` on the issue with what the work taught, the PR body content
10
- the repository's instructions derive from the pull request's changed paths at that head, and one
11
- `dispatch message` on the issue. Retro commits nothing and pushes nothing, since every handoff is
12
- a record on the Dispatch issue and `docs/solutions/` is history no role writes to now. Retro
13
- writes no handoff and never rewrites the reviewer-approved head.
14
-
15
- When the implementer reports that it cannot compute that body content or do the work a line of it
16
- affirms, that its read of the body failed or came back empty, or that GitHub refused the body, it
17
- has pushed nothing and is still in its phase. Answer it with `envoy_publish` to its role topic,
18
- saying how from the deployment instructions; when they do not say, open a `dispatch ask` naming the
19
- missing instruction.
8
+ Retro posts one `dispatch comment` of learnings and one `dispatch message`, brings the pull
9
+ request body up to date, and commits nothing. When it reports that it cannot compute, read or
10
+ write that body, it is still in its phase: answer it on its role topic from the deployment
11
+ instructions, or open a `dispatch ask` naming the missing instruction.
20
12
 
21
13
  ## Accepting
22
14
 
23
- Sign off an issue with no children once its evidence holds for its goal and every requirement of
24
- its spec, none unmet; a parent only after its last round (below), because
25
- before it the approved head does not carry its children's merges.
26
-
27
- ```text
28
- dispatch comment --issue LEGION-40 --body-file - <<'EOF'
29
- <acceptance: scope, integration evidence, the tester's handoff, each check with its result, the approved head>
30
- EOF
31
- legion({ op: "sign_off", issue: "LEGION-40" })
32
- ```
33
-
34
- - The issue's Dispatch status stays `needs_review` in `accepting`; `sign_off` moves it to `retro`.
35
- - A `catch-up` whose `reason` names an issue as waiting for your acceptance is the wake for it: it
36
- is in `accepting`, and the `phase-finished` that moved it there may never have reached you.
37
- While a root's architect has failed, its notices end undelivered. While a child's own architect
38
- does not hold its role, the child's notices go to the architect above it. Either way, a retried
39
- architect learns of the wait from its catch-up alone. Accept it as this section says, a parent
40
- only after its last round (below).
41
- - The daemon refuses `sign_off` while an issue beneath the one you accept is still in the workflow
42
- (`SIGNOFF_CHILD_IN_WORKFLOW`, naming each one): run each one to done, and sign off again.
43
- Park one with `park_child` only when a person asked for that move, or when the work is done, folded into another issue or no longer needed,
44
- and say in a comment which of those it is. Ask the person about a child that can reach neither
45
- `done` nor a park under that rule, and hold the acceptance until they answer. Until the person
46
- answers the ask on the root about an unreleased child you moved, sign off neither the issue you
47
- moved it under nor any issue above it that you accept (`skill://legion-architect`, section 3):
48
- release the child when they say to run it; when they say to stop it, close it, or move it to
49
- `icebox` under the rule when they say its work should wait, citing their answer. A parent: sign
50
- off only after its last round (below). The daemon then closes a parent that is not the root at
51
- its own merge, which under this rule comes after its children's. One issue beneath never holds
52
- it: one the daemon itself holds at `admitted` under an ancestor it has already accepted, which
53
- starts when that ancestor closes.
54
- - `request_backward_move` names the issue, because your grant serves the tree; the daemon starts
55
- that phase's role with your reason in its task.
56
- - `handoff_complete` from you in `accepting` is refused `ACCEPTANCE_IS_SIGN_OFF`. CI red at the head
57
- in `accepting` returns the issue to `implementing` by the daemon's table.
58
- - No `after_merge` result is asked here: the production check records it after the close, where
59
- the project's `production_check` opens one.
60
- - A finding ask on the issue holds the acceptance: one a worker sent you, or one `dispatch read`
61
- lists under `Open asks:` whose question opens `Finding from ` or `Clear defect from `
62
- (`skill://legion-worker/references/findings.md`, "When no controller takes it"). Follow each
63
- (`dispatch follow --ask <id> --action follow`) and, once answered, publish its reference to the
64
- controller topic. Accept only once each is resolved or carries the controller's
65
- `Filed dispatch://`, `Handed dispatch://` or `Not filed:` reply, because a closed issue hides
66
- its asks from the controller.
15
+ Read, against the goal, every check and every requirement:
16
+
17
+ 1. the tester's handoff: `dispatch handoff-read --issue <issue> --phase test`;
18
+ 2. `dispatch results --issue <issue>`: whether a pass stands for each check at the approved head;
19
+ 3. the reviewer's approval of the head its Legion footer names, never its `commit_id`
20
+ (`skill://legion-worker/references/merge-gate.md`);
21
+ 4. each claim of the reviewer's prose, against the code at that head;
22
+ 5. `gh pr view <n> --json mergeable,mergeStateStatus`: a `CONFLICTING` head gets no CI
23
+ (*A conflicting head*, below).
24
+
25
+ - `sign_off` works only in `accepting`, where the Dispatch status reads `needs_review`; your
26
+ `handoff_complete` there is refused (`ACCEPTANCE_IS_SIGN_OFF`).
27
+ - A `catch-up` whose `reason` names an issue waiting for your acceptance is its wake: the
28
+ `phase-finished` may never have reached you.
29
+ - `SIGNOFF_CHILD_IN_WORKFLOW` names each issue beneath still in the workflow: run each to done, or
30
+ park it under the rule, and sign off again. Ask the person about one that can do neither, and
31
+ hold the acceptance until they answer.
32
+ - A finding ask holds the acceptance: one a worker sent you, or one `dispatch read` lists under
33
+ `Open asks:` whose question opens `Finding from ` or `Clear defect from `. Follow it
34
+ (`dispatch follow --ask <id> --action follow`) and publish its reference to the controller topic.
35
+ Accept only once it is resolved, or carries the controller's reply
36
+ (`Filed dispatch://`, `Handed dispatch://` or `Not filed:`): a closed issue hides its open
37
+ questions from the controller.
38
+ - No `after_merge` result is asked here; the production check records it after the close.
67
39
 
68
40
  ## The last round
69
41
 
70
- A parent's own pull request proves each of its checks, so sign off a parent with children only
71
- on an approved head carrying the merges of every child those checks need. Each needs a passing
72
- result at that head, or, for one in another repository, at a commit on the branch that
73
- issue's pull request merged into or on that repository's default branch — that default branch
74
- alone where Dispatch knows of no merge of the issue — and, for a `default_branch` check, on that
75
- default branch whatever branch the pull request merged into. A child records no result that
76
- proves a parent's check: such a result was recorded at the child's head and not at the parent's,
77
- and a child carrying part of a parent's
78
- requirement proves it with a check on its own Verification document whose `serves` names that
79
- requirement. Nothing in the tree builds on the parent's own merge, which comes last: a child
80
- that waits for it waits forever, so work another child builds on is a child of its own.
81
- While the approved head does not carry those
82
- merges, or a check in another repository has no pass standing since the close of a child it
83
- needs, leave the issue in `accepting` until each has closed (`child-closed`) or a park has
84
- already taken it out (`child-status`). That wait is no reason to park a child. Move a parked
85
- child's criterion to the parent's own pull request or a released, open child first; never
86
- downgrade it. The parent's requirement stays the parent's, pending
87
- until this round, where its head must meet it.
88
- Then, in one turn:
42
+ Sign off a parent only on an approved head that carries the merges of every child its checks
43
+ need. Each check needs a pass at that head; one in another repository, a pass standing since the
44
+ close of each child it needs, at a commit on the branch that issue's pull request merged into or
45
+ on its default branch; a `default_branch` check, on the default branch. A criterion proven on a
46
+ deployed system is proven after that child's deploy, as the repository's deploy skill says. A
47
+ child's result proves no check of the parent: a child carrying part of a parent's requirement
48
+ proves it with a check of its own whose `serves` names it. Nothing builds on the parent's merge,
49
+ which comes last. Until those children close, leave the issue in `accepting`; that wait is no
50
+ reason to park a child. Before you park a child, move its criterion to the parent's own pull
51
+ request or a released, open child; never downgrade it. Then, in one turn:
89
52
 
90
53
  1. `envoy_publish` to the tester's role topic: "The next round of <KEY> is its last round: a full
91
- test round of every check of the issue with no `ci_check`." The
92
- backward move's reason reaches only the implementer.
54
+ test round of every check of the issue with no `ci_check`."
93
55
  2. `request_backward_move` to `implementing`, with the reason "Last round: merge the default
94
56
  branch your addressing line names into the branch, push, end your forward-merge comment with
95
- `parent's last round: full test round`, and complete." Never use a hard-coded `main`. The move
96
- counts a review round, or a conflict round, which `review_round_cap` leaves out, where the
97
- record holds the head conflicting with its base.
98
-
99
- While the parent waits in `accepting`, a child's merge needs no move of its own: the last round's
100
- forward merge resolves them all, so spend no backward move per child. A conflict on its head the
101
- daemon answers itself, asking the implementer to merge the base forward while the parent stays in
102
- `accepting` (*A conflicting head*, below). A move for a child's merge counts toward
103
- `review_round_cap`, since the record holds no conflict on the head to leave it out.
104
-
105
- A criterion proven on a deployed system is proven after that child's deploy, as the repository's
106
- deploy skill says.
107
-
108
- If the pull request merged before its last round, it can carry no new head, so move nothing back.
109
- Once they have closed, have a fresh `task` subagent run each check with no `ci_check` on the
110
- default branch and record each result. Read each `ci_check` check's derived result in
111
- `dispatch results`, which no role records. Post them in the acceptance comment, then `sign_off`.
112
-
113
- ## The order after your acceptance
114
-
115
- The daemon keeps this order from its fixed table; you start none of its steps:
116
-
117
- 1. The tester's last result is green and the reviewer approves the head.
118
- 2. The reviewer's approval of the head by SHA moves the issue to `accepting`; your `sign_off` moves
119
- it to `retro`.
120
- 3. Retro records what the work taught as a `dispatch comment` on the issue and brings the PR body
121
- up to date. It commits nothing, so the approved head is the head the merger merges. No merge
122
- carries a handoff onto the default branch, since every handoff is a record on the Dispatch
123
- issue and no commit carries one.
124
- 4. The merger reads the pull request and merges that head itself, as the implement App and with the
125
- head it read as the head GitHub must match
126
- (into the default branch
127
- `gh pr merge <n> --squash --match-head-commit <head> --subject '<pull request title> (#<n>)' --body ''`,
128
- whose explicit message keeps GitHub's default squash message from joining the branch's commit
129
- messages onto the base; into another base, a merge commit (`--merge` in place of `--squash`)
130
- where the repository allows one, because a squash there gives each pull request built on that
131
- branch a conflict of history alone; or `expectedHeadOid` on a merge-queue base, where it
132
- enqueues the pull request); it
133
- never turns auto-merge on, and the daemon submits no merge and changes no merge setting. The
134
- repository's required reviews and
135
- checks decide when it lands; Legion neither reads nor writes those rules, and a review only a
136
- person can give is waited for, never bypassed. Nothing compares that head with the approved one:
137
- a repository that wants a later push reviewed says so in its own rulesets. The merger's
138
- completion records its phase row and moves nothing, and the daemon posts no packet.
139
- 5. The merge lands under the repository's rules, the daemon reads it and closes the issue once
140
- every issue beneath it has left the workflow (for a root, every other issue of its tree).
141
-
142
- A person's request after your sign-off is a requirement of this issue, filed nowhere else: in
143
- `retro` or `merging` the role holding the phase makes the `request_backward_move`.
144
- A merge the merger cannot make arrives while the merger holds `merging`, so the merger makes the
145
- move and you tell it which; from `accepting` you send an issue back only to `implementing` or
146
- `testing`.
147
-
148
- - A failed verification the merger reports: handle it as the `pr-blocked` row of
149
- `skill://legion-architect/references/wake-routing.md` says, telling the merger to move the
150
- issue back with `request_backward_move`, naming what failed; never bypass.
151
- - A merge GitHub refuses for a repository setting or an App permission — a merge-queue base whose
152
- `squash_merge_commit_message` joins the branch's commit messages among them: the merger tells
153
- you, and only a person can change it. Ask one with `dispatch ask`, naming the pull request, the
154
- head and GitHub's refusal; never bypass a rule.
155
- - A squash into a base other than the default branch, where the repository allows only squash or
156
- the base's rules require a linear history: the merger tells the architect its addressing line
157
- names which open pull requests of the tree build on the merged branch. Each one whose issue
158
- stands past `implementing` and that GitHub then reports `CONFLICTING` stays in its phase, and
159
- the daemon asks its implementer to merge the base forward once the next step needs a mergeable
160
- head (*A conflicting head*, below); the architect that owns its issue hears of that ask by
161
- `checks-red`. For each pull request on that list whose issue is yours and still in
162
- `implementing`, tell its implementer (`envoy_publish` to its role topic) to merge that base
163
- forward in its implementing round: the daemon sends no `checks-red` for such an issue, and
164
- tells its implementer itself only when a check the base requires has no green result on the
165
- head, the base requires a current branch, or the daemon could not read the base's rules.
57
+ `parent's last round: full test round`, and complete." Never hard-code `main`.
58
+
59
+ A child's merge while the parent waits needs no move of its own: the last round's forward merge
60
+ takes them all, and the daemon answers a conflict on its head (*A conflicting head*, below). If
61
+ the pull request merged before its last round, move nothing back: once the children close, have
62
+ a fresh `task` subagent run each check with no `ci_check` on the default branch and record each
63
+ result, read each `ci_check` result in `dispatch results`, post them in the acceptance comment,
64
+ then `sign_off`.
65
+
66
+ ## After your sign-off
67
+
68
+ Retro runs, then the merger merges the approved head under the repository's own rules; you start
69
+ none of it. A person's request after your sign-off is a requirement of this issue: the role that
70
+ holds the phase makes the `request_backward_move`. When the merger reports:
71
+
72
+ - a failed verification: tell it to move the issue back with `request_backward_move`, naming what
73
+ failed;
74
+ - a merge GitHub refuses for a repository setting or an App permission: open a `dispatch ask`
75
+ naming the pull request, the head and GitHub's refusal, and never bypass a rule;
76
+ - a squash into a base other than the default branch: tell the implementer of each open pull
77
+ request of the tree built on that branch whose issue is yours and still in `implementing` to
78
+ merge that base forward in its implementing round. Past `implementing`, the daemon asks for that
79
+ merge itself (*A conflicting head*, below).
166
80
 
167
81
  ## A conflicting head
168
82
 
169
- A head that conflicts with its base keeps the issue in its phase. The daemon reads GitHub's
170
- mergeability twice, at least a minute apart, and acts only on a conflict both reads report, and
171
- only when the next step needs a mergeable head: the issue stands in `accepting`, `retro` or
172
- `merging`; a check the base requires has no green result on the head, since GitHub runs no check
173
- on a conflicting head; the base requires a pull request to be current with it; or the daemon
174
- could not read the base's rules. Otherwise it records the conflict and nothing else, the tester
175
- and the reviewer go on at that head, an approval of that head ends the review round, and the
176
- daemon acts once the issue enters `accepting`.
177
-
178
- When it acts, it asks the implementer, in a merge-forward message on the implementer's role
179
- topic, to merge the base forward in the issue workspace and push, with no handoff and no
180
- completion; in `testing`, `reviewing` and `merging` it tells the phase's worker to stop writing
181
- the workspace; and it tells you once with
182
- a `checks-red` notice naming the phase the issue stays in, the head, the base and why. You start
183
- nothing for it. In `implementing` the daemon tells the implementer alone, and no notice comes to
184
- you.
83
+ A head that conflicts with its base keeps the issue in its phase. The daemon asks the implementer
84
+ to merge the base forward only when the next step needs a mergeable head (*The daemon's ask* in
85
+ `skill://legion-worker/references/conflicts-and-rewrites.md`). A conflict it does not act on yet
86
+ is recorded: the tester and the reviewer go on at that head, an approval of it ends the review
87
+ round, and the daemon acts when the issue enters `accepting`. When it asks outside
88
+ `implementing`, it tells you once by `checks-red`, naming the phase the issue stays in, the head,
89
+ the base and why; in `implementing` no notice comes. You start nothing for the merge.
185
90
 
186
- Once the merge lands, the phase's worker is told the new head and reads what the merge changed.
187
- For a merge of the base, `git show --remerge-diff <merge>` shows its resolution, and `git diff --stat <merge>^1 <merge>` lists the files the base brought in.
188
- A check those files or the resolution can reach runs again, and a check the merge was made for has no pass to carry.
189
- A completion that names the replaced head, or names no head once the merge landed, is refused
190
- (`HANDOFF_HEAD_MERGED_FORWARD`) and is made again at the new head. Past review, the daemon asks the reviewer to read the merge and approve the
191
- new head by its SHA, or request changes, and to tell you and the phase's worker what it decided:
192
- in `accepting`, wait for that approval of the new head before `sign_off`, and send the issue back
193
- with `request_backward_move` when the reviewer requests changes. No Legion check compares the head
194
- that merges with the approved one: a repository that wants a later push reviewed says so in its
195
- own rulesets.
91
+ Past review, the daemon also asks the reviewer to read the merge and approve the new head by its
92
+ SHA, or request changes. In `accepting`, wait for that approval of the new head before
93
+ `sign_off`, and send the issue back with `request_backward_move` when the reviewer requests
94
+ changes.
196
95
 
197
96
  ## A review thread GitHub will not resolve
198
97
 
199
- GitHub lets only the pull request author's App resolve a thread, so the implementer resolves every
200
- thread with plain `gh`: the ones it answers and the bot threads the reviewer accepted and named to
201
- it. The reviewer resolves none. If the implementer reports that GitHub refused its
202
- `resolveReviewThread`, open a `dispatch ask` naming the thread's id or URL and GitHub's message, for
203
- a human to resolve it by hand, with options for resolved / could not. The merger does not complete
204
- while that ask is open; the merge itself checks no thread state
205
- (`skill://legion-worker/references/merge-gate.md`).
98
+ Only the pull request author's App resolves a thread, so the implementer resolves them all. When
99
+ GitHub refuses its `resolveReviewThread`, open a `dispatch ask` with the thread's URL and GitHub's
100
+ message, for a person to resolve it, with the options resolved and could not. The merger does not
101
+ complete while it is open.
206
102
 
207
103
  ## The close
208
104
 
209
- The merge closes the issue: the daemon reads the merged pull request — from GitHub's webhook or
210
- from its own read of the issue — and writes `done`. An issue that reaches `merging` on a pull
211
- request GitHub has already merged closes at once.
212
-
213
- - An issue whose merge lands while an issue beneath it is still in the workflow (for a root,
214
- another issue of its tree) stays in `merging`, its workers kept and live, until the last of
215
- them is done or parked. One
216
- `pr-merged` notice names what it waits for and none follows as they depart, so read the pull
217
- request on GitHub.
218
- - A child's close reaches you as `child-closed`. Where the project's `production_check` names the
219
- role that works the check — the tester, unless the setting is `off` — the daemon retires five
220
- of its six claims and leaves that role running, because the issue still owes the production
221
- check; where the setting is `off` no check opens, and the close retires all six and releases
222
- the pod. When the issue's
223
- pod and Sandbox go is in `skill://legion-worker/references/merge-gate.md`, *The production check
224
- after the close*.
225
- - A root's close writes `done`, releases any admission slot the tree's issues still held, and lingers the tree for
226
- `linger_hours` with every member suspended. The linger's end, the tree's last step, waits until
227
- every member's open production check has closed.
228
-
229
- Nothing of the production check is yours. Its record is the pull request and the result of the
230
- issue's `after_merge` check, whether or not the issue is closed. A defect it finds is never an
231
- issue the checking role files: a clear defect goes to the controller, and any other is a
232
- `dispatch ask`. `read_record` shows a closed issue's open check (`check`: the pull request, the
233
- merge commit, the role the check records as the one that works it, the looks, what woke the last
234
- one, and `nextWakeAt`, when the next look is due — the time the checking agent named for itself on
235
- a `pending`, the retry of a look nobody reported, or the check's own bound where neither stands).
105
+ The merge closes the issue (`done`). One whose merge lands while an issue beneath it is still in
106
+ the workflow stays in `merging` until the last of them is done or parked; one `pr-merged` notice
107
+ names what it waits for. The production check after the close is not yours. A root's close
108
+ lingers the tree for `linger_hours`.
236
109
 
237
110
  ## Hand-over at a root's linger
238
111
 
239
- When a person closes a root and it stays `done` through its linger, each child still in the
240
- workflow is handed to Legion as a root of its own: `todo` with the `legion` label, its phase, gate,
241
- phase records and pull request carried into a new generation, and that phase's role started. A
242
- child that had its own architect keeps that architect's session: the root's architect start
243
- resumes the same claim, and its next launch gives it the root architect's prompt. A child that ran
244
- without one gets a new architect session. A child that never started is handed over too,
245
- carrying no run, whatever held it at `admitted`: it waits in the line for a slot and for any
246
- unfinished blocker, and its architect starts as a fresh root and registers its own spec. Only a
247
- child that finished, was parked or was never released stays. The child stays its own tree;
248
- reopening the old root does not take it back. The hand-over runs by itself and needs no action
249
- from you.
250
- Park a child with `park_child` before then only when a person asked for that move, or when the work is done, folded into another issue or no longer needed, and cite that reason in a comment on the child.
251
- Ask the person whether a child's work must end with the root. A root that is parked
252
- rather than closed hands over only a child in `merging` whose pull request is still open,
253
- since the daemon re-admits no parked root and only that child's own merger, started again under
254
- its own tree, merges that head. Ask the person whether that child's merge must wait for the root.
255
-
256
- If you are that child's architect:
257
-
258
- - You may be the child's own architect from before the hand-over. Your session is the same, and
259
- your role prompt is now the root architect's. Follow that prompt from your next `catch-up`,
260
- which says `handed_over`.
261
- - Your catch-up says `handed_over` and `carried`: resume from the phase, and never register a spec
262
- or ask for approval again.
263
- - It says `handed_over` alone (no gate to carry): your workers already run their phases, so
264
- decompose nothing, and read the root's phase from the catch-up (for a root `held`, the phase its
265
- `held` notice names). Before the merge, register your spec with `register_gate`: the tree's
266
- work starts on its approval.
267
- That registration's approval request waits with the person like any other, but it starts no wait of the root's own: a root your catch-up calls `handed_over` stands at a phase it carried, never `admitted`, and only a root at `admitted` waits on a person.
268
- The section below is for a root of your own at `admitted`, not for this one.
269
- When that `design-approved` arrives, release and start
270
- nothing: the workers are already running. A child carried in `accepting` is yours to accept. In
271
- `merging` the work is already through every gate, so register none.
272
-
273
- ## Your slot while a person has your spec
274
-
275
- This is for a root of your own standing at `admitted`, the only phase from which a root waits on a person.
276
- A registration that leaves the approval request with the person moves your root to `awaiting_person`, and what brings the root back is the answer, not the registration.
277
- Your root keeps its admission slot throughout: a root in `awaiting_person` is one of the roots that keep their slot through a wait ([Admission and the `legion` label](https://cybermonklabs.github.io/legion/legion/concepts/#admission-and-the-legion-label)).
278
- So your resume takes no slot and comes however full the cap is, whether or not the gate has ever opened in this generation.
279
- The first phase that resume starts waits in the line among the issues whose work came back, oldest first; whether it needs a slot again depends on whether your root waits on another issue, an open child under it or a `blocked_by` link to an issue that is not `done` ([Admission and the `legion` label](https://cybermonklabs.github.io/legion/legion/concepts/#admission-and-the-legion-label)).
280
- A changes request, or a newer version of the document that hands the request back to you, leaves the gate closed, so it holds the tree's work until a new approval.
281
- While your answered root stands in the line, your record carries `waitingLine`: your place in the line and its length, your `part` (`returned`) and `kind` (`answered`), your `partPlace` of `partLength` among the issues whose work came back, `holdsSlot` true because your root has held its slot since its start, `since`, the moment your work came back, and `reason`, the daemon's own sentence for that place.
282
- An issue that has not started carries `rootRank`, `ownRank` and `rootKey` in place of `since`, the two Dispatch ranks that placed it and the key of its tree root.
283
- `why` beside it says why any issue of your tree is not working now, in one word and one sentence: `claim_stopped`, a claim nothing will wake; `waiting`, this line; `blocked`, a Dispatch link or an open child below it, though its reason can be the sentence of the issue's `admission.held` word (the sentence table of `packages/daemon/internal/projection/why.go` says when); `unlisted`, an issue the record holds in the workflow that no admission list places.
284
- Nothing is sent to you about that wait, and your resume task says what answered it.
285
- Act on neither your place nor your wait: the daemon starts you again on the pass that reads the answer.
112
+ A root a person closed that stays `done` through its linger hands each child still in the
113
+ workflow, a child that never started included, to Legion as a root of its own; only a finished,
114
+ parked or never-released child stays. Ask the person whether a child's work must end with the root.
115
+ A parked root hands over only a child in `merging` whose pull request is open. Your role prompt
116
+ says what a `handed_over` catch-up asks of you.