@sjawhar/claude-envoy 4.11.0 → 4.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/AGENTS.md +43 -497
- package/dist/envoy-channel.js +1 -1
- package/legion/skills/legion-architect/SKILL.md +88 -66
- package/legion/skills/legion-architect/references/acceptance.md +89 -258
- package/legion/skills/legion-architect/references/decomposition.md +94 -213
- package/legion/skills/legion-architect/references/design-gate.md +88 -353
- package/legion/skills/legion-architect/references/wake-routing.md +51 -43
- package/legion/skills/legion-controller/SKILL.md +50 -181
- package/legion/skills/legion-controller/references/admission.md +25 -54
- package/legion/skills/legion-controller/references/backlog-stewardship.md +23 -119
- package/legion/skills/legion-controller/references/consolidation.md +9 -93
- package/legion/skills/legion-controller/references/daily-report.md +21 -99
- package/legion/skills/legion-controller/references/escalation.md +16 -118
- package/legion/skills/legion-controller/references/finding-asks.md +31 -162
- package/legion/skills/legion-controller/references/park-asks.md +33 -0
- package/legion/skills/legion-controller/references/parked-decisions.md +20 -264
- package/legion/skills/legion-controller/references/session.md +26 -84
- package/legion/skills/legion-controller/references/slack-mentions.md +18 -134
- package/legion/skills/legion-controller/references/triage.md +18 -89
- package/legion/skills/legion-controller/references/wakes.md +22 -549
- package/legion/skills/legion-controller/references/weekly-audit.md +9 -90
- package/legion/skills/legion-oracle/SKILL.md +19 -28
- package/legion/skills/legion-retro/SKILL.md +54 -93
- package/legion/skills/legion-retro/references/learnings.md +21 -33
- package/legion/skills/legion-retro/references/pr-body-content.md +21 -37
- package/legion/skills/legion-worker/SKILL.md +50 -64
- package/legion/skills/legion-worker/references/ci-checks.md +16 -84
- package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +34 -93
- package/legion/skills/legion-worker/references/default-branch-check.md +22 -60
- package/legion/skills/legion-worker/references/findings.md +25 -180
- package/legion/skills/legion-worker/references/foreign-path.md +14 -22
- package/legion/skills/legion-worker/references/gvisor.md +20 -0
- package/legion/skills/legion-worker/references/merge-gate.md +43 -419
- package/legion/skills/legion-worker/references/plan-tests.md +8 -28
- package/legion/skills/legion-worker/references/pr-body.md +19 -218
- package/legion/skills/legion-worker/references/review-threads.md +16 -70
- package/legion/skills/legion-worker/references/tools.md +31 -578
- package/legion/skills/legion-worker/references/withheld-capability.md +12 -163
- package/legion/skills/simplify-settled-diff/SKILL.md +23 -41
- package/legion/skills/simplify-settled-diff/references/personas/code-quality-reviewer.md +14 -14
- package/legion/skills/simplify-settled-diff/references/personas/code-reuse-reviewer.md +4 -4
- package/legion/skills/simplify-settled-diff/references/personas/efficiency-reviewer.md +8 -8
- package/package.json +1 -1
- package/skills/agent-secrets/SKILL.md +46 -312
- package/skills/agent-secrets/references/store-a-secret.md +9 -0
- package/skills/approval-review/SKILL.md +20 -76
- package/skills/asd-ste100/SKILL.md +43 -85
- package/skills/asd-ste100/examples/before-after.md +18 -53
- package/skills/dispatch/SKILL.md +1 -1
- package/skills/dispatch-writing-specs/SKILL.md +1 -1
- package/skills/envoy/SKILL.md +56 -126
- package/skills/envoy/references/check-settlement.md +26 -43
- package/skills/envoy/references/deliveries.md +26 -144
- package/skills/envoy/references/legion.md +12 -45
- package/skills/envoy/references/roles.md +11 -9
- package/skills/envoy/references/sources.md +13 -25
- package/skills/outside-message/SKILL.md +24 -81
- package/skills/plain-words/SKILL.md +24 -55
- package/skills/thermonuclear-code-quality/SKILL.md +16 -26
- package/skills/thermonuclear-deep-review/SKILL.md +22 -31
- package/legion/skills/legion-worker/references/cleanup-deletion.md +0 -22
- package/legion/skills/legion-worker/references/systematic-rename.md +0 -19
- package/skills/asd-ste100/references/writing-rules.md +0 -59
- package/skills/plain-words/references/mechanics.md +0 -49
|
@@ -1,274 +1,30 @@
|
|
|
1
1
|
# Decisions on a parked tree
|
|
2
2
|
|
|
3
|
-
A parked tree is a root
|
|
4
|
-
`icebox` and whose `issues.<KEY>.phase` in `read_state` is `done`. Its architect is suspended or
|
|
5
|
-
gone, so nobody inside the tree hears what a person says on it. The Go daemon sends you each such
|
|
6
|
-
decision as `parked-decision on <KEY>`; the walk below finds one sent while no controller ran. When
|
|
7
|
-
the park is your own hold, you decide whether such a decision runs the tree again; whoever made the
|
|
8
|
-
park, you start the tree when a person asks you to. When it runs, its architect's start task, or the
|
|
9
|
-
catch-up of a later launch, names each decision the daemon relayed, and both spec versions when the
|
|
10
|
-
approved one is not the current one, so you need not tell it.
|
|
3
|
+
Read this on a `parked-decision` wake, and for the parked-root walk at every start and on each `tick`. A parked tree is a labelled root in `backlog` or `icebox` whose `issues.<KEY>.phase` is `done`. Its architect is gone, so nobody inside it hears a person's decision. The daemon sends you each one as `parked-decision` (`decision`, `root`, `ref`, `actor`, and a spec decision's `version` and `reason`); the walk finds those sent while no controller ran.
|
|
11
4
|
|
|
12
|
-
|
|
5
|
+
A person's own approval of a parked root's primary document while no tree is live is no decision for you: the daemon sets the root `todo` itself. A carried approval, or one on a root that keeps a Dispatch parent, is a decision. A session's reply on a parked tree is none.
|
|
13
6
|
|
|
14
|
-
A
|
|
15
|
-
again when a person sets it to `todo`, or when it is your own hold (a park you marked
|
|
16
|
-
`Parked by Legion while it waits on:`, step 2 of **Deciding**) and a person's decision after the
|
|
17
|
-
park gives its work a next step, as below.
|
|
18
|
-
A parked root that is your own hold also runs again when you checked that the hold's cause or the
|
|
19
|
-
architect's cause is gone, or that the event it waits on has happened, as the wakes reference
|
|
20
|
-
says (the `held` and `worker-died` wakes, and
|
|
21
|
-
[A tree that waits on an event outside Legion](skill://legion-controller/references/wakes.md#a-tree-that-waits-on-an-event-outside-legion)):
|
|
22
|
-
you set it to `todo` with a comment on the root that cites the park's mark and says what you
|
|
23
|
-
checked.
|
|
24
|
-
[The walk](#the-walk) makes that check at every start and on each `tick`.
|
|
25
|
-
Every other park, a person's, another session's or an operator's `legion issue status`, stays parked
|
|
26
|
-
until a person sets it to `todo`, the daemon queues a person's approval of its spec (**The
|
|
27
|
-
notice**, the paragraph that begins "A person's own approval"), or a person asks you to start it:
|
|
28
|
-
that request is a person's move, as the list of moves to `todo` in
|
|
29
|
-
[Free slots](skill://legion-controller/SKILL.md#free-slots) says.
|
|
30
|
-
|
|
31
|
-
A held root is not a parked one. It stands at `phase: held` and is still in the workflow, and a
|
|
32
|
-
`todo` on it releases the hold instead of starting a new run: the issue returns to the phase its
|
|
33
|
-
hold came from and that phase's role starts again, at the same generation
|
|
34
|
-
(`skill://legion-controller/references/wakes.md`, the `held` wake). A root that is parked or
|
|
35
|
-
lingers takes `todo` alone, and that `todo` re-admits its tree. The pair `backlog` and then `todo`
|
|
36
|
-
(step 1 of **Deciding**) is for a root still in the workflow whose architect has stopped, a held
|
|
37
|
-
root included, where `todo` alone would only release the hold. The `backlog` write takes that
|
|
38
|
-
tree out of the workflow, so the `todo` after it re-admits the tree.
|
|
39
|
-
|
|
40
|
-
## The notice
|
|
41
|
-
|
|
42
|
-
Its payload is `{kind: "parked-decision", decision, root, ref, actor, version?, reason?}`:
|
|
43
|
-
|
|
44
|
-
- `decision`: `design-approved`, `design-changes-requested` (`reason` holds the person's words)
|
|
45
|
-
or `carried-gate-opened` (an approval of the spec a carried root depends on), each with the
|
|
46
|
-
spec's `version`; `ask-answered` or `ask-resolved` (a person answered or resolved a question
|
|
47
|
-
asked on `<KEY>`); `ask-reply` (a person replied on an ask of `<KEY>`, giving the turn to the
|
|
48
|
-
agent, or replied under a closed ask).
|
|
49
|
-
- `root`: the tree's root, the issue you act on. `<KEY>` is where the decision was made: the root
|
|
50
|
-
or another issue of its tree.
|
|
51
|
-
- `ref`: the decision in Dispatch: `dispatch://<KEY>/spec`, `dispatch://<KEY>/ask/<id>` or
|
|
52
|
-
`dispatch://<KEY>/comment/<id>`.
|
|
53
|
-
- `actor`: the person who made it, `user:<login>`.
|
|
54
|
-
|
|
55
|
-
A session's reply on an ask of a parked tree is no decision. The daemon sends no notice for it and
|
|
56
|
-
logs `workflow: a session's reply on a parked tree is not relayed`; the reply stays on the Dispatch
|
|
57
|
-
ask for the person who asked, and the walk below skips it.
|
|
58
|
-
|
|
59
|
-
A person's own approval of a parked root's own spec (its primary document), when its tree is not
|
|
60
|
-
live, is no notice either: it is that person's handover, and the daemon sets the root `todo`
|
|
61
|
-
itself, whoever parked it (`admission: queued a person's handover`, `source=approval`). Two
|
|
62
|
-
approvals of a root's spec are not that handover and still come as notices: a carried approval,
|
|
63
|
-
which Dispatch writes in the person's name with a reason that begins
|
|
64
|
-
`Carried forward from the approval of version`, when their answer to a decision block was the
|
|
65
|
-
whole change since the version they approved, when a later version's text is the text of the
|
|
66
|
-
version they approved, or when a later version's text is that text with the questions a reopen
|
|
67
|
-
opened again, and an approval on a root that keeps a Dispatch parent, as a child a linger handed
|
|
68
|
-
to Legion does. The other spec notices are a request for changes and an approval of a document
|
|
69
|
-
that is not the root's primary one.
|
|
7
|
+
A held root is not a parked one: `todo` on a root at `phase: held` releases the hold at the same generation. A root still in the workflow whose architect stopped takes `backlog`, then `todo`, which re-admits the tree.
|
|
70
8
|
|
|
71
9
|
## Deciding
|
|
72
10
|
|
|
73
|
-
1. **Where the tree stands.** Read `issues.<root
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
Answer a question as step 4 says, and leave the tree as it is. In that reply and in the
|
|
86
|
-
root's copy, write `<root>'s architect has stopped, so it` for `<root> is parked, so its
|
|
87
|
-
architect`, `The tree waits.` for `The tree stays parked.`, and `backlog, then todo,` for
|
|
88
|
-
`todo`.
|
|
89
|
-
Otherwise the tree already heard the decision: do nothing.
|
|
90
|
-
- Its `phase` is `done`: read the root's Dispatch status (`dispatch read --issue <root>`).
|
|
91
|
-
`backlog` or `icebox`: go on. `done`: the tree finished; set nothing and name `ref` in your
|
|
92
|
-
summary. `triage`: a person pulled it back; set nothing and name it. Any other status: someone
|
|
93
|
-
else moved the root back into the workflow after the notice was sent; set nothing and name
|
|
94
|
-
`ref` in your summary.
|
|
95
|
-
2. **After the park.** Under the root's `Events:`, each `issue.created`, `issue.updated` and
|
|
96
|
-
`issue.closed` line ends `status <status>`: every change to the issue writes one, a rank,
|
|
97
|
-
priority, label or assignee change too, and each shows the status the issue had then. The park
|
|
98
|
-
is the oldest line of the newest unbroken run of those lines that show the root's current
|
|
99
|
-
status (an event of another type between two of them does not break the run). The author of
|
|
100
|
-
the park line parked the tree. The park is your own hold only when that line is by `session
|
|
101
|
-
legion-daemon:<PROJECT>` and, after it and at most 10 minutes after it, `Events:` show a
|
|
102
|
-
`comment.created` from a session (any controller session: its id changes when the controller
|
|
103
|
-
restarts or is taken over) that begins `Parked by Legion while it waits on:`. That is the mark
|
|
104
|
-
you post on the root, in the same turn, when you park a tree on a person's answer to the
|
|
105
|
-
`dispatch ask` you opened for a hold, for a failed architect or for a tree that waits on an
|
|
106
|
-
event outside Legion (the `held`, `worker-died` and
|
|
107
|
-
[A tree that waits on an event outside Legion](skill://legion-controller/references/wakes.md#a-tree-that-waits-on-an-event-outside-legion)
|
|
108
|
-
sections of [the wakes reference](skill://legion-controller/references/wakes.md)), and for no
|
|
109
|
-
other park: a park a person asks for on their own, without your ask, or one you make at
|
|
110
|
-
triage, gets no mark. The window pairs the
|
|
111
|
-
mark with the park it was posted for: `set_status` writes the status to Dispatch before it
|
|
112
|
-
returns, so the mark's line follows the park's within the turn, and a mark older than the park
|
|
113
|
-
line belongs to an earlier park. Every other park is someone else's: a person's (`user
|
|
114
|
-
<login>`), another session's, and one by `session legion-daemon:<PROJECT>` with no mark beside
|
|
115
|
-
it. The daemon writes an operator's `legion issue status` and a park you made because a person
|
|
116
|
-
asked under that same session, so the author alone does not show your own hold. A decision older
|
|
117
|
-
than the park is no reason to run: the park is the later word. When that run reaches the oldest
|
|
118
|
-
such line `Events:` shows, read the root's events through the API, which keeps more than 10: the
|
|
119
|
-
`curl` of [Triage a root](skill://legion-controller/references/triage.md#triage-a-root) step 2, whose
|
|
120
|
-
events carry `type`, `actor`, `created_at` and `payload.status` or `payload.body`. When the run
|
|
121
|
-
still reaches the oldest event you read, the park is that line or an older one, and you cannot
|
|
122
|
-
read who parked it: judge only the events newer than it, and name in your summary each older
|
|
123
|
-
decision (an approval's or a changes request's two events as one, named
|
|
124
|
-
`dispatch://<KEY>/spec`) that no newer `Parked decision read:` comment has judged, as one you
|
|
125
|
-
could not place. When no event you read shows a status, the park is older than every one of
|
|
126
|
-
them. A decision on another issue of the tree counts when its time is newer than the root's
|
|
127
|
-
park.
|
|
128
|
-
3. **Read once.** A comment that begins `Parked decision read:`, from any session (a controller's
|
|
129
|
-
session id changes when it restarts or is taken over), newer than the decision, on the root or
|
|
130
|
-
on the issue where the decision was made, has judged it: do nothing.
|
|
131
|
-
4. **Judge the words, not the kind.** Read the decision (`dispatch read --ref <ref>` for an ask or
|
|
132
|
-
a reply; for a request for changes, the notice's `reason` or the issue's `Spec approval:` line;
|
|
133
|
-
for an approval, `issues.<root>.designGate` and `issues.<root>.gatedSteps` beside it, which
|
|
134
|
-
carries one entry for each design gate step the deployment gates, with that step's
|
|
135
|
-
`artifactId`, `currentVersion`, `approvedVersion` and `status`). An approval or a request for
|
|
136
|
-
changes is two
|
|
137
|
-
events at one time, the approval request's `ask.answered` and `artifact.approved` or
|
|
138
|
-
`artifact.changes_requested`: judge them as one decision, whose `ref` is `dispatch://<KEY>/spec`.
|
|
139
|
-
- It gives the work a next step: an approval of the spec, a request for changes that says what
|
|
140
|
-
to change, an answer that picks an option or supplies the missing fact, a reply that tells
|
|
141
|
-
the agent to go on. An approval counts when `issues.<root>.designGate.approvedVersion` equals
|
|
142
|
-
`issues.<root>.designGate.currentVersion`, and also when it is lower: then the architect's
|
|
143
|
-
start task names both versions, and the architect requests approval of the current one.
|
|
144
|
-
Where `gatedSteps` carries more than one entry, read each one the same way: the tree runs
|
|
145
|
-
again only once every entry is `approved`, and an entry still `waiting`, `unregistered` or
|
|
146
|
-
`changes_requested` is work the architect holds.
|
|
147
|
-
- It is your own hold (step 2): set the root to `todo` (`set_status`). Admission queues it,
|
|
148
|
-
the tree runs again at a new generation and its architect starts with the decision. That
|
|
149
|
-
`todo` releases no hold. Post one comment on the issue where the decision was made
|
|
150
|
-
(`dispatch comment --issue <KEY> --body-file -`): `Parked decision read: <ref> by <login>
|
|
151
|
-
gives this tree its next step (<one sentence>). Legion runs it again.`
|
|
152
|
-
- Any other park, or you cannot read who parked the tree, when the decision's own words ask
|
|
153
|
-
Legion to start the tree: that is a person's request to start it
|
|
154
|
-
([Free slots](skill://legion-controller/SKILL.md#free-slots)). Set the root to `todo`
|
|
155
|
-
(`set_status`) and post one comment on the issue where the decision was made:
|
|
156
|
-
`Parked decision read: <ref> by <login> asks Legion to start this tree. Legion runs it
|
|
157
|
-
again.`
|
|
158
|
-
- Any other park, or you cannot read who parked the tree, in any other case: set nothing. A
|
|
159
|
-
decision that only gives the work a next step is no request to start it.
|
|
160
|
-
Post one comment on the issue where the decision was made: `Parked decision read: <ref> by
|
|
161
|
-
<login> gives this tree its next step (<one sentence>).`, then the sentence for that park,
|
|
162
|
-
then `Its architect then starts
|
|
163
|
-
with this decision.` For a comment that is no reply on an ask, leave out the last sentence:
|
|
164
|
-
the daemon relays no such comment. The sentence for the park:
|
|
165
|
-
- A person's or another session's: `<parker> parked the tree, so it stays parked until a
|
|
166
|
-
person sets it to todo, approves its spec when it has no parent, or asks Legion to start
|
|
167
|
-
it.`, with the login for a person and `session <id>` for a session.
|
|
168
|
-
- One by `session legion-daemon:<PROJECT>` with no mark: `The tree was parked through Legion
|
|
169
|
-
(session legion-daemon:<PROJECT>) for no hold of its own, so it stays parked until a
|
|
170
|
-
person sets it to todo, approves its spec when it has no parent, or asks Legion to start
|
|
171
|
-
it.`
|
|
172
|
-
- One you cannot read: `Its last 10 events do not show who parked the tree, so it stays
|
|
173
|
-
parked until a person sets it to todo, approves its spec when it has no parent, or asks
|
|
174
|
-
Legion to start it.`
|
|
175
|
-
- It only questions the work: a question, a doubt about the premise, a request for changes that
|
|
176
|
-
only asks why. Leave it parked and answer the question in one reply:
|
|
177
|
-
- Answer from the record when it holds the answer: the issue and its spec (`dispatch read`,
|
|
178
|
-
`dispatch doc-read`), its handoffs (`dispatch handoff-read --issue <KEY> --phase <word>`)
|
|
179
|
-
and its pull request. Write `Parked decision read: <ref> by <login> asks <the question in
|
|
180
|
-
a few words>.`, then the answer and where in the record it is, then `The tree stays parked.
|
|
181
|
-
Set <root> to todo to run it.`
|
|
182
|
-
- When the record does not answer it, write `Parked decision read: <ref> by <login> asks
|
|
183
|
-
<the question in a few words>. The record does not answer it, and <root> is parked, so
|
|
184
|
-
its architect cannot answer either. Set <root> to todo to bring its architect back to
|
|
185
|
-
answer.`
|
|
186
|
-
- When the park is not your own hold, or you cannot read who parked the tree (step 2), end
|
|
187
|
-
either reply with the sentence the next-step comment above gives for that park, with
|
|
188
|
-
`<root>` for `the tree`, in place of its `Set <root> to todo …` sentence. In the reply the
|
|
189
|
-
record does not answer, add `Its architect then starts with this question.` after that
|
|
190
|
-
sentence, except for a comment that is no reply on an ask.
|
|
191
|
-
- Post the reply on the question's own ask, on the issue where the person asked it, so the
|
|
192
|
-
ask hands the turn to the person. For an answer or a resolution (`ref` ends
|
|
193
|
-
`/ask/<ask id>`): `dispatch comment --issue <KEY> --reply-to-ask <ask id> --turn human
|
|
194
|
-
--body-file -`. For a reply (`ref` ends `/comment/<comment id>`): `dispatch comment
|
|
195
|
-
--issue <KEY> --reply-to <comment id> --body-file -`. Dispatch puts that reply under the
|
|
196
|
-
same ask, and a session's reply there hands the turn to the person, as `--turn human`
|
|
197
|
-
does. The command takes `--turn` only with `--reply-to-ask`. A request for changes has no
|
|
198
|
-
ask of its own: post the reply on the issue whose spec it reviews (`dispatch comment
|
|
199
|
-
--issue <KEY> --body-file -`).
|
|
200
|
-
- When `<KEY>` is another issue of the tree, post on the root too (`dispatch comment --issue
|
|
201
|
-
<root> --body-file -`): the same comment for a next step, and for a question a short copy,
|
|
202
|
-
`Parked decision read: <ref> by <login> asks a question, replied to on <KEY>. The tree stays
|
|
203
|
-
parked.` The decision's own issue holds a comment either way: its events are where a later
|
|
204
|
-
walk finds the decision, and the root's last 10 events may no longer show the root's comment
|
|
205
|
-
by then. Several decisions on one tree at once get one comment that names each `ref`, on the
|
|
206
|
-
root and on each such issue.
|
|
11
|
+
1. **Where the tree stands.** Read `issues.<root>`.
|
|
12
|
+
- `phase` is not `done`: the tree runs. When its `architect.state` is `failed` or `retired`, nobody heard: judge it in steps 3 and 4, and re-admit a tree whose decision gives a next step with `backlog`, then `todo`, once the `worker-died` cause is gone (`skill://legion-controller/references/wakes.md`). In those comments write `<root>'s architect has stopped, so it` for `<root> is parked, so its architect` and `The tree waits.` for `The tree stays parked.`. Otherwise the tree heard it: do nothing.
|
|
13
|
+
- `phase` is `done`: `dispatch read --issue <root>`. In `backlog` or `icebox`, go on. In any other status, set nothing and name `ref` in your summary.
|
|
14
|
+
2. **Who parked it.** Under the root's `Events:`, each `issue.created`, `issue.updated` and `issue.closed` line ends `status <status>`. The park is the oldest line of the newest unbroken run of those lines showing the current status. It is your own hold only when that line is by `session legion-daemon:<PROJECT>` and, within 10 minutes after it, a session's comment begins `Parked by Legion while it waits on:`. Every other park is someone else's. `Events:` shows only the last 10 events: when the run reaches the oldest one shown, read `/api/v1/issues/<root>/events?limit=200` with the `curl` of `skill://legion-controller/references/session.md` ("Reading Dispatch's API"); when it still does, you cannot read who parked it, so judge only the events newer than the oldest you read, and name older decisions in your summary as ones you could not place. A decision older than the park is no reason to run.
|
|
15
|
+
3. **Read once.** A `Parked decision read:` comment from any session, newer than the decision, on the root or the decision's issue, has judged it: do nothing.
|
|
16
|
+
4. **Judge the words, not the kind.** Read the decision (`dispatch read --ref <ref>`; for an approval, `issues.<root>.designGate` and `gatedSteps`). An approval and its approval request's `ask.answered` are one decision, `ref` `dispatch://<KEY>/spec`.
|
|
17
|
+
- It gives the work a next step: an approval (every `gatedSteps` entry `approved`; an `approvedVersion` below `currentVersion` counts), a change request that says what to change, an answer that picks an option or supplies the fact, a reply that tells the agent to go on.
|
|
18
|
+
- Your own hold: `set_status` the root to `todo`, and comment `Parked decision read: <ref> by <login> gives this tree its next step (<one sentence>). Legion runs it again.`
|
|
19
|
+
- Another's park, or one you cannot read, whose words ask Legion to start the tree: `todo`, and comment `Parked decision read: <ref> by <login> asks Legion to start this tree. Legion runs it again.`
|
|
20
|
+
- Another's park otherwise: set nothing, and comment `Parked decision read: <ref> by <login> gives this tree its next step (<one sentence>).`, then `<parker> parked the tree, so it stays parked until a person sets it to todo, approves its spec when it has no parent, or asks Legion to start it.` (the login, `session <id>`, or "The tree was parked through Legion (session legion-daemon:<PROJECT>) for no hold of its own"), then, for an ask's answer or reply, `Its architect then starts with this decision.`
|
|
21
|
+
- It only questions the work: leave it parked, and reply `Parked decision read: <ref> by <login> asks <the question in a few words>.`, then the answer and where in the record it is (issue, spec, handoffs, pull request) and `The tree stays parked. Set <root> to todo to run it.`; or, when the record does not answer it, `The record does not answer it, and <root> is parked, so its architect cannot answer either. Set <root> to todo to bring its architect back to answer.` For another's park, end with that park's sentence instead of `Set <root> to todo …`.
|
|
22
|
+
- Post on the issue where the decision was made: under its ask, `dispatch comment --issue <KEY> --reply-to-ask <ask id> --turn human --body-file -`; under a reply, `--reply-to <comment id>`; for a change request, a plain comment on that issue. When that issue is not the root, post a short copy on the root as well. Several decisions on one tree get one comment naming each `ref`.
|
|
207
23
|
|
|
208
24
|
## The walk
|
|
209
25
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
[At every start](skill://legion-controller/references/triage.md#at-every-start) reads triage.
|
|
216
|
-
Keep the rows that `read_state` records under `issues` at phase `done`.
|
|
217
|
-
2. For each, read the root (`dispatch read --issue <root>`), then its children
|
|
218
|
-
(`dispatch read --ref dispatch://<root>/children`) and each child (`dispatch read --issue
|
|
219
|
-
<child>`), and each child's children the same way, down the tree.
|
|
220
|
-
3. A decision is an event under `Events:`, by a `user`, newer than the root's park (**Deciding**,
|
|
221
|
-
step 2) and than every `Parked decision read:` comment from any session on the root or on the
|
|
222
|
-
issue the event is on, of type `artifact.approved`, `artifact.changes_requested`,
|
|
223
|
-
`ask.answered`, `ask.resolved` or `comment.created`. An event line shows the decision's start
|
|
224
|
-
(an answer as `<question> -> <answer>`) and its author (`user <login>`), but no id. An
|
|
225
|
-
`artifact.approved` or `artifact.changes_requested` event, with the approval request's
|
|
226
|
-
`ask.answered` at the same time, is one decision whose `ref` is `dispatch://<KEY>/spec`, and
|
|
227
|
-
the issue's `Spec approval:` line shows a request's reason. Skip an `artifact.approved` only
|
|
228
|
-
when it is the person's handover, which the daemon queues itself (**The notice**, the paragraph
|
|
229
|
-
that begins "A person's own approval"), and with it the approval request's `ask.answered` at the
|
|
230
|
-
same time. It is that
|
|
231
|
-
handover when all three hold: the root's `parent` is `null`; the event's `payload.artifact_id`
|
|
232
|
-
is the root's `primary_artifact_id`; and its `payload.reason` does not begin `Carried forward
|
|
233
|
-
from the approval of version`. The events `curl` of
|
|
234
|
-
[Triage a root](skill://legion-controller/references/triage.md#triage-a-root) step 2 shows the
|
|
235
|
-
payload, and the same `curl` of `/api/v1/issues/<root>` shows `parent` and
|
|
236
|
-
`primary_artifact_id`, the fields the daemon reads. When that read fails, skip nothing: judge
|
|
237
|
-
the approval. Judge every other approval as a decision. For any other ask or a comment, find
|
|
238
|
-
the item: `Open asks:` names an ask still open, and `dispatch search` finds an ask or a comment
|
|
239
|
-
by its words. The id at the end of a hit's link (`/asks/<id>`, `?ask=<id>`, `#b-<block id>`,
|
|
240
|
-
`/comments/<id>`, `?comment=<id>`) names it. Read an ask with `dispatch read --ref
|
|
241
|
-
dispatch://<KEY>/ask/<id>`, which takes a block id too and prints the ask's own id as `Ask id:`.
|
|
242
|
-
That ask id goes in `ref` (`dispatch://<KEY>/ask/<ask id>`) and in `--reply-to-ask`. A
|
|
243
|
-
comment's `ref` is `dispatch://<KEY>/comment/<id>`. Two limits: the walk counts every comment
|
|
244
|
-
by a person, a reply on an ask or not, where the daemon's notice comes only for an ask reply;
|
|
245
|
-
and `Events:` shows an issue's last 10 events, so a decision older than those, pushed out by
|
|
246
|
-
later edits (a rank or priority change writes an event too), is not found here. The daemon's
|
|
247
|
-
notice does not depend on that window.
|
|
248
|
-
4. Decide each tree's decisions as **Deciding** says, its step 1 included. An event of those types
|
|
249
|
-
that is older than the park goes in your summary when **Deciding** step 2 says so.
|
|
250
|
-
5. Take each root of step 1's list whose park is your own hold (**Deciding**, step 2) and whose
|
|
251
|
-
tree had no decision that step 4 judged in this walk: the next walk checks a root whose tree
|
|
252
|
-
had a decision. The mark of each root you take, the first line of the
|
|
253
|
-
`Parked by Legion while it waits on:` comment that **Deciding** step 2 pairs with the park,
|
|
254
|
-
names the cause or the event that the tree waits on. When that comment cites an ask's answer,
|
|
255
|
-
the root's `Asked whether to park:` comment that names that ask gives the `<key>` of the same
|
|
256
|
-
wait on its second line
|
|
257
|
-
(`skill://legion-controller/references/wakes.md#ask-whether-to-park-a-tree`). Check that wait
|
|
258
|
-
now:
|
|
259
|
-
- For an `event:` key, read what its reference names: the issue, the pull request, the
|
|
260
|
-
release, the deploy run, or the message or comment that names what the tree waits on.
|
|
261
|
-
- For any other mark, check the cause that the mark names. That is a mark with a `held` or an
|
|
262
|
-
`architect failed:` key, or a mark with no park ask: its comment cites no ask, or cites an
|
|
263
|
-
ask that no `Asked whether to park:` comment names. A mark with no park ask comes from an
|
|
264
|
-
escalated hold that an earlier Legion parked at once. Judge whether the cause is gone with
|
|
265
|
-
the test of step 3 of
|
|
266
|
-
[An escalated hold](skill://legion-controller/references/escalation.md#an-escalated-hold).
|
|
267
|
-
A live row of `read_state`'s `capabilities` speaks only for a session that runs, and the
|
|
268
|
-
parked tree runs none. So the lack of such a row is no evidence that the cause is gone.
|
|
269
|
-
|
|
270
|
-
When the event has happened or the cause is gone, set the root to `todo` (`set_status`). Post
|
|
271
|
-
one comment on the root (`dispatch comment --issue <root> --body-file -`) that cites the mark
|
|
272
|
-
and says what you checked, as the wakes reference says. When the event has not happened, the
|
|
273
|
-
cause stays, or you cannot tell, move nothing. Name the root and what it waits on in your
|
|
274
|
-
summary.
|
|
26
|
+
1. List the parked roots: `dispatch issues --project <PROJECT> --status backlog --label legion --all`, then with `--status icebox`. Keep those `read_state` records at `phase: done`.
|
|
27
|
+
2. Read each root, then each issue under it, level by level (`dispatch issues --project <PROJECT> --parent <KEY> --all`).
|
|
28
|
+
3. A decision is an event by a `user`, newer than the root's park and every `Parked decision read:` comment on its issue, of type `artifact.approved`, `artifact.changes_requested`, `ask.answered`, `ask.resolved` or `comment.created`. Skip an `artifact.approved` that is the person's own handover: the root's `parent` is `null`, the event's `payload.artifact_id` is the root's `primary_artifact_id` (the same `curl` of `/api/v1/issues/<root>`), and its `payload.reason` does not begin `Carried forward from the approval of version`. When that read fails, judge it. Find an ask or comment's id under `Open asks:` or with `dispatch search`; `dispatch read --ref dispatch://<KEY>/ask/<id>` prints its `Ask id:`.
|
|
29
|
+
4. Decide each tree's decisions as [Deciding](#deciding) says.
|
|
30
|
+
5. For each root that is your own hold and had no decision this walk, check its wait: for an `event:` key, read what its reference names; for any other mark, judge the cause by step 3 of `skill://legion-controller/references/escalation.md#an-escalated-hold` (a missing `capabilities` row proves nothing, since a parked tree runs no session). When the event has happened or the cause is gone, `set_status` the root to `todo` with a comment that cites the mark and what you checked. Otherwise move nothing, and name the root and its wait in your summary.
|
|
@@ -1,113 +1,55 @@
|
|
|
1
1
|
# How the controller session runs
|
|
2
2
|
|
|
3
|
-
Read this when you need to know who launched you, what `
|
|
4
|
-
request, when `gh` or `curl` fails, when `set_status` answers 403, or when a person takes the
|
|
5
|
-
controller over by hand. The `How this controller runs` part of your system prompt says who
|
|
6
|
-
launched you.
|
|
3
|
+
Read this when you need to know who launched you, what the `legion` tool does, how to read a pull request or Dispatch's API, why `set_status` answers 403, or how a person takes the controller over by hand. The `How this controller runs` part of your system prompt says who launched you.
|
|
7
4
|
|
|
8
5
|
## Launched by the operator (`controller: operator`, the default)
|
|
9
6
|
|
|
10
|
-
The operator ran `legion controller start --config controller.yaml
|
|
11
|
-
own machine, and you are that foreground session. The daemon reads your liveness from the Envoy
|
|
12
|
-
role registry: the holder of `legion-<project>-controller`, its state and its `last_seen`. It
|
|
13
|
-
replaces no controller whose session reads `unresponsive` — past the live window, inside the gone
|
|
14
|
-
horizon, still the holder — and acts only on one that reads `gone`. The daemon launches no
|
|
15
|
-
controller itself, so do not exit the session: while none runs, the project has no controller. A
|
|
16
|
-
second `legion controller start` replaces you: it mints a new secret, your grants stop working
|
|
17
|
-
(every `set_status` answers 403), and the role moves to the new session.
|
|
7
|
+
The operator ran `legion controller start --config controller.yaml` on their own machine, and you are that foreground session. The daemon replaces no controller whose session reads `unresponsive`, and it launches and relaunches no controller of this kind: one that stops answering is a person's to start again. So do not exit the session, because while none runs the project has no controller. A second `legion controller start` replaces you: it mints a new secret, your grants stop working (every `set_status` answers 403), and the role moves to the new session.
|
|
18
8
|
|
|
19
9
|
## Launched by the daemon (`controller: daemon`)
|
|
20
10
|
|
|
21
|
-
The daemon runs you in a pod and
|
|
22
|
-
daemon relaunches it and resumes this session with a new start message, so run the start procedure
|
|
23
|
-
each time one arrives. A person reaches you through Dispatch (a message on the Agents page, an
|
|
24
|
-
answer to your ask, a mention), Envoy or Slack. No `legion controller start` can replace you.
|
|
11
|
+
The daemon runs you in a pod. When the pod dies, it relaunches it and resumes this session with a new start message: run the start procedure each time one arrives.
|
|
25
12
|
|
|
26
13
|
## The `legion` tool
|
|
27
14
|
|
|
28
|
-
- `
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
in the workflow that stands in neither `admission.active` nor `admission.waiting`, each with
|
|
34
|
-
one word for why nothing of it runs and the issues that hold it;
|
|
35
|
-
`skill://legion-controller/references/admission.md` gives the word for each row and what ends
|
|
36
|
-
it), `capabilities[]`, `daemon.project`, and
|
|
37
|
-
`settings` (the daemon's resolved `legion.yaml`, with no credential in it).
|
|
38
|
-
- `op: "set_status"` with `issue` and `status` (`todo`, `backlog` or `icebox`) moves an issue. Each
|
|
39
|
-
call mints its grant in-process from the secret the session registered with, so a stale secret
|
|
40
|
-
fails it with a 403.
|
|
41
|
-
Move an issue to `backlog` or `icebox` only when a person asked for that move, or when the work is done, folded into another issue or no longer needed.
|
|
42
|
-
Cite that reason in a comment on the issue. Two writes are not that move: a root's restart,
|
|
43
|
-
which sets `backlog` and then `todo` in the same turn, and the report issue's `icebox`, because
|
|
44
|
-
that issue holds no work. You cannot set `done`: only an issue's architect or the daemon closes
|
|
45
|
-
an issue.
|
|
15
|
+
- `read_state`: the daemon's whole state: `issues.<KEY>` (`phase`, `holdReason`, `heldFrom`, `architect`, `workers`, `tree`, `waitingOn`), `admission` (`cap`, `active`, `waiting`, `trees`, `blocked`, `held`), `capabilities`, `daemon.project`, and `settings`, the resolved `legion.yaml`.
|
|
16
|
+
- `set_status` (`issue`, `status`: `todo`, `backlog` or `icebox`). Each call mints its grant from the secret the session registered with. You cannot set `done`.
|
|
17
|
+
- `compact` (`issue`, `role`): the daemon shortens that claim's session to a summary and sends it its task again; the claim keeps its session and workspace. It refuses a claim with no process (`CLAIM_NOT_RUNNING`).
|
|
18
|
+
- `fresh_session` (`issue`, `role`): starts the claim again with its task in a new session; the old session, and all it knew, is left behind. It is the one door that brings back a dead role.
|
|
19
|
+
- Both refuse `CLAIM_IN_A_TURN` (a process in a turn, or a compaction) and `CLAIM_UNSETTLED` (the runtime did not answer, or the claim moved): ask again later. For a root with no architect claim both answer `NO_CLAIM`.
|
|
46
20
|
|
|
47
21
|
## `gh`
|
|
48
22
|
|
|
49
|
-
`gh`
|
|
50
|
-
(`gh api graphql -f query='{viewer{login}}'` names it). It reads with the token of the GitHub
|
|
51
|
-
owner a command names (`-R owner/repo`, `repos/owner/repo` in `gh api`, a GitHub URL), and with the
|
|
52
|
-
first owner's token (`GH_CONFIG_DIR`) otherwise, so always name the repository: another owner's repository read with
|
|
53
|
-
the first owner's token can fail. The tokens sit in `LEGION_GH_OWNERS_DIR`, one read-only directory
|
|
54
|
-
per owner the review App is installed on, each token reaching every repository that owner's
|
|
55
|
-
installation holds, refreshed
|
|
56
|
-
every minute. When the daemon has no GitHub App, `legion controller start`
|
|
57
|
-
prints `[legion] the daemon has no GitHub App to act as; the controller's gh acts as nobody`.
|
|
23
|
+
`gh` acts as the review App's bot account (`gh api graphql -f query='{viewer{login}}'` names it). It reads with the token of the owner a command names (`-R owner/repo`, `repos/owner/repo`, a GitHub URL), so always name the repository.
|
|
58
24
|
|
|
59
|
-
End every pull-request comment or review you post with
|
|
60
|
-
`<!-- legion: {"session":"<session-id>","phase":"controller"} -->`, because the daemon reads that
|
|
61
|
-
footer to tell your review from the reviewer's verdict.
|
|
25
|
+
End every pull-request comment or review you post with `<!-- legion: {"session":"<session-id>","phase":"controller"} -->`: the daemon reads that footer to tell your review from the reviewer's verdict.
|
|
62
26
|
|
|
63
27
|
## Reading a pull request
|
|
64
28
|
|
|
65
|
-
Read a pull request an issue names
|
|
66
|
-
the shape `https://github.com/<owner>/<repo>/pull/<n>`, with nothing before, after or inside it but
|
|
67
|
-
GitHub's owner and repository characters and the digits. Run it single-quoted, exactly as the issue
|
|
68
|
-
shows it, because any other text from an issue could run as a command:
|
|
29
|
+
Read a pull request an issue names only by a URL of the shape `https://github.com/<owner>/<repo>/pull/<n>`, with nothing before, after or inside it but GitHub's owner and repository characters and the digits. Run it single-quoted, exactly as the issue shows it, because any other text from an issue could run as a command:
|
|
69
30
|
|
|
70
31
|
```text
|
|
71
32
|
gh pr view 'https://github.com/<owner>/<repo>/pull/<n>' --json state -q .state
|
|
72
33
|
```
|
|
73
34
|
|
|
74
|
-
It answers `OPEN
|
|
75
|
-
fails, report `<KEY>: pull request <url> unreadable: <gh's first stderr line>` and read it as none
|
|
76
|
-
of the three. Text of any other shape is never a command argument: report
|
|
77
|
-
`<KEY>: pull request <text> unreadable: not a pull-request URL`.
|
|
35
|
+
It answers `OPEN`, `MERGED` or `CLOSED`. When it fails, report `<KEY>: pull request <url> unreadable: <gh's first stderr line>`. Text of any other shape is never a command argument: report `<KEY>: pull request <text> unreadable: not a pull-request URL`.
|
|
78
36
|
|
|
79
|
-
##
|
|
37
|
+
## Reading Dispatch's API
|
|
80
38
|
|
|
81
|
-
Each
|
|
82
|
-
start` sets them only when `controller.yaml` names `dispatch_url`; the daemon's pod sets
|
|
83
|
-
`DISPATCH_URL` when the daemon has one. When they are unset, every `curl` fails: act on nothing it
|
|
84
|
-
would decide and name it in your summary. Each passes its token as a header file (`-H @<(…)`), so
|
|
85
|
-
that no process's arguments hold it: run it in bash, because `sh` refuses that form.
|
|
86
|
-
|
|
87
|
-
## Taking the controller over by hand
|
|
88
|
-
|
|
89
|
-
To move the controller to a hand-started Oh My Pi session, start it with
|
|
90
|
-
`LEGION_CONTROLLER_SECRET` (or `LEGION_CONTROLLER_SECRET_FILE`, a path to a file holding it),
|
|
91
|
-
`LEGION_DAEMON_URL`, `LEGION_PROJECT` (the daemon's project) and `LEGION_STATE_DIR` in its
|
|
92
|
-
environment, then run:
|
|
39
|
+
Each read of Dispatch's API in these references is a `curl` of a route under `DISPATCH_URL`, with the token of `DISPATCH_TOKEN_FILE` on standard input, so that no process's arguments hold it. Run it in bash:
|
|
93
40
|
|
|
94
41
|
```text
|
|
95
|
-
|
|
42
|
+
printf 'Authorization: Bearer %s' "$(< "$DISPATCH_TOKEN_FILE")" | curl -sS --fail-with-body -H @- "$DISPATCH_URL<route>"
|
|
96
43
|
```
|
|
97
44
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
-
|
|
109
|
-
- It keeps the secret it started with. After the next `legion controller start` mints a new one,
|
|
110
|
-
every `set_status` fails with a 403 from the grant mint: start a fresh session with the new
|
|
111
|
-
secret instead of retrying.
|
|
112
|
-
- The role does not follow `/new` or `/fork`, because without `LEGION_CONTROLLER=1` the new session
|
|
113
|
-
is not a Legion session to the extension: run `/legion-claim-controller` again after either.
|
|
45
|
+
`legion controller start` sets `DISPATCH_URL` only when `controller.yaml` names `dispatch_url`, and `DISPATCH_TOKEN_FILE` beside it only with `dispatch_token_file`: under `dispatch_token_broker` it sets no token file. The daemon sets both for a controller it launches. Quote a route that carries a query, because the shell reads `?` and `&`. When the read fails, or the variables are unset, act on nothing the read would decide and name its first line in your summary.
|
|
46
|
+
|
|
47
|
+
## Taking the controller over by hand
|
|
48
|
+
|
|
49
|
+
Start an Oh My Pi session with `LEGION_CONTROLLER_SECRET` (or `LEGION_CONTROLLER_SECRET_FILE`), `LEGION_DAEMON_URL`, `LEGION_PROJECT` and `LEGION_STATE_DIR` in its environment, then run `/legion-claim-controller` once. It registers the session, claims the Envoy role, and moves the daemon's controller session id to it.
|
|
50
|
+
|
|
51
|
+
- Never pass the secret as an argument or copy it into a transcript.
|
|
52
|
+
- Do not set `LEGION_CONTROLLER=1`: that marks a launched controller, which waits for a start message.
|
|
53
|
+
- Its `gh` is whatever its own environment gives it.
|
|
54
|
+
- After the next `legion controller start` mints a new secret, every `set_status` answers 403: start a fresh session with the new secret.
|
|
55
|
+
- The role does not follow `/new` or `/fork`: run `/legion-claim-controller` again after either.
|