@sjawhar/claude-envoy 1.23.0 → 1.24.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 +39 -9
- package/legion/skills/legion-architect/references/acceptance.md +6 -3
- package/legion/skills/legion-architect/references/merge-notices.md +13 -6
- package/legion/skills/legion-architect/references/wake-routing.md +2 -1
- package/legion/skills/legion-controller/SKILL.md +2 -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,
|
|
@@ -52477,7 +52488,8 @@ var LegionOperatorClaimResponse = object({
|
|
|
52477
52488
|
suspensionHeld: literal(true).optional(),
|
|
52478
52489
|
pluginContract: number2().int().nonnegative(),
|
|
52479
52490
|
updateRound: nonEmptyString.optional(),
|
|
52480
|
-
updateHead: nonEmptyString.optional()
|
|
52491
|
+
updateHead: nonEmptyString.optional(),
|
|
52492
|
+
step: legionStepView.optional()
|
|
52481
52493
|
});
|
|
52482
52494
|
var legionPodUpdateRounds = object({
|
|
52483
52495
|
swept: boolean2(),
|
|
@@ -55262,9 +55274,9 @@ var import_nats2 = __toESM(require_mod4(), 1);
|
|
|
55262
55274
|
|
|
55263
55275
|
// package.json
|
|
55264
55276
|
var name = "@sjawhar/claude-envoy";
|
|
55265
|
-
var version2 = "1.
|
|
55277
|
+
var version2 = "1.24.0";
|
|
55266
55278
|
var legion = {
|
|
55267
|
-
daemonApiVersion:
|
|
55279
|
+
daemonApiVersion: 57
|
|
55268
55280
|
};
|
|
55269
55281
|
|
|
55270
55282
|
// ../pi-shared/src/agent-stream.ts
|
|
@@ -56824,6 +56836,10 @@ async function withBound(work, ms) {
|
|
|
56824
56836
|
clearTimeout(timer);
|
|
56825
56837
|
}
|
|
56826
56838
|
}
|
|
56839
|
+
function architectLive(record) {
|
|
56840
|
+
const architect = record?.architect;
|
|
56841
|
+
return architect !== undefined && architect.state !== "retired" && architect.state !== "failed";
|
|
56842
|
+
}
|
|
56827
56843
|
function createPhaseReminder(deps) {
|
|
56828
56844
|
const boundMs = deps.recordBoundMs ?? RECORD_READ_BOUND_MS;
|
|
56829
56845
|
let stall = { state: "closed", count: 0 };
|
|
@@ -56909,7 +56925,7 @@ function createPhaseReminder(deps) {
|
|
|
56909
56925
|
const phase = record?.phase ?? "unknown";
|
|
56910
56926
|
const reminders = stall.count;
|
|
56911
56927
|
try {
|
|
56912
|
-
const live = record
|
|
56928
|
+
const live = architectLive(record);
|
|
56913
56929
|
const topic = ROLE_TOPIC_PREFIX + roleToken(deps.project ?? "", live ? claim.issue : claim.tree, "architect");
|
|
56914
56930
|
const answer = await publish({
|
|
56915
56931
|
topic,
|
|
@@ -57094,8 +57110,19 @@ var DEFAULT_STALL_LIMITS = {
|
|
|
57094
57110
|
reminderMs: 300000,
|
|
57095
57111
|
waitingMs: 900000,
|
|
57096
57112
|
resumeMs: 120000,
|
|
57097
|
-
architectAfter: 3
|
|
57113
|
+
architectAfter: 3,
|
|
57114
|
+
callGraceMs: 300000,
|
|
57115
|
+
callBoundMs: 3600000,
|
|
57116
|
+
stepMs: 120000
|
|
57098
57117
|
};
|
|
57118
|
+
var LONG_CALL_BOUND_MS = 14400000;
|
|
57119
|
+
var LONG_CALL_BOUND_ROLES = [
|
|
57120
|
+
"implementer",
|
|
57121
|
+
"reviewer"
|
|
57122
|
+
];
|
|
57123
|
+
function defaultCallBoundMs(role) {
|
|
57124
|
+
return role !== undefined && LONG_CALL_BOUND_ROLES.includes(role) ? LONG_CALL_BOUND_MS : DEFAULT_STALL_LIMITS.callBoundMs;
|
|
57125
|
+
}
|
|
57099
57126
|
function integerSetting(env, log, name, fallback, least) {
|
|
57100
57127
|
const raw = env[name];
|
|
57101
57128
|
if (raw === undefined)
|
|
@@ -57109,12 +57136,15 @@ function integerSetting(env, log, name, fallback, least) {
|
|
|
57109
57136
|
}
|
|
57110
57137
|
return value;
|
|
57111
57138
|
}
|
|
57112
|
-
function stallLimits(env, log) {
|
|
57139
|
+
function stallLimits(env, log, role) {
|
|
57113
57140
|
return {
|
|
57114
57141
|
reminderMs: integerSetting(env, log, "LEGION_STALL_REMINDER_MS", DEFAULT_STALL_LIMITS.reminderMs, 0),
|
|
57115
57142
|
waitingMs: integerSetting(env, log, "LEGION_STALL_WAITING_MS", DEFAULT_STALL_LIMITS.waitingMs, 0),
|
|
57116
57143
|
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)
|
|
57144
|
+
architectAfter: integerSetting(env, log, "LEGION_STALL_ARCHITECT_AFTER", DEFAULT_STALL_LIMITS.architectAfter, 2),
|
|
57145
|
+
callGraceMs: integerSetting(env, log, "LEGION_STALL_CALL_GRACE_MS", DEFAULT_STALL_LIMITS.callGraceMs, 0),
|
|
57146
|
+
callBoundMs: integerSetting(env, log, "LEGION_STALL_CALL_BOUND_MS", defaultCallBoundMs(role), 0),
|
|
57147
|
+
stepMs: integerSetting(env, log, "LEGION_STALL_STEP_MS", DEFAULT_STALL_LIMITS.stepMs, 0)
|
|
57118
57148
|
};
|
|
57119
57149
|
}
|
|
57120
57150
|
|
|
@@ -57246,7 +57276,7 @@ function writePhaseStallRecord(file, entry, recreatedNoticeSent, log) {
|
|
|
57246
57276
|
}
|
|
57247
57277
|
}
|
|
57248
57278
|
function createPhaseHookEndpoint(deps) {
|
|
57249
|
-
const limits = stallLimits(deps.env, deps.log);
|
|
57279
|
+
const limits = stallLimits(deps.env, deps.log, configuredValue(deps.env["LEGION_ROLE"]));
|
|
57250
57280
|
const restored = readPhaseStallRecord(deps.stateFile, deps.log);
|
|
57251
57281
|
let entry = restored.entry ?? { state: "closed", count: 0, reported: false };
|
|
57252
57282
|
let recreatedNoticeSent = restored.recreatedNoticeSent;
|
|
@@ -82,11 +82,14 @@ Then, in one turn:
|
|
|
82
82
|
2. `request_backward_move` to `implementing`, with the reason "Last round: merge the default
|
|
83
83
|
branch your addressing line names into the branch, push, end your forward-merge comment with
|
|
84
84
|
`parent's last round: full test round`, and complete." Never use a hard-coded `main`. The move
|
|
85
|
-
counts a review round
|
|
85
|
+
counts a review round, or a conflict round, which `review_round_cap` leaves out, where the
|
|
86
|
+
record holds the head conflicting with its base.
|
|
86
87
|
|
|
87
88
|
While the parent waits in `accepting`, a conflict on its head or a child's merge needs no move of
|
|
88
|
-
its own: the last round's forward merge resolves them all, so spend no backward move per child
|
|
89
|
-
|
|
89
|
+
its own: the last round's forward merge resolves them all, so spend no backward move per child.
|
|
90
|
+
A move for a child's merge counts toward `review_round_cap`, since the record holds no conflict on
|
|
91
|
+
the head to leave it out; a move for a conflict the record does hold is left out, and still costs
|
|
92
|
+
the implementer a forward merge the last round makes anyway.
|
|
90
93
|
|
|
91
94
|
A criterion proven on a deployed system is proven after that child's deploy, as the repository's
|
|
92
95
|
deploy skill says.
|
|
@@ -41,12 +41,19 @@ the merge, which GitHub names as the actor of its own disables; then what was re
|
|
|
41
41
|
reason (`manual`, `merge_conflict`, `manually_disabled`, `merge_commit_blocked`, …), when, and
|
|
42
42
|
READY's head. It was not a failed merge, which comes as a `checks-red` instead. The daemon submits
|
|
43
43
|
that merge no further, so the removal stands, and the issue stays in `awaiting_merge`. Read the
|
|
44
|
-
pull request on GitHub.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
pull request on GitHub.
|
|
45
|
+
A `merge_conflict` removal reaches you only when the head conflicts with the base itself (GitHub's
|
|
46
|
+
merge state `DIRTY`), when GitHub answered no merge state for five minutes, or when it is the
|
|
47
|
+
second such removal of this head: a conflict with a pull request queued ahead of it, which that
|
|
48
|
+
merge state tells apart, the daemon submits once more at the same head and says so on the issue,
|
|
49
|
+
telling you nothing.
|
|
50
|
+
Where the conflict is on the base, the daemon's own conflict check sends the issue back to
|
|
51
|
+
`implementing` by itself.
|
|
52
|
+
Otherwise ask a person with `dispatch ask` (the one who removed it, when the reason names a person
|
|
53
|
+
rather than GitHub on its own), naming the pull request at READY's head and the reason; that
|
|
54
|
+
person merges or queues it again under the repository's rules when it should land, and the merge
|
|
55
|
+
closes the issue.
|
|
56
|
+
Never bypass a rule.
|
|
50
57
|
|
|
51
58
|
## `merge-waiting`
|
|
52
59
|
|
|
@@ -27,7 +27,7 @@ and 7 (a conflict, the hand-over, the close) is in
|
|
|
27
27
|
| `design-approved` | Its `version` is the approved one, and it names no step: under more than one gated step, read `gatedSteps` in your own record (the `legion` tool's `read_record`) to see which step that version opened and whether another still holds the tree. A human approved the document of one gated step at its current version; that step is open. Proceed to section 2 once every gated step is `approved` — except on a root whose catch-up said `handed_over`: its workers already run their phases, so start nothing; the approval releases any READY the gate refused. One whose `version` is the version a human's own answer to a decision block wrote, after an earlier approval (Dispatch carried that approval to it, "After approval" in `skill://legion-architect/references/design-gate.md`), opens nothing new: carry on, and release no child because of it. A root that was waiting on a question in `awaiting_person` gets no such notice: the task that resumes it says "Your spec is approved at version N and the design gate is open: this resume is your design-approved wake", and that resume is this wake — proceed to section 2 on it. |
|
|
28
28
|
| `design-changes-requested` | Its `version` and `reason`, and no step: under more than one gated step, read `gatedSteps` in your own record (the `legion` tool's `read_record`) and take the step whose `status` is `changes_requested`. A human asked for changes to that step's document at `version`, for `reason`. Revise that document as the reason asks and request approval again as "The armed gate" in `skill://legion-architect/references/design-gate.md` says; end your turn; that step is closed. On a root that was waiting on a question in `awaiting_person`, a review the human gave after the wait began comes in the resume task, not in this notice, whether it answered the wait or came after something else did: the task names the review with its version and reason, unless a later approval superseded it. A `version` below the latest, or a second request for one version, is a request that reached the daemon late: read it as the same section's last paragraph says. Each request arrives once. |
|
|
29
29
|
| `phase-finished` | The daemon has already moved the issue to its next phase by its fixed table and started that phase's role; you start nothing. Read the finishing phase's handoff on the Dispatch issue (`dispatch handoff-read --issue <issue> --phase <word>`); if it shows unresolved gaps, tell the role now working the issue (`envoy_publish` to its role topic). A `planner` notice that names a departure from the spec's design defers to the full condition in "After approval" of `skill://legion-architect/references/design-gate.md`: when the approved Summary, the requirements, the checks, the scope and the settled decisions still hold, the plan is the record; otherwise change the root spec and request approval again as that section says. A `reviewer` notice whose GitHub review is `CHANGES_REQUESTED` needs nothing from you: the daemon has returned the issue to `implementing` (Dispatch `in_progress`) and started the **implementer**, whose correction goes through the tester and the reviewer again, never straight to retro. A `reviewer` notice with an `APPROVED` review means the issue is in `accepting` and the acceptance is yours (section 6): read the evidence, then `sign_off` (a parent only after its last round, "The last round" in `skill://legion-architect/references/acceptance.md`) or send it back with `request_backward_move`. A `tester` notice with `verdict: "fail"` — its handoff carries `implementerProof.verdict: "rejected"`, or a failure naming a check with no current passing result — has gone back to the **implementer** by the daemon's table; never record that check's result from another role. A worker that reports no surface reaches the changed path sends that report instead of completing its phase, so the daemon starts nothing more on that issue and the worker stays idle in its session, not suspended: build the surface in this tree: a child issue (infrastructure, tooling, or a skill) after the red-team check in `skill://legion-architect/references/decomposition.md`, or, when the red team folds it, tell the waiting worker to move the issue back to `implementing` with `request_backward_move`, naming the surface. When it is a child, tell the waiting worker to continue with `envoy_publish` to its role topic once that child's `child-closed` arrives. That report is never a reason to advance the phase. |
|
|
30
|
-
| `pr-blocked` | Its `reason` names the pull request and the `max_fix_attempts` it reached, or reads `Issue reached review_round_cap=<N
|
|
30
|
+
| `pr-blocked` | Its `reason` names the pull request and the `max_fix_attempts` it reached, or reads `Issue reached review_round_cap=<N>: <n> rounds counted, <m> conflict rounds not counted.` (the end of this row). The count is of heads pushed onto a red verdict: no handoff is a commit, so every such push counts except a push by the review App (a planner's, tester's, reviewer's or architect's), and the head pushed onto a red the tester's red tests earned (a planned red) does not count either. Published once per exhausted count, not on every later red verdict for that count. Read the failed CI evidence and recovery attempts. The notice moves nothing, and no later CI red within the attempt that ran the count out (the counted head, and every head pushed on top of it until a push lands on a head CI judged green or on a settled head whose base branch requires no check and no workflow, the tester's red tests onto the held red included) sends the work back from `testing`, `reviewing`, `accepting`, `retro` or `merging` either: the issue stays in its phase until you move it, or a worker's own decision does (a tester's `fail`, a reviewer's request for changes). A head pushed onto green CI, or onto a settled head whose base branch requires no check and no workflow, leaves that attempt, so its red still comes as a `checks-red`. In `implementing`, give the implementer the failing checks (`envoy_publish` to its role topic). In any later phase a worker holds, tell that worker (`envoy_publish` to its role topic) to move the issue back to `implementing` with `request_backward_move`, naming the failing checks, and the daemon starts the implementer. In `accepting`, where no worker holds a phase, the move is yours: `request_backward_move` with `issue`, naming the failing checks. In `awaiting_merge`, where no worker holds a phase and a backward move is refused, open a `dispatch ask` naming the failing checks for the human who merges. Do not treat the blocked PR as final. A `review_round_cap` reason is the implementer's round count instead: every move back to an earlier phase counts one, and a move made while the head conflicts with its base counts as a conflict round the cap leaves out; the notice comes again with each round past the cap. It moves nothing either, since the round that reached the cap has already started its worker. Tell the rounds apart by what announced each: a tester's fail by its `phase-finished` with `verdict: "fail"`; a request for changes by the reviewer's `phase-finished` over a `CHANGES_REQUESTED` review; the daemon's own move by a `checks-red` notice, whose reason names a conflict (`the head conflicts with <base>`), the required checks that failed (`CI is red at <head>`), or the merge queue's failed merge and its failing run (`the merge queue took pull request #<n> out at READY's head …`); a worker's `request_backward_move` by a `phase-finished` from the role that asked, whose reason reaches only the task of the worker the move started, so ask that worker; your own send-back from `accepting` by the reason you gave. The message's `<n> rounds counted` has already left the conflict rounds out, so judge the cap by it. Conflict returns need nothing from you beyond the next round. Tester fails, requests for changes and CI-red returns (a `checks-red` notice is raised for CI only when a required check fails on code the branch pushed, or when the merge queue fails the merge) are the rounds the cap is for. Each `review_round_cap` notice is a decision you make in the turn it wakes, never one left for the next round to make: read what every counted round found, choose one of the three below, act on it in the same turn, and post it as a `dispatch comment` on the issue naming the rounds you read and the choice. **Narrow**: the change itself is sound but each round finds more around it; tell the implementer and the reviewer (`envoy_publish` to each one's role topic) which checks the next round answers, dropping no requirement; a correctness finding is still fixed in this pull request, and so is a wording nit or any clear fix in a file it touches, so the `Fast-follow:` line carries only cleanup in files it does not touch. **Split**: part of the work cannot settle in this pull request. It is a child only when it needs a repository or a deploy order of its own (`skill://legion-architect`, section 1), and then it goes through the red-team check in `skill://legion-architect/references/decomposition.md` and is filed as a child of this issue's parent, never of this one, since this issue closes at its own merge. A requirement moves only to that released child. Work in a repository this tree already has a pull request in is no child and is not parked in `backlog`: write it into the spec of the issue whose pull request carries it, the parent's, or a sibling's when the parent's pull request is in another repository. On the root, open a `dispatch ask` for the part that cannot settle here (`skill://legion-worker/references/findings.md`): it stays this issue's requirement, and this pull request carries it, until the person who answers that ask records that the issue will not deliver it. **Accept the rounds**: each round found less than the one before it, and the last found no defect in the change itself (a stale line, a comment that states an old default); let the loop run and say why in the comment. A later notice is a new decision: accept again only when its round found less than the round you last accepted, and otherwise narrow or split. A finding that changes what the spec requires or what a check proves is a decision block in the root spec ("After approval" in `skill://legion-architect/references/design-gate.md`), and `dispatch ask` is only for a decision that needs a human's authority; neither replaces the choice. Judge a worker's backward move by the reason that worker gives. A move you ordered for a conflict found before `awaiting_merge` ("A conflicting head" in `skill://legion-architect/references/acceptance.md`) is a conflict return. The merger's move back to `reviewing` for a READY refusal (`READY_UNREVIEWED_CHANGE`, or `READY_NOT_APPROVED` when its task names no approved head), and the reviewer's no-fix request for changes that follows it so the tester runs the head, are not the work going in circles either. A move that sends back code found wrong counts with the tester fails. |
|
|
31
31
|
| `pr-merged` | The pull request merged and the issue did not close; its `reason` says why. Merged before the issue reached `awaiting_merge`: the workflow runs on, and the merge closes the issue the moment it gets there, your acceptance and retro first. Merged while the rest of the tree still runs: the reason names the pull request and every issue the close waits for, and the root waits in `awaiting_merge`, its workers kept and live and no admission slot held, until the last of them is done or parked ("The close" in `skill://legion-architect/references/acceptance.md`). Either way you start nothing and no further notice follows. |
|
|
32
32
|
| `pr-closed-unmerged` | Decide from current scope whether the work is reopened, started over (`park_child` then `rerun_child`, for a child), or ended with a reason. Delegate the repository action to the responsible phase worker and keep ownership. |
|
|
33
33
|
| `pull-request-missing` | Its `reason` names the issue, the repository, the branch and the handoff commit: the issue's implementer completed at that commit and GitHub lists no open pull request on the branch, so the issue stays in `implementing`. Tell the implementer (`envoy_publish` to its role topic) to open the pull request from that branch; the daemon records it and moves the issue to `testing` once it is open. When the work should not go on, decide as the `pr-closed-unmerged` row says. It comes once per handoff commit. |
|
|
@@ -38,6 +38,7 @@ and 7 (a conflict, the hand-over, the close) is in
|
|
|
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
39
|
| 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
40
|
| `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. |
|
|
41
|
+
| `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
42
|
| `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
43
|
| `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
44
|
|
|
@@ -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` |
|
|
@@ -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.24.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": 57
|
|
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.
|