@sjawhar/claude-envoy 2.31.5 → 2.32.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/dist/dispatch.js +9 -3
- package/dist/envoy-channel.js +42 -16
- package/legion/agents/plan-reviewer.md +5 -1
- package/legion/skills/legion-architect/SKILL.md +4 -3
- package/legion/skills/legion-architect/references/acceptance.md +14 -4
- package/legion/skills/legion-architect/references/decomposition.md +4 -3
- package/legion/skills/legion-architect/references/design-gate.md +24 -5
- package/legion/skills/legion-controller/references/daily-report.md +2 -2
- package/legion/skills/legion-controller/references/finding-asks.md +12 -9
- package/legion/skills/legion-controller/references/session.md +2 -1
- package/legion/skills/legion-controller/references/slack-mentions.md +2 -2
- package/legion/skills/legion-controller/references/triage.md +2 -2
- package/legion/skills/legion-controller/references/wakes.md +2 -2
- package/legion/skills/legion-oracle/SKILL.md +6 -4
- package/legion/skills/legion-retro/SKILL.md +9 -3
- package/legion/skills/legion-worker/SKILL.md +14 -12
- package/legion/skills/legion-worker/references/ci-checks.md +20 -3
- package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +12 -40
- package/legion/skills/legion-worker/references/findings.md +11 -11
- package/legion/skills/legion-worker/references/merge-gate.md +31 -30
- package/legion/skills/legion-worker/references/plan-tests.md +40 -0
- package/legion/skills/legion-worker/references/pr-body.md +31 -10
- package/legion/skills/legion-worker/references/tools.md +6 -6
- package/legion/skills/legion-worker/references/withheld-capability.md +9 -5
- package/legion/skills/simplify-settled-diff/SKILL.md +1 -1
- package/package.json +1 -1
- package/skills/agent-secrets/SKILL.md +5 -3
- package/skills/dispatch-first/SKILL.md +1 -1
- package/skills/dispatch-writing-specs/SKILL.md +2 -2
- package/skills/envoy/SKILL.md +8 -5
- package/skills/envoy/references/deliveries.md +2 -1
- package/skills/envoy/references/legion.md +10 -1
- package/skills/envoy/references/roles.md +1 -1
- package/skills/plain-words/SKILL.md +1 -1
- package/src/envoy-channel-server.ts +6 -10
|
@@ -133,19 +133,23 @@ already relocated onto the issue's volume, which has the room for them (`docs/ku
|
|
|
133
133
|
tools a role's own work needs", carries the figure), and a sanctioned install is paid once per
|
|
134
134
|
issue pod, on the issue's own disk, by the issue's roles together.
|
|
135
135
|
|
|
136
|
-
**The worked case, and the one a role actually meets: the Dispatch e2e stack.** A
|
|
137
|
-
`packages/dispatch`
|
|
138
|
-
(`bun run e2e -- e2e/<one spec file>`) —
|
|
139
|
-
of the default selection,
|
|
136
|
+
**The worked case, and the one a role actually meets: the Dispatch e2e stack.** A spec a role
|
|
137
|
+
added or changed in `packages/dispatch` runs in the pod while it is written, as a development run,
|
|
138
|
+
one spec a command (`bun run e2e -- e2e/<one spec file>`) — a wall-clock spec, whose three
|
|
139
|
+
projects are out of the default selection, with a command that names its project:
|
|
140
140
|
`bun run e2e -- --project=chromium-alone e2e/heavy-bodies.e2e.ts --workers=1`.
|
|
141
141
|
`packages/dispatch/AGENTS.md` carries both of those as the three commands to copy as they stand.
|
|
142
|
+
The change's proof is CI's run at the head, never the pod's.
|
|
142
143
|
CI's `dispatch-browser` job runs one of two lanes, and neither is the whole suite on every pull
|
|
143
144
|
request. An unlabelled pull request gets the pull-request lane: `chromium`, `iphone`, `stub`
|
|
144
145
|
and `stub-phone`, held to the rows tagged `@pr`. The full lane - every project over every row,
|
|
145
146
|
the three `-alone` ones among them - runs on a pull request labelled `full-ci`, on the merge
|
|
146
147
|
queue and nightly, and the `alone` job that holds the wall-clock rows is gated on it
|
|
147
148
|
(`if: inputs.lane == 'full'` under `alone:` in `.github/workflows/dispatch-browser.yaml`), so no
|
|
148
|
-
unlabelled pull request runs a wall-clock row at all.
|
|
149
|
+
unlabelled pull request runs a wall-clock row at all. So a `@pr` row is proved by the pull-request
|
|
150
|
+
lane, and any other row, every wall-clock row among them, by the full lane under `full-ci`, with
|
|
151
|
+
`dispatch-browser` as its check's `ci_check`
|
|
152
|
+
(`skill://legion-architect/references/design-gate.md#a-check-ci-proves`). One spec needs
|
|
149
153
|
the same stack as all the specs: a Postgres with pgvector. On a digest
|
|
150
154
|
carrying `legion-testpg`, use the pod's own server
|
|
151
155
|
(`skill://legion-worker/references/tools.md#the-database-your-tests-use`) and
|
|
@@ -56,7 +56,7 @@ An interface or data shape that existed only in an earlier iteration of the curr
|
|
|
56
56
|
|
|
57
57
|
## Step 4: Verify behavior is preserved
|
|
58
58
|
|
|
59
|
-
Run this step only when a fix was applied. Run
|
|
59
|
+
Run this step only when a fix was applied. Run the typecheck, lint or build of the packages the fixes touched, and the tests that cover the changed code, by name. Run no whole test suite: CI runs each suite when the branch is pushed. A pass that applied nothing left the head as it was, so there is nothing to verify: record `no fix applied; head unchanged, no verification run` in the summary and go to Step 5.
|
|
60
60
|
|
|
61
61
|
Report failures with the check name and relevant output. Fix simplification-caused failures or revert the responsible change; never relax assertions, weaken types, or skip tests.
|
|
62
62
|
|
package/package.json
CHANGED
|
@@ -66,12 +66,13 @@ name is empty. Measured on 2026-11-04 from a Legion issue pod: Slack answered
|
|
|
66
66
|
`{"ok":false,"error":"not_authed"}`. What the client hands over — the value, or the placeholder of
|
|
67
67
|
a secret behind the airlock — exists only in the environment of the command the client starts, so
|
|
68
68
|
that command must read it itself. Put the command in single quotes, inside
|
|
69
|
-
`sh -c`, where the quotes keep the expansion for the child
|
|
69
|
+
`sh -c`, where the quotes keep the expansion for the child, and give `curl` the header on standard
|
|
70
|
+
input (`-H @-`), so the value is in no command's arguments:
|
|
70
71
|
|
|
71
72
|
```sh
|
|
72
73
|
# right
|
|
73
74
|
agent-secrets LEGION_SLACK_BOT_TOKEN -- \
|
|
74
|
-
sh -c '
|
|
75
|
+
sh -c 'printf "Authorization: Bearer %s" "$LEGION_SLACK_BOT_TOKEN" | curl -sS -H @- https://slack.com/api/auth.test'
|
|
75
76
|
```
|
|
76
77
|
|
|
77
78
|
The repository uses the same form for a GitHub App token in `docs/deployment.md`:
|
|
@@ -260,8 +261,9 @@ reaches no shell history.
|
|
|
260
261
|
|
|
261
262
|
```sh
|
|
262
263
|
agent-secrets LEGION_SLACK_BOT_TOKEN --reason 'read the thread of a Slack mention' --wait 0s -- sh -c '
|
|
264
|
+
printf "Authorization: Bearer %s" "$LEGION_SLACK_BOT_TOKEN" |
|
|
263
265
|
curl -sS -G https://slack.com/api/conversations.replies \
|
|
264
|
-
-H
|
|
266
|
+
-H @- \
|
|
265
267
|
--data-urlencode channel=<channel_id> \
|
|
266
268
|
--data-urlencode ts=<thread_ts> \
|
|
267
269
|
--data-urlencode limit=200'
|
|
@@ -24,7 +24,7 @@ Part | Content
|
|
|
24
24
|
`Problem` | What goes wrong, for whom, with counts
|
|
25
25
|
`Goals and non-goals` | What is in and out of scope
|
|
26
26
|
`Requirements` | a `:::requirement` block each, `**R1.**` on, its source (`From:`)
|
|
27
|
-
`Verification` | the issue's `verification.md`, a `:::check` block each: `serves`, `surface`, `run
|
|
27
|
+
`Verification` | the issue's `verification.md`, a `:::check` block each: `serves`, `surface`, `run` (where it names tests, specific ones), `when`, `negative_control`. For a whole test suite, name its CI job in `ci_check`: a check carrying `ci_check` is CI's and takes no `run`
|
|
28
28
|
`Design` | How it meets them; a value and its reason for each limit, size and time
|
|
29
29
|
`Decisions` | One line: `The decisions are in dispatch://KEY/artifact/decisions-md.`
|
|
30
30
|
|
|
@@ -47,7 +47,7 @@ For each spec, ask, comment and message:
|
|
|
47
47
|
|
|
48
48
|
- Name the concrete case and its numbers, then the choice in those terms, never "Which option?".
|
|
49
49
|
- A choice inside what the person asked for, one their messages favour, routine cleanup, sequencing, naming, a choice between equivalent options, and a fix you can make are yours.
|
|
50
|
-
- Ask with an [ask block](skill://dispatch/SKILL.md#asks-and-ask-blocks): 2 to 4 options,
|
|
50
|
+
- Ask with an [ask block](skill://dispatch/SKILL.md#asks-and-ask-blocks): 2 to 4 options, short and self-contained: a person answers it with no other reading.
|
|
51
51
|
- For each technical term you coined in this session, count by exact match the files holding it, in the repositories the work touches and in Dispatch. Expand or drop a term with a single-digit count. Read the draft for a coinage of common words too.
|
|
52
52
|
- Measure each claim the ask rests on, its premise and each option's precondition. Where you cannot, mark the claim unverified and name the missing measurement; call an option unavailable only where a precondition demonstrably fails. No unmeasured number goes in a premise.
|
|
53
53
|
- Before you pass a question on as one only an attended or privileged act answers, try the source that answers it, then the other records holding it. Keep a privileged read for what only the live system knows.
|
package/skills/envoy/SKILL.md
CHANGED
|
@@ -135,13 +135,16 @@ Every topic starts with `notifications.`.
|
|
|
135
135
|
- Publish to a role with `envoy_publish(topic="notifications.role.<role>", ...)`;
|
|
136
136
|
never subscribe to a role topic, because the listener forwards a role message to its holder only.
|
|
137
137
|
A publish returns once Envoy's stream has stored the forward for the holder, with the live `holder` and its `holder_state`.
|
|
138
|
-
When
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
When no live session holds the role, Envoy keeps the message for one hour: the answer says it was kept, and its `kept_until` is the time that hour ends.
|
|
139
|
+
That holds when nobody claims the role, and when its holder is not `live`: the answer then also names the holder, its `holder_state` (`unresponsive` or `gone`) and its `last_seen`.
|
|
140
|
+
The next session to hold the role live before `kept_until` is handed the message once, and that can be the same holder when it answers again.
|
|
141
|
+
If no session takes it by then, Envoy drops it, and when your publish named your session, sends your session a message that names it, unless it dropped it more than an hour late.
|
|
142
|
+
An `unresponsive` holder is not dead, so start no replacement for it and take nothing from it.
|
|
143
|
+
A forward the stream did not store for a live holder within about 4 seconds errs, and you see that error after about 8 seconds, because the client tries once more.
|
|
144
|
+
Neither a kept answer nor an error releases the role's claim: a holder whose `holder_state` is `unresponsive` keeps its role.
|
|
142
145
|
`envoy_role_get(role=...)` finds the holder first.
|
|
143
146
|
The forward is kept on the holder's inbox, so the holder's session gets it once from its own durable consumer, also after a restart, a reconnect, or while it was not running.
|
|
144
|
-
From a shell with no tool device, read the holder with `envoy role <role>` where sjawhar/dotfiles' `scripts/envoy` is on the PATH, and in a Legion pod, which has no `envoy` command, with `curl -sS -H
|
|
147
|
+
From a shell with no tool device, read the holder with `envoy role <role>` where sjawhar/dotfiles' `scripts/envoy` is on the PATH, and in a Legion pod, which has no `envoy` command, with `curl -sS -H @<(printf 'Authorization: Bearer %s' "$(< "$ENVOY_TOKEN_FILE")") "$ENVOY_URL/v1/roles/<role>" | jq -r '.holder // .reason // .error'` in bash (the `<(...)` keeps the token out of `curl`'s arguments), which prints the holder's session id, `unclaimed` for a role nobody holds, or the error of a refused read, such as `unauthorized` for a bad token.
|
|
145
148
|
|
|
146
149
|
- A message that must reach more than 4 role topics is the project controller's to send, not yours.
|
|
147
150
|
Each publish wakes a session, and a woken session reads its whole context again, which the provider charges as uncached input: a mean of 576,083 tokens a wake, a median of 493,636 and a ninetieth percentile of 1,327,888.
|
|
@@ -110,7 +110,8 @@ It depends on where a session takes its deliveries, not on whether the topic is
|
|
|
110
110
|
the listener finds the live holder and forwards the message to it, and drops the message when that holder is the message's source session.
|
|
111
111
|
The stream keeps the forward on the holder's inbox, so the holder's session gets it once, also after a restart or while it was not running.
|
|
112
112
|
No session answers a receipt for one: a publish returns once the stream stored the forward.
|
|
113
|
-
A role message no live holder can take is kept for
|
|
113
|
+
A role message no live holder can take is kept for one hour, until the `kept_until` the publish answers with, and the next session to hold the role live in that hour is handed it once.
|
|
114
|
+
If no session takes it, Envoy drops it, and when the publish named a sender session, Envoy sends that session a message that names it, unless it dropped it more than an hour late.
|
|
114
115
|
|
|
115
116
|
- Every other `notifications.` topic, one no source uses and the stream does not keep, is refused by name
|
|
116
117
|
— at `envoy_publish` and at `envoy_subscribe` alike — because no session would ever receive it.
|
|
@@ -19,9 +19,11 @@ Read this in a Legion pane before you touch a role claim, or when a Legion role
|
|
|
19
19
|
Only the reaper releases a claim, once its holder is `gone`;
|
|
20
20
|
a Legion role whose agent process exits is `gone` at once, so its successor's soft claim takes the role without waiting out the live window.
|
|
21
21
|
|
|
22
|
-
- `holder_lapsed`: a session holds the claim but has not registered within the live window
|
|
22
|
+
- `holder_lapsed`: a session holds the claim but has not registered within the live window.
|
|
23
|
+
The daemon's own notices send `keep: false`, so the listener refuses such a notice `404` and forwards nothing.
|
|
23
24
|
The error names the holder, its `holder_state` and its `last_seen`, and says `claim_released: false`.
|
|
24
25
|
An `unresponsive` holder is not dead: it keeps the role, nothing replaces it, and the daemon holds the packet and publishes it again.
|
|
26
|
+
A publish of yours to such a role is kept instead: the answer is `202` with `kept_reason: holder_lapsed` and `kept_until`.
|
|
25
27
|
|
|
26
28
|
- `delivery_failed`: the stream stored no forward for the holder:
|
|
27
29
|
the holder lookup failed, the publish errored, or the stream did not store the forward within the send's window.
|
|
@@ -34,8 +36,15 @@ Read this in a Legion pane before you touch a role claim, or when a Legion role
|
|
|
34
36
|
|
|
35
37
|
- A role message forwarded to you is kept on your inbox in the stream, which your own durable consumer reads, so your session gets it once, also after the pane restarts or reconnects.
|
|
36
38
|
|
|
39
|
+
- A role message to a released Legion role is kept for one hour, and it wakes the role.
|
|
40
|
+
The listener reports the wake at the keep.
|
|
41
|
+
Its sweep reports the wake again every five minutes while the message has at least 20 minutes of its hour left and no live session holds the role.
|
|
42
|
+
The woken session gets the message as an Envoy card with `kept_at`, and the card can come before the task the daemon gives the woken role.
|
|
43
|
+
If the role is not back inside the hour, Envoy drops the message, and when the publish named a sender session, Envoy sends that session a message that names it, unless it dropped it more than an hour late.
|
|
44
|
+
|
|
37
45
|
- Never forward these failure payloads to an architect, because the daemon already acts on them.
|
|
38
46
|
|
|
39
47
|
- A role send the listener refuses `404` also raises one exception on `notifications.envoy.exceptions.notifications.role.<role>`, with the reason it refused: `unclaimed` or `holder_lapsed`.
|
|
48
|
+
The listener refuses only a publish it keeps nothing for: one sent with `keep: false`, as the daemon's own notices are, or one whose keep failed.
|
|
40
49
|
It is a bus signal and nothing more: no consumer acts on a peer's refusal, and the daemon's own refused outbox row retries by itself until the role is held or its architect cannot hold it again.
|
|
41
50
|
Never re-send a refused message by hand on the strength of one.
|
|
@@ -4,7 +4,7 @@ Read this when a role you held is gone after a resume, fork or restart, when `en
|
|
|
4
4
|
|
|
5
5
|
- A claim belongs to the session, not the process. `omp --resume` re-claims the role recorded in the session transcript, also after the reaper removed the old session's row (the reaper removes a row only once that session is `gone`: past the gone horizon, `ENVOY_SESSION_GONE_HORIZON`, 1h by default).
|
|
6
6
|
- `/fork`, `/branch`, `/handoff` and any other switch that carries the transcript read the role the previous session id held and move it to the new id while the new session starts. `/new` and `/resume` install an unrelated transcript and carry nothing.
|
|
7
|
-
- A holder that has not registered for longer than the live window (`ENVOY_SESSION_LIVE_WINDOW`, 5m by default) reads `unresponsive`, and keeps its role
|
|
7
|
+
- A holder that has not registered for longer than the live window (`ENVOY_SESSION_LIVE_WINDOW`, 5m by default) reads `unresponsive`, and keeps its role. Envoy keeps a role publish to it for one hour and answers that it kept it, with `kept_reason: holder_lapsed`, the holder, its `holder_state`, its `last_seen` and `kept_until`, the time that hour ends. The next session to hold the role live in that hour gets the message: the holder when it answers again, or a session that claims the role. If no session takes it by `kept_until`, Envoy drops it, and when your publish named your session, sends your session a message that names it, unless it dropped it more than an hour late. An unresponsive holder is not dead, so start no replacement for that session and take nothing from it. Only the role-claim reaper releases a claim, once the holder is `gone`. A client that stops cleanly deregisters its own session and sends its client instance id, and the listener removes the registration only when the registration carries the same id or none, so a departing client never removes a registration another process made under the same session id.
|
|
8
8
|
- A role message the listener forwarded to your session while you held the role is kept on your inbox in the stream, which your own durable consumer reads, so your session gets it once after a resume or a reconnect within 72 hours, also when the role moved to another session in the meantime.
|
|
9
9
|
- An automatic reclaim never steals. It is a soft claim, which the listener grants when the role is unheld, when its holder is not `live` — `gone`, or `unresponsive` past the live window, which is how a relaunched Legion role recovers it — and when its holder is the id this session continues (a fork's parent) and that predecessor is this client instance's: the predecessor is not `live`, or its live registration carries this instance's own id, or one of the two sides carries no instance id. A client instance is one Oh My Pi Envoy extension instance, or one Claude Code channel-server process; each mints its id when it starts. Any other `live` session keeps the role — the parent of a `/fork` whose role moved to the child, a second process on the same transcript, a named predecessor another client instance still runs — and the listener refuses atomically, naming that holder, while the resumed session logs a warning and holds nothing.
|
|
10
10
|
- A refusal does not stop the session. The session keeps running, and it stays registered, but without the role. It does not claim again at each heartbeat. The Oh My Pi plugin takes the role at its next session event, once the holder is no longer live. The Claude Code channel takes the role at an explicit claim. Use `envoy_role_get` to read who holds the role now.
|
|
@@ -38,7 +38,7 @@ happens, you did not know, and the phrase hid it from you as well as from the re
|
|
|
38
38
|
|---|---|
|
|
39
39
|
| land the change, land the PR | merge it, release it, deploy it, apply it — whichever one it is |
|
|
40
40
|
| unblock the work | X can start once Y merges |
|
|
41
|
-
| name the problem, name the owner, name a date | say the problem; who owns it is X;
|
|
41
|
+
| name the problem, name the owner, name a date | say the problem; who owns it is X; Y is left, and at the measured rate it ends on <date> |
|
|
42
42
|
| it pays for itself, that pays | it costs $16,306 and returns $60,379 a month |
|
|
43
43
|
| carry it to X, carry the finding | tell X; send it to X; put it on the issue |
|
|
44
44
|
| this shows the gap, the number shows | the gap is 12 of 30; the number is 1.17 |
|
|
@@ -63,6 +63,7 @@ import {
|
|
|
63
63
|
EnvoyToolOperation,
|
|
64
64
|
envoyToolSpecs,
|
|
65
65
|
publishConfirmationText,
|
|
66
|
+
publishResultDetails,
|
|
66
67
|
sendConfirmationText,
|
|
67
68
|
sessionsOnMachine,
|
|
68
69
|
type ToolArgumentsByOperation,
|
|
@@ -1859,19 +1860,14 @@ export async function executeEnvoyTool(
|
|
|
1859
1860
|
})
|
|
1860
1861
|
// The answer the model reads, its line first: the counts of a stored topic's answer, a role
|
|
1861
1862
|
// holder, or a kept answer, which is a success of its own, all in the words the Oh My Pi
|
|
1862
|
-
// plugin uses (`publishConfirmationText`).
|
|
1863
|
+
// plugin uses (`publishConfirmationText`). This server always names its own session as the
|
|
1864
|
+
// source, so the listener sends that session a message for a kept copy no session took,
|
|
1865
|
+
// unless it drops the copy more than an hour late, and the line says so.
|
|
1863
1866
|
return {
|
|
1864
|
-
message: publishConfirmationText(result),
|
|
1867
|
+
message: publishConfirmationText(result, { senderNamed: true }),
|
|
1865
1868
|
event_id: result.envelope.event_id,
|
|
1866
1869
|
topic: result.envelope.topic,
|
|
1867
|
-
...(result
|
|
1868
|
-
...(result.holderState === undefined ? {} : { holder_state: result.holderState }),
|
|
1869
|
-
...(result.recipients === undefined ? {} : { recipients: result.recipients }),
|
|
1870
|
-
...(result.recipientsConnected === undefined
|
|
1871
|
-
? {}
|
|
1872
|
-
: { recipients_connected: result.recipientsConnected }),
|
|
1873
|
-
...(result.kept === undefined ? {} : { kept: result.kept }),
|
|
1874
|
-
...(result.keptReason === undefined ? {} : { kept_reason: result.keptReason }),
|
|
1870
|
+
...publishResultDetails(result),
|
|
1875
1871
|
}
|
|
1876
1872
|
}
|
|
1877
1873
|
case EnvoyToolOperation.subscribe: {
|