@sjawhar/claude-envoy 2.6.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/AGENTS.md +13 -3
- package/dist/envoy-channel.js +68 -27
- package/legion/skills/legion-architect/SKILL.md +1 -1
- package/legion/skills/legion-architect/references/acceptance.md +49 -52
- package/legion/skills/legion-architect/references/design-gate.md +4 -5
- package/legion/skills/legion-architect/references/wake-routing.md +7 -16
- package/legion/skills/legion-controller/SKILL.md +2 -2
- package/legion/skills/legion-controller/references/admission.md +4 -5
- package/legion/skills/legion-controller/references/backlog-stewardship.md +3 -4
- package/legion/skills/legion-controller/references/escalation.md +8 -7
- package/legion/skills/legion-controller/references/finding-asks.md +1 -1
- package/legion/skills/legion-controller/references/session.md +1 -1
- package/legion/skills/legion-controller/references/slack-mentions.md +1 -1
- package/legion/skills/legion-controller/references/triage.md +1 -1
- package/legion/skills/legion-controller/references/wakes.md +6 -4
- package/legion/skills/legion-retro/SKILL.md +13 -19
- package/legion/skills/legion-worker/SKILL.md +12 -8
- package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +3 -3
- package/legion/skills/legion-worker/references/merge-gate.md +110 -151
- package/legion/skills/legion-worker/references/pr-body.md +15 -14
- package/legion/skills/legion-worker/references/review-threads.md +4 -4
- package/package.json +2 -2
- package/src/legion-phase-hook.ts +25 -11
- package/legion/skills/legion-architect/references/merge-notices.md +0 -104
package/.omp-plugin/plugin.json
CHANGED
package/AGENTS.md
CHANGED
|
@@ -171,9 +171,19 @@ settles the machine: the first reminder of a run comes back as
|
|
|
171
171
|
`{"decision":"block","reason":<the reminder>}`, which Claude Code turns into one more turn of the
|
|
172
172
|
same session, and it is the only one of that run; every later one is written into the session over
|
|
173
173
|
the bridge's inbox from a timer, because a line written while a turn runs is appended to that turn
|
|
174
|
-
and the run would never settle for the daemon. `StopFailure`
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
and the run would never settle for the daemon. `StopFailure` runs instead of `Stop` when the turn
|
|
175
|
+
ended on an API error ("Hooks reference", code.claude.com/docs/en/hooks), and its
|
|
176
|
+
`${last_assistant_message}` is then the error text itself, not what the worker said: that is the
|
|
177
|
+
provider refusing the turn, so the machine takes it as `refused`: it earns no continuation, since
|
|
178
|
+
continuing into another turn at once would only buy another refusal, which is what left
|
|
179
|
+
dispatch://INFRA-264's implementer reminded for ever.
|
|
180
|
+
It does arm one timer, because the task that refused turn carried ended with it and nothing else
|
|
181
|
+
would wake this worker, so one transient refusal would leave the issue idle.
|
|
182
|
+
Claude Code ignores whatever this hook returns, which now costs nothing. What ends a session the provider keeps refusing is the daemon: the bridge reports each
|
|
183
|
+
turn's outcome to `POST /legion/v1/claims/turn-outcome` and the daemon fails the claim once the
|
|
184
|
+
trailing run of refusals reaches `launch_failure_limit`, and the runner's record check then drops
|
|
185
|
+
every reminder, since a failed claim is replaced by a retry in a session of its own.
|
|
186
|
+
`PostToolUse` and `PostToolUseFailure` are the worker
|
|
177
187
|
working, which puts the count back to zero; a non-empty `${agent_id}` is a subagent's
|
|
178
188
|
call and is ignored. `UserPromptSubmit` is this server's only sight of an inbound turn — the
|
|
179
189
|
daemon's task reaches Claude Code's stdin from the bridge, never this process — so it declares the
|
package/dist/envoy-channel.js
CHANGED
|
@@ -52644,7 +52644,6 @@ var LEGION_WORKFLOW_PHASES = [
|
|
|
52644
52644
|
"accepting",
|
|
52645
52645
|
"retro",
|
|
52646
52646
|
"merging",
|
|
52647
|
-
"awaiting_merge",
|
|
52648
52647
|
"integrating",
|
|
52649
52648
|
"done",
|
|
52650
52649
|
"held"
|
|
@@ -52658,7 +52657,6 @@ var LEGION_PHASE_BACKWARD_TARGETS = [
|
|
|
52658
52657
|
"accepting",
|
|
52659
52658
|
"retro",
|
|
52660
52659
|
"merging",
|
|
52661
|
-
"awaiting_merge",
|
|
52662
52660
|
"done",
|
|
52663
52661
|
"held"
|
|
52664
52662
|
];
|
|
@@ -52751,6 +52749,11 @@ var legionClaimView = object({
|
|
|
52751
52749
|
updateReasons: nonEmptyString2.optional(),
|
|
52752
52750
|
providerErrorRun: number2().int().positive().optional(),
|
|
52753
52751
|
pendingTask: legionPendingTaskView.optional(),
|
|
52752
|
+
lastTurnStart: timestamp.optional(),
|
|
52753
|
+
lastTurnEnd: timestamp.optional(),
|
|
52754
|
+
lastDeathCause: nonEmptyString2.optional(),
|
|
52755
|
+
lastStartFailure: nonEmptyString2.optional(),
|
|
52756
|
+
lastReady: timestamp.optional(),
|
|
52754
52757
|
step: legionStepView.optional(),
|
|
52755
52758
|
failure: legionClaimFailureView.optional(),
|
|
52756
52759
|
pendingCause: legionFailureCause.optional()
|
|
@@ -52763,6 +52766,7 @@ var legionPhaseView = object({
|
|
|
52763
52766
|
claim: legionClaimView,
|
|
52764
52767
|
handoffCommit: nonEmptyString2.optional(),
|
|
52765
52768
|
handoffRecord: legionHandoffRecordView.optional(),
|
|
52769
|
+
pass: number2().int().nonnegative(),
|
|
52766
52770
|
rounds: number2().int().nonnegative(),
|
|
52767
52771
|
backwardMoves: record(string2(), number2().int().positive()).optional()
|
|
52768
52772
|
});
|
|
@@ -52771,7 +52775,7 @@ var legionPullRequestView = object({
|
|
|
52771
52775
|
number: number2().int().positive(),
|
|
52772
52776
|
head: nonEmptyString2,
|
|
52773
52777
|
state: _enum2(["open", "merged", "closed"]),
|
|
52774
|
-
|
|
52778
|
+
mergeState: _enum2(["clean", "unstable", "has_hooks", "blocked", "dirty", "behind", "draft", "unknown"]).optional(),
|
|
52775
52779
|
reviewDecision: nonEmptyString2.optional()
|
|
52776
52780
|
});
|
|
52777
52781
|
var legionGateView = object({
|
|
@@ -52949,6 +52953,7 @@ var legionCapabilityState = object({
|
|
|
52949
52953
|
source: _enum2(["configuration", "boot"]).optional()
|
|
52950
52954
|
});
|
|
52951
52955
|
var legionSettings = looseObject({
|
|
52956
|
+
review_round_cap: number2().int().positive(),
|
|
52952
52957
|
worker_boot_timeout_seconds: number2().int().positive()
|
|
52953
52958
|
});
|
|
52954
52959
|
var legionCacheView = object({
|
|
@@ -53022,6 +53027,30 @@ var LegionReadyRequest = strictObject({
|
|
|
53022
53027
|
generation: number2().int().positive(),
|
|
53023
53028
|
capabilities: LegionCapabilityReport.optional()
|
|
53024
53029
|
});
|
|
53030
|
+
var turnOutcomeFields = {
|
|
53031
|
+
generation: number2().int().positive(),
|
|
53032
|
+
sequence: number2().int().positive(),
|
|
53033
|
+
outcome: _enum2(["clean", "refused"]),
|
|
53034
|
+
message: string2().optional()
|
|
53035
|
+
};
|
|
53036
|
+
var LegionTurnOutcomeAgentRequest = strictObject({
|
|
53037
|
+
claimToken: nonEmptyString2,
|
|
53038
|
+
sessionId: nonEmptyString2,
|
|
53039
|
+
secret: nonEmptyString2,
|
|
53040
|
+
...turnOutcomeFields
|
|
53041
|
+
});
|
|
53042
|
+
var LegionTurnOutcomeBootRequest = strictObject({
|
|
53043
|
+
bootToken: nonEmptyString2,
|
|
53044
|
+
...turnOutcomeFields
|
|
53045
|
+
});
|
|
53046
|
+
var LegionTurnOutcomeRequest = union([
|
|
53047
|
+
LegionTurnOutcomeAgentRequest,
|
|
53048
|
+
LegionTurnOutcomeBootRequest
|
|
53049
|
+
]);
|
|
53050
|
+
var LegionTurnOutcomeResponse = object({
|
|
53051
|
+
refusedRun: number2().int().nonnegative(),
|
|
53052
|
+
failed: boolean2()
|
|
53053
|
+
});
|
|
53025
53054
|
var LegionReadyForUpdateRequest = strictObject({
|
|
53026
53055
|
claimToken: nonEmptyString2,
|
|
53027
53056
|
sessionId: nonEmptyString2,
|
|
@@ -53144,6 +53173,11 @@ var LegionOperatorClaimResponse = object({
|
|
|
53144
53173
|
pluginContract: number2().int().nonnegative(),
|
|
53145
53174
|
updateRound: nonEmptyString2.optional(),
|
|
53146
53175
|
updateHead: nonEmptyString2.optional(),
|
|
53176
|
+
lastTurnStart: timestamp.optional(),
|
|
53177
|
+
lastTurnEnd: timestamp.optional(),
|
|
53178
|
+
lastDeathCause: nonEmptyString2.optional(),
|
|
53179
|
+
lastStartFailure: nonEmptyString2.optional(),
|
|
53180
|
+
lastReady: timestamp.optional(),
|
|
53147
53181
|
step: legionStepView.optional(),
|
|
53148
53182
|
failure: legionClaimFailureView.optional()
|
|
53149
53183
|
});
|
|
@@ -53164,9 +53198,7 @@ var LegionGrantResponse = object({
|
|
|
53164
53198
|
expiresAt: timestamp
|
|
53165
53199
|
});
|
|
53166
53200
|
var LegionEmptyResponse = object({});
|
|
53167
|
-
var LegionHandoffCompleteResponse = object({
|
|
53168
|
-
note: nonEmptyString2.optional()
|
|
53169
|
-
});
|
|
53201
|
+
var LegionHandoffCompleteResponse = object({});
|
|
53170
53202
|
var LegionWaveReleaseResponse = object({
|
|
53171
53203
|
released: array(nonEmptyString2),
|
|
53172
53204
|
started: array(issueKey),
|
|
@@ -53186,7 +53218,6 @@ var LegionHandoffCompleteRequest = strictObject({
|
|
|
53186
53218
|
grantId: nonEmptyString2,
|
|
53187
53219
|
summary: nonEmptyString2,
|
|
53188
53220
|
verdict: string2(),
|
|
53189
|
-
ready: boolean2(),
|
|
53190
53221
|
commit: nonEmptyString2.optional(),
|
|
53191
53222
|
handoffId: nonEmptyString2.optional(),
|
|
53192
53223
|
handoffVersion: number2().int().positive().optional(),
|
|
@@ -53420,6 +53451,7 @@ function createLegionDaemonClient(baseUrl, fetchFn = fetch) {
|
|
|
53420
53451
|
ready: (input, options) => acknowledge("/legion/v1/claims/ready", input, options?.signal),
|
|
53421
53452
|
readyForUpdate: (input) => acknowledge("/legion/v1/claims/ready-for-update", input),
|
|
53422
53453
|
exit: (input) => acknowledge("/legion/v1/claims/exit", input),
|
|
53454
|
+
turnOutcome: (input) => post("/legion/v1/claims/turn-outcome", LegionTurnOutcomeRequest, LegionTurnOutcomeResponse, input),
|
|
53423
53455
|
activity: (input) => acknowledge("/legion/v1/claims/activity", input),
|
|
53424
53456
|
releaseRecords: (input) => post("/legion/v1/claims/release-records", LegionReleaseRecordsRequest, LegionReleaseRecordsResponse, input),
|
|
53425
53457
|
grant: (input) => post("/legion/v1/grants", LegionGrantRequest, LegionGrantResponse, input),
|
|
@@ -55933,9 +55965,9 @@ var import_nats2 = __toESM(require_mod4(), 1);
|
|
|
55933
55965
|
|
|
55934
55966
|
// package.json
|
|
55935
55967
|
var name = "@sjawhar/claude-envoy";
|
|
55936
|
-
var version2 = "2.
|
|
55968
|
+
var version2 = "2.7.0";
|
|
55937
55969
|
var legion = {
|
|
55938
|
-
daemonApiVersion:
|
|
55970
|
+
daemonApiVersion: 86
|
|
55939
55971
|
};
|
|
55940
55972
|
|
|
55941
55973
|
// ../pi-shared/src/agent-stream.ts
|
|
@@ -57249,12 +57281,12 @@ async function bootLegionClaim(host) {
|
|
|
57249
57281
|
await host.afterRegister?.(claim);
|
|
57250
57282
|
host.setCapability({
|
|
57251
57283
|
sessionID: host.registration.sessionId,
|
|
57252
|
-
claimToken: claim.claimToken,
|
|
57253
|
-
generation: claim.generation,
|
|
57254
57284
|
tree: claim.tree,
|
|
57255
57285
|
issue: claim.issue,
|
|
57256
57286
|
role: claim.role,
|
|
57257
57287
|
secret: claim.secret,
|
|
57288
|
+
claimToken: claim.claimToken,
|
|
57289
|
+
generation: claim.generation,
|
|
57258
57290
|
promptAgents: claim.promptAgents
|
|
57259
57291
|
});
|
|
57260
57292
|
const ready = {
|
|
@@ -57348,6 +57380,8 @@ function stepPhaseStall(state, input) {
|
|
|
57348
57380
|
return state.state === "closed" ? { state } : { state: { state: "open", count: 0 } };
|
|
57349
57381
|
case "tool-call":
|
|
57350
57382
|
return { state: { state: state.state, count: 0 } };
|
|
57383
|
+
case "refused":
|
|
57384
|
+
return { state };
|
|
57351
57385
|
case "reminded":
|
|
57352
57386
|
return state.state === "closed" ? { state } : { state: { state: "open", count: state.count + 1 } };
|
|
57353
57387
|
case "settle": {
|
|
@@ -57501,6 +57535,14 @@ function createPhaseReminder(deps) {
|
|
|
57501
57535
|
});
|
|
57502
57536
|
return { reminds: false, record };
|
|
57503
57537
|
}
|
|
57538
|
+
const state = record.workers[claim.role]?.claim.state;
|
|
57539
|
+
if (state === "failed") {
|
|
57540
|
+
deps.log.debug("legion: the daemon has failed this claim; no reminder is sent", {
|
|
57541
|
+
issue: claim.issue,
|
|
57542
|
+
role: claim.role
|
|
57543
|
+
});
|
|
57544
|
+
return { reminds: false, record };
|
|
57545
|
+
}
|
|
57504
57546
|
return { reminds: true, record };
|
|
57505
57547
|
};
|
|
57506
57548
|
const tellArchitect = async (record) => {
|
|
@@ -57623,17 +57665,20 @@ function createPhaseReminder(deps) {
|
|
|
57623
57665
|
generation += 1;
|
|
57624
57666
|
advance(input);
|
|
57625
57667
|
},
|
|
57626
|
-
settle: async (
|
|
57668
|
+
settle: async (turn) => {
|
|
57627
57669
|
turnRunning = false;
|
|
57628
57670
|
generation += 1;
|
|
57671
|
+
if (turn.kind === "refused") {
|
|
57672
|
+
advance(turn);
|
|
57673
|
+
continued = false;
|
|
57674
|
+
armReminder(reminderText(""), deps.limits.reminderMs);
|
|
57675
|
+
return;
|
|
57676
|
+
}
|
|
57677
|
+
const text = turn.lastAssistantText;
|
|
57629
57678
|
if (stall.state !== "closed")
|
|
57630
57679
|
lastMessage = text.slice(0, LAST_MESSAGE_LIMIT);
|
|
57631
57680
|
const before = stall.count;
|
|
57632
|
-
const reminder = advance(
|
|
57633
|
-
kind: "settle",
|
|
57634
|
-
lastAssistantText: text,
|
|
57635
|
-
backgroundWork: options?.backgroundWork
|
|
57636
|
-
});
|
|
57681
|
+
const reminder = advance(turn);
|
|
57637
57682
|
if (stall.state === "awaiting-update") {
|
|
57638
57683
|
continued = false;
|
|
57639
57684
|
return;
|
|
@@ -57647,7 +57692,7 @@ function createPhaseReminder(deps) {
|
|
|
57647
57692
|
continued = false;
|
|
57648
57693
|
return;
|
|
57649
57694
|
}
|
|
57650
|
-
if (before !== 0 || continued
|
|
57695
|
+
if (before !== 0 || continued) {
|
|
57651
57696
|
continued = false;
|
|
57652
57697
|
armReminder(reminder, deps.limits.reminderMs);
|
|
57653
57698
|
return;
|
|
@@ -57955,14 +58000,16 @@ function createPhaseHookEndpoint(deps) {
|
|
|
57955
58000
|
stopHookActive: event.stopHookActive ?? "",
|
|
57956
58001
|
backgroundWork
|
|
57957
58002
|
});
|
|
57958
|
-
const reminded = await reminder.settle(
|
|
58003
|
+
const reminded = await reminder.settle({
|
|
58004
|
+
kind: "settle",
|
|
58005
|
+
lastAssistantText: event.lastAssistantMessage ?? "",
|
|
57959
58006
|
backgroundWork
|
|
57960
58007
|
});
|
|
57961
58008
|
await sendActivity(claim, backgroundWork);
|
|
57962
58009
|
return reminded === undefined ? {} : { decision: "block", reason: reminded };
|
|
57963
58010
|
}
|
|
57964
58011
|
case "StopFailure": {
|
|
57965
|
-
await reminder.settle(event.lastAssistantMessage ?? ""
|
|
58012
|
+
await reminder.settle({ kind: "refused", message: event.lastAssistantMessage ?? "" });
|
|
57966
58013
|
return {};
|
|
57967
58014
|
}
|
|
57968
58015
|
case "PostToolUse":
|
|
@@ -58230,7 +58277,6 @@ var PhaseOpArguments = discriminatedUnion("op", [
|
|
|
58230
58277
|
verdict: _enum2(["pass", "pending", "fail"], {
|
|
58231
58278
|
error: "handoff_complete's verdict is pass, pending or fail"
|
|
58232
58279
|
}).optional(),
|
|
58233
|
-
ready: boolean2({ error: "handoff_complete's ready is true or false" }).optional(),
|
|
58234
58280
|
wake_at: nextLook.optional()
|
|
58235
58281
|
}),
|
|
58236
58282
|
operation("request_backward_move", {
|
|
@@ -58274,7 +58320,7 @@ var PHASE_OP_SENTENCES = {
|
|
|
58274
58320
|
requestBackwardMove: "request_backward_move returns an issue to an earlier phase (`to`, `reason`): a phase worker moves its own issue; " + "the tree's architect moves an issue in accepting, named by `issue`, back to implementing or testing, which counts a review round. "
|
|
58275
58321
|
};
|
|
58276
58322
|
function legionToolDescription(host) {
|
|
58277
|
-
return "Perform the workflow operation the Legion daemon assigned this role. The daemon advances phases; this tool cannot spawn workers. " + (host.before ?? "") + "handoff_complete (phase workers and sub-architects; the daemon accepts a completion only from the role working the issue's current phase, " + "and the checking role's report on a look of its closed issue's production check) reports this phase complete: `summary` (two sentences for " + "
|
|
58323
|
+
return "Perform the workflow operation the Legion daemon assigned this role. The daemon advances phases; this tool cannot spawn workers. " + (host.before ?? "") + "handoff_complete (phase workers and sub-architects; the daemon accepts a completion only from the role working the issue's current phase, " + "and the checking role's report on a look of its closed issue's production check) reports this phase complete: `summary` (two sentences for the " + "architect), `verdict` pass|fail from the tester alone on a phase completion (the daemon refuses a verdict from " + "any other role there) and pass|pending|fail on a production check report (pending: production does not carry the merge " + "yet). A planning, implementing, testing or reviewing phase ends with a handoff record on the " + "Dispatch issue: write it with `dispatch handoff-write --issue <issue> --phase <plan|implement|test|review> --body-file <file>` before " + "calling. This call reads the phase's newest record from Dispatch and reports it; the implementer's round also reports the commit " + "`legion/<issue>@origin` names, so push the branch first; retro and the merger's completion report the commit the workspace stands on. It " + "refuses, posting nothing, a phase with no record, a Dispatch that does not answer, or an implementer's `@-` not yet on " + "`legion/<issue>@origin`, each naming the remedy. A production check report " + "(the task whose first line is `Production check of <KEY>`, handed once the merge closed the issue to the role the check records) needs no " + "handoff and no commit: it carries its verdict and summary alone. A pending report also names `wake_at`, an RFC 3339 time: when you want the " + "next look. A pass, a fail, and a pending on the check's last look end the check, so none of them carries `wake_at` " + "(CHECK_WAKE_UNEXPECTED), and a pending on any other look is refused without one (CHECK_WAKE_REQUIRED). A report on an issue whose check is " + "closed or never opened is refused (CHECK_NOT_OPEN), and so is one from a role the check does not record (CHECK_ROLE_MISMATCH). " + "The daemon refuses " + "HANDOFF_SESSION_MISMATCH (another session wrote the record), HANDOFF_NOT_NEW (the record is the one you named for your previous phase: " + "write this phase's handoff), " + "HANDOFF_STALE_ASSIGNMENT (the issue left your phase and came back while your turn ran, so this completion is of the assignment before the one " + "the phase hands you now: end the turn without completing; the task of the assignment it hands you now is work of its own, so do that work and " + "complete it with a handoff of its own, never this record or verdict again), the implementer's completion of implementing with no open " + "pull request on `legion/<issue>` and none recorded " + "merged (HANDOFF_NO_PULL_REQUEST: open it; one naming a closed pull request is the architect's to decide); a refused completion changed " + "nothing, so fix what it names and complete again. " + "ready_for_update answers the daemon's update task on this issue's pod: `round` is the round id that task names, and the " + "daemon takes your answer for that round alone. Push every commit you want kept to the issue branch " + "first, because the pod and its disk are replaced after every worker of the pod has answered. The call ends no phase. The " + "daemon holds your next task until your process comes back on the new pod, in this same session. " + (host.after ?? "") + `What a later phase needs goes in your handoff; a question for another live role goes to its role topic with ${host.envoyPublish}.`;
|
|
58278
58324
|
}
|
|
58279
58325
|
async function mintClaimGrant(daemon, claim) {
|
|
58280
58326
|
const { grantId } = await daemon.grant({
|
|
@@ -58444,9 +58490,6 @@ async function completeHandoff(runtime, args) {
|
|
|
58444
58490
|
if (args.verdict === undefined) {
|
|
58445
58491
|
throw new Error("handoff_complete on a production check names a verdict of pass, pending or fail");
|
|
58446
58492
|
}
|
|
58447
|
-
if (args.ready === true) {
|
|
58448
|
-
throw new Error("handoff_complete on a production check is no READY: leave ready out");
|
|
58449
|
-
}
|
|
58450
58493
|
if (claim.role !== check.role) {
|
|
58451
58494
|
throw new Error(`${claim.issue}'s production check is the ${check.role}'s, and this session is the ${claim.role}'s: only the role the check records reports on it`);
|
|
58452
58495
|
}
|
|
@@ -58462,7 +58505,6 @@ async function completeHandoff(runtime, args) {
|
|
|
58462
58505
|
grantId: await mintClaimGrant(daemon, claim),
|
|
58463
58506
|
summary: args.summary,
|
|
58464
58507
|
verdict: args.verdict ?? "",
|
|
58465
|
-
ready: false,
|
|
58466
58508
|
...args.wake_at === undefined ? {} : { wakeAt: args.wake_at }
|
|
58467
58509
|
});
|
|
58468
58510
|
}
|
|
@@ -58477,7 +58519,6 @@ async function completeHandoff(runtime, args) {
|
|
|
58477
58519
|
grantId: await mintClaimGrant(daemon, claim),
|
|
58478
58520
|
summary: args.summary,
|
|
58479
58521
|
verdict: args.verdict ?? "",
|
|
58480
|
-
ready: args.ready ?? false,
|
|
58481
58522
|
...report
|
|
58482
58523
|
});
|
|
58483
58524
|
}
|
|
@@ -44,7 +44,7 @@ An answered root stands in the admission line until the pass that resumes it, an
|
|
|
44
44
|
- Release every child as soon as it is filed, each with `--blocked-by` the issues it waits on, and never hold a release back for a close: a released child, held or running, keeps the root's close waiting, but once the root's own pull request has merged the root closes the moment its last released child leaves, and a child released after that finds no live tree and runs as an orphan root of its own.
|
|
45
45
|
- On each `child-closed`, read the child's handoff. Edit the spec of each open child the result changes, and take out each child it makes unneeded with `park_child` and say why with `dispatch comment`.
|
|
46
46
|
- Before you park a child for good (one made unneeded, or parked so its tree can finish), set the `--blocked-by` list of each sibling that waits on it again without it (one call with the rest of its list, or `--clear-blocked-by` when it was the only one), or park that sibling too: a parked child is stopped, not done, and its dependents stay held with no notice. A park followed by `rerun_child` keeps its dependents' links: they wait through the rerun and start when the rerun's merge closes the child.
|
|
47
|
-
- A released child takes an admission slot of its own when the daemon starts its first phase and keeps it until it is done
|
|
47
|
+
- A released child takes an admission slot of its own when the daemon starts its first phase and keeps it until it is done or leaves the workflow, and it waits in the admission line until the daemon starts it, so a tree of four started issues holds four of the cap's issues. It never becomes a root while your tree is live.
|
|
48
48
|
|
|
49
49
|
## 3. Children complete
|
|
50
50
|
|
|
@@ -106,55 +106,53 @@ The daemon keeps this order from its fixed table; you start none of its steps:
|
|
|
106
106
|
2. The reviewer's approval of the head by SHA moves the issue to `accepting`; your `sign_off` moves
|
|
107
107
|
it to `retro`.
|
|
108
108
|
3. Retro records what the work taught as a `dispatch comment` on the issue and brings the PR body
|
|
109
|
-
up to date. It commits nothing, so the approved head is the head
|
|
110
|
-
a handoff onto the default branch, since
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
5. The merge lands under the repository's rules and closes the issue; a
|
|
124
|
-
the rest of its tree has left the workflow.
|
|
109
|
+
up to date. It commits nothing, so the approved head is the head the merger merges. No merge
|
|
110
|
+
carries a handoff onto the default branch, since every handoff is a record on the Dispatch
|
|
111
|
+
issue and no commit carries one.
|
|
112
|
+
4. The merger reads the pull request and merges that head itself, as the implement App and with the
|
|
113
|
+
head it read as the head GitHub must match
|
|
114
|
+
(`gh pr merge <n> --squash --match-head-commit <head> --subject '<pull request title> (#<n>)' --body ''`,
|
|
115
|
+
whose explicit message keeps GitHub's default squash message from joining the branch's commit
|
|
116
|
+
messages onto the base; or `expectedHeadOid` on a
|
|
117
|
+
merge-queue base, where it enqueues the pull request); it never turns auto-merge on, and the
|
|
118
|
+
daemon submits no merge and changes no merge setting. The repository's required reviews and
|
|
119
|
+
checks decide when it lands; Legion neither reads nor writes those rules, and a review only a
|
|
120
|
+
person can give is waited for, never bypassed. Nothing compares that head with the approved one:
|
|
121
|
+
a repository that wants a later push reviewed says so in its own rulesets. The merger's
|
|
122
|
+
completion records its phase row and moves nothing, and the daemon posts no packet.
|
|
123
|
+
5. The merge lands under the repository's rules, the daemon reads it and closes the issue; a
|
|
124
|
+
root's close waits until the rest of its tree has left the workflow.
|
|
125
125
|
|
|
126
126
|
A person's request after your sign-off is a requirement of this issue, filed nowhere else: in
|
|
127
|
-
`retro` or `merging` the role holding the phase makes the `request_backward_move
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
and you tell it which; from `accepting` you send an issue back only to `implementing` or
|
|
127
|
+
`retro` or `merging` the role holding the phase makes the `request_backward_move`.
|
|
128
|
+
A merge the merger cannot make arrives while the merger holds `merging`, so the merger makes the
|
|
129
|
+
move and you tell it which; from `accepting` you send an issue back only to `implementing` or
|
|
131
130
|
`testing`.
|
|
132
131
|
|
|
133
132
|
- A failed verification the merger reports: handle it as the `pr-blocked` row of
|
|
134
133
|
`skill://legion-architect/references/wake-routing.md` says, telling the merger to move the
|
|
135
134
|
issue back with `request_backward_move`, naming what failed; never bypass.
|
|
136
|
-
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
- A merge GitHub refuses for a repository setting or an App permission — a merge-queue base whose
|
|
136
|
+
`squash_merge_commit_message` joins the branch's commit messages among them: the merger tells
|
|
137
|
+
you, and only a person can change it. Ask one with `dispatch ask`, naming the pull request, the
|
|
138
|
+
head and GitHub's refusal; never bypass a rule.
|
|
139
139
|
|
|
140
140
|
## A conflicting head
|
|
141
141
|
|
|
142
|
-
What returns the tree to review is a changed diff: a
|
|
143
|
-
|
|
144
|
-
a conflict-resolution merge whose fingerprint (the unchanged-diff check,
|
|
142
|
+
What returns the tree to review is a changed diff: a conflict-resolution merge whose
|
|
143
|
+
fingerprint (the unchanged-diff check,
|
|
145
144
|
`skill://legion-worker/references/conflicts-and-rewrites.md`) differs from the approved head's.
|
|
146
|
-
A conflict merge whose fingerprint is unchanged does not
|
|
145
|
+
A conflict merge whose fingerprint is unchanged does not, and no Legion check compares the head
|
|
146
|
+
that merges with the approved one: a repository that wants a later push reviewed says so in its
|
|
147
|
+
own rulesets.
|
|
147
148
|
|
|
148
149
|
Make a conflict-resolution merge only when GitHub reports `CONFLICTING`
|
|
149
|
-
(`gh pr view <n> --json mergeable,mergeStateStatus`).
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
- In `awaiting_merge`, do nothing: the daemon withdraws the READY and sends the issue back to
|
|
156
|
-
`implementing` itself, telling you with a `checks-red` whose reason reads
|
|
157
|
-
`the head conflicts with <base>`.
|
|
150
|
+
(`gh pr view <n> --json mergeable,mergeStateStatus`). From `testing`, `reviewing`, `accepting`,
|
|
151
|
+
`retro` and `merging` alike the daemon acts on it itself: it moves the issue back to
|
|
152
|
+
`implementing`, starts the implementer, and tells you with a `checks-red` notice naming the phase
|
|
153
|
+
the issue was taken out of and whose reason reads
|
|
154
|
+
`the head conflicts with <base>: GitHub runs no checks on it; merge <base> forward`. You start
|
|
155
|
+
nothing for it.
|
|
158
156
|
|
|
159
157
|
The daemon then runs the phases from `implementing`: the implementer merges the bookmark forward
|
|
160
158
|
with the destination and pushes it (the procedure in
|
|
@@ -162,7 +160,7 @@ with the destination and pushes it (the procedure in
|
|
|
162
160
|
fingerprints; the tester re-runs the bare gates only and the class search of every earlier
|
|
163
161
|
round's findings at the new head; the reviewer approves the new head by SHA, or continues its
|
|
164
162
|
round if it had not approved; the daemon carries the issue through your acceptance and retro to
|
|
165
|
-
the merger's
|
|
163
|
+
the merger's merge.
|
|
166
164
|
|
|
167
165
|
## A review thread GitHub will not resolve
|
|
168
166
|
|
|
@@ -171,17 +169,18 @@ thread with plain `gh`: the ones it answers and the bot threads the reviewer acc
|
|
|
171
169
|
it. The reviewer resolves none. If the implementer reports that GitHub refused its
|
|
172
170
|
`resolveReviewThread`, open a `dispatch ask` naming the thread's id or URL and GitHub's message, for
|
|
173
171
|
a human to resolve it by hand, with options for resolved / could not. The merger does not complete
|
|
174
|
-
while that ask is open;
|
|
172
|
+
while that ask is open; the merge itself checks no thread state
|
|
175
173
|
(`skill://legion-worker/references/merge-gate.md`).
|
|
176
174
|
|
|
177
175
|
## The close
|
|
178
176
|
|
|
179
|
-
The merge closes the issue:
|
|
180
|
-
|
|
177
|
+
The merge closes the issue: the daemon reads the merged pull request — from GitHub's webhook or
|
|
178
|
+
from its own read of the issue — and writes `done`. An issue that reaches `merging` on a pull
|
|
179
|
+
request GitHub has already merged closes at once.
|
|
181
180
|
|
|
182
181
|
- A root whose merge lands while another issue of its tree is still in the workflow stays in
|
|
183
|
-
`
|
|
184
|
-
is done or parked. One
|
|
182
|
+
`merging`, its workers kept and live and its admission slot kept with them, until the last of
|
|
183
|
+
them is done or parked. One
|
|
185
184
|
`pr-merged` notice names what it waits for and none follows as they depart, so read the pull
|
|
186
185
|
request on GitHub.
|
|
187
186
|
- A child's close reaches you as `child-closed`. Where the project's `production_check` names the
|
|
@@ -213,9 +212,9 @@ waits in the line for a slot and for any unfinished blocker, and its architect s
|
|
|
213
212
|
root and registers its own spec. Only a child that finished, was parked or was never released
|
|
214
213
|
stays. The child stays its own tree; reopening the old root does not take it back. Park a child
|
|
215
214
|
with `park_child` before then when its work should stop with the root. A root that is parked
|
|
216
|
-
rather than closed hands over only a child
|
|
217
|
-
since the daemon re-admits no parked root and only that child's own
|
|
218
|
-
|
|
215
|
+
rather than closed hands over only a child in `merging` whose pull request is still open,
|
|
216
|
+
since the daemon re-admits no parked root and only that child's own merger, started again under
|
|
217
|
+
its own tree, merges that head; park that child too when its merge should wait with the root.
|
|
219
218
|
|
|
220
219
|
If you are that child's architect:
|
|
221
220
|
|
|
@@ -223,24 +222,22 @@ If you are that child's architect:
|
|
|
223
222
|
or ask for approval again.
|
|
224
223
|
- It says `handed_over` alone (no gate to carry): your workers already run their phases, so
|
|
225
224
|
decompose nothing, and read the root's phase from the catch-up (for a root `held`, the phase its
|
|
226
|
-
`held` notice names). Before
|
|
227
|
-
|
|
225
|
+
`held` notice names). Before the merge, register your spec with `register_gate`: the tree's
|
|
226
|
+
work starts on its approval.
|
|
228
227
|
That registration's approval request waits with the person like any other, but it starts no wait of the root's own: a root your catch-up calls `handed_over` stands at a phase it carried, never `admitted`, and only a root at `admitted` waits on a person.
|
|
229
228
|
The section below is for a root of your own at `admitted`, not for this one.
|
|
230
229
|
When that `design-approved` arrives, release and start
|
|
231
230
|
nothing: the workers are already running. A child carried in `accepting` is yours to accept. In
|
|
232
|
-
`
|
|
233
|
-
the root to `implementing` makes its next READY read the gate again, so a later `ready-refused`
|
|
234
|
-
is when you register.
|
|
231
|
+
`merging` the work is already through every gate, so register none.
|
|
235
232
|
|
|
236
233
|
## Your slot while a person has your spec
|
|
237
234
|
|
|
238
235
|
This is for a root of your own standing at `admitted`, the only phase from which a root waits on a person.
|
|
239
236
|
A registration that leaves the approval request with the person moves your root to `awaiting_person`, and what brings the root back is the answer, not the registration.
|
|
240
|
-
Your root keeps its admission slot throughout: it holds the slot the daemon gave it at its start until it is done
|
|
237
|
+
Your root keeps its admission slot throughout: it holds the slot the daemon gave it at its start until it is done or leaves the workflow.
|
|
241
238
|
So your resume takes no slot and comes however full the cap is, whether or not the gate has ever opened in this generation.
|
|
242
239
|
The first phase that resume starts needs no slot of its own either, since the root holds one: 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.
|
|
243
|
-
A changes request, or a newer version of the document that hands the request back to you, leaves the gate closed, so
|
|
240
|
+
A changes request, or a newer version of the document that hands the request back to you, leaves the gate closed, so it holds the tree's work until a new approval.
|
|
244
241
|
While your answered root stands in the line, your record carries `waitingLine`: your place in the line and its length, your `part` (`returned`) and `kind` (`answered`), your `partPlace` of `partLength` among the issues whose work came back, `holdsSlot` true because your root has held its slot since its start, `since`, the moment your work came back, and `reason`, the daemon's own sentence for that place.
|
|
245
242
|
An issue that has not started carries `rootRank`, `ownRank` and `rootKey` in place of `since`, the two Dispatch ranks that placed it and the key of its tree root.
|
|
246
243
|
`why` beside it says why any issue of your tree is not working now, in one word and one sentence: `claim_stopped`, a claim nothing will wake; `waiting`, this line; `blocked`, a Dispatch link or an open child below it; `unlisted`, an issue the record holds in the workflow that no admission list places.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# The root spec and the design gate
|
|
2
2
|
|
|
3
3
|
Part of `skill://legion-architect`, section 1. Read it before you write the root spec, before any
|
|
4
|
-
edit to an approved root spec, and on `design-approved
|
|
5
|
-
`ready-refused`.
|
|
4
|
+
edit to an approved root spec, and on `design-approved` or `design-changes-requested`.
|
|
6
5
|
|
|
7
6
|
## Writing the root spec
|
|
8
7
|
|
|
@@ -264,7 +263,7 @@ Dispatch shows the request back on your turn. While the root waits on a question
|
|
|
264
263
|
human's approval or changes request of the spec answers that wait too, and the task says how the
|
|
265
264
|
spec stands. Your resume takes no slot, whether or not the gate opened, because the root holds
|
|
266
265
|
one all along: an issue keeps its admission slot from the moment the daemon starts it
|
|
267
|
-
until it is done
|
|
266
|
+
until it is done or leaves the workflow. The answered root stands in
|
|
268
267
|
the admission line until the pass that resumes it, and nothing is sent to you about that wait:
|
|
269
268
|
your record's `waitingLine` gives the live place in the line and the line's length, and beside
|
|
270
269
|
them the line's own fields — `part` and `kind`, `partPlace` of `partLength` inside that part,
|
|
@@ -317,8 +316,8 @@ to the version it writes. Once they have answered:
|
|
|
317
316
|
changed since the earlier approval, then the reviews' sentence (the card shows `Approved at
|
|
318
317
|
version N on <date> by <who>.`, and its `Show diff` control carries the detail). The rewrite
|
|
319
318
|
closes the gate until they approve. Release no further child until the `design-approved` after
|
|
320
|
-
it; work already in flight, including what the daemon started at the answer, continues
|
|
321
|
-
|
|
319
|
+
it; work already in flight, including what the daemon started at the answer, continues through
|
|
320
|
+
its merge.
|
|
322
321
|
|
|
323
322
|
A settled decision is the human's. A plan that would overturn one goes back to the planner with the
|
|
324
323
|
decision kept, unless the planner brings evidence the human did not weigh that would change it
|