@feigi/fleet-ctl 3.40.0 → 3.40.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feigi/fleet-ctl",
3
- "version": "3.40.0",
3
+ "version": "3.40.2",
4
4
  "description": "Agent fleet: run-team controller, merge bot, PR reviewer, and the ticket pipeline they share",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -462,15 +462,23 @@ function launchedRunners(text) {
462
462
  * refuses a repeat from within a run — and every reviewer runner a row
463
463
  * launched, that `liveOnLedger` does not carry, plus every name the archive's
464
464
  * own `## Retired` already held (`retired`, bare retirable names — the caller
465
- * validates them), once each, in that order. A retired name stays taken for
466
- * the rest of the omp session: the process that ran the member still holds a
467
- * peer under it, and omp answers a second task of that name with `<name>-2`
468
- * while `hub send <name>` keeps reaching the first. `carried` is
469
- * `{rows, dispatched}`, the texts of the rows and the `## Dispatched` entries
470
- * the new ledger carries (`liveOnLedger`'s picks); a name it carries, live or
471
- * as a settled copy, is on the new ledger already and is not listed twice. A
472
- * row is read whether or not it parsed, but an unsettled member token on it
473
- * retires nothing: only a settled name is known gone.
465
+ * validates them), once each: the `## Retired` names first, then the
466
+ * `## Dispatched` entries' in order, then the rows' in the order given, a
467
+ * row's member tokens before the reviewer runners it launched. A retired
468
+ * name stays taken for the rest of the omp session: the process that ran
469
+ * the member still holds a peer under it, and omp answers a second task of
470
+ * that name with `<name>-2` while `hub send <name>` keeps reaching the
471
+ * first. `carried` is `{rows, dispatched}`, the texts of the rows and the
472
+ * `## Dispatched` entries the new ledger carries (`liveOnLedger`'s picks); a
473
+ * name it carries, live or as a settled copy, is on the new ledger already
474
+ * and is not listed twice.
475
+ * `dispatched` is every entry the archive held, well-formed or not, and a row
476
+ * is read whether or not it parsed. A token with an outcome is a name this
477
+ * session used, so it is retired whether or not its outcome is one of its
478
+ * family's: the name on `impl-5=bogus` is retired, though the line is not
479
+ * carried. An unsettled member token — a bare name, no outcome — retires
480
+ * nothing: only a name known gone is retired, and a line whose name does not
481
+ * parse names no member.
474
482
  */
475
483
  export function retiredOnLedger(rows, dispatched, retired, carried) {
476
484
  const seen = new Set();
@@ -488,10 +496,10 @@ export function retiredOnLedger(rows, dispatched, retired, carried) {
488
496
  for (const name of retired) add(name);
489
497
  for (const e of dispatched) {
490
498
  const t = parseToken(e);
491
- if (t !== null && t.error === null && t.outcome !== null) add(t.name);
499
+ if (t !== null && t.outcome !== null) add(t.name);
492
500
  }
493
501
  for (const text of rows) {
494
- for (const t of memberTokens(text)) if (t.error === null && t.outcome !== null) add(t.name);
502
+ for (const t of memberTokens(text)) if (t.outcome !== null) add(t.name);
495
503
  for (const name of launchedRunners(text)) add(name);
496
504
  }
497
505
  return out;
@@ -20,7 +20,8 @@
20
20
  // dispatch and never loses or reorders one — settling annotates an entry in
21
21
  // place — which is what lets `merge-bot-<n>` be numbered from it; a rotate
22
22
  // that carries a run's live entries forward carries a settled one only for a
23
- // member a carried row names, and retires every other settled name into
23
+ // member a carried row names, and retires every other settled name — and a
24
+ // name whose outcome is outside its family's vocabulary — into
24
25
  // `## Retired`, where `dispatch` and that numbering still read it.
25
26
  //
26
27
  // Writer policy: the controller owns run state
@@ -1564,7 +1565,8 @@ function runCheck() {
1564
1565
  // controller's to read and no script's.
1565
1566
  //
1566
1567
  // An `ancestor` rotate also writes `## Retired`: the bare name of every
1567
- // member the archive settled and the new ledger does not carry, of every
1568
+ // member the archive settled, or gave an outcome outside its family's
1569
+ // vocabulary, and the new ledger does not carry, of every
1568
1570
  // reviewer runner its rows launched and the new ledger does not carry, and
1569
1571
  // every name the archive's own `## Retired` held. The omp process those
1570
1572
  // members ran in is still this run's, and it answers a second task under a
@@ -1721,10 +1723,13 @@ function runRotate() {
1721
1723
  // siblings' with them, and the tick's per-PR reading of the PR is unchanged;
1722
1724
  // and the `## Dispatched` entries, settled ones among them, that keep a
1723
1725
  // carried member from reading live again. retiredOnLedger() names the rest:
1724
- // every settled member neither travels, and every reviewer runner a row
1725
- // launched, read off the parsed rows and the skipped ones alike — a row the
1726
- // tick refuses still names members this session ran — and the archive's own
1727
- // `## Retired`, each line of which must be a bare member or reviewer name.
1726
+ // every member neither travels that a line gives an outcome — a settled one,
1727
+ // or one whose outcome is outside its family's vocabulary, which skips the
1728
+ // line but not the name — and every reviewer runner a row launched, read off
1729
+ // the parsed rows, the skipped ones and every `## Dispatched` entry alike — a
1730
+ // line the tick refuses still names members this session ran — and the
1731
+ // archive's own `## Retired`, each line of which must be a bare member or
1732
+ // reviewer name.
1728
1733
  function carryOf(text) {
1729
1734
  const skipped = [];
1730
1735
  const skippedRows = [];
@@ -1739,7 +1744,8 @@ function carryOf(text) {
1739
1744
  return false;
1740
1745
  }
1741
1746
  });
1742
- const dispatched = sectionOf(text, DISPATCHED).filter((e) => {
1747
+ const allDispatched = sectionOf(text, DISPATCHED);
1748
+ const dispatched = allDispatched.filter((e) => {
1743
1749
  const t = parseToken(e);
1744
1750
  if (t !== null && t.error === null) return true;
1745
1751
  skipped.push({ line: e, why: t === null ? "not a member token" : `${t.name}: ${t.error}` });
@@ -1752,7 +1758,7 @@ function carryOf(text) {
1752
1758
  });
1753
1759
  const live = liveOnLedger(rows, dispatched);
1754
1760
  const carried = { rows: live.rows.map((i) => rows[i]), dispatched: live.dispatched };
1755
- const retired = retiredOnLedger([...rows, ...skippedRows], dispatched, archivedRetired, carried);
1761
+ const retired = retiredOnLedger([...rows, ...skippedRows], allDispatched, archivedRetired, carried);
1756
1762
  return { ...carried, retired, skipped };
1757
1763
  }
1758
1764
 
@@ -180,8 +180,19 @@ function nestedHash(abs, env) {
180
180
  const now = entriesAt(abs, env, new Set());
181
181
  if (!now.ok) throw new Error(now.why);
182
182
  let head = git("git rev-parse HEAD", ["rev-parse", "-q", "--verify", "HEAD^{commit}"], abs, env);
183
- if (!head.ok) head = git("git symbolic-ref HEAD", ["symbolic-ref", "-q", "HEAD"], abs, env);
184
- if (!head.ok) throw new Error(head.why);
183
+ if (!head.ok) {
184
+ // No readable commit. Only a branch whose ref does not exist yet (show-ref
185
+ // exit 1) is unborn and hashes as the name HEAD holds; a ref that exists,
186
+ // or a show-ref that failed any other way, is a failed read.
187
+ const symbolic = git("git symbolic-ref HEAD", ["symbolic-ref", "-q", "HEAD"], abs, env);
188
+ // HEAD is detached or otherwise invalid.
189
+ if (!symbolic.ok) throw new Error(symbolic.why);
190
+ const ref = symbolic.stdout.trim();
191
+ const probe = git("git show-ref --verify", ["show-ref", "-q", "--verify", "--", ref], abs, env);
192
+ if (probe.ok) throw new Error(`HEAD points to ${ref} but the commit cannot be resolved`);
193
+ if (probe.status !== 1) throw new Error(probe.why);
194
+ head = symbolic;
195
+ }
185
196
  return `repo:${sha(`${head.stdout}${formatEntries(now.entries)}`)}`;
186
197
  }
187
198
 
@@ -410,9 +410,10 @@ phase, or in any later one, asks the maintainer which tickets to take.
410
410
  every unsettled `## Dispatched` entry and the settled entry of each
411
411
  member a carried row names; exclusions, `## Filed`, `## Ruled` and the
412
412
  drain marker are never carried. Every other settled name — in
413
- `## Dispatched` or on any row — and every reviewer runner a row launched
414
- goes into the new ledger's `## Retired` as a bare name, with whatever the
415
- archive's own `## Retired` held: omp answers a second `task` under a name
413
+ `## Dispatched` or on any row, and including a name whose outcome is
414
+ outside its family's vocabulary, whose line is skipped below — and every
415
+ reviewer runner a row launched goes into the new ledger's `## Retired` as
416
+ a bare name, with whatever the archive's own `## Retired` held: omp answers a second `task` under a name
416
417
  this process has used with `<name>-2` while `hub send <name>` keeps
417
418
  reaching the first, so a settled name stays taken for the session, not
418
419
  the run. `dispatch` refuses a retired name and names the replacement — one
@@ -423,7 +424,9 @@ phase, or in any later one, asks the maintainer which tickets to take.
423
424
  reads `## Retired`: a ticket an earlier run worked is not claimed by it
424
425
  and can be shortlisted again.
425
426
  A line it cannot parse is skipped with a warning naming it, and the
426
- rotation still succeeds. It prints `{rotated, archive, carried: {rows,
427
+ rotation still succeeds; a member name on a skipped line that carries an
428
+ outcome is retired all the same, and a bare member token on a skipped row
429
+ retires nothing. It prints `{rotated, archive, carried: {rows,
427
430
  dispatched}, retired, skipped}`. The carried tokens keep the tick from
428
431
  dispatching onto those members' work, keep their names taken, and give
429
432
  their late results a token to settle; the stranded-claim step below
@@ -4200,7 +4203,8 @@ live count from it, so nobody states one. Write neither by hand:
4200
4203
  same `<file>.lock`, and the next write starts the empty skeleton — unless
4201
4204
  the previous run was this session's own, when it first writes the rows and
4202
4205
  `## Dispatched` entries still live into a new ledger, and every other
4203
- settled name into its `## Retired` (phase 0 says which). Refused
4206
+ settled name, or name given an out-of-vocabulary outcome, into its
4207
+ `## Retired` (phase 0 says which). Refused
4204
4208
  while the recorded controller is alive and not this run's ancestor, ledger
4205
4209
  or none — or, with no record and a ledger to move, while the heartbeat mark
4206
4210
  is still beating — or when the archive name already exists, the process