@sjawhar/pi-legion 19.31.0 → 19.31.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/legion.js CHANGED
@@ -29799,7 +29799,7 @@ import { logger as logger3 } from "@oh-my-pi/pi-utils";
29799
29799
  // package.json
29800
29800
  var package_default = {
29801
29801
  name: "@sjawhar/pi-legion",
29802
- version: "19.31.0",
29802
+ version: "19.31.2",
29803
29803
  license: "Apache-2.0",
29804
29804
  type: "module",
29805
29805
  omp: {
@@ -53,7 +53,7 @@ Read each by its `skill://` link: a read by path stops at 300 lines.
53
53
 
54
54
  ## Every role pushes its own commits
55
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 (anthropics/claude-code#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.
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
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
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
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.
@@ -35,7 +35,9 @@ as the fingerprint decides (*The reviewer*, below, and
35
35
  commit, so every push to the branch is work whose head gets GitHub's workflow runs of its own.
36
36
  With `<o>/<r>`, `<n>`, `<base>` and `<headRefOid>` from
37
37
  `gh pr view <n> --json baseRefName,headRefOid`, two reads. The required set is the
38
- base branch's rulesets' required checks and its branch protection's, when it has any. Both
38
+ base branch's rulesets' required checks and its branch protection's, when it has any.
39
+ A check the base does not require holds no approval. You neither wait for it nor re-run it for the approval, and the daemon reads no verdict from it either. Read its result all the same. A red one whose log shows that the change breaks something is a correctness finding like any other. A red one that shows no fault of the change is named in the review body and decides nothing.
40
+ Both
39
41
  branch endpoints take the base as a URL path, each segment escaped and each `/` kept (a raw `#`
40
42
  or `%` reads another branch), built in the same command from the name GitHub returns, never
41
43
  pasted or carried over from an earlier command:
@@ -49,10 +51,13 @@ as the fingerprint decides (*The reviewer*, below, and
49
51
  ```
50
52
 
51
53
  A read GitHub refuses stops the command there, and is reported to the architect, never guessed.
54
+ With that read refused, the required set is unknown, so no required item can be judged: do not approve, and wait with a `WAITING` line naming the refused read. The architect has the read made with a credential that can make it, or asks a person, and the review goes on from its answer.
52
55
  The head's check-runs
53
56
  (`gh api repos/<o>/<r>/commits/<headRefOid>/check-runs --paginate --jq '.check_runs[] | [.name, .status, .conclusion] | @tsv'`):
54
57
  every required name present, `completed` and `success` (GitHub counts `neutral` and `skipped`
55
- as passing for a required check). A required check
58
+ as passing for a required check).
59
+ When the list holds more than one run of a required name, the newest run decides, the one with the latest `started_at`. An older run of that name, whatever its conclusion, is no result: never re-run a job for a `cancelled` row that a newer run of the same name has superseded. Read the whole list before you choose. `--paginate` runs `--jq` once per page, so take the newest of each name over the merged list, not inside the `--jq`. A commit status is read the same way: the newest status of each context decides.
60
+ A required check
56
61
  `queued`, `requested`, `waiting`, `pending` or `in_progress`: wait. One `completed` as `cancelled`, or absent from a run at the
57
62
  head that holds its job: on a `pull_request` run, re-run that run's
58
63
  failed and cancelled jobs, once, then wait — never the whole run, which runs again every job that
@@ -80,6 +85,7 @@ as the fingerprint decides (*The reviewer*, below, and
80
85
  the head has settled.
81
86
  For such an item, what the base requires is more than its status checks: a `code_scanning` rule, which the read above prints under `code_scanning:`, requires an analysis no status-check list names.
82
87
  Read the merge state first, whatever the head's other runs show (`gh pr view <n> --repo <o>/<r> --json mergeable,mergeStateStatus`): a head that conflicts with its base (`DIRTY`) has no merge ref, so GitHub starts no `pull_request` run for it, while a `pull_request_target` run, which GitHub builds from the base with no merge ref, can be green beside the missing item.
88
+ A merge state of `UNKNOWN` is one GitHub has not computed yet: read it again after a minute, and for up to five minutes. A state still `UNKNOWN` after that, or a read that fails twice, is reported to the architect with the answer GitHub gave, as a refused read is: do not approve, and wait with a `WAITING` line naming the read. A read that GitHub answers with a rate limit waits for the reset the answer names, and is then made again.
83
89
  Count the head's runs: `gh api repos/<o>/<r>/commits/<headRefOid>/check-runs --jq .total_count`.
84
90
  A head GitHub computes no merge for (`DIRTY`) takes a merge of its base forward, which is the implementer's push, and never the remedy below; the daemon itself sends such a head back to implementing, so it never waits in the issue's `mergeWait` once a read has answered for it.
85
91
  A commit status is no check run, so read the head's commit statuses as well as the check-runs list above, every page: `gh api --paginate 'repos/<o>/<r>/commits/<headRefOid>/status?per_page=100' --jq '.statuses[] | [.context, .state] | @tsv'`.
@@ -96,6 +102,7 @@ as the fingerprint decides (*The reviewer*, below, and
96
102
  A job reports its `name:`, an expression there evaluated for each matrix entry, or else its key, with ` (<matrix values>)` after it for a matrix job; a job of a reusable workflow reports `<calling job> / <job>` and runs on the calling file's `on:`; and for a `code_scanning` rule the jobs that run the tool's analysis report under their own names, while the tool's own check run (`CodeQL`) is the code-scanning App's, made when an analysis uploads, so a head whose analysis jobs ran with no `CodeQL` run is no head this test matches.
97
103
  Third, neither list holds a run of it.
98
104
  That head takes the remedy.
105
+ A head with more than one required item that has no run takes the remedy when its first part holds for the head and at least one item meets the second and third parts: the close and reopen is one act for the whole head. Before you close, tell the architect about every other such item in the same message, by its case. Each of them is then waited for as its own case says, and none of them is a reason to reopen a second time. A head with any item in a case that says never close and reopen it takes no remedy for any of its items.
99
106
  A head that matches none of these cases takes no remedy: tell the architect, do not approve, and wait with a `WAITING` line naming what you wait on; the architect takes it to a person, since GitHub has more cases than these, so an unknown case costs a person's look rather than a wrong action.
100
107
  So does a head whose required item still has no run once every run the reopen started has concluded (before then the item is missing only because its run has not started): tell the architect, do not approve, and wait with a `WAITING` line naming what you wait on, and never reopen it a second time.
101
108
  Close the pull request, wait a minute, and reopen it at the same head: in cybermonklabs/legion a reopen within about a minute of the close can have its new CI run cancelled by the close's own run, which leaves a failing `ci-ok` (`.github/workflows/tests-closed.yaml`).
@@ -104,13 +111,13 @@ as the fingerprint decides (*The reviewer*, below, and
104
111
  So tell the architect before you close, and say why.
105
112
  Do not approve until the required item's run at the head has concluded green: the remedy is how it gets a run, not a reason to approve without one.
106
113
  It is for no other state: not a check that is running, not a check that is red, and not a head GitHub holds for a review the repository requires.
107
- A head whose checks are still running is waited for, unapproved: in the two lists above, a check run whose status is `queued`, `requested`, `waiting`, `pending` or `in_progress`, or a commit status whose state is `pending`, is running, not missing.
114
+ A head whose required checks are still running is waited for, unapproved: in the two lists above, a check run whose status is `queued`, `requested`, `waiting`, `pending` or `in_progress`, or a commit status whose state is `pending`, is running, not missing.
108
115
  For a GitHub Actions job, GitHub ends that wait itself: a job still queued for a self-hosted runner after 24 hours is cancelled, a running job ends at its own `timeout-minutes` or at GitHub's execution limit, 6 hours on a GitHub-hosted runner and 5 days on a self-hosted one, which fails it, and every workflow run ends at 35 days, its waiting included (GitHub's Actions limits page); the settlement of that conclusion moves the round.
109
116
  A run `waiting` on an environment's approval waits on a person, up to 30 days, and a check run no Actions job owns, another GitHub App's or one a workflow created through the API, or a commit status left `pending`, has no such bound and ends only when whoever made it ends it: one that stands longer than its CI usually takes is the architect's to raise with a person, so tell the architect, naming the run, do not approve, and wait with a `WAITING` line naming what you wait on.
110
117
  The daemon's own count in the issue's `mergeWait`, `checkRuns`, is only the runs a CI settlement applied, so a zero there is no evidence of what GitHub holds: read the two lists on GitHub before you act.
111
118
  Approval is refused while any `before_merge` check of the issue's own Verification document has no pass standing at the head being reviewed: `REQUEST_CHANGES` naming each such check by its block id, and `dispatch results --issue <issue>` is the read that decides it, under the check's own line saying whether a pass stands and from which roles. That answer leaves out a pass at another commit, a pass recorded under an older wording of the check and a retracted pass, each of which the command still prints; a fail recorded after a pass leaves that pass standing until someone retracts it.
112
119
  A check carrying `ci_check` is CI's: the one result that `dispatch results` derives from the named run decides it (`skill://legion-worker/references/ci-checks.md`). While that run has not concluded, wait for it by its name, and do not approve or request changes for that check. Wait the same way where GitHub could not be read. When no run of that name answers after the head's checks settle, tell the architect as a finding and request no changes for it.
113
- A check whose `run` is a whole test suite has wrong words, which the architect rewrites: tell the architect as a finding, wait for the rewrite with a `WAITING` line naming it, and request no changes for it.
120
+ A check whose `run` is a whole test suite and has no pass standing at the head has wrong words, which the architect rewrites: tell the architect as a finding, wait for the rewrite with a `WAITING` line naming it, and request no changes for it. One that has a pass standing at the head is a finding for the architect too, and its pass decides the check, so the review goes on.
114
121
  An issue with no Verification document, or whose Verification document holds no `before_merge` check, is a gap you name in the review body, never a review that asks for changes: say which of the two it is, and tell the architect, who writes the checks. Your own findings and the checks that do exist still decide the review, and on an issue that has none the architect's acceptance is the gate.
115
122
  A result proves the head it was recorded at. A result a child recorded against a root's check proves nothing for the root, since it was recorded at the child's head, and a child never records the result that proves a root's check. A child that carries part of a root's requirement proves it with a check on the child's own Verification document whose `serves` names that requirement, at the child's own head. A root's own checks are proven at the root's own head, or, for an `after_merge` check, on the branch the root's pull request merged into or on the repository's default branch, in the root's last round.
116
123
  On a docs-only PR the `Thermo` line still records the simplify pass and the defects it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion",
3
- "version": "19.31.0",
3
+ "version": "19.31.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {