@sjawhar/pi-legion 12.1.0 → 12.2.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.
package/dist/legion.js CHANGED
@@ -7495,7 +7495,7 @@ async function findHandoffCommit(input) {
7495
7495
 
7496
7496
  // ../pi-shared/src/interface.ts
7497
7497
  import { logger } from "@oh-my-pi/pi-utils";
7498
- var ENVOY_PLUGIN_INTERFACE_VERSION = 4;
7498
+ var ENVOY_PLUGIN_INTERFACE_VERSION = 5;
7499
7499
  var ENVOY_PLUGIN_INTERFACE_KEY = Symbol.for("legion.pi-shared.envoy-plugin-interface");
7500
7500
  var LEGION_PLUGIN_LOADED_KEY = Symbol.for("legion.pi-legion.loaded");
7501
7501
  var LEGACY_LEGION_LOADED_KEY = Symbol.for("legion.pi-envoy.legion-loaded");
@@ -7612,6 +7612,9 @@ function onEnvoyRoleRegained(listener) {
7612
7612
  }
7613
7613
 
7614
7614
  // ../pi-shared/src/startup-turn.ts
7615
+ function markStartupTurnPending(sessionID) {
7616
+ envoyPluginInterface().startupTurn = { session: sessionID, sentAt: undefined };
7617
+ }
7615
7618
  function markStartupTurnSent(sessionID) {
7616
7619
  envoyPluginInterface().startupTurn = { session: sessionID, sentAt: Date.now() };
7617
7620
  }
@@ -8178,7 +8181,7 @@ async function bootLegionClaim(host) {
8178
8181
  // package.json
8179
8182
  var package_default = {
8180
8183
  name: "@sjawhar/pi-legion",
8181
- version: "12.1.0",
8184
+ version: "12.2.0",
8182
8185
  license: "Apache-2.0",
8183
8186
  type: "module",
8184
8187
  omp: {
@@ -8505,6 +8508,7 @@ function createControllerSession(deps) {
8505
8508
  const envoyContext = "setInterval" in context ? context : undefined;
8506
8509
  if (startMessage !== undefined && !startMessageSent) {
8507
8510
  if (context.sessionManager.getSessionId() !== sessionID) {
8511
+ clearStartupTurn(sessionID);
8508
8512
  startHandedOver = true;
8509
8513
  return;
8510
8514
  }
@@ -8537,8 +8541,12 @@ function createControllerSession(deps) {
8537
8541
  claimWidget = undefined;
8538
8542
  };
8539
8543
  const handleSessionStart = async (context) => {
8540
- if (!daemonLaunchedController(process.env))
8544
+ if (!daemonLaunchedController(process.env)) {
8545
+ if (operatorLaunchedController(process.env) && process.env.LEGION_CONTROLLER_START_MESSAGE && !startMessageSent) {
8546
+ markStartupTurnPending(context.sessionManager.getSessionId());
8547
+ }
8541
8548
  return;
8549
+ }
8542
8550
  const sessionID = context.sessionManager.getSessionId();
8543
8551
  if (controllerSessionID === undefined || controllerSessionID === sessionID) {
8544
8552
  await claim(context);
@@ -8555,11 +8563,14 @@ function createControllerSession(deps) {
8555
8563
  context.ui.notify("legion: this process already sent the start message, but its controller claim did not finish; run /legion-claim-controller to claim the controller role and its wakes again.", "warning");
8556
8564
  return;
8557
8565
  }
8566
+ const claimed = context.sessionManager.getSessionId();
8558
8567
  try {
8559
8568
  await claimOnce(context, { registered: false });
8560
8569
  } catch (error) {
8561
8570
  const message = messageFor(error);
8562
8571
  logger3.error(`[legion] the controller claim failed: ${message}`);
8572
+ if (!startMessageSent)
8573
+ clearStartupTurn(claimed);
8563
8574
  context.ui.notify(startMessageSent ? `legion: the controller claim failed after the start message was sent: ${message}. The start turn has the controller's registration; run /legion-claim-controller to claim the controller role and its wakes again.` : `legion: the controller claim failed: ${message}. Run /legion-claim-controller to claim again; it sends the start message once the claim succeeds.`, "warning");
8564
8575
  }
8565
8576
  });
@@ -53,10 +53,20 @@ it, and any other change to the head voids it.
53
53
  push's runs and read the CI head again). GitHub's compare lists at most 300 files for the whole
54
54
  comparison, so `files` at 300 is a comparison GitHub cut at its cap and `handoffsOnly` decides
55
55
  nothing: tell the architect and do not approve. A required check
56
- `queued` or `in_progress`: wait. One `completed` as
57
- `cancelled`, or absent: `gh run rerun <run-id>` once, then wait; when nothing will run it (a
58
- check only a commit status reports, a workflow another repository defines), tell the architect
59
- and do not approve. `gh pr checks <n>` is not the read: it reads only the current head, which
56
+ `queued` or `in_progress`: wait. One `completed` as `cancelled`, or absent: re-run that run's
57
+ failed and cancelled jobs, once, then wait — never the whole run, which runs again every job that
58
+ succeeded too. Find the run and job at the CI head: the head's runs
59
+ (`gh api 'repos/<o>/<r>/actions/runs?head_sha=<ci head>&per_page=100' --jq '.workflow_runs[] | [.id, .name, .event, .status, .conclusion] | @tsv'`),
60
+ then each candidate run's jobs
61
+ (`gh api repos/<o>/<r>/actions/runs/<run-id>/jobs --jq '.jobs[] | [.id, .name, .status, .conclusion] | @tsv'`).
62
+ A cancelled job: `gh run rerun <run-id> --failed`, which GitHub applies to the run's failed and
63
+ cancelled jobs and the jobs that depend on them, and to nothing that succeeded. Never
64
+ `--job <job-id>` alone: under a routing workflow, re-running only the final job reads the
65
+ cancelled results again and stays red. GitHub refuses a re-run while an attempt of that run is
66
+ still in progress: wait for it. When no
67
+ run at the CI head holds the job, or nothing will run it (a check only a commit status reports, a
68
+ workflow another repository defines), tell the architect and do not approve. `gh pr checks <n>`
69
+ is not the read: it reads only the current head, which
60
70
  at a handoff head shows only the `pr-title` runs the review events start (measured on
61
71
  sjawhar/legion#1944 at 0220b94fc2 on 2026-10-14).
62
72
  Approval is refused while either `E2E (implementer)` or `E2E (tester)` is missing: `REQUEST_CHANGES` naming the missing line.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion",
3
- "version": "12.1.0",
3
+ "version": "12.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {