@sjawhar/claude-envoy 2.32.3 → 2.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,5 +2,5 @@
2
2
  "name": "claude-envoy",
3
3
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
4
4
  "mcpServers": "./.mcp.json",
5
- "version": "2.32.3"
5
+ "version": "2.33.0"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "2.32.3",
3
+ "version": "2.33.0",
4
4
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
5
5
  "mcpServers": {}
6
6
  }
package/dist/dispatch.js CHANGED
@@ -27848,6 +27848,7 @@ var EXCHANGE_CLIENT_ID = "dispatch-token-exchange";
27848
27848
  var FORM_SESSION = "session";
27849
27849
  var FORM_LAUNCHER_CREDENTIAL = "launcher_credential";
27850
27850
  var FORM_LAUNCHER_CREDENTIAL_DECLINED = "false";
27851
+ var FORM_PROJECTS = "projects";
27851
27852
  var SUBJECT_TOKEN_TYPE_KUBERNETES = "urn:envoy:params:oauth:token-type:kubernetes-service-account";
27852
27853
  var SUBJECT_TOKEN_TYPE_GOOGLE = "urn:envoy:params:oauth:token-type:google-identity";
27853
27854
  var SUBJECT_TOKEN_TYPE_PERSON = "urn:envoy:params:oauth:token-type:person-google-identity";
@@ -29341,6 +29342,7 @@ class BrokerTokenClient {
29341
29342
  #subject;
29342
29343
  #actor;
29343
29344
  #session;
29345
+ #projects;
29344
29346
  #launcherCredential;
29345
29347
  #renewBeforeMs;
29346
29348
  #now;
@@ -29357,6 +29359,7 @@ class BrokerTokenClient {
29357
29359
  this.#subject = options.subject;
29358
29360
  this.#actor = options.actor;
29359
29361
  this.#session = options.session ?? "";
29362
+ this.#projects = [...options.projects ?? []];
29360
29363
  this.#launcherCredential = options.launcherCredential ?? true;
29361
29364
  this.#renewBeforeMs = options.renewBeforeMs ?? DEFAULT_RENEW_BEFORE_MS;
29362
29365
  this.#now = options.now ?? Date.now;
@@ -29407,6 +29410,8 @@ class BrokerTokenClient {
29407
29410
  };
29408
29411
  if (this.#session !== "")
29409
29412
  form[FORM_SESSION] = this.#session;
29413
+ if (this.#projects.length > 0)
29414
+ form[FORM_PROJECTS] = this.#projects.join(" ");
29410
29415
  if (!this.#launcherCredential) {
29411
29416
  form[FORM_LAUNCHER_CREDENTIAL] = FORM_LAUNCHER_CREDENTIAL_DECLINED;
29412
29417
  }
@@ -29711,6 +29716,8 @@ var IDENTITY_VAR = "AGENT_SECRETS_MACHINE_IDENTITY";
29711
29716
  var MACHINE_TOKEN_FILE_VAR = "AGENT_SECRETS_MACHINE_TOKEN_FILE";
29712
29717
  var MACHINE_AUDIENCE_VAR = "AGENT_SECRETS_MACHINE_AUDIENCE";
29713
29718
  var SESSION_VAR = "AGENT_SECRETS_SESSION";
29719
+ var PROJECTS_VAR = "AGENT_SECRETS_PROJECTS";
29720
+ var MAX_PROJECTS = 16;
29714
29721
  var POOL_AUDIENCE_VAR = "AGENT_SECRETS_POOL_AUDIENCE";
29715
29722
  var POOL_ACCOUNT_VAR = "AGENT_SECRETS_POOL_ACCOUNT";
29716
29723
  var IDENTITY_KUBERNETES = "kubernetes";
@@ -29722,6 +29729,7 @@ var BROKER_VARIABLES = [
29722
29729
  MACHINE_TOKEN_FILE_VAR,
29723
29730
  MACHINE_AUDIENCE_VAR,
29724
29731
  SESSION_VAR,
29732
+ PROJECTS_VAR,
29725
29733
  POOL_AUDIENCE_VAR,
29726
29734
  POOL_ACCOUNT_VAR,
29727
29735
  SIGNIN_DIR_VAR,
@@ -29771,6 +29779,24 @@ function tradeSession(env, own = "") {
29771
29779
  const acting = own.trim();
29772
29780
  return acting !== "" ? acting : value(env, SESSION_VAR);
29773
29781
  }
29782
+ function tradeProjects(env) {
29783
+ const keys = value(env, PROJECTS_VAR).split(/\s+/).filter((key) => key !== "");
29784
+ if (keys.length > MAX_PROJECTS) {
29785
+ throw new Error(`${PROJECTS_VAR}: ${keys.length} projects are named, and a token names at most ${MAX_PROJECTS}`);
29786
+ }
29787
+ for (const key of keys) {
29788
+ if (!PROJECT_KEY_PATTERN.test(key)) {
29789
+ throw new Error(`${PROJECTS_VAR}: "${key}" is not a project key: ${PROJECT_KEY_RULE}`);
29790
+ }
29791
+ }
29792
+ const sorted = keys.sort();
29793
+ for (let at = 1;at < sorted.length; at += 1) {
29794
+ if (sorted[at] === sorted[at - 1]) {
29795
+ throw new Error(`${PROJECTS_VAR}: ${sorted[at]} is named twice, and a list names each project once`);
29796
+ }
29797
+ }
29798
+ return sorted;
29799
+ }
29774
29800
  async function brokerTokenClient(env, own = "") {
29775
29801
  const brokerUrl = value(env, BROKER_URL_VAR);
29776
29802
  const machine = machineIdentity(env);
@@ -29796,7 +29822,8 @@ async function brokerTokenClient(env, own = "") {
29796
29822
  key: await importDpopKey(record.box_key, `${record.person}'s box key`),
29797
29823
  subject: personIdentity(record, flow),
29798
29824
  actor: machine,
29799
- session: own.trim() || signInSessionName(record)
29825
+ session: own.trim() || signInSessionName(record),
29826
+ projects: tradeProjects(env)
29800
29827
  });
29801
29828
  return { client, signIn: { person: record.person, thumbprint: record.thumbprint } };
29802
29829
  }
@@ -40579,6 +40579,7 @@ var EXCHANGE_CLIENT_ID = "dispatch-token-exchange";
40579
40579
  var FORM_SESSION = "session";
40580
40580
  var FORM_LAUNCHER_CREDENTIAL = "launcher_credential";
40581
40581
  var FORM_LAUNCHER_CREDENTIAL_DECLINED = "false";
40582
+ var FORM_PROJECTS = "projects";
40582
40583
  var SUBJECT_TOKEN_TYPE_KUBERNETES = "urn:envoy:params:oauth:token-type:kubernetes-service-account";
40583
40584
  var SUBJECT_TOKEN_TYPE_GOOGLE = "urn:envoy:params:oauth:token-type:google-identity";
40584
40585
  var SUBJECT_TOKEN_TYPE_PERSON = "urn:envoy:params:oauth:token-type:person-google-identity";
@@ -42082,6 +42083,7 @@ class BrokerTokenClient {
42082
42083
  #subject;
42083
42084
  #actor;
42084
42085
  #session;
42086
+ #projects;
42085
42087
  #launcherCredential;
42086
42088
  #renewBeforeMs;
42087
42089
  #now;
@@ -42098,6 +42100,7 @@ class BrokerTokenClient {
42098
42100
  this.#subject = options.subject;
42099
42101
  this.#actor = options.actor;
42100
42102
  this.#session = options.session ?? "";
42103
+ this.#projects = [...options.projects ?? []];
42101
42104
  this.#launcherCredential = options.launcherCredential ?? true;
42102
42105
  this.#renewBeforeMs = options.renewBeforeMs ?? DEFAULT_RENEW_BEFORE_MS;
42103
42106
  this.#now = options.now ?? Date.now;
@@ -42148,6 +42151,8 @@ class BrokerTokenClient {
42148
42151
  };
42149
42152
  if (this.#session !== "")
42150
42153
  form[FORM_SESSION] = this.#session;
42154
+ if (this.#projects.length > 0)
42155
+ form[FORM_PROJECTS] = this.#projects.join(" ");
42151
42156
  if (!this.#launcherCredential) {
42152
42157
  form[FORM_LAUNCHER_CREDENTIAL] = FORM_LAUNCHER_CREDENTIAL_DECLINED;
42153
42158
  }
@@ -42452,6 +42457,8 @@ var IDENTITY_VAR = "AGENT_SECRETS_MACHINE_IDENTITY";
42452
42457
  var MACHINE_TOKEN_FILE_VAR = "AGENT_SECRETS_MACHINE_TOKEN_FILE";
42453
42458
  var MACHINE_AUDIENCE_VAR = "AGENT_SECRETS_MACHINE_AUDIENCE";
42454
42459
  var SESSION_VAR = "AGENT_SECRETS_SESSION";
42460
+ var PROJECTS_VAR = "AGENT_SECRETS_PROJECTS";
42461
+ var MAX_PROJECTS = 16;
42455
42462
  var POOL_AUDIENCE_VAR = "AGENT_SECRETS_POOL_AUDIENCE";
42456
42463
  var POOL_ACCOUNT_VAR = "AGENT_SECRETS_POOL_ACCOUNT";
42457
42464
  var IDENTITY_KUBERNETES = "kubernetes";
@@ -42463,6 +42470,7 @@ var BROKER_VARIABLES = [
42463
42470
  MACHINE_TOKEN_FILE_VAR,
42464
42471
  MACHINE_AUDIENCE_VAR,
42465
42472
  SESSION_VAR,
42473
+ PROJECTS_VAR,
42466
42474
  POOL_AUDIENCE_VAR,
42467
42475
  POOL_ACCOUNT_VAR,
42468
42476
  SIGNIN_DIR_VAR,
@@ -42512,6 +42520,24 @@ function tradeSession(env, own = "") {
42512
42520
  const acting = own.trim();
42513
42521
  return acting !== "" ? acting : value(env, SESSION_VAR);
42514
42522
  }
42523
+ function tradeProjects(env) {
42524
+ const keys = value(env, PROJECTS_VAR).split(/\s+/).filter((key) => key !== "");
42525
+ if (keys.length > MAX_PROJECTS) {
42526
+ throw new Error(`${PROJECTS_VAR}: ${keys.length} projects are named, and a token names at most ${MAX_PROJECTS}`);
42527
+ }
42528
+ for (const key of keys) {
42529
+ if (!PROJECT_KEY_PATTERN.test(key)) {
42530
+ throw new Error(`${PROJECTS_VAR}: "${key}" is not a project key: ${PROJECT_KEY_RULE}`);
42531
+ }
42532
+ }
42533
+ const sorted = keys.sort();
42534
+ for (let at = 1;at < sorted.length; at += 1) {
42535
+ if (sorted[at] === sorted[at - 1]) {
42536
+ throw new Error(`${PROJECTS_VAR}: ${sorted[at]} is named twice, and a list names each project once`);
42537
+ }
42538
+ }
42539
+ return sorted;
42540
+ }
42515
42541
  async function brokerTokenClient(env, own = "") {
42516
42542
  const brokerUrl = value(env, BROKER_URL_VAR);
42517
42543
  const machine = machineIdentity(env);
@@ -42537,7 +42563,8 @@ async function brokerTokenClient(env, own = "") {
42537
42563
  key: await importDpopKey(record.box_key, `${record.person}'s box key`),
42538
42564
  subject: personIdentity(record, flow),
42539
42565
  actor: machine,
42540
- session: own.trim() || signInSessionName(record)
42566
+ session: own.trim() || signInSessionName(record),
42567
+ projects: tradeProjects(env)
42541
42568
  });
42542
42569
  return { client, signIn: { person: record.person, thumbprint: record.thumbprint } };
42543
42570
  }
@@ -57476,7 +57503,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
57476
57503
 
57477
57504
  // package.json
57478
57505
  var name = "@sjawhar/claude-envoy";
57479
- var version2 = "2.32.3";
57506
+ var version2 = "2.33.0";
57480
57507
  var legion = {
57481
57508
  daemonApiVersion: 144
57482
57509
  };
@@ -26691,6 +26691,7 @@ var EXCHANGE_CLIENT_ID = "dispatch-token-exchange";
26691
26691
  var FORM_SESSION = "session";
26692
26692
  var FORM_LAUNCHER_CREDENTIAL = "launcher_credential";
26693
26693
  var FORM_LAUNCHER_CREDENTIAL_DECLINED = "false";
26694
+ var FORM_PROJECTS = "projects";
26694
26695
  var SUBJECT_TOKEN_TYPE_KUBERNETES = "urn:envoy:params:oauth:token-type:kubernetes-service-account";
26695
26696
  var SUBJECT_TOKEN_TYPE_GOOGLE = "urn:envoy:params:oauth:token-type:google-identity";
26696
26697
  var SUBJECT_TOKEN_TYPE_PERSON = "urn:envoy:params:oauth:token-type:person-google-identity";
@@ -28184,6 +28185,7 @@ class BrokerTokenClient {
28184
28185
  #subject;
28185
28186
  #actor;
28186
28187
  #session;
28188
+ #projects;
28187
28189
  #launcherCredential;
28188
28190
  #renewBeforeMs;
28189
28191
  #now;
@@ -28200,6 +28202,7 @@ class BrokerTokenClient {
28200
28202
  this.#subject = options.subject;
28201
28203
  this.#actor = options.actor;
28202
28204
  this.#session = options.session ?? "";
28205
+ this.#projects = [...options.projects ?? []];
28203
28206
  this.#launcherCredential = options.launcherCredential ?? true;
28204
28207
  this.#renewBeforeMs = options.renewBeforeMs ?? DEFAULT_RENEW_BEFORE_MS;
28205
28208
  this.#now = options.now ?? Date.now;
@@ -28250,6 +28253,8 @@ class BrokerTokenClient {
28250
28253
  };
28251
28254
  if (this.#session !== "")
28252
28255
  form[FORM_SESSION] = this.#session;
28256
+ if (this.#projects.length > 0)
28257
+ form[FORM_PROJECTS] = this.#projects.join(" ");
28253
28258
  if (!this.#launcherCredential) {
28254
28259
  form[FORM_LAUNCHER_CREDENTIAL] = FORM_LAUNCHER_CREDENTIAL_DECLINED;
28255
28260
  }
@@ -28554,6 +28559,8 @@ var IDENTITY_VAR = "AGENT_SECRETS_MACHINE_IDENTITY";
28554
28559
  var MACHINE_TOKEN_FILE_VAR = "AGENT_SECRETS_MACHINE_TOKEN_FILE";
28555
28560
  var MACHINE_AUDIENCE_VAR = "AGENT_SECRETS_MACHINE_AUDIENCE";
28556
28561
  var SESSION_VAR = "AGENT_SECRETS_SESSION";
28562
+ var PROJECTS_VAR = "AGENT_SECRETS_PROJECTS";
28563
+ var MAX_PROJECTS = 16;
28557
28564
  var POOL_AUDIENCE_VAR = "AGENT_SECRETS_POOL_AUDIENCE";
28558
28565
  var POOL_ACCOUNT_VAR = "AGENT_SECRETS_POOL_ACCOUNT";
28559
28566
  var IDENTITY_KUBERNETES = "kubernetes";
@@ -28565,6 +28572,7 @@ var BROKER_VARIABLES = [
28565
28572
  MACHINE_TOKEN_FILE_VAR,
28566
28573
  MACHINE_AUDIENCE_VAR,
28567
28574
  SESSION_VAR,
28575
+ PROJECTS_VAR,
28568
28576
  POOL_AUDIENCE_VAR,
28569
28577
  POOL_ACCOUNT_VAR,
28570
28578
  SIGNIN_DIR_VAR,
@@ -28614,6 +28622,24 @@ function tradeSession(env, own = "") {
28614
28622
  const acting = own.trim();
28615
28623
  return acting !== "" ? acting : value(env, SESSION_VAR);
28616
28624
  }
28625
+ function tradeProjects(env) {
28626
+ const keys = value(env, PROJECTS_VAR).split(/\s+/).filter((key) => key !== "");
28627
+ if (keys.length > MAX_PROJECTS) {
28628
+ throw new Error(`${PROJECTS_VAR}: ${keys.length} projects are named, and a token names at most ${MAX_PROJECTS}`);
28629
+ }
28630
+ for (const key of keys) {
28631
+ if (!PROJECT_KEY_PATTERN.test(key)) {
28632
+ throw new Error(`${PROJECTS_VAR}: "${key}" is not a project key: ${PROJECT_KEY_RULE}`);
28633
+ }
28634
+ }
28635
+ const sorted = keys.sort();
28636
+ for (let at = 1;at < sorted.length; at += 1) {
28637
+ if (sorted[at] === sorted[at - 1]) {
28638
+ throw new Error(`${PROJECTS_VAR}: ${sorted[at]} is named twice, and a list names each project once`);
28639
+ }
28640
+ }
28641
+ return sorted;
28642
+ }
28617
28643
  async function brokerTokenClient(env, own = "") {
28618
28644
  const brokerUrl = value(env, BROKER_URL_VAR);
28619
28645
  const machine = machineIdentity(env);
@@ -28639,7 +28665,8 @@ async function brokerTokenClient(env, own = "") {
28639
28665
  key: await importDpopKey(record.box_key, `${record.person}'s box key`),
28640
28666
  subject: personIdentity(record, flow),
28641
28667
  actor: machine,
28642
- session: own.trim() || signInSessionName(record)
28668
+ session: own.trim() || signInSessionName(record),
28669
+ projects: tradeProjects(env)
28643
28670
  });
28644
28671
  return { client, signIn: { person: record.person, thumbprint: record.thumbprint } };
28645
28672
  }
@@ -30,7 +30,7 @@ and 7 (a conflict, the hand-over, the close) is in
30
30
  | `review-stuck` | A review round the daemon cannot end on its own, in one of three ways: no review decides the round, the approval is of code the current head may not carry, or GitHub will not merge the head. The `review-stuck` paragraphs of your own role prompt give each one, its `topic` and what answers it. The third carries no `topic`. Its remedy, the close and the reopen at the same head, is for one named case only, and your role prompt gives the sort and the remedy's test in full; this row is their summary. Read what the base requires as `skill://legion-worker/references/merge-gate.md` reads it, rulesets and branch protection both, where a `code_scanning` rule requires an analysis no status-check list names. Read what the head carries in two lists, every page: its check runs (counted by `gh api repos/<owner>/<repo>/commits/<head>/check-runs --jq .total_count` and listed by `gh api --paginate 'repos/<owner>/<repo>/commits/<head>/check-runs?per_page=100' --jq '.check_runs[] | [.name, .status, .conclusion] | @tsv'`) and its commit statuses (`gh api --paginate 'repos/<owner>/<repo>/commits/<head>/status?per_page=100' --jq '.statuses[] | [.context, .state] | @tsv'`), since a commit status is no check run. A required item in either list is reported, and 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, and a check run concluded `failure`, `timed_out`, `cancelled` or `startup_failure`, or a status in state `failure` or `error`, is red; never read the status endpoint's top-level `state`, which reads `pending` with no status at all. A required item in neither list falls in a named case: a fork pull request whose runs wait for a maintainer's approval (`action_required`), a check only a commit status would report, and a workflow another repository defines each take a person through a `dispatch ask`; a required workflow whose own path filter skips every file of the change gets no run, and a reopen sends the same event, so while the base still carries that filter the head takes a change to the workflow or to the head, and once the base has dropped it the head is the remedy's own case. The remedy's own case is a required workflow no event started on a pull request already open, and its test is the role prompt's: not a fork and no run `action_required`; a workflow file, as the merge commit holds it, has a job reporting the required item whose `on:` runs it for `pull_request` with no `types`, `branches` or path filter that excludes this change; and neither list holds a run of it. Such a head takes the reopen. A head that matches none of the named cases takes a person through a `dispatch ask`, never the reopen, since GitHub has more cases than these; so does a head whose required item still has no run once every run the reopen started has concluded. Close the pull request, wait a minute, and reopen it at the same head, since in cybermonklabs/legion a quicker reopen can have its CI run cancelled by the close's own run and leave `ci-ok` failing (`tests-closed.yaml`); tell the reviewer on its role topic to do it, since a repository action is the phase worker's. It costs two things: the close writes a `pr-closed-unmerged` notice, which is this close and ends no work, and the reopen starts the head's other checks again. 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. A round whose head has no settled run gets no `review-stuck` notice of any kind, so read it in your own record with the `legion` tool's `read_record`, where the issue's `mergeWait` names the head: its `checkRuns` counts only the runs a CI settlement applied, so 0 there is no evidence of what GitHub holds, and you read the head's two lists before you act. A run still running there is waited for; for a GitHub Actions job GitHub ends the wait itself (24 hours queued on a self-hosted runner, `timeout-minutes` or 6 hours hosted and 5 days self-hosted running, 35 days for a whole workflow run), whose settlement moves the round, a `waiting` run waits on a person's approval of an environment, up to 30 days, and another App's check run, one a workflow created through the API and a `pending` commit status have no such bound and go to a person once they stand longer than their CI usually takes. Every run concluded while `checkRuns` stays 0 is a settlement not yet arrived, which Dispatch's CI reconcile pass repairs where it runs, a pass every 5 minutes reaching each head within a cycle of passes, so read the record again after a few passes; a head still at 0 then is sorted as above: a red required check is `request_backward_move` to `implementing`, a required item with no run takes the reopen only when the test matches, and every other head takes a person. A conflicting head never waits in `mergeWait` once a read has answered for it, because the daemon sends it back itself with a `checks-red` notice. |
31
31
  | `message-refused` | Dispatch refused a write the daemon was making on an issue of your tree, the way it would refuse every attempt, so the daemon makes it no more. A close reason is held to Dispatch's bound at the call that carries it (`close_root` answers `CLOSE_REASON_TOO_LONG`, naming the bound and how far over the text is), so this is a refusal that check did not predict. Read its `reason`: on a status write the daemon writes the status all the same, so the status is set unless Dispatch refused the status itself, which the reason says — with the status set, only the reason beside it is on no issue, and you post what a person still needs yourself; with the status refused, the issue keeps the status it had while the daemon's own record reads the one the write carried, a disagreement no retry of the daemon's closes, so ask a person with `dispatch ask` to set it. On a message write nothing of what it carried reached the issue, and the `reason` gives its length and its first line, so post what a person needs yourself. |
32
32
  | A reply on an ask you follow | Interpret the reply in the issue's design context. Answer in its thread (`dispatch comment --reply-to <comment id>`; under an open ask whose next move is yours, such as the approval request you must revise or hand back, `--reply-to-ask <ask id> --turn agent`, since a default-turn reply hands that request back to the human and a corrected `--summary` is then refused) where the reply carries a question, a disagreement, a correction or a fact you do not have, and whenever you are unsure; an approval, or an answer that settles the question with nothing left to say, draws no comment and no message back to the person who answered. Then adjust the plan or relay the reply via `envoy_publish` to the responsible worker's role token, which an answer needing nothing from you still needs; scope and product decisions remain with you. |
33
- | `worker-died` | Its `role` and `phase`. That role's claim failed: its launches or prompts ran out, or its provider refused every turn of its session (its `failure.detail` reads `the provider refused <n> turns in a row: <message>`). For a phase worker the daemon holds the issue (phase `held`) and starts nothing more on it. It carries `failure` as well (the notice of a held phase, and that of a role which does not work the issue's phase; the one that ends a closed issue's production-check look carries neither `failure` nor `phase`, its `reason` naming the cause already): `cause`, one cause word of the seven the daemon chooses from (`launch_refused`, `died`, `never_registered`, `stale_plugin`, `prompt_retires_exhausted`, `provider_error`, and `unrecorded` for a failure recorded before the daemon kept a cause), `detail`, the sentence written beside that word, `death` and `startFailure`, what the runtime and the launcher last said of this claim where it recorded either, and `launchFailures`, `deaths`, `promptFailures` and `promptRetires`, each a `count` beside the `limit` it ran out at. The claim's record in `read_record` carries the same `failure`, and the issue's `heldFrom` names the phase the hold took it out of. Reassess the work, then decide with `retry_or_escalate`: `retry` when the failure looks agent-specific or transient, `escalate` to hand the held issue to the controller when it looks environmental. `reason` is optional on either decision: a `retry`'s reaches the restarted worker's task, so say in it what you changed or what you want done differently, and an `escalate`'s reaches the controller as the `escalation` key of the `held` notice that records it, so say in it why the tree cannot go on without a decision of the controller's. A `retry` of a claim that failed on refusals starts a **new session**, since resuming the one the provider refused would be refused again: that worker has read none of its own earlier work, and is told so in its first task, which names its branch and the handoffs to read. Expect it to re-read before it continues, and tell it anything only you know. |
33
+ | `worker-died` | Its `role` and `phase`. That role's claim failed: its launches or prompts ran out, or its provider refused every turn of its session (its `failure.detail` reads `the provider refused <n> turns in a row: <message>`), or its system prompt is too large for its pod's start frame (a `launch_refused` with no count at its limit, whose `detail` names the role, the size and the limit: only a shorter prompt starts it, so a `retry` before the prompt is cut fails again at once; `escalate` it). For a phase worker the daemon holds the issue (phase `held`) and starts nothing more on it. It carries `failure` as well (the notice of a held phase, and that of a role which does not work the issue's phase; the one that ends a closed issue's production-check look carries neither `failure` nor `phase`, its `reason` naming the cause already): `cause`, one cause word of the seven the daemon chooses from (`launch_refused`, `died`, `never_registered`, `stale_plugin`, `prompt_retires_exhausted`, `provider_error`, and `unrecorded` for a failure recorded before the daemon kept a cause), `detail`, the sentence written beside that word, `death` and `startFailure`, what the runtime and the launcher last said of this claim where it recorded either, and `launchFailures`, `deaths`, `promptFailures` and `promptRetires`, each a `count` beside the `limit` it ran out at. The claim's record in `read_record` carries the same `failure`, and the issue's `heldFrom` names the phase the hold took it out of. Reassess the work, then decide with `retry_or_escalate`: `retry` when the failure looks agent-specific or transient, `escalate` to hand the held issue to the controller when it looks environmental. `reason` is optional on either decision: a `retry`'s reaches the restarted worker's task, so say in it what you changed or what you want done differently, and an `escalate`'s reaches the controller as the `escalation` key of the `held` notice that records it, so say in it why the tree cannot go on without a decision of the controller's. A `retry` of a claim that failed on refusals starts a **new session**, since resuming the one the provider refused would be refused again: that worker has read none of its own earlier work, and is told so in its first task, which names its branch and the handoffs to read. Expect it to re-read before it continues, and tell it anything only you know. |
34
34
  | `worker-stalled` | Its `role` and `reason`. The daemon's stall backstop acted on that worker's stalled turn: its agent had not stepped for longer than the `worker_stall_backstop_hours` this deployment gives the role, and most often the daemon ended the turn and brought the same session back on a new process. The `reason` is the record the daemon read — when the agent last stepped and how long ago that was, the bound it passed, when the turn began, and the last call the daemon saw, with its tool, its call id, when it started and whether it ended — and never a call's arguments, whose text the daemon keeps in no column. It says what the daemon did as well, which is not always a relaunch: where the daemon's wake pacing parked the replacement, the task was taken back and the launch that replaces the stalled process is queued, due at the moment the notice names, and that process runs on until the launch's turn, which may start nothing — a suspension waiting for the claim, a refused lifecycle recheck or the tree's close can end the claim there instead; where a suspension was already waiting for that turn, that suspension ran instead of a replacement and the claim is suspended with nothing queued for it, waiting on a resume; where the launch that replaces the process could not be written, the daemon is still retrying that launch; and where every try at that launch was refused, the claim has failed, and the `worker-died` that comes with it is yours to answer as that row says. It says what became of the stalled process too, for every end but the parked one: that it was stopped, or that the runtime did not confirm the stop, in which case that process may be running still and holding what it runs on — tell the controller of that one, because the daemon stops it again only at its next launch of that claim or at its next restart. No second notice follows any of these unless the daemon restarts while a relaunch is parked, which decides the claim again. The task that worker was serving is still owed to it, and what its return waits on is the one the notice names — the parked launch's turn, the retried launch, or a resume; the stall itself charged the claim nothing, and no phase moved: on every end but the failed one the phase goes on by itself and you start nothing. Your part is to read what the record says the agent was doing and to judge whether that work needs a decision of yours — a call that hung on something the plan did not foresee is one, a turn that comes back and finishes is not. A stall of your own session reaches you the same way, on your own issue; when the stalled claim is a tree's architect, the controller is told of it too. |
35
35
  | `worker-silent` | Its `role` and `reason`. That worker stopped between turns rather than inside one: its process is up, it holds no task, and its agent has not stepped for longer than the `worker_silence_minutes` this deployment sets, so nothing in the daemon and nothing in that process was going to prompt it again. The `reason` is the record the daemon read — the issue, the role, the phase, when the agent last stepped and how long ago that was — and it ends with what the daemon wrote about it, read from the phase entry the role's phase row names: the start row that sends the work of that entry, where the worker's claim was never given it, or the start row that sends the phase's task again, where the claim is on that entry already, naming the entry where the row holds one. That row is written and the worker is coming back with that work: read the issue's record with the `legion` tool's `read_record` to see where the phase stands, and start nothing yourself. The one thing that still refuses the start is a suspension an operator holds over the claim, which the outbox reads when it runs the row and which the `reason` names: ask the operator to resume that claim, and message the role on its topic (`envoy_publish`) where its phase cannot wait. It comes once for each silence, and a worker that takes a step and then goes quiet again is told again. |
36
36
  | `worker-background-stalled` | Its `role` and `reason`. That worker's own session reports background work of its own — an async job, a subagent, a background task — still running, and it has reported the same thing without change for longer than the `worker_background_hours` this deployment sets. The `reason` is the record the daemon read: the issue, the role, the phase, the kinds the session named, when it last reported them and how long ago that was. Nothing was sent to that worker and nothing will be sent for this: the daemon cannot tell a job that hung from a long one, so it names the worker to you and decides nothing. Your part is to read what the session says it is waiting on and to judge whether that work needs a decision of its own — a job waiting on a surface that does not exist, or on a person, is one; a long build or a long test run is not. Read the issue's record with the `legion` tool's `read_record` for where the phase stands, then either leave the work to finish or message the role on its topic (`envoy_publish`) with what you decide. The worker is not prompted by the silence repair while it reports such work, so nothing else is coming for it either. It comes once for each standing report: a worker whose reported work changes — a job that ends and another that starts — is told of again under the new report. |
@@ -35,7 +35,9 @@ you release it. Read the record, then choose the release.
35
35
  `promptFailures`, and `prompt_retire_limit` bounds `promptRetires`. The count that reached its
36
36
  limit is the budget that ran out, and the cause word says what spent it. The architect reads
37
37
  the same `failure` in its own record and reads these limits nowhere, so name the limit when you
38
- answer it.
38
+ answer it. A `launch_refused` with no count at its limit is a system prompt too large for its
39
+ pod's start frame, and its `detail` names the role, the size and the limit: only a shorter prompt
40
+ starts that role, so a release before the prompt is cut fails again at once.
39
41
  3. **The release.** The `held` wake gives each release its price. On a root whose tree does not
40
42
  linger, `set_status` to `todo` releases the hold and costs nothing: the issue returns to the
41
43
  phase `heldFrom` names, that phase's role starts with its task, and the generation, the review
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "2.32.3",
3
+ "version": "2.33.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",
@@ -178,9 +178,10 @@ after it means the command could not start, and the status is 1.
178
178
  Without the grant line the status is the client's own:
179
179
 
180
180
  - **1** — a refusal or a failure that the message names: a name the broker does not serve
181
- (`UNKNOWN_SECRET`), a broker it cannot reach, a machine that is not logged in to the broker, a
182
- request cancelled or expired, `REQUEST_PENDING`, a grant that is no longer live, or a command
183
- that is not on `PATH`.
181
+ (`UNKNOWN_SECRET`), a secret that waits for its first value (`PENDING_VALUE`), a broker it cannot
182
+ reach, a machine that is not logged in to the broker, a request cancelled or expired,
183
+ `REQUEST_PENDING`, a grant that is no longer live, or a command that is not on `PATH`, which is
184
+ refused before the broker is asked anything, so it reaches no approver.
184
185
  - **2** — a usage error: no broker identity at all (no key in the key dir and no helper socket), no
185
186
  `AGENT_SECRETS_URL`, no `--`, no `NAME`, or a flag value the client refuses.
186
187
  - **75** — the request still waits for a person. The message names who decides it, where, and the
@@ -234,6 +235,17 @@ prompt, a skill, or the issue you work on. There is no list to browse and nothin
234
235
  secret exists is recorded against your session with the reason you signed, and it reaches a
235
236
  person's Inbox unless the model judge decides it first.
236
237
  - `UNKNOWN_SECRET` and a denial are final. Do not ask again, and do not try a name of your own.
238
+ - `PENDING_VALUE` is not final: the secret exists, and its owner is storing its value with
239
+ `agent-secrets secret create` now. No request was made and no approver asked. Ask again in a few
240
+ minutes. After ten minutes the broker stops calling it pending and refuses the name
241
+ `UNKNOWN_SECRET`: the create that made it deletes it when its prompt ends, at ten minutes or,
242
+ where its owner was still typing then, when that entry ends; a create that was killed deletes
243
+ nothing, and the secret stays in the store with no value. Tell its
244
+ owner, who sees it as `versions: none` in `agent-secrets secret show NAME`. The owner frees the
245
+ name with `gcloud secrets delete <id> --project <project number>` (`<id>` is the part after
246
+ `secrets/` of the `secret_name` that `show` prints), or stores the value with
247
+ `agent-secrets secret set NAME`. `agent-secrets secret delete NAME` only schedules the deletion
248
+ 30 days out, and until then the name stays taken, so the next `secret create` of it is refused.
237
249
  - A secret that a service owns goes to that service's own pods and VMs and to nothing else:
238
250
  `Evaluate` in `packages/envoy/internal/broker/policy/policy.go` grants a service-owned secret at
239
251
  once when the session's own service is the secret's owner, and denies every other session, with
@@ -276,7 +288,10 @@ the Application Default Credentials, else the gcloud login; on AWS, `--profile`,
276
288
  the email of the person the credential names, and is refused where it names none, as a token
277
289
  minted for `cloud-platform` alone does: give `--owner <email>` there. Both read the value from
278
290
  standard input or from a prompt with echo off, never from an argument. Type it at the prompt, so it
279
- reaches no shell history.
291
+ reaches no shell history. On Google Cloud, `create` makes the secret before it asks for the value,
292
+ so a store that refuses the create asks for none. Until the value is added, a failure or a signal
293
+ deletes that empty secret again, except where the store's answer leaves open whether it stored the
294
+ value: then `create` keeps the secret, exits 1, and names `agent-secrets secret show NAME` to check.
280
295
 
281
296
  ## A worked example: one page of a Slack thread
282
297