@sjawhar/claude-envoy 1.23.1 → 1.25.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/dist/envoy-channel.js +44 -9
- package/legion/skills/legion-architect/SKILL.md +3 -0
- package/legion/skills/legion-architect/references/acceptance.md +14 -1
- package/legion/skills/legion-architect/references/design-gate.md +9 -1
- package/legion/skills/legion-architect/references/wake-routing.md +2 -0
- package/legion/skills/legion-controller/SKILL.md +2 -1
- package/legion/skills/legion-controller/references/admission.md +1 -1
- package/legion/skills/legion-controller/references/wakes.md +46 -0
- package/package.json +2 -2
- package/src/legion-phase-hook.ts +1 -1
package/.omp-plugin/plugin.json
CHANGED
package/dist/envoy-channel.js
CHANGED
|
@@ -52114,6 +52114,16 @@ var legionCapabilityReportView = object({
|
|
|
52114
52114
|
ok: array(nonEmptyString),
|
|
52115
52115
|
open: array(object({ name: nonEmptyString, detail: nonEmptyString }))
|
|
52116
52116
|
});
|
|
52117
|
+
var legionStepView = object({
|
|
52118
|
+
at: timestamp.optional(),
|
|
52119
|
+
turnStartedAt: timestamp.optional(),
|
|
52120
|
+
tool: nonEmptyString.optional(),
|
|
52121
|
+
callId: nonEmptyString.optional(),
|
|
52122
|
+
argsBytes: number2().int().positive().optional(),
|
|
52123
|
+
argsHash: nonEmptyString.optional(),
|
|
52124
|
+
startedAt: timestamp.optional(),
|
|
52125
|
+
endedAt: timestamp.optional()
|
|
52126
|
+
});
|
|
52117
52127
|
var legionClaimView = object({
|
|
52118
52128
|
session: string2(),
|
|
52119
52129
|
state: _enum2(LEGION_CLAIM_STATES),
|
|
@@ -52121,7 +52131,8 @@ var legionClaimView = object({
|
|
|
52121
52131
|
capabilities: legionCapabilityReportView.optional(),
|
|
52122
52132
|
pluginContract: number2().int().nonnegative(),
|
|
52123
52133
|
updateRound: nonEmptyString.optional(),
|
|
52124
|
-
updateHead: nonEmptyString.optional()
|
|
52134
|
+
updateHead: nonEmptyString.optional(),
|
|
52135
|
+
step: legionStepView.optional()
|
|
52125
52136
|
});
|
|
52126
52137
|
var legionHandoffRecordView = object({
|
|
52127
52138
|
id: nonEmptyString,
|
|
@@ -52161,6 +52172,10 @@ var legionSlotView = object({
|
|
|
52161
52172
|
admittedAt: timestamp,
|
|
52162
52173
|
lentTo: issueKey.optional()
|
|
52163
52174
|
});
|
|
52175
|
+
var legionWaitingLineView = object({
|
|
52176
|
+
place: number2().int().positive(),
|
|
52177
|
+
length: number2().int().positive()
|
|
52178
|
+
});
|
|
52164
52179
|
var legionCheckWakeView = object({
|
|
52165
52180
|
kind: nonEmptyString,
|
|
52166
52181
|
detail: string2(),
|
|
@@ -52245,6 +52260,7 @@ var legionIssue = object({
|
|
|
52245
52260
|
designGate: legionGateView.optional(),
|
|
52246
52261
|
gatedSteps: array(legionGatedStepView).optional(),
|
|
52247
52262
|
slot: legionSlotView.optional(),
|
|
52263
|
+
waitingLine: legionWaitingLineView.optional(),
|
|
52248
52264
|
waitingOn: legionWaitingOn.optional(),
|
|
52249
52265
|
check: legionCheckView.optional(),
|
|
52250
52266
|
memoryGroup: _enum2(["memory", "none"]).optional(),
|
|
@@ -52477,7 +52493,8 @@ var LegionOperatorClaimResponse = object({
|
|
|
52477
52493
|
suspensionHeld: literal(true).optional(),
|
|
52478
52494
|
pluginContract: number2().int().nonnegative(),
|
|
52479
52495
|
updateRound: nonEmptyString.optional(),
|
|
52480
|
-
updateHead: nonEmptyString.optional()
|
|
52496
|
+
updateHead: nonEmptyString.optional(),
|
|
52497
|
+
step: legionStepView.optional()
|
|
52481
52498
|
});
|
|
52482
52499
|
var legionPodUpdateRounds = object({
|
|
52483
52500
|
swept: boolean2(),
|
|
@@ -55262,9 +55279,9 @@ var import_nats2 = __toESM(require_mod4(), 1);
|
|
|
55262
55279
|
|
|
55263
55280
|
// package.json
|
|
55264
55281
|
var name = "@sjawhar/claude-envoy";
|
|
55265
|
-
var version2 = "1.
|
|
55282
|
+
var version2 = "1.25.0";
|
|
55266
55283
|
var legion = {
|
|
55267
|
-
daemonApiVersion:
|
|
55284
|
+
daemonApiVersion: 58
|
|
55268
55285
|
};
|
|
55269
55286
|
|
|
55270
55287
|
// ../pi-shared/src/agent-stream.ts
|
|
@@ -56824,6 +56841,10 @@ async function withBound(work, ms) {
|
|
|
56824
56841
|
clearTimeout(timer);
|
|
56825
56842
|
}
|
|
56826
56843
|
}
|
|
56844
|
+
function architectLive(record) {
|
|
56845
|
+
const architect = record?.architect;
|
|
56846
|
+
return architect !== undefined && architect.state !== "retired" && architect.state !== "failed";
|
|
56847
|
+
}
|
|
56827
56848
|
function createPhaseReminder(deps) {
|
|
56828
56849
|
const boundMs = deps.recordBoundMs ?? RECORD_READ_BOUND_MS;
|
|
56829
56850
|
let stall = { state: "closed", count: 0 };
|
|
@@ -56909,7 +56930,7 @@ function createPhaseReminder(deps) {
|
|
|
56909
56930
|
const phase = record?.phase ?? "unknown";
|
|
56910
56931
|
const reminders = stall.count;
|
|
56911
56932
|
try {
|
|
56912
|
-
const live = record
|
|
56933
|
+
const live = architectLive(record);
|
|
56913
56934
|
const topic = ROLE_TOPIC_PREFIX + roleToken(deps.project ?? "", live ? claim.issue : claim.tree, "architect");
|
|
56914
56935
|
const answer = await publish({
|
|
56915
56936
|
topic,
|
|
@@ -57094,8 +57115,19 @@ var DEFAULT_STALL_LIMITS = {
|
|
|
57094
57115
|
reminderMs: 300000,
|
|
57095
57116
|
waitingMs: 900000,
|
|
57096
57117
|
resumeMs: 120000,
|
|
57097
|
-
architectAfter: 3
|
|
57118
|
+
architectAfter: 3,
|
|
57119
|
+
callGraceMs: 300000,
|
|
57120
|
+
callBoundMs: 3600000,
|
|
57121
|
+
stepMs: 120000
|
|
57098
57122
|
};
|
|
57123
|
+
var LONG_CALL_BOUND_MS = 14400000;
|
|
57124
|
+
var LONG_CALL_BOUND_ROLES = [
|
|
57125
|
+
"implementer",
|
|
57126
|
+
"reviewer"
|
|
57127
|
+
];
|
|
57128
|
+
function defaultCallBoundMs(role) {
|
|
57129
|
+
return role !== undefined && LONG_CALL_BOUND_ROLES.includes(role) ? LONG_CALL_BOUND_MS : DEFAULT_STALL_LIMITS.callBoundMs;
|
|
57130
|
+
}
|
|
57099
57131
|
function integerSetting(env, log, name, fallback, least) {
|
|
57100
57132
|
const raw = env[name];
|
|
57101
57133
|
if (raw === undefined)
|
|
@@ -57109,12 +57141,15 @@ function integerSetting(env, log, name, fallback, least) {
|
|
|
57109
57141
|
}
|
|
57110
57142
|
return value;
|
|
57111
57143
|
}
|
|
57112
|
-
function stallLimits(env, log) {
|
|
57144
|
+
function stallLimits(env, log, role) {
|
|
57113
57145
|
return {
|
|
57114
57146
|
reminderMs: integerSetting(env, log, "LEGION_STALL_REMINDER_MS", DEFAULT_STALL_LIMITS.reminderMs, 0),
|
|
57115
57147
|
waitingMs: integerSetting(env, log, "LEGION_STALL_WAITING_MS", DEFAULT_STALL_LIMITS.waitingMs, 0),
|
|
57116
57148
|
resumeMs: integerSetting(env, log, "LEGION_STALL_RESUME_MS", DEFAULT_STALL_LIMITS.resumeMs, 0),
|
|
57117
|
-
architectAfter: integerSetting(env, log, "LEGION_STALL_ARCHITECT_AFTER", DEFAULT_STALL_LIMITS.architectAfter, 2)
|
|
57149
|
+
architectAfter: integerSetting(env, log, "LEGION_STALL_ARCHITECT_AFTER", DEFAULT_STALL_LIMITS.architectAfter, 2),
|
|
57150
|
+
callGraceMs: integerSetting(env, log, "LEGION_STALL_CALL_GRACE_MS", DEFAULT_STALL_LIMITS.callGraceMs, 0),
|
|
57151
|
+
callBoundMs: integerSetting(env, log, "LEGION_STALL_CALL_BOUND_MS", defaultCallBoundMs(role), 0),
|
|
57152
|
+
stepMs: integerSetting(env, log, "LEGION_STALL_STEP_MS", DEFAULT_STALL_LIMITS.stepMs, 0)
|
|
57118
57153
|
};
|
|
57119
57154
|
}
|
|
57120
57155
|
|
|
@@ -57246,7 +57281,7 @@ function writePhaseStallRecord(file, entry, recreatedNoticeSent, log) {
|
|
|
57246
57281
|
}
|
|
57247
57282
|
}
|
|
57248
57283
|
function createPhaseHookEndpoint(deps) {
|
|
57249
|
-
const limits = stallLimits(deps.env, deps.log);
|
|
57284
|
+
const limits = stallLimits(deps.env, deps.log, configuredValue(deps.env["LEGION_ROLE"]));
|
|
57250
57285
|
const restored = readPhaseStallRecord(deps.stateFile, deps.log);
|
|
57251
57286
|
let entry = restored.entry ?? { state: "closed", count: 0, reported: false };
|
|
57252
57287
|
let recreatedNoticeSent = restored.recreatedNoticeSent;
|
|
@@ -14,6 +14,9 @@ You own one issue tree from its first decision to the merge that closes it. The
|
|
|
14
14
|
- Act on delivered wakes and the live artifacts they name; build no wait loop, since every wake reaches you.
|
|
15
15
|
- Check each claim against the code as fetched now (the default branch your addressing line names, or the head under review), never the workspace as it was at admission, and tell every fresh reader you dispatch to do the same: the branch may have moved since.
|
|
16
16
|
- Before you end a turn that waits on a human, open what they must answer: a decision block, a `dispatch ask` or `dispatch request-approval`. A turn that ends with nothing open asks nobody, and the tree stops. Open an ordinary ask on the root issue itself, never a child: only a question a session of this tree opens on the root starts a wait on a person, so an ask on a child starts no wait and leaves the tree standing still. Once you have handed a root question to the human, end your turn: when nothing else of the tree is at work — no other issue of the tree in a phase, the `legion` label still on, and no person or outside session holding the root's Dispatch claim — the root returns its admission slot (`awaiting_person`) while this session stays live. Read the human's comments and replies as they arrive. Their answer gives this live claim a task naming what answered and what is still with them. The same holds once you request approval and `register_gate` that version: the registration hands the spec to the human, so end your turn there too, and the human's review, or a newer version once Dispatch shows the request back on your turn, gives you that task.
|
|
17
|
+
While a resume of that root waits for an admission slot, you get one `waiting-for-slot` notice saying what answered the wait, where your root stands in the admission line then, and that the daemon starts you again by itself at the next free slot.
|
|
18
|
+
You get it only while this session holds its Envoy role: a session whose pod the daemon released while the root waited is told nothing, and its resume task says what answered the wait.
|
|
19
|
+
Your record's `waitingLine` gives the live place and the line's length, and you act on neither: the daemon starts you.
|
|
17
20
|
- Deliver every criterion of the root spec in this tree. Work leaves it only when a root splits, as a `dispatch ask` for the rest: work outside has no owner.
|
|
18
21
|
- A problem outside the tree is a `dispatch ask`, never an issue you file, because a person decides whether it needs one (`skill://legion-worker/references/findings.md`). A clear defect is the exception. Fix one in code this tree touches or depends on in this tree's pull request. Send any other to the controller, which gives it to the tree that owns that code.
|
|
19
22
|
- Before you write a spec or ask a person anything, read the repository's `STRATEGY.md` when it has one and the design principles where it states them (`AGENTS.md`, in this repository), then use a standard best-practice solution; ask only what neither settles, with one recommendation. A design that crosses a Boundary in `STRATEGY.md` goes to its owner before it is built. Find the standard with a web search and with how two or three well-regarded projects solve the problem. Cite them in a few lines of the spec's `Design`. A design far from the standard is a sign to fix the underlying problem, not to add a workaround.
|
|
@@ -224,8 +224,21 @@ If you are that child's architect:
|
|
|
224
224
|
- It says `handed_over` alone (no gate to carry): your workers already run their phases, so
|
|
225
225
|
decompose nothing, and read the root's phase from the catch-up (for a root `held`, the phase its
|
|
226
226
|
`held` notice names). Before `awaiting_merge`, register your spec with `register_gate`: your
|
|
227
|
-
merger's READY waits for its approval.
|
|
227
|
+
merger's READY waits for its approval.
|
|
228
|
+
That registration's approval request waits with the person like any other, but it returns no admission slot: 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.
|
|
229
|
+
The slot rule below is for a root of your own at `admitted`, not for this one.
|
|
230
|
+
When that `design-approved` arrives, release and start
|
|
228
231
|
nothing: the workers are already running. A child carried in `accepting` is yours to accept. In
|
|
229
232
|
`awaiting_merge` the READY is through, so register none; a red or conflicting head that returns
|
|
230
233
|
the root to `implementing` makes its next READY read the gate again, so a later `ready-refused`
|
|
231
234
|
is when you register.
|
|
235
|
+
|
|
236
|
+
## Your slot while a person has your spec
|
|
237
|
+
|
|
238
|
+
This is for a root of your own standing at `admitted`, the only phase from which a root waits on a person.
|
|
239
|
+
A registration that leaves the approval request with the person returns your root's admission slot, and what brings the root back is the answer, not the registration.
|
|
240
|
+
What decides whether your resume waits for a slot is whether the gate has ever opened in this generation, never whether it stands open now: an approval opens your gate, and a root whose gate has ever opened needs no slot to resume, so it resumes however full the cap is.
|
|
241
|
+
The first phase that resume starts takes a slot of its own: it waits in the line among the issues whose work came back, oldest first, placed by the moment your gate opened, so it stands behind every issue of that part whose work came back before it.
|
|
242
|
+
A changes request, or a newer version of the document that hands the request back to you, leaves the gate closed, so your merger's READY waits for a new approval; it brings back no need for a slot to resume, and only a root whose gate has never opened has one: then, while every slot is taken, you get one `waiting-for-slot` notice, and your record carries `waitingLine`, your place in the line and its length.
|
|
243
|
+
You get the notice only while this session holds its Envoy role: a session whose pod the daemon released while the root waited is told nothing, and its resume task says what answered the wait.
|
|
244
|
+
Act on neither: the daemon starts you again at the next free slot.
|
|
@@ -174,7 +174,15 @@ tree is at work, the root returns its admission slot and waits on its design gat
|
|
|
174
174
|
approval or changes request delivers your next task, and so does a newer spec version once
|
|
175
175
|
Dispatch shows the request back on your turn. While the root waits on a question instead, the
|
|
176
176
|
human's approval or changes request of the spec answers that wait too, and the task says how the
|
|
177
|
-
spec stands.
|
|
177
|
+
spec stands. An approval that opens the last gated step leaves your resume waiting for no slot at
|
|
178
|
+
all: it comes back however full the cap is. Where your root's gate has never opened, the resume
|
|
179
|
+
needs a slot, and while it waits for one you get one `waiting-for-slot` notice saying what
|
|
180
|
+
answered the wait, where your root stands in the admission line then and that the daemon starts
|
|
181
|
+
you again by itself, and your record's `waitingLine` gives the live place and the line's length;
|
|
182
|
+
act on neither.
|
|
183
|
+
You get the notice only while this session holds its Envoy role: a session whose pod the daemon
|
|
184
|
+
released while the root waited is told nothing, and its resume task says what answered the wait.
|
|
185
|
+
Release no child until every gated step is open: a delivered wake shows
|
|
178
186
|
`design-approved` on the root, or a task says its design gate is open, and under more than one
|
|
179
187
|
step `gatedSteps` in your record shows each one `approved`. The daemon sends a root waiting on a
|
|
180
188
|
person no `design-approved` notice, and "this resume is your design-approved wake" is that wake.
|
|
@@ -36,8 +36,10 @@ and 7 (a conflict, the hand-over, the close) is in
|
|
|
36
36
|
| `merge-stalled` | GitHub shows the pull request closed, or at another head, while the record still awaits READY's head, and that change's webhook never reached the daemon: read the pull request on GitHub and act on what it shows (`skill://legion-architect/references/merge-notices.md#merge-stalled`). |
|
|
37
37
|
| `merge-removed` | A person, or GitHub on its own, took the pull request out of the merge queue or turned its auto-merge off at READY's head after the daemon submitted the merge: read the pull request on GitHub and act on the removal's reason (`skill://legion-architect/references/merge-notices.md#merge-removed`). |
|
|
38
38
|
| `merge-waiting` | GitHub has not completed the merge the daemon submitted within an hour of READY's acceptance, and nothing has been withdrawn: read the pull request on GitHub for what GitHub waits on and ask a person for what no worker can do (`skill://legion-architect/references/merge-notices.md#merge-waiting`). |
|
|
39
|
+
| `waiting-for-slot` | Its `reason` says what answered your root's wait on a person, that your issue needs an admission slot and the cap has none free now, and where your issue stands in the admission line at that moment, the live place and length being `waitingLine` in your own record (the `legion` tool's `read_record`): do nothing, because the daemon starts you again by itself at the next free slot. |
|
|
39
40
|
| A reply on an ask you follow | Interpret the reply in the issue's design context. Answer in its thread (`dispatch comment --reply-to <comment id>`; under an open ask whose next move is yours, such as the approval request you must revise or hand back, `--reply-to-ask <ask id> --turn agent`, since a default-turn reply hands that request back to the human and a corrected `--summary` is then refused) where the reply carries a question, a disagreement, a correction or a fact you do not have, and whenever you are unsure; an approval, or an answer that settles the question with nothing left to say, draws no comment and no message back to the person who answered. Then adjust the plan or relay the reply via `envoy_publish` to the responsible worker's role token, which an answer needing nothing from you still needs; scope and product decisions remain with you. |
|
|
40
41
|
| `worker-died` | Its `role` and `phase`. That role's claim failed: its launches or prompts ran out. For a phase worker the daemon holds the issue (phase `held`) and starts nothing more on it. Reassess the work, then decide with `retry_or_escalate`: `retry` when the failure looks agent-specific or transient, `escalate` to hand the held issue to the controller when it looks environmental. |
|
|
42
|
+
| `worker-stalled` | Its `role` and `reason`. The daemon's stall backstop acted on that worker's stalled turn: its agent had not stepped for longer than the `worker_stall_backstop_hours` this deployment gives the role, and most often the daemon ended the turn and brought the same session back on a new process. The `reason` is the record the daemon read — when the agent last stepped and how long ago that was, the bound it passed, when the turn began, and the last call the daemon saw, with its tool, its call id, when it started and whether it ended — and never a call's arguments, whose text the daemon keeps in no column. It says what the daemon did as well, which is not always a relaunch: where the daemon's wake pacing parked the replacement, the task was taken back and the launch that replaces the stalled process is queued, due at the moment the notice names, and that process runs on until the launch's turn, which may start nothing — a suspension waiting for the claim, a refused lifecycle recheck or the tree's close can end the claim there instead; where a suspension was already waiting for that turn, that suspension ran instead of a replacement and the claim is suspended with nothing queued for it, waiting on a resume; where the launch that replaces the process could not be written, the daemon is still retrying that launch; and where every try at that launch was refused, the claim has failed, and the `worker-died` that comes with it is yours to answer as that row says. It says what became of the stalled process too, for every end but the parked one: that it was stopped, or that the runtime did not confirm the stop, in which case that process may be running still and holding what it runs on — tell the controller of that one, because the daemon stops it again only at its next launch of that claim or at its next restart. No second notice follows any of these unless the daemon restarts while a relaunch is parked, which decides the claim again. The task that worker was serving is still owed to it, and what its return waits on is the one the notice names — the parked launch's turn, the retried launch, or a resume; the stall itself charged the claim nothing, and no phase moved: on every end but the failed one the phase goes on by itself and you start nothing. Your part is to read what the record says the agent was doing and to judge whether that work needs a decision of yours — a call that hung on something the plan did not foresee is one, a turn that comes back and finishes is not. A stall of your own session reaches you the same way, on your own issue; when the stalled claim is a tree's architect, the controller is told of it too. |
|
|
41
43
|
| `held` | Its `role` and `phase` (the phase the issue left), or `phase` with `reason: "escalated"`. Without `reason`, that phase's worker ran out of launches or prompts: the issue is held (phase `held`), the `worker-died` that comes with it is yours to answer with `retry_or_escalate` as that row says, and the controller hears of the hold too. With `reason: "escalated"`, it records your own `escalate`: the controller has the issue now, and you start nothing for it. |
|
|
42
44
|
| `ready-refused` | Its `version` and `reason`, and the `reason` names the gated step the READY waits on. The merger's READY was refused, and its packet is kept with the completion so no second READY is ever needed. With `version` greater than 0, `reason` reads `READY refused: approve design version <N> of the tree's <step> document before requesting READY.`: that step's document is already registered at that version, so get it approved (`skill://legion-architect/references/design-gate.md`), and the daemon advances the merge and posts the kept packet the moment every gated step is open. With `version` 0, `reason` reads `READY refused: no design version of the tree's <step> document is approved; register and approve it before requesting READY.`: that step is not registered yet, so register it and get it approved (`skill://legion-architect/references/design-gate.md`) exactly as above; the daemon releases the kept packet the same way — at registration itself when that opens the step (a deployment that gates no step, or Dispatch already shows the version approved), otherwise the moment a human approves the version you registered. The refusal names the first closed step, in the order the deployment gates them, and no second READY is asked for however many steps were closed: read `gatedSteps` in your own record (the `legion` tool's `read_record`) for every step still closed, and open each one. Nothing else is needed once every gated step is open. On a root whose catch-up said `carried`, the gate is a copy on the old root's spec document: run nothing of `skill://legion-architect/references/design-gate.md` for that step; tell the controller the READY waits on a human's approval of that document, and `carried-gate-opened` follows the approval. A `reason` starting `READY_PACKET_MISSING` names a READY refused before the daemon kept packets: that READY is void and the issue stays in merging, so start it over (`park_child` then `rerun_child`, for a child) or end it. |
|
|
43
45
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: legion-controller
|
|
3
|
-
description: Use when you are a Legion project's controller session, on any controller wake (triage, slot-free, todo, tick, unslotted, awaiting-person, parked-decision, held, worker-died, update-stalled), weekly-plan ranking, backlog stewardship, a clear defect or finding ask a role sends, an issue a person asks you to file, the daily report, an architect's escalation, or a person's message or mention.
|
|
3
|
+
description: Use when you are a Legion project's controller session, on any controller wake (triage, slot-free, todo, tick, unslotted, awaiting-person, parked-decision, held, worker-died, worker-stalled, update-stalled), weekly-plan ranking, backlog stewardship, a clear defect or finding ask a role sends, an issue a person asks you to file, the daily report, an architect's escalation, or a person's message or mention.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Legion Controller
|
|
@@ -73,6 +73,7 @@ Wake details: `skill://legion-controller/references/wakes.md`.
|
|
|
73
73
|
| `parked-decision on <KEY>` | `skill://legion-controller/references/parked-decisions.md#deciding` |
|
|
74
74
|
| `held on <KEY>` | Nothing, unless `reason: "escalated"`: then an escalation |
|
|
75
75
|
| `worker-died on <KEY>` (`role: "architect"`) | Re-admit once its cause is gone, else park it |
|
|
76
|
+
| `worker-stalled on <KEY>` (`role: "architect"`) | Nothing, unless the notice says the claim failed: its turn was ended, its task is still owed, and the notice says what became of its process |
|
|
76
77
|
| `update-stalled on <KEY>` | `skill://legion-controller/references/escalation.md#an-update-round-that-is-not-finishing-update-stalled` |
|
|
77
78
|
| An architect's escalation | `skill://legion-controller/references/escalation.md` |
|
|
78
79
|
| A finding ask's reference, or its answer | `skill://legion-controller/references/finding-asks.md` |
|
|
@@ -11,7 +11,7 @@ which trees run: `admission.trees` does.
|
|
|
11
11
|
| The key is in `admission.active` | An issue holding a slot, a root or a child: a worker of it has work now. A root is here while its architect writes the spec (`admitted`, before its design gate first opens) and in each of its own phases; a child in each of its phases | Nothing, beyond [trees waiting on a root claim](skill://legion-controller/SKILL.md#trees-waiting-on-a-root-claim) |
|
|
12
12
|
| The key is in `admission.trees` | The root of a live tree: its lifecycle stands open and it does not linger, or it waits in the line or on a person. A tree is live whether or not any issue of it holds a slot, so this is the list that says which trees run, and `issues.<KEY>.tree` says which tree an issue stands in | Nothing: read it wherever you need the running trees |
|
|
13
13
|
| The key is in `admission.waiting` and not in `admission.blocked` | An issue waiting for a slot, in the line's own order: first the issues that held a slot and have work again, and the roots a person answered while they waited in `awaiting_person`, oldest first by when the work came back; then the issues whose first phase can start, by the Dispatch rank of their tree's root, and within one root's rank that tree's own issues before the root itself. A root that left another tree (handed over by its finished tree, or admitted as an orphan) waits here as its own root even under a live tree, the old root's return included: no tree adopts it | Nothing: it takes the next free slot by itself |
|
|
14
|
-
| `phase: awaiting_person`, `waitingOn` | A root that already ran and now waits only on a person: an answer to its architect's question (`waitingOn.kind` `ask`) or a review of its spec (`gate`). It holds no slot, its architect stays live to read the person's comments and replies, and its tree stays live. Unanswered, it is in neither `admission.active` nor `admission.waiting`, and only `admission.trees` names its tree; `waitingOn.answeredAt` means the daemon has
|
|
14
|
+
| `phase: awaiting_person`, `waitingOn` | A root that already ran and now waits only on a person: an answer to its architect's question (`waitingOn.kind` `ask`) or a review of its spec (`gate`). It holds no slot, its architect stays live to read the person's comments and replies, and its tree stays live. Unanswered, it is in neither `admission.active` nor `admission.waiting`, and only `admission.trees` names its tree; `waitingOn.answeredAt` means the daemon has put it in `admission.waiting`, among the issues whose work came back, oldest first | Nothing: it is not something to admit, label or park, and the slot it returned is no reason to take an issue ([Free slots](skill://legion-controller/SKILL.md#free-slots)). The daemon delivers the answer task to its architect at that promotion: at once, taking no slot, when the root's design gate has already opened, and at the next free slot while its architect is still writing the first spec. If its label goes or a person or outside session claims it on Dispatch, the daemon sends `unslotted` and does not resume work under another owner |
|
|
15
15
|
| The key is in `admission.blocked` | An issue Legion is waiting to start, with what it waits on: the Dispatch issues of its `blocked_by` links that nobody has finished, or, for a parent, the open children beneath it that children-first holds it for. It takes no slot until they are done, and one that is in the line stands in `admission.waiting` too | Nothing: a link's wait ends when each blocker reaches `done` (a person's close, or the blocker's own merge) or its link is taken off (by a person or the tree's architect), and a children-first wait ends when the last open child leaves the workflow, which is its tree's architect's work. Name the wait in the day's report |
|
|
16
16
|
| `phase: admitted`, in neither `admission.active` nor `admission.waiting`, and Dispatch shows a `child_of` parent | A child that has not started: it runs or waits with its tree, the root its `child_of` chain reaches. Under a root whose `phase` is `done` it waits with it. A labelled `todo` issue here is not in the line either: one whose recorded parent is in a live tree runs in that tree (the daemon adopted it there), or is held with that parent while the parent itself is held under an unreleased child, and one whose parent is not recorded but sits under a live tree is held under an unreleased child of that tree until its architect releases it or its parent. One a person moved to `todo` beneath an ancestor whose reviewed head the daemon has already accepted is held here until that ancestor closes. The unreleased-child hold is not `admission.blocked`, which names blocked-by links and children-first waits | Leave it to its tree. It runs again when its root does, or as a root of its own once it is `todo` with the `legion` label and no live tree is above it |
|
|
17
17
|
| `phase: admitted`, `status: todo`, in neither list, no parent | A root a person took out of the line by taking its label off | Nothing: the label puts it back in the line, and a person's label is their decision |
|
|
@@ -118,6 +118,52 @@ architect's last message on the root issue. When you find none, or it is gone, r
|
|
|
118
118
|
fresh budgets). When it stays, park the tree (`set_status` the root to `backlog`) and say why on
|
|
119
119
|
the issue, because a relaunch would fail the same way.
|
|
120
120
|
|
|
121
|
+
## `worker-stalled on <KEY>` (`{kind: "worker-stalled", role: "architect", reason}`)
|
|
122
|
+
|
|
123
|
+
The daemon's stall backstop acted on a stalled turn of the tree's architect: its agent had not
|
|
124
|
+
stepped for longer than the `worker_stall_backstop_hours` the deployment gives that role, and most
|
|
125
|
+
often the daemon ended the turn and brought the same session back on a new process. You get a copy
|
|
126
|
+
only for a tree's own architect, because every other notice of the tree goes to that architect and
|
|
127
|
+
nobody inside the tree is left to read this one; the architect is told on its issue as well. The
|
|
128
|
+
`reason` is the record the daemon read: when the agent last stepped and how long ago that was, the
|
|
129
|
+
bound it passed, when the turn began, and the last call the daemon saw, with its tool, its call
|
|
130
|
+
id, when it started and whether it ended — never a call's arguments, whose text the daemon keeps
|
|
131
|
+
in no column. It says what the daemon did as well, which is not always a relaunch: where the
|
|
132
|
+
daemon's wake pacing parked the replacement, the task was taken back and the launch that replaces
|
|
133
|
+
the stalled process is queued, due at the moment the notice names; the daemon made no stop of
|
|
134
|
+
that process and the claim records it still. The launch's turn may start nothing, or not the
|
|
135
|
+
launch the park queued — a suspension waiting for the claim, a refused lifecycle recheck, the
|
|
136
|
+
tree's close, a take-back the store refuses at the turn itself, a launch whose own write or start
|
|
137
|
+
the daemon cannot make, and an
|
|
138
|
+
operator's task that runs the launch early are among the things that can change it; where a
|
|
139
|
+
suspension was already waiting for that turn, the suspension ran instead of a replacement and the
|
|
140
|
+
claim is suspended with nothing queued for it, waiting on a resume; where the launch that replaces
|
|
141
|
+
the process has not started, either its write was refused and the daemon retries it at its probe
|
|
142
|
+
interval, or the daemon's own shutdown cut the launch short and the daemon's next start takes it up;
|
|
143
|
+
and where every try at that
|
|
144
|
+
launch was refused, the claim has failed and nothing relaunches it. The notice says which, and no
|
|
145
|
+
second notice follows it: where it names a parked launch, the `wakesWaiting` list of `read_state`
|
|
146
|
+
is what says whether that launch is still waiting its turn.
|
|
147
|
+
|
|
148
|
+
The notice says what became of the stalled process itself, for every end: that the daemon made no
|
|
149
|
+
stop of it and the claim records it still, which is the parked end; that it was stopped; or that
|
|
150
|
+
the runtime did not confirm the stop, in which case that process may be running still and holding
|
|
151
|
+
what it runs on.
|
|
152
|
+
A stop the runtime would not make is a finding to put to a person, with the notice in it, because
|
|
153
|
+
the daemon stops that process again only at its next launch of that claim or at its next restart.
|
|
154
|
+
|
|
155
|
+
Nothing was charged to the claim for the stall itself, and on every end but the failed one
|
|
156
|
+
nothing failed either: the task that architect was serving is still owed to it, and the notice
|
|
157
|
+
names what its return waits on — the parked launch's turn, the retried launch, or a resume — no
|
|
158
|
+
issue was held, and no status moved.
|
|
159
|
+
Do nothing to the tree — park nothing, re-admit nothing, set no status — and start nothing. A
|
|
160
|
+
notice that names the failed end is the exception: that architect's claim is failed, its
|
|
161
|
+
`worker-died` reaches you as any other does, and you answer that notice as its own section says.
|
|
162
|
+
One copy comes per stall, so an architect that stalls again
|
|
163
|
+
and again sends one each time: that is a finding to put to a person
|
|
164
|
+
([Findings](skill://legion-controller/SKILL.md#findings-and-the-issues-you-file)), with the
|
|
165
|
+
records you were sent in it.
|
|
166
|
+
|
|
121
167
|
## `update-stalled on <KEY>` (`{kind: "update-stalled", reason, update}`)
|
|
122
168
|
|
|
123
169
|
An update round over the issue's pod, or over one claim's own process, is not finishing. Handle
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjawhar/claude-envoy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.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": 58
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
package/src/legion-phase-hook.ts
CHANGED
|
@@ -311,7 +311,7 @@ export function writePhaseStallRecord(
|
|
|
311
311
|
* restored here before any hook can be answered.
|
|
312
312
|
*/
|
|
313
313
|
export function createPhaseHookEndpoint(deps: PhaseHookDeps): PhaseHookEndpoint {
|
|
314
|
-
const limits = stallLimits(deps.env, deps.log)
|
|
314
|
+
const limits = stallLimits(deps.env, deps.log, configuredValue(deps.env["LEGION_ROLE"]))
|
|
315
315
|
const restored = readPhaseStallRecord(deps.stateFile, deps.log)
|
|
316
316
|
// The machine's entry and this host's own key are one record, so the last entry written is kept
|
|
317
317
|
// for the write the notice makes.
|