@sjawhar/opencode-legion-envoy 3.0.0 → 3.0.2
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/dist/src/server.js
CHANGED
|
@@ -13954,7 +13954,7 @@ var dispatchToolSpecs = [
|
|
|
13954
13954
|
{
|
|
13955
13955
|
name: "dispatch_issue",
|
|
13956
13956
|
example: { project: "DSP", title: "Native workspace" },
|
|
13957
|
-
description: "Create a native Dispatch issue for newly tracked work. Search first with dispatch_search; if potentially duplicate issues exist, this returns 409 POSSIBLE_DUPLICATE unless force is true after reading them. " + `Do not use it when an existing issue already covers the work; read or update that issue instead. ${ISSUE_REFERENCE}`,
|
|
13957
|
+
description: "Create a native Dispatch issue for newly tracked work. Search first with dispatch_search; if potentially duplicate issues exist, this returns 409 POSSIBLE_DUPLICATE unless force is true after reading them. " + "A spec holding an ask block whose body breaks its content rule (one or more question paragraphs, then at most one bullet list of options, last) is refused with 400 INVALID_ASK_BLOCK. " + `Do not use it when an existing issue already covers the work; read or update that issue instead. ${ISSUE_REFERENCE}`,
|
|
13958
13958
|
arguments: (z2) => ({
|
|
13959
13959
|
project: z2.string().describe("Project key for the new issue."),
|
|
13960
13960
|
title: z2.string().describe("Concise issue title."),
|
|
@@ -14200,7 +14200,7 @@ var dispatchToolSpecs = [
|
|
|
14200
14200
|
name: "dispatch_artifact",
|
|
14201
14201
|
example: { issue: "DSP-1", name: "design.md", content: `# Design
|
|
14202
14202
|
` },
|
|
14203
|
-
description: "Attach a local file or inline text as an issue artifact or project document. Do not use it to edit a live document; use " +
|
|
14203
|
+
description: "Attach a local file or inline text as an issue artifact or project document. Do not use it to edit a live document; use " + "dispatch_doc_edit instead. Exactly one of path or content is required; artifacts are limited to 25 MiB. " + "Markdown holding an ask block whose body breaks its content rule (one or more question paragraphs, then at most one bullet list of options, last) is refused with 400 INVALID_ASK_BLOCK; a new version of a document is held to it only for the asks it writes or changes. " + `${OWNER_REFERENCE}`,
|
|
14204
14204
|
arguments: (z2) => ({
|
|
14205
14205
|
issue: z2.string().describe(ISSUE_REFERENCE).optional(),
|
|
14206
14206
|
project: z2.string().describe("Project key for an unlinked document.").optional(),
|
package/package.json
CHANGED
package/skills/dispatch/SKILL.md
CHANGED
|
@@ -688,7 +688,10 @@ its authoritative value at settlement.
|
|
|
688
688
|
|
|
689
689
|
Questions about a document must be `ask` blocks, never an `Open questions` prose section. An ask
|
|
690
690
|
body is one or more question paragraphs followed by an optional bullet list of options, where each
|
|
691
|
-
item is `Label: description`.
|
|
691
|
+
item is `Label: description`. A spec, an uploaded document or an uploaded version holding an ask that
|
|
692
|
+
breaks that shape - a code block, heading or quote in it, a paragraph after its options, a second
|
|
693
|
+
list - is refused with `INVALID_ASK_BLOCK`; so is an edit that writes one. An ask someone left
|
|
694
|
+
unreadable in the browser refuses nothing it is carried through unchanged by. For example:
|
|
692
695
|
|
|
693
696
|
```md
|
|
694
697
|
:::ask{urgency="high" multiple="false"}
|
|
@@ -233,8 +233,7 @@ Preserve this order exactly:
|
|
|
233
233
|
|
|
234
234
|
1. tester green and review cycles complete;
|
|
235
235
|
2. on a clean review, `spawn_worker` the implementer once more to push only the `.legion/`
|
|
236
|
-
deletion
|
|
237
|
-
head. The deletion must land before that approval, which is head-pinned. An implementer
|
|
236
|
+
deletion, then the reviewer approves that head. The deletion must land before that approval, which is head-pinned. An implementer
|
|
238
237
|
completion advances the status only from `in_progress` to `testing`; this push, like retro
|
|
239
238
|
later, leaves the status where it is, so you set nothing by hand — on its `phase-complete`
|
|
240
239
|
wake, `spawn_worker` the reviewer to approve that head (a finished reviewer may already be
|
|
@@ -259,8 +258,8 @@ What returns the tree to review: a changed diff — a commit above the approved
|
|
|
259
258
|
touches anything outside `docs/solutions/`, or a rebase whose fingerprint
|
|
260
259
|
(`skill://legion-worker`'s unchanged-diff check) differs from the approved head's. What does not: retro's
|
|
261
260
|
`docs/solutions/` commit, and a rebase forced by a GitHub-reported conflict whose fingerprint
|
|
262
|
-
is unchanged. For that rebase the order is: the implementer rebases
|
|
263
|
-
fingerprints; the tester re-runs the bare gates only; the reviewer confirms and approves the new
|
|
261
|
+
is unchanged. For that rebase the order is: the implementer rebases, pushes the rebased chain with
|
|
262
|
+
`legion-worker`'s procedure for rewritten commits, and posts the before/after fingerprints; the tester re-runs the bare gates only; the reviewer confirms and approves the new
|
|
264
263
|
head by SHA (or continues its round if it had not approved); the merger republishes READY.
|
|
265
264
|
Retro does not re-run. A rebase happens only when GitHub reports `CONFLICTING`
|
|
266
265
|
(`legion gh -- pr view <n> --json mergeable,mergeStateStatus`); read that on every end-game
|
|
@@ -271,8 +270,9 @@ it. Do not let the merger publish `READY` for an obsolete approval.
|
|
|
271
270
|
If a worker reports that `legion threads resolve` exited 1 naming a review thread GitHub refused
|
|
272
271
|
to resolve, open a `dispatch_ask` that names the thread's URL and GitHub's message for a human to
|
|
273
272
|
resolve it by hand, with options for resolved / could not; the merger does not publish while it
|
|
274
|
-
is open. That is the one review-thread step a human takes: the review App cannot resolve
|
|
275
|
-
and the implementer's and merger's runs of the command
|
|
273
|
+
is open. That is the one review-thread step a human takes: the review App cannot resolve a thread
|
|
274
|
+
on a pull request the implementer opened, and the implementer's and merger's runs of the command
|
|
275
|
+
close every accepted one.
|
|
276
276
|
|
|
277
277
|
## 7. Close
|
|
278
278
|
|
|
@@ -311,7 +311,7 @@ active phase worker.
|
|
|
311
311
|
| `worker-recovered` | Payload `{type:"worker-recovered", issue, role, fromRef, delivery?}`. The worker's tree volume was lost and the daemon replaced it from the committed handoff on `fromRef`. `delivery: "spawned"` means the current assignment was preserved on the new worker; do not resend it. `delivery: "queued"` means that preserved assignment awaits capacity; wait for `worker-started`. Without `delivery`, inspect `.legion/` and the active phase before deciding whether work needs a new assignment. |
|
|
312
312
|
| `pr-ready` | Verify the live PR head, green status, and review state. Continue the review/retro/merger order only for that current head. |
|
|
313
313
|
| `pr-review` | Payload `{type:"pr-review", state, author, body}`. Delivered to whichever role is currently active for the issue, falling back to you when no worker phase is active. Follows the same verdict rule as a reviewer's `phase-complete`: `state: "changes_requested"` sends the implementer back in with the review findings, then tester, then reviewer — never the reviewer again and never retro; that `spawn_worker` returns the issue to `in_progress` on its own (the daemon writes it for a corrective implementer whenever the PR's latest recorded review is changes requested, a human's after approval included), so you set nothing by hand; `state: "approved"` proceeds toward retro (step 5) once the step 6 integration/merge-gate conditions are met. `state: "approved"` on a rebased head whose body names an unchanged fingerprint is that confirmation: proceed to retro if it has not run, otherwise to the merger — never to a second retro or test round. |
|
|
314
|
-
| `pr-blocked` | Payload `{type:"pr-blocked", pr, attempts}`. `attempts` counts heads pushed onto a red verdict that changed something outside `.legion/` — handoff-only pushes (`.legion/` paths only) never count; a push the daemon cannot classify (a listener without `changed_paths`, a list capped at 100, a push listing no commits) does. Published once per exhausted count, not on every later red verdict for that count. Read the failed CI evidence and recovery attempts. Assign a focused implementer or corrective child, then return it through testing and review; do not treat the blocked PR as final. |
|
|
314
|
+
| `pr-blocked` | Payload `{type:"pr-blocked", pr, attempts}`. `attempts` counts heads pushed onto a red verdict that changed something outside `.legion/` — handoff-only pushes (`.legion/` paths only) never count, a push by the review App (a planner's, tester's, reviewer's or architect's) never counts, and the head after a red the tester's red tests earned (a review-App push that changed a path outside `.legion/`, however many handoff-only pushes follow it) does not count either — so after the tester's handoff-only push onto the implementer's red, the implementer's next push does count; a push the daemon cannot classify (a listener without `changed_paths`, a list capped at 100, a push listing no commits) does. Published once per exhausted count, not on every later red verdict for that count. Read the failed CI evidence and recovery attempts. Assign a focused implementer or corrective child, then return it through testing and review; do not treat the blocked PR as final. |
|
|
315
315
|
| `pr-merged` | Payload `{type:"pr-merged", pr, mergeCommitSha}`. The PR merged because a human merged it under the repository's rules. `spawn_worker` the **implementer** with the production-check task naming that merge commit (it resumes the same agent; a retired role has no live holder, so never `envoy_publish` for this). Its `phase-complete` is what brings you to step 7: verify the record on the pull request and this issue first, then sign off naming it and set the issue `done`. A merge is not the close. |
|
|
316
316
|
| `pr-closed-unmerged` | Decide from current scope whether to reopen the work, send a fresh implementer, or cancel it with a reason. Delegate the repository action to the responsible phase worker and keep ownership. |
|
|
317
317
|
| `issue-comment` | Interpret the comment in the issue's design context. Answer it, adjust the plan, or relay it via `envoy_publish` to the responsible worker's role token; scope and product decisions remain with you. |
|
|
@@ -327,6 +327,11 @@ everything else in the tree, or use `dispatch_ask` for a human question; workers
|
|
|
327
327
|
Sami directly with `dispatch_ask` the same way. Do not create a wait loop for any wake
|
|
328
328
|
source.
|
|
329
329
|
|
|
330
|
+
Never yield while waiting on a human. A human is waiting on you only where an open ask sits
|
|
331
|
+
in their inbox, so open it — `dispatch_ask`, or `dispatch_request_approval` for the spec
|
|
332
|
+
gate — before you stop. Otherwise proceed: proceeding is the default, and a stop that waits
|
|
333
|
+
on nobody stalls the tree until someone notices.
|
|
334
|
+
|
|
330
335
|
## Architecture components
|
|
331
336
|
|
|
332
337
|
Bootstrap on a root whose project has an architecture source: in the root's first PR (the implement worker pushes it), write `.dispatch/architecture/<id>.md` files for the planned components — front matter `title`, `parent`, `depends_on`, `external`; no `paths` yet. The importer reads the source branch's head, so the sync and the attach below work only once that PR has merged to the source branch: until then leave the root on `inherit` (the attach would answer `400 COMPONENTS_INPUT`, the component does not exist yet). After the merge, `dispatch_architecture_sync({ project })` and attach the root with `dispatch_issue_update({ issue, components: { mode: "explicit", ids: [...] } })`. Children inherit the root's attachment; give a child its own `components` only when it changes a narrower set, and `{ mode: "none", reason }` when it is not architectural work. Attach before decomposing, and require every implementer to change the component file beside the code it describes in the same review.
|
|
@@ -232,15 +232,9 @@ commit is `plan: record handoff`.
|
|
|
232
232
|
|
|
233
233
|
## Implementer push and pull request
|
|
234
234
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
cd -- "$LEGION_WORKSPACE" && \
|
|
241
|
-
jj -R "$LEGION_WORKSPACE" bookmark set legion/<KEY> && \
|
|
242
|
-
jj -R "$LEGION_WORKSPACE" git push --bookmark legion/<KEY>
|
|
243
|
-
```
|
|
235
|
+
The implementer opens the pull request. After its implementation commit and verification, it
|
|
236
|
+
pushes the issue branch under this exact name with the one push procedure every role uses
|
|
237
|
+
(*Every role pushes its own commits*, below).
|
|
244
238
|
|
|
245
239
|
The provisioned issue workspace configures `credential.helper` with the daemon's absolute
|
|
246
240
|
credential command, so `jj -R "$LEGION_WORKSPACE" git push` authenticates transparently
|
|
@@ -286,7 +280,7 @@ Verified the implementer's proof by <re-running its command | driving the same s
|
|
|
286
280
|
**Fast-follow:** <one named cleanup item and where it will land>, or "none".
|
|
287
281
|
|
|
288
282
|
**Chain:** stacked on <base bookmark> frozen at <sha> / not stacked.
|
|
289
|
-
**Retarget:** Retargeting a pull request to a new base does not re-run Tests; after a retarget, rebase onto the new base and push — the new head runs Tests against the new merge result — and cite that run in the PR body.
|
|
283
|
+
**Retarget:** Retargeting a pull request to a new base does not re-run Tests; after a retarget, record the pushed tip, rebase onto the new base, and push with `legion-worker`'s procedure for rewritten commits — the new head runs Tests against the new merge result — and cite that run in the PR body.
|
|
290
284
|
```
|
|
291
285
|
|
|
292
286
|
**A proof** is the changed behaviour exercised on the surface a user reaches it through, recorded
|
|
@@ -314,9 +308,9 @@ this proof.
|
|
|
314
308
|
`Accepted: not a defect — <reason>`, or `Still open: <what remains>`; nothing else is an
|
|
315
309
|
acceptance, and nobody replies after an `Accepted:` (any later reply that is not itself an
|
|
316
310
|
`Accepted:` — the opener's own follow-up included — leaves the thread open, since the command
|
|
317
|
-
reads only the newest comment). The review App can reply on a thread
|
|
318
|
-
|
|
319
|
-
|
|
311
|
+
reads only the newest comment). The review App can reply on a thread but cannot resolve it:
|
|
312
|
+
GitHub grants resolving a review thread to the pull request's author, and the implementer opens
|
|
313
|
+
every Legion pull request (`packages/daemon/src/daemon/AGENTS.md`, GitHub Apps). So the
|
|
320
314
|
**implementer** runs `legion threads resolve --pr <number> --repo <owner>/<repo>` before every
|
|
321
315
|
push that answers a review (the corrective push and the final `.legion/` deletion push) and
|
|
322
316
|
pastes its output into the `Threads` section. The command resolves each unresolved thread
|
|
@@ -341,7 +335,8 @@ this proof.
|
|
|
341
335
|
tip; post one PR comment (Legion footer):
|
|
342
336
|
`rebase <old-tip-sha> → <new-tip-sha>; fingerprint <before> → <after>; unchanged|changed`.
|
|
343
337
|
Rebase the whole chain — `jj -R "$LEGION_WORKSPACE" rebase -s 'roots(main@origin..@)' -d main@origin` —
|
|
344
|
-
so the tester's and reviewer's commits move with yours.
|
|
338
|
+
so the tester's and reviewer's commits move with yours. Record the pushed tip before it and
|
|
339
|
+
push the rebased chain with the push procedure (*Rewriting pushed commits*, below).
|
|
345
340
|
- **No deferrals.** Sami, 2026-09-11, verbatim: "My rule is no deferrals." The `Fast-follow:`
|
|
346
341
|
field names naming, duplication, or wording cleanup only; anything that changes behaviour,
|
|
347
342
|
hides an error, or breaks a gate lands in this PR.
|
|
@@ -399,8 +394,7 @@ this proof.
|
|
|
399
394
|
Legion footer), and a `comments[]` array of `{path, line, side, body}`, one entry per
|
|
400
395
|
finding — never one `pr review` call per finding (each submission fires a `pr-review` wake).
|
|
401
396
|
Then return the issue to the architect; when clean, have the architect send the implementer
|
|
402
|
-
back to push the `.legion/` deletion
|
|
403
|
-
and approve it by name. After a conflict-forced rebase, compute the fingerprint at the
|
|
397
|
+
back to push the `.legion/` deletion, then review **that** head and approve it by name. After a conflict-forced rebase, compute the fingerprint at the
|
|
404
398
|
`commit_id` of your last submitted review and at the new head. Equal and that review was
|
|
405
399
|
`APPROVE`: submit one more `APPROVE` naming the new head by SHA, its body naming both SHAs
|
|
406
400
|
and the fingerprint — a confirmation, not a round; no thermo pass, no thread pass. Equal and
|
|
@@ -535,29 +529,61 @@ cd -- "$LEGION_WORKSPACE" && \
|
|
|
535
529
|
jj -R "$LEGION_WORKSPACE" split -m "<phase>: record handoff" .legion/<phase>.json
|
|
536
530
|
```
|
|
537
531
|
|
|
538
|
-
**
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
532
|
+
**Every role pushes its own commits.** After the handoff commit — and, for the tester, the red
|
|
533
|
+
tests it wrote — advance the issue bookmark and push it with the provisioned credential helper,
|
|
534
|
+
which authenticates as your role's App (`appRoleForLegionRole` in
|
|
535
|
+
`packages/daemon/src/daemon/github-apps.ts`). `-r @-` puts the bookmark on the commit you just
|
|
536
|
+
split off: the working copy left above it has no description, and `jj git push` refuses a
|
|
537
|
+
commit without one. `--allow-backwards` is for that local step alone: after a split the bookmark
|
|
538
|
+
can sit on the undescribed working copy above `@-`. `--bookmark` also publishes the locally
|
|
539
|
+
provisioned bookmark on its first push — a bookmark not yet tracking a remote one is tracked
|
|
540
|
+
automatically. This is the one push procedure; every push of the issue branch uses it:
|
|
541
|
+
|
|
542
|
+
```bash
|
|
543
|
+
cd -- "$LEGION_WORKSPACE" && \
|
|
544
|
+
tip_file="${TMPDIR:-/tmp}/legion-<KEY>-$LEGION_ROLE-rewritten-tip" && \
|
|
545
|
+
old=$(cat -- "$tip_file" 2>/dev/null || true) && \
|
|
546
|
+
behind=$(jj -R "$LEGION_WORKSPACE" log --no-graph -T 'commit_id.short() ++ "\n"' \
|
|
547
|
+
-r "remote_bookmarks(exact:\"legion/<KEY>\", exact:\"origin\") ~ (::@-${old:+ | $old})") && \
|
|
548
|
+
{ [ -z "$behind" ] || { echo "legion/<KEY>@origin is at $behind, which @- does not descend from" >&2; false; }; } && \
|
|
549
|
+
jj -R "$LEGION_WORKSPACE" bookmark set legion/<KEY> -r @- --allow-backwards && \
|
|
550
|
+
jj -R "$LEGION_WORKSPACE" git push --bookmark legion/<KEY> && \
|
|
551
|
+
rm -f -- "$tip_file"
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
The `behind` check refuses unless `@-` descends from `legion/<KEY>@origin` (or the branch is not
|
|
555
|
+
on GitHub yet). Every issue workspace shares one clone, so another role's push moves
|
|
556
|
+
`legion/<KEY>@origin` here at once. With the flag and no check, `jj git push` then moves the
|
|
557
|
+
remote branch sideways onto your commit and drops theirs (jj 0.45.1:
|
|
558
|
+
`bookmark: legion/K [move sideways from <theirs> to <yours>]`). A clone that has not seen the other
|
|
559
|
+
push is refused by jj itself (`unexpectedly moved on the remote`).
|
|
560
|
+
|
|
561
|
+
**Rewriting pushed commits** — the conflict-forced rebase, the rebase after a retarget, or a
|
|
562
|
+
`jj squash --into` a commit already on GitHub — leaves the pushed tip outside `::@-`, so record
|
|
563
|
+
that tip first, after a fetch and while your chain still descends from it:
|
|
545
564
|
|
|
546
565
|
```bash
|
|
547
566
|
cd -- "$LEGION_WORKSPACE" && \
|
|
548
|
-
jj -R "$LEGION_WORKSPACE"
|
|
549
|
-
jj -R "$LEGION_WORKSPACE"
|
|
567
|
+
jj -R "$LEGION_WORKSPACE" git fetch && \
|
|
568
|
+
behind=$(jj -R "$LEGION_WORKSPACE" log --no-graph -T 'commit_id.short() ++ "\n"' \
|
|
569
|
+
-r 'remote_bookmarks(exact:"legion/<KEY>", exact:"origin") ~ ::@-') && \
|
|
570
|
+
{ [ -z "$behind" ] || { echo "legion/<KEY>@origin is at $behind, which @- does not descend from" >&2; false; }; } && \
|
|
571
|
+
jj -R "$LEGION_WORKSPACE" log --no-graph -T 'commit_id' \
|
|
572
|
+
-r 'remote_bookmarks(exact:"legion/<KEY>", exact:"origin")' \
|
|
573
|
+
>"${TMPDIR:-/tmp}/legion-<KEY>-$LEGION_ROLE-rewritten-tip"
|
|
550
574
|
```
|
|
551
575
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
the
|
|
576
|
+
Then rewrite, resolve, and push with the procedure above. It lets the remote branch sit on the
|
|
577
|
+
tip you recorded, which the rewrite replaced, and on nothing else: when another role pushed after
|
|
578
|
+
you recorded it, the push is refused. The push deletes the file.
|
|
579
|
+
|
|
580
|
+
Before the push, check ancestry and identity as above: the chain carries every earlier phase's
|
|
581
|
+
commits, and pushing them with yours is expected. A refusal, and a push the remote rejects, is a
|
|
582
|
+
report to the architect with the output, never a force-push. The merger makes no commit and
|
|
583
|
+
pushes nothing.
|
|
558
584
|
|
|
559
|
-
Do not report phase completion until the write, existence check,
|
|
560
|
-
|
|
585
|
+
Do not report phase completion until the write, existence check, handoff commit, and push
|
|
586
|
+
succeed. This is the committed copy the next phase
|
|
561
587
|
reads after revival. It is removed once, at the end of a clean review: the implementer pushes
|
|
562
588
|
that deletion at the reviewer's direction. No other phase removes it — and once it is gone
|
|
563
589
|
(`jj -R "$LEGION_WORKSPACE" file list -r @- .legion` prints nothing on stdout; jj warns on
|
|
@@ -590,3 +616,9 @@ When blocked on lifecycle, scope, or cross-phase matters, `envoy_publish` the ow
|
|
|
590
616
|
architect a concise message: issue, phase, verified observation, what you tried, and the
|
|
591
617
|
decision required. Reach for `dispatch_ask` yourself only for a standalone human question
|
|
592
618
|
outside that coordination.
|
|
619
|
+
|
|
620
|
+
Never yield while blocked on a decision someone else owns. Before you stop, make the block
|
|
621
|
+
visible where its owner will see it: a lifecycle, scope, or cross-phase decision goes to the
|
|
622
|
+
owning architect as above, and a standalone human question goes in `dispatch_ask`. Otherwise
|
|
623
|
+
proceed: proceeding is the default, and a phase that stops silently holds its issue until
|
|
624
|
+
someone notices.
|