@sjawhar/claude-envoy 4.10.0 → 4.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/AGENTS.md +43 -497
- package/dist/codex-hook.js +9 -3
- package/dist/dispatch.js +9 -3
- package/dist/envoy-channel.js +10 -4
- package/dist/session-hook.js +9 -3
- package/legion/skills/legion-architect/SKILL.md +88 -66
- package/legion/skills/legion-architect/references/acceptance.md +89 -258
- package/legion/skills/legion-architect/references/decomposition.md +94 -213
- package/legion/skills/legion-architect/references/design-gate.md +88 -353
- package/legion/skills/legion-architect/references/wake-routing.md +51 -43
- package/legion/skills/legion-controller/SKILL.md +50 -181
- package/legion/skills/legion-controller/references/admission.md +25 -54
- package/legion/skills/legion-controller/references/backlog-stewardship.md +23 -119
- package/legion/skills/legion-controller/references/consolidation.md +9 -93
- package/legion/skills/legion-controller/references/daily-report.md +21 -99
- package/legion/skills/legion-controller/references/escalation.md +16 -118
- package/legion/skills/legion-controller/references/finding-asks.md +31 -162
- package/legion/skills/legion-controller/references/park-asks.md +33 -0
- package/legion/skills/legion-controller/references/parked-decisions.md +20 -264
- package/legion/skills/legion-controller/references/session.md +26 -84
- package/legion/skills/legion-controller/references/slack-mentions.md +18 -134
- package/legion/skills/legion-controller/references/triage.md +18 -89
- package/legion/skills/legion-controller/references/wakes.md +22 -549
- package/legion/skills/legion-controller/references/weekly-audit.md +9 -90
- package/legion/skills/legion-oracle/SKILL.md +19 -28
- package/legion/skills/legion-retro/SKILL.md +54 -93
- package/legion/skills/legion-retro/references/learnings.md +21 -33
- package/legion/skills/legion-retro/references/pr-body-content.md +21 -37
- package/legion/skills/legion-worker/SKILL.md +50 -64
- package/legion/skills/legion-worker/references/ci-checks.md +16 -84
- package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +34 -93
- package/legion/skills/legion-worker/references/default-branch-check.md +22 -60
- package/legion/skills/legion-worker/references/findings.md +25 -180
- package/legion/skills/legion-worker/references/foreign-path.md +14 -22
- package/legion/skills/legion-worker/references/gvisor.md +20 -0
- package/legion/skills/legion-worker/references/merge-gate.md +43 -419
- package/legion/skills/legion-worker/references/plan-tests.md +8 -28
- package/legion/skills/legion-worker/references/pr-body.md +19 -218
- package/legion/skills/legion-worker/references/review-threads.md +16 -70
- package/legion/skills/legion-worker/references/tools.md +31 -578
- package/legion/skills/legion-worker/references/withheld-capability.md +12 -163
- package/legion/skills/simplify-settled-diff/SKILL.md +23 -41
- package/legion/skills/simplify-settled-diff/references/personas/code-quality-reviewer.md +14 -14
- package/legion/skills/simplify-settled-diff/references/personas/code-reuse-reviewer.md +4 -4
- package/legion/skills/simplify-settled-diff/references/personas/efficiency-reviewer.md +8 -8
- package/package.json +1 -1
- package/skills/agent-secrets/SKILL.md +46 -312
- package/skills/agent-secrets/references/store-a-secret.md +9 -0
- package/skills/approval-review/SKILL.md +20 -76
- package/skills/asd-ste100/SKILL.md +43 -85
- package/skills/asd-ste100/examples/before-after.md +18 -53
- package/skills/dispatch/SKILL.md +1 -1
- package/skills/dispatch-writing-specs/SKILL.md +1 -1
- package/skills/envoy/SKILL.md +56 -126
- package/skills/envoy/references/check-settlement.md +26 -43
- package/skills/envoy/references/deliveries.md +26 -144
- package/skills/envoy/references/legion.md +12 -45
- package/skills/envoy/references/roles.md +11 -9
- package/skills/envoy/references/sources.md +13 -25
- package/skills/outside-message/SKILL.md +24 -81
- package/skills/plain-words/SKILL.md +24 -55
- package/skills/thermonuclear-code-quality/SKILL.md +16 -26
- package/skills/thermonuclear-deep-review/SKILL.md +22 -31
- package/legion/skills/legion-worker/references/cleanup-deletion.md +0 -22
- package/legion/skills/legion-worker/references/systematic-rename.md +0 -19
- package/skills/asd-ste100/references/writing-rules.md +0 -59
- package/skills/plain-words/references/mechanics.md +0 -49
|
@@ -5,76 +5,62 @@ description: Use when dispatched as a per-process Legion phase worker — planne
|
|
|
5
5
|
|
|
6
6
|
# Legion Phase Worker
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Your role prompt gives the workspace, the push, the handoff, `handoff_complete`, the waits and the pod release; this skill adds the rest. Where it disagrees with the code or a command's `--help`, follow those and tell your architect which line is wrong.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Every phase
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
5. **Record the handoff** your role prompt names with `dispatch handoff-write --issue <issue> --phase <word> --body-file - <<'EOF'`, its JSON on standard input, or with an absolute path a command printed. Never write it into the workspace, which jj snapshots into the working-copy commit, and never with the `write` tool to a path that starts with `$`: that tool expands no variable and makes a directory of that name in the workspace. A handoff is never a commit, and no handoff carries the evidence: what you ran is a result you record against one of the issue's checks with `dispatch result`, and `skill://legion-worker/references/pr-body.md#what-a-result-is` defines a check and a result. To change a handoff already recorded, read it with `dispatch handoff-read`, edit the body, and record it whole again: each `dispatch handoff-write` adds a version, and `handoff_complete` reports the newest.
|
|
19
|
-
Every handoff body holds `head`, the 40-character lower-case commit the work it reports was done against — the commit the planner's workspace stood on, the commit the implementer pushed as `@-`, the commit the tester's recorded results name (the `--commit` it gave `dispatch result`), the `commit_id` of the review the reviewer submits — and your completion carries that head to the daemon, which takes a completion of an earlier entry of your phase only at the head the record holds. The tester and the reviewer never fill it with a read of the pull request's head made when they write the handoff: a push that landed while they worked names a head their work was not done against.
|
|
20
|
-
6. **Push any work, then complete**, as the push section below says. `handoff_complete` is your only way to end a phase: add no label, keep no status of your own and run no loop of your own, since the daemon owns the issue's state and the architect its decomposition and gates.
|
|
12
|
+
1. Read the issue, then its `open-items.md` where one exists (`dispatch doc-read --issue <issue> --artifact open-items-md`): the architect records decisions there that it does not message. Then read each earlier phase's handoff (`dispatch handoff-read --issue <issue> --phase <plan|implement|test|review>`). A record beats your memory.
|
|
13
|
+
2. Before the turn's first `jj new`, list `jj -R "$LEGION_WORKSPACE" diff -r @ --name-only` and `jj -R "$LEGION_WORKSPACE" diff --from "legion/<issue>@origin" --to @ --name-only`. A path you did not write in either list: read `skill://legion-worker/references/foreign-path.md`.
|
|
14
|
+
3. Commit only your phase's paths: `jj -R "$LEGION_WORKSPACE" split -m "<message>" <paths…>`.
|
|
15
|
+
4. Before you write the handoff, run `jj -R "$LEGION_WORKSPACE" status` and remove or restore every file you copied in that is not your phase's work: the working copy is the next role's first commit.
|
|
16
|
+
5. Every role writes the one workspace, so a file can change under your check. Run checks from a copy of the head (`git archive`, or a clone under `$TMPDIR`) where you can, and run `git diff --quiet <head> -- <files the check reads>` before you record a result. A script that fails in the workspace is a finding only when it fails again with `sha256sum <script>` unchanged just before and after. A run whose output you did not capture can be neither confirmed nor cleared.
|
|
17
|
+
6. A codebase-wide rename or deletion leaves historical records (transcripts, test snapshots, changelog entries) unchanged.
|
|
21
18
|
|
|
22
19
|
## Stop rules
|
|
23
20
|
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
21
|
+
- A refused completion is information, not a retry loop. Quote the answer verbatim to the architect.
|
|
22
|
+
- `HANDOFF_STALE_GENERATION` or `HANDOFF_NO_RUN`: push nothing more and end the turn without completing. When the task then arrives with its work and handoff done, call `handoff_complete` again in its turn; never redo the work.
|
|
23
|
+
- `HANDOFF_STALE_ENTRY`: end the turn without completing; the daemon sends the new entry's task by itself. Do what it asks at the head it names, with a handoff of its own.
|
|
24
|
+
- `HANDOFF_HEAD_MERGED_FORWARD`: a merge forward the daemon asked for has landed above the head your completion names, or your completion names no head; nothing was recorded. Read the merge (`skill://legion-worker/references/conflicts-and-rewrites.md`), then complete again at the new head with a handoff that names it.
|
|
25
|
+
- `HANDOFF_NOT_CURRENT_PHASE`: report it; never complete again. `HANDOFF_ALREADY_RECORDED`: the first answer stands.
|
|
26
|
+
- These waits stand rather than proceed, each ending the turn with a `WAITING` line naming what it waits on:
|
|
27
|
+
- a planner on a decision the plan itself needs, because a plan completed around an open decision carries that gap into every later phase;
|
|
28
|
+
- a reviewer on a half of the round that has no review, on a required check with no run at the head, or on the architect's rewrite of a check whose `run` is a whole test suite (`skill://legion-worker/references/merge-gate.md`);
|
|
29
|
+
- retro on the architect's answer to a defect it reported;
|
|
30
|
+
- a pushing role whose second push still did not carry the pull request onto its commit.
|
|
31
|
+
- Send any other decision someone else owns (product, scope, design, lifecycle, another phase's) to the owning architect with what you observed, what you tried and the decision needed, then go on.
|
|
32
|
+
- No surface reaches the changed path: report it to the architect, never complete (`skill://legion-worker/references/pr-body.md`).
|
|
33
|
+
- A released pod is not a stop. Your session, phase and task are kept, and the next pod restores your unpushed tracked work; nothing else of the disk survives.
|
|
34
|
+
- When another role's topic answers 404, read its handoff with `dispatch handoff-read`.
|
|
35
|
+
|
|
36
|
+
## Commits and pushes
|
|
37
|
+
|
|
38
|
+
- Before a push, run the trailer check in `skill://legion-worker/references/default-branch-check.md`. Then, with the `$default` it set, read your branch's full commit messages: `jj -R "$LEGION_WORKSPACE" log -r "${default}@origin..@" -T 'description ++ "\n"'`. Earlier phases' commits in it are expected; `description.first_line()` shows no trailer.
|
|
39
|
+
- Write no trailer yourself. The pane's jj adds `Omp-Session:` and `Legion-Role:`, and `Dispatch: <KEY>` in a repository the deployment names; the git wrapper adds the first two to a `git commit`. A merge, revert, cherry-pick or rebase that git makes gets none. Cure a commit that lacks a line by describing it again in the pane's shell; where that adds no issue line and `LEGION_ISSUE_TRAILER` is set, add the trailer line `Dispatch: $LEGION_ISSUE_TRAILER` yourself.
|
|
40
|
+
- A repository you clone under `$LEGION_WORKSPACE` is stamped with this issue's key: clone one you will push elsewhere outside it.
|
|
41
|
+
- A planner whose issue moved back from implementing starts on the remote tip: `jj -R "$LEGION_WORKSPACE" new legion/<KEY>@origin`.
|
|
42
|
+
|
|
43
|
+
## Pull request and merge gate
|
|
44
|
+
|
|
45
|
+
- The implementer opens the pull request with the line `Dispatch: <KEY>` in its body. Later phases push to that branch and edit that pull request.
|
|
46
|
+
- No deferrals. A finding that changes behaviour, hides an error, or breaks a gate is fixed in this pull request. So is a wording nit or any clear fix in a file it touches: a later round costs a CI pass and a review. `Fast-follow:` reads `none` or names cleanup in files the pull request does not touch.
|
|
47
|
+
- The merge gate, in order: the tester's evidence green → the reviewer's approval of the head → the architect's acceptance → retro, which commits nothing → the merger's merge of the head it read, which closes the issue → the production check after the close, the tester's unless the project's `production_check` is `off`. Only the merger runs `gh pr merge`; nobody turns auto-merge on.
|
|
48
|
+
- End every pull-request comment you post with `<!-- legion: {"session":"<session-id>","phase":"<phase>"} -->`.
|
|
49
|
+
- Never run `gh config set` or `gh alias set`, and leave `GH_TOKEN`, `GITHUB_TOKEN` and `GH_HOST` unset: a set variable outranks the gh directory the daemon refreshes.
|
|
50
|
+
- Before you report a resource unreachable, or read a GitHub `404` as no access, try the call through `skill://agent-secrets` and read the profiles in `AWS_CONFIG_FILE`. Request a secret only for your issue's work.
|
|
53
51
|
|
|
54
|
-
##
|
|
55
|
-
|
|
56
|
-
- Before a push, run the trailer check (`skill://legion-worker/references/default-branch-check.md`) and then, with the `$default` it set, read your branch's own commit messages: `jj -R "$LEGION_WORKSPACE" log -r "${default}@origin..@" -T 'description ++ "\n"'` — earlier phases' commits in it are expected; never `ancestors(@, 5)`, which stops at five commits while a branch can hold more, and never `description.first_line()`, which shows no trailer. Invent no trailer of your own: the pane's jj appends `Omp-Session:` and `Legion-Role:` to every commit the pane's shell makes, in any jj repository, and, for a repository the deployment names, the issue line `Dispatch: <KEY>` beside them, that one scoped to the pane's own workspace. A `git commit` gets the same two lines, and no issue line, from the git wrapper. A jj repository you clone or create under that workspace is stamped like the workspace, so a commit you make in one carries this deployment's issue key: clone a repository you will push elsewhere outside `$LEGION_WORKSPACE`, and push no commit made under it to a repository that takes no issue key. Four kinds of commit get none of these lines added: one that another process made outside the pane's shell with no overlay, one that a git command made without `git commit` (a merge, a revert, a cherry-pick, a rebase), a `git commit` where the git whose version the wrapper reads is older than 2.32 (the first git with `git commit --trailer`; cybermonklabs/legion `docs/deployment.md` says which git that is), and, on the Claude harness, a jj commit of a subagent's bash that lacks the session's environment file (Claude Code issue 46696, which `packages/claude-envoy/hooks/session-hook.ts` records and ships a `dispatch` fallback for). That subagent's `git commit` still carries the role line. A commit of yours that shows a line short is cured by describing it again, since the trailers are appended when a description is set. A re-describe appends the issue line only where the shell it runs in has the pane's jj config overlay, so it adds nothing in a shell that carries none — a subagent's bash, or a pane whose overlay the writer could not make. Where it adds nothing, write the line yourself: put `Dispatch: $LEGION_ISSUE_TRAILER` into the description as a trailer line of its own, and only when `LEGION_ISSUE_TRAILER` is set, since that variable is the deployment's own name for the key this repository takes, and an unset one means the repository takes no key and the line belongs in no commit of it. Look because a base branch can require the issue line in the commit that lands: a squash builds that message from the branch's commit messages, and it leaves a merge commit's message out, so the line belongs in an ordinary commit.
|
|
57
|
-
- Only work is pushed: code, red tests, a forward merge, and the empty commit that carries the pull request onto the commit you pushed (the bullet below). No commit message carries a line or bracket keyword that stops GitHub's workflows (`[skip ci]` and its kin), since every head needs its own checks and a base that requires a check will not merge a head whose checks never ran. Retro pushes nothing: it records what the work taught with `dispatch comment` on the issue.
|
|
58
|
-
- **After a push, read the pull request's head and check that it is your commit.** A branch and a pull request are two objects on GitHub: the push moves the branch, and GitHub then moves the pull request onto the new commit, which is what starts its checks, and a push GitHub does not follow leaves the newer commit with no checks while Legion reads and tests the older one. The step applies once the branch has an open pull request, whose number your task's `Pull request:` line names (`gh pr list --repo <the issue's repository> --head legion/<KEY> --state open --json number --jq '.[0].number'` when it names none): run `gh pr view <n> --repo <the issue's repository> --json headRefOid --jq .headRefOid` about ten seconds after your push, again about ten seconds later, and a last time about thirty seconds after that, with a read that gives the pushed commit ending the step there and only the last read deciding a mismatch, and compare each answer with the commit you pushed, which `jj -R "$LEGION_WORKSPACE" log -r legion/<KEY>@origin --no-graph -T commit_id` prints in the 40 characters `headRefOid` answers in. This read is of the pull request's own head and of no check, so the wait it makes is not a wait on CI (`skill://legion-worker/references/pr-body.md#never-waiting-on-ci`). When the last read still is not your commit, carry the pull request with a commit of its own, an empty one when your work is complete and an empty one just as much when `@` holds work of yours, since a push of a commit the branch already holds moves no ref; the push section of your role prompt gives the one `jj` recipe, which leaves `@` and everything in it where it is. A new head is a different commit, so record each `before_merge` check again at the new head. A check carrying `ci_check` is CI's, so skip it. When that second push does not carry the pull request either, tell your architect the commit you pushed, the head each read gave and the time of each, and end the turn with a WAITING line naming that answer rather than completing: a phase completed here hands the next role a commit the pull request does not name. The push you make to answer an update message is the exception: that message has you answer the daemon and end the turn at once, so make this read in your next turn, before your phase completes. The merger pushes nothing, so this step never falls to it; it reports a mismatch it sees to the architect.
|
|
59
|
-
- A planner whose issue moved back from implementing starts on the remote tip, `jj -R "$LEGION_WORKSPACE" new legion/<KEY>@origin`, so a commit it makes never sits on the implementer's unpushed commits.
|
|
60
|
-
|
|
61
|
-
## PR body, review, and the merge gate
|
|
52
|
+
## Deployment instructions
|
|
62
53
|
|
|
63
|
-
|
|
64
|
-
- **No deferrals.** A finding that changes behaviour, hides an error, or breaks a gate is fixed in this pull request, and so is a wording nit or any clear fix in a file it touches: a later round costs a CI pass and another review. The body's one `Fast-follow:` line reads "none", or names cleanup in files this pull request does not touch.
|
|
65
|
-
- **The reviewer pushes nothing to the branch it reviews**, a prose fix included: it names a prose fault (wording, a count, a tense, a citation) in its review, as any other finding (`skill://legion-worker/references/merge-gate.md`).
|
|
66
|
-
- **The merge gate**, in order: the tester's evidence green → the reviewer's approval of the head → the architect's acceptance → retro → the merger's merge of the head it read → the daemon's reading of that merge, which closes the issue → the production check after the close, which the project's `production_check` setting gives to the tester unless it is `off`, and whose every look but the last names its own next look with `wake_at`. The merger runs that merge itself, as the implement App and with the head it read as the head GitHub must match (`gh pr merge <n> --squash --match-head-commit <head> --subject '<pull request title> (#<n>)' --body ''`, so GitHub's default squash message never joins the branch's commit messages onto the base; or `enqueuePullRequest` with `expectedHeadOid` on a merge-queue base), and into a base other than the repository's default branch it merges as `skill://legion-worker/references/merge-gate.md` says; it never turns auto-merge on, the daemon submits no merge and changes no merge setting, and the repository's own rules decide what may merge. No other role runs `gh pr merge`.
|
|
67
|
-
- Append `<!-- legion: {"session":"<session-id>","phase":"<phase>"} -->` to every pull-request comment you post, and to every pull-request review the same footer with the head that review read in it: `<!-- legion: {"session":"<session-id>","phase":"review","head":"<the head you reviewed>"} -->`.
|
|
68
|
-
The reviewer's review of its own round carries that round's entry too, `<!-- legion: {"session":"<session-id>","phase":"review","head":"<the head you reviewed>","entry":"<entry>"} -->`, where `<entry>` is the number of the newest `Review entry: <n>.` sentence that is the last sentence of a task or a wake of its session, in quotes, so that a placeholder left in it cannot make the footer invalid JSON: such a footer loses its session and its head too and is set aside.
|
|
69
|
-
A comment, and a review of any other role, carry no entry, since no other role's task names one.
|
|
70
|
-
The daemon finds the session behind a review by that footer, and takes its `head` as the review's own word for the code it read: a review the review App submits decides a review round only when that head is the pull request's current head, in full and compared exactly (`intake.PullRequestReview.LegionHead`, `workflow.refusesRound`).
|
|
71
|
-
That head is the head whose diff and checks you read, and the `commit_id` you submit with, never the head GitHub shows at the moment you submit: read `gh pr view <n> --repo <owner>/<repo> --json headRefOid --jq .headRefOid` before you submit, and when it names another head a push landed under you, so review that head and submit at it rather than renaming the footer to a head you have not read.
|
|
72
|
-
The daemon cannot read GitHub's own `commit_id` for the review instead, because GitHub rewrites `commit_id` to the pull request's current head, so its record of a review can name a head the review never saw.
|
|
73
|
-
A review whose footer names another head, or no head, decides no round: it is set aside, the round stays open, the architect is told the reason when the review's own webhook arrived — a review only the daemon's read of GitHub's list saw leaves the architect its base reason — and the reviewer has to submit the review again at the head it read.
|
|
74
|
-
The daemon tells a review of the reviewer's round from a review of an earlier round by that entry, and only a review of the round moves the commit a later round's task names as `Last reviewed commit:`; a review with no entry, or with another one, still decides the round, and the next round then reads more: from an older commit, or the whole change.
|
|
75
|
-
- Never write a GitHub issue, by `gh issue` or a non-GET `gh api` on `/issues` (post or edit a PR conversation comment with `gh pr comment`): Legion's issues live on Dispatch. Never run `gh config set` or `gh alias set`, and leave `GH_TOKEN`, `GITHUB_TOKEN` and `GH_HOST` empty: the daemon rewrites your gh directory in place, and a set variable outranks it.
|
|
76
|
-
- Before you report a resource unreachable, and before you read a GitHub `404` under your own token as no access, run the call through the secrets broker's client (`skill://agent-secrets`, which holds the form, the exit statuses, where a name comes from and what a `404` means), and check `AWS_CONFIG_FILE` (read its profiles): a deployment can give your pod either. Your `task` subagents and background jobs inherit both, and your `gh` and `git`. Request a secret only to use it for your issue's work.
|
|
54
|
+
They override this skill, except: no deferrals; the base merged forward only as `skill://legion-worker/references/conflicts-and-rewrites.md#reintegrating-the-base` allows; the implementer's own result for every `before_merge` check with no `ci_check` (`skill://legion-worker/references/pr-body.md#what-a-result-is`); and the production check after the close (`skill://legion-worker/references/merge-gate.md#the-production-check-after-the-close`).
|
|
77
55
|
|
|
78
|
-
##
|
|
56
|
+
## References
|
|
79
57
|
|
|
80
|
-
|
|
58
|
+
- PR body, a check's result, the simplify pass: `skill://legion-worker/references/pr-body.md`.
|
|
59
|
+
- A check carrying `ci_check`: `skill://legion-worker/references/ci-checks.md`.
|
|
60
|
+
- Review, approval, merge, production check: `skill://legion-worker/references/merge-gate.md`.
|
|
61
|
+
- Review threads, a bot's finding: `skill://legion-worker/references/review-threads.md`.
|
|
62
|
+
- A conflict, the daemon's merge-forward message, a need for the base, a retarget, a wrong pushed commit: `skill://legion-worker/references/conflicts-and-rewrites.md`.
|
|
63
|
+
- A plan you write or review: `skill://legion-worker/references/plan-tests.md`.
|
|
64
|
+
- Builds, tests, tools or a database in the pod: `skill://legion-worker/references/tools.md`; before you unpack or install what the image lacks: `skill://legion-worker/references/withheld-capability.md`.
|
|
65
|
+
- A problem outside your issue, or a failed production check: `skill://legion-worker/references/findings.md`.
|
|
66
|
+
- Text that reaches a person outside the company: `skill://outside-message`.
|
|
@@ -1,26 +1,14 @@
|
|
|
1
1
|
# A check CI proves
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
carries `ci_check`, before you run, record, judge or write the line of any check. Every path it
|
|
5
|
-
cites is in cybermonklabs/legion.
|
|
3
|
+
Read it when a check of the issue's Verification document carries `ci_check`, before you run, record, judge or write the line of any check.
|
|
6
4
|
|
|
7
5
|
## What it is
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
the head. Such a check has no `run`, its `when` is `before_merge`, and it names its
|
|
11
|
-
`negative_control`. Through the documents API, Dispatch refuses a write that breaks one of these
|
|
12
|
-
rules, or that gives `ci_check` to a check that already holds a recorded result. A write in the
|
|
13
|
-
live editor lands, and the next settlement removes that `ci_check` and names the rule in the
|
|
14
|
-
issue's Activity.
|
|
7
|
+
`ci_check` names the GitHub check run that proves the check at the head. Such a check has no `run`, its `when` is `before_merge`, and it names its `negative_control`. The architect writes it as `skill://legion-architect/references/design-gate.md` says.
|
|
15
8
|
|
|
16
9
|
## No role runs it
|
|
17
10
|
|
|
18
|
-
A check carrying `ci_check` is CI's. No role runs its work in its
|
|
19
|
-
result for it: Dispatch refuses such a result with `409 CHECK_PROVED_BY_CI`. The CI job stays a
|
|
20
|
-
job like any other, and the rules for a red CI job apply to it. `dispatch results --issue <issue>`
|
|
21
|
-
reads the named check run at the head of the issue's pull request. It prints the one result it
|
|
22
|
-
derives from that run, the same `A pass stands:` line a recorded check gets, and the line for the
|
|
23
|
-
pull request body:
|
|
11
|
+
A check carrying `ci_check` is CI's. No role runs its work in the pod or records a result for it: Dispatch refuses one with `409 CHECK_PROVED_BY_CI`. `dispatch results --issue <issue>` reads the named run at the head of the issue's pull request and prints the one result it derives, its `A pass stands:` line, and the line for the PR body:
|
|
24
12
|
|
|
25
13
|
```
|
|
26
14
|
- <id> (before_merge): <verdict> at <sha> by ci (CI run <name>, <conclusion>), <currency>. <text>
|
|
@@ -28,85 +16,29 @@ pull request body:
|
|
|
28
16
|
Pull request line: - Check <id> (before_merge): <verdict> at <sha>, from CI run <name>. <words>
|
|
29
17
|
```
|
|
30
18
|
|
|
31
|
-
When the run gives no result, the
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
- <id> (before_merge): no result: <detail> <text>
|
|
35
|
-
A pass stands: <no | not known>.
|
|
36
|
-
Pull request line: - Check <id> (before_merge): CI run <name> has no result (<case>)
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
The case is one of these:
|
|
19
|
+
When the run gives no result, the line reads `CI run <name> has no result (<case>)`, the case one of:
|
|
40
20
|
|
|
41
21
|
- `not_completed`: the run is still going.
|
|
42
22
|
- `absent`: no run of that name is at the head.
|
|
43
23
|
- `no_head`: Dispatch holds no pull request head of the issue.
|
|
44
24
|
- `neutral`, `skipped` or `cancelled`: the run concluded and proved nothing.
|
|
25
|
+
- `github_unreadable`: Dispatch could not read GitHub; treat it as a run still going.
|
|
45
26
|
|
|
46
|
-
|
|
47
|
-
pass nor a fail, and the next read tries again. The tester and the reviewer treat it as a run that
|
|
48
|
-
is still going (below). Each read is made at the head, so a push needs no write from any role.
|
|
49
|
-
|
|
50
|
-
## The tester
|
|
51
|
-
|
|
52
|
-
Read `dispatch results --issue <issue>` first. Then run and record only the checks that carry no
|
|
53
|
-
`ci_check` and whose `run` is no whole test suite, and the proofs on a real surface that CI cannot
|
|
54
|
-
make. A check with `ci_check` needs no
|
|
55
|
-
pass from the implementer. It is an entry in `failures` only when its derived result is a fail, or
|
|
56
|
-
its run concluded `skipped`, `neutral` or `cancelled`.
|
|
57
|
-
|
|
58
|
-
## The `Checks` line
|
|
59
|
-
|
|
60
|
-
The implementer writes the line of each such check in the pull request body's `Checks` block. It
|
|
61
|
-
copies the `Pull request line` that `dispatch results` prints. While the named run gives no
|
|
62
|
-
result, that line is the no-result line. The next role that writes the body reads
|
|
63
|
-
`dispatch results` again and puts the derived line in its place.
|
|
27
|
+
## What each role does
|
|
64
28
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
gets no new field, and the tester fails no round for the run.
|
|
70
|
-
|
|
71
|
-
The reviewer waits for that run by its name, as it waits for a required check that GitHub shows
|
|
72
|
-
`queued` or `in progress`. Until the run concludes, the reviewer does not approve and does not
|
|
73
|
-
request changes for that check. The named run is usually not one the base branch requires, so the
|
|
74
|
-
wait on required checks does not cover it.
|
|
75
|
-
|
|
76
|
-
## A job held back from an ordinary pull request
|
|
77
|
-
|
|
78
|
-
A `ci_check` can name a job that the repository runs on a pull request only on request: on
|
|
79
|
-
cybermonklabs/legion, the slow suites and the full browser lane run only under the label `full-ci`
|
|
80
|
-
(`.github/workflows/ci.yaml`). Such a check is proved in CI too, never in the pod. Without the
|
|
81
|
-
label, such a job is at the head and reads `skipped`, which leaves the check no pass. The
|
|
82
|
-
implementer adds that label and then pushes, because the workflow starts on a push and not on a
|
|
83
|
-
label, and the run at that head is the check's proof. The label stays on for as long as a
|
|
84
|
-
`ci_check` of the issue names a held-back job, because every later head (a review fix, a forward
|
|
85
|
-
merge) needs its own run; where it came off, it goes on again before the next push. The tester
|
|
86
|
-
takes the check's result from that run, as from any other.
|
|
29
|
+
- The implementer copies each such check's `Pull request line` into the `Checks` block. The next role that writes the body reads `dispatch results` again and replaces a no-result line.
|
|
30
|
+
- The tester runs and records only the checks with no `ci_check`. A `ci_check` check goes in `failures` only when its derived result is a fail, or its run concluded `skipped`, `neutral` or `cancelled`. A run still going fails no round: say so in `implementerProof.how`.
|
|
31
|
+
- The reviewer waits for a run still going by its name, and neither approves nor requests changes for that check until it concludes.
|
|
32
|
+
- A job the repository runs on a pull request only under the label `full-ci` (on cybermonklabs/legion, the slow suites and the full browser lane) reads `skipped` without it. The implementer adds the label, then pushes, because the workflow starts on a push and not on a label. The label stays on while a `ci_check` of the issue names such a job.
|
|
87
33
|
|
|
88
34
|
## A name that no run answers
|
|
89
35
|
|
|
90
|
-
When the head's checks have settled and no run of the
|
|
91
|
-
merge state first (*Never waiting on CI* in `skill://legion-worker/references/pr-body.md`): a head
|
|
92
|
-
that conflicts with its base gets no `pull_request` run, and the forward merge cures it. A
|
|
93
|
-
held-back job (above) is not absent without the label: it reads `skipped`, and the label cures it.
|
|
94
|
-
Otherwise the words of the check are wrong. The tester and the reviewer each send this to the
|
|
95
|
-
architect as a finding, with
|
|
96
|
-
`envoy_publish` to its role topic. The architect corrects the name or gives the check a command.
|
|
97
|
-
Neither role fails the round or requests changes for it, because the change under review is not
|
|
98
|
-
what is wrong.
|
|
36
|
+
When the head's checks have settled and no run of the name answers:
|
|
99
37
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
The
|
|
103
|
-
This is true also when the job is a unit or integration suite, which proves no other check.
|
|
104
|
-
The limit: such a check claims only that the named job passed at that head. It never takes the
|
|
105
|
-
place of the proof a tester makes on a real surface. The tester continues to prove the surface
|
|
106
|
-
with the checks that CI cannot run.
|
|
38
|
+
1. Read the merge state first (`gh pr view <n> --json mergeStateStatus`): a `DIRTY` head gets no `pull_request` run, and the forward merge cures it.
|
|
39
|
+
2. A held-back job reads `skipped`, not absent: the label cures it.
|
|
40
|
+
3. Otherwise the check's words are wrong. The tester and the reviewer each send it to the architect as a finding with `envoy_publish`; neither fails the round nor requests changes for it.
|
|
107
41
|
|
|
108
|
-
##
|
|
42
|
+
## What the evidence is
|
|
109
43
|
|
|
110
|
-
The
|
|
111
|
-
[A check CI proves](skill://legion-architect/references/design-gate.md#a-check-ci-proves) in
|
|
112
|
-
`skill://legion-architect/references/design-gate.md`.
|
|
44
|
+
The named job is the check's proof at the head, and no role repeats it, even when it is a unit or integration suite. It proves only that the job passed there: the tester still proves the real surface with the checks CI cannot run.
|
|
@@ -1,101 +1,42 @@
|
|
|
1
1
|
# Conflicts, retargets, and a wrong pushed commit
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
daemon asks you to merge the base forward (a merge-forward message on your role topic), the
|
|
5
|
-
controller asks you to resolve a conflict, the change needs something only the base has, the pull
|
|
6
|
-
request is retargeted to a new base, or a commit you already pushed is wrong.
|
|
7
|
-
Every path it cites is in cybermonklabs/legion.
|
|
3
|
+
Read it when GitHub reports the pull request `CONFLICTING`, the daemon's merge-forward message asks you to merge the base forward or to stop writing the workspace, the controller asks you to resolve a conflict, the change needs something only the base has, the pull request is retargeted, you read a merge of the base, or a commit you pushed is wrong.
|
|
8
4
|
|
|
9
5
|
## Reintegrating the base
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
bookmark with the destination in one new commit, so nothing existing is rewritten and nothing
|
|
44
|
-
built on your prior commits, in this tree or another, ever moves. `base` is the pull request's
|
|
45
|
-
base branch (the repository's default branch unless the pull request is stacked), read as a jj
|
|
46
|
-
string literal: jj parses a bare bookmark name as an expression, and a name pasted between
|
|
47
|
-
quotes can close them itself (`release"@origin|"stable` would select `release` and `stable`), so
|
|
48
|
-
the revset is built from the serialized name alone:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
base=$(gh pr view <n> -R <owner>/<repo> --json baseRefName -q '.baseRefName | @json') && \
|
|
52
|
-
jj -R "$LEGION_WORKSPACE" new legion/<KEY> "${base}@origin" -m "<message>"
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
`<message>` is written in the repository's own commit convention, read from the repository
|
|
56
|
-
itself: its commit-message check (a commitlint configuration or the workflow that lints
|
|
57
|
-
commits) where it has one, else its recent commits on the base. Where it uses Conventional
|
|
58
|
-
Commits, that is a listed type and the merge in words, for example
|
|
59
|
-
`chore(<scope>): merge <base> into <branch>`. Where neither shows a convention, it is the
|
|
60
|
-
merge in words alone, for example `Merge <base> into <branch>`. Never a fixed prefix of the
|
|
61
|
-
skill's own: a check that lints every commit of the pull request refuses a type its list does
|
|
62
|
-
not hold, and `merge` is in no Conventional Commits list.
|
|
63
|
-
|
|
64
|
-
Merge from the bookmark, never from `@`: a `jj split` leaves `@` an empty, undescribed
|
|
65
|
-
commit above the described one the bookmark already names, and `jj git push` refuses to push
|
|
66
|
-
any commit without a description — merging from `@` drags that undescribed commit into the
|
|
67
|
-
ancestry and the push fails (`Won't push commit … since it has no description`); the bookmark
|
|
68
|
-
is always on a described, already-pushed commit. If the merge conflicts, resolve it in that
|
|
69
|
-
one commit — edit the markers directly; there is nothing to squash, since the merge is the
|
|
70
|
-
only new commit. Then `jj -R "$LEGION_WORKSPACE" new` to move off it, and push it (*Every role
|
|
71
|
-
pushes its own commits* in `skill://legion-worker`; a merge is a code push like any other): the
|
|
72
|
-
merge descends from both the bookmark's old position and the destination, so it is a genuine
|
|
73
|
-
fast-forward.
|
|
74
|
-
- **After a retarget.** Retargeting a pull request to a new base does not re-run Tests. Read
|
|
75
|
-
`base` again and merge the bookmark onto it in one command
|
|
76
|
-
(`base=$(gh pr view <n> -R <owner>/<repo> --json baseRefName -q '.baseRefName | @json') && jj -R "$LEGION_WORKSPACE" new legion/<KEY> "${base}@origin" -m "<message>"`, its `<message>` in the repository's own commit convention, as above) and push it the
|
|
77
|
-
ordinary way, a genuine fast-forward, so the new head runs Tests
|
|
78
|
-
against the new merge result, and cite that run in the PR body.
|
|
79
|
-
- **The daemon's ask.** A head that conflicts with its base keeps the issue in its phase. The
|
|
80
|
-
daemon reads GitHub twice, a minute apart, and acts on a conflict only
|
|
81
|
-
when the next step needs a mergeable head: the issue stands in `accepting`, `retro` or
|
|
82
|
-
`merging`, a check the base requires has no green result on the head (GitHub runs no check on
|
|
83
|
-
a conflicting head), the base requires a pull request to be current with it, or the daemon
|
|
84
|
-
could not read the base's rules. Then the issue keeps its phase, and the implementer gets a
|
|
85
|
-
merge-forward message on its role topic: merge the base forward in `$LEGION_WORKSPACE`, the one
|
|
86
|
-
workspace every role of the issue shares, after the working-copy check of
|
|
87
|
-
`skill://legion-worker/references/foreign-path.md`, as this section says, and push the issue
|
|
88
|
-
branch. Write no handoff and make no completion for the merge itself. In `testing`,
|
|
89
|
-
`reviewing` and `merging` the phase is another role's: the daemon told its worker to stop
|
|
90
|
-
writing the workspace and tells it the new head when your push lands. In `accepting` the phase
|
|
91
|
-
is the architect's. In `implementing` and in `retro` the phase is your own, and your
|
|
92
|
-
assignment and its completion stand.
|
|
7
|
+
The implementer merges the base into the issue branch only when GitHub reports it `CONFLICTING`, the daemon's merge-forward message asks it (*The daemon's ask*, below), the controller asks because of a conflict, the architect's backward move names a parent's last round, the change needs something only the base has, or the pull request was retargeted. Never to refresh CI or pick up the default branch: each merge is a new head that reruns CI and can void a review. Never with `jj rebase`, which rewrites pushed commits (*A wrong pushed commit*, below).
|
|
8
|
+
|
|
9
|
+
Before you race another tree's pull request on shared files, `envoy_publish` to its implementer's role topic, ask when its next push lands, and merge once, after it.
|
|
10
|
+
|
|
11
|
+
1. Merge the bookmark, never `@`, with the base, in one new commit. `base` is the pull request's base branch, JSON-quoted so jj reads it as a string literal:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
base=$(gh pr view <n> -R <owner>/<repo> --json baseRefName -q '.baseRefName | @json') && \
|
|
15
|
+
jj -R "$LEGION_WORKSPACE" new legion/<KEY> "${base}@origin" -m "<message>"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Write `<message>` in the repository's own commit convention (its commit-lint configuration, else its recent commits on the base), such as `chore(<scope>): merge <base> into <branch>`, or `Merge <base> into <branch>` where none shows. `@` after a split is an empty commit with no description, which `jj git push` refuses.
|
|
19
|
+
2. Resolve any conflict in that one commit, then `jj -R "$LEGION_WORKSPACE" new` to move off it.
|
|
20
|
+
3. A merge brings instances from the base that the branch's own diff never shows, so before you push the merge search its head for the class of every finding of every earlier review round.
|
|
21
|
+
4. Push the merge as any code push, build the branch, and record the issue's checks again at the merge head, each check with no `ci_check` (a check carrying one is read again from its CI run), even with no text conflict.
|
|
22
|
+
5. Post one PR comment with the Legion footer: `forward merge <old-tip-sha> → <new-tip-sha>; <the condition it meets>`, with each class search beside it. In a parent's last round, end it with `parent's last round: full test round`.
|
|
23
|
+
|
|
24
|
+
After a retarget, do the same merge onto the new base, and cite the new head's run in the PR body. Recover a jj mistake forward (`jj new`, `jj restore <paths>`), never with `jj undo`, `jj abandon` or `jj op restore`, which rewrite the shared operation log.
|
|
25
|
+
|
|
26
|
+
## Reading a merge of the base
|
|
27
|
+
|
|
28
|
+
Every role reads a merge of the base the same way:
|
|
29
|
+
|
|
30
|
+
- `git show --remerge-diff <merge>` shows its resolution, and `git diff --stat <merge>^1 <merge>` lists the files the base brought in.
|
|
31
|
+
- A check those files or the resolution can reach runs again, and a check the merge was made for has no pass to carry.
|
|
32
|
+
|
|
33
|
+
## The daemon's ask
|
|
34
|
+
|
|
35
|
+
A head that conflicts with its base keeps the issue in its phase. The daemon reads GitHub twice, at least a minute apart, and acts only on a conflict both reads report, and only when the next step needs a mergeable head: the issue stands in `accepting`, `retro` or `merging`; a check the base requires has no green result on the head, since GitHub runs no check on a conflicting head; the base requires a pull request to be current with it; or the daemon could not read the base's rules.
|
|
36
|
+
|
|
37
|
+
- The implementer gets a merge-forward message on its role topic. Merge the base forward in `$LEGION_WORKSPACE`, the one workspace every role of the issue shares, so another role's work can sit in it: before this merge's `jj new`, run the two path lists of step 2 of `skill://legion-worker` again, even when this turn already ran a `jj new`, and read `skill://legion-worker/references/foreign-path.md` for any path you did not write. Then merge as *Reintegrating the base* says and push the issue branch, with no handoff and no completion for the merge. In `implementing` and `retro` the phase is the implementer's, and its assignment and its completion stand.
|
|
38
|
+
- In `testing`, `reviewing` and `merging`, the phase's worker is told to stop writing the workspace: stop at once, complete nothing at the old head (the merger merges and enqueues nothing), and keep your turn and its jobs. When the push lands you are told the new head: read the merge as above and go on at that head.
|
|
93
39
|
|
|
94
40
|
## A wrong pushed commit
|
|
95
41
|
|
|
96
|
-
|
|
97
|
-
backwards bookmark move and no force push. A rewrite moves every commit built on it, another
|
|
98
|
-
tree's branch included, and leaves a review, a CI run or a link that names a commit GitHub no
|
|
99
|
-
longer holds. Answer a wrong pushed commit with a follow-up commit on top, and a wrong commit
|
|
100
|
-
message with a line in the pull request body. A base frozen for others to stack on takes its fixes
|
|
101
|
-
the same way, and the PR body's `Chain` line records what is frozen.
|
|
42
|
+
Never rewrite a pushed commit: no `jj squash --into` it, no new description, no backward bookmark move, no force push. A rewrite moves every commit built on it and leaves reviews, CI runs and links naming a commit GitHub no longer holds. Answer a wrong commit with a follow-up commit on top, and a wrong message with a line in the PR body. A base frozen for others to stack on takes its fixes the same way; the body's `Chain` line records it.
|