@feigi/fleet-ctl 3.160.6 → 3.161.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.
@@ -0,0 +1,47 @@
1
+ // Why the cost guard tripped a Cell, and which Objective a reason holds a Cell
2
+ // back under. One table for the guard that writes the reasons (pr-cost.mjs) and
3
+ // every reader of its `tripped` entries: the router, the tick and the cockpit.
4
+ //
5
+ // A `tripped` entry is `{ cell, on: [<reason>, …] }`. A bare Cell name, or an
6
+ // entry whose `on` is null, was written before a trip recorded its reasons: it
7
+ // holds the Cell back under every Objective, as every trip did then, and has
8
+ // no reasons to name.
9
+ //
10
+ // Zero deps: sibling modules only.
11
+
12
+ import { CELL } from "./ledger-grammar.mjs";
13
+
14
+ /** The reasons, in the order an entry lists them. */
15
+ export const TRIP_REASONS = Object.freeze(["floor", "usd", "minutes"]);
16
+
17
+ /** The reasons each Objective holds a Cell back on: `cost` leaves out a dearer Cell, `speed` a slower one; both a Cell under the floor. */
18
+ export const EXCLUDED_ON = Object.freeze({
19
+ cost: Object.freeze(["floor", "usd"]),
20
+ speed: Object.freeze(["floor", "minutes"]),
21
+ });
22
+
23
+ /**
24
+ * Why `raw`, one entry of a guard's `tripped`, is no entry, or null when it is one: a Cell name, or `{ cell, on }`
25
+ * with `cell` a Cell and `on` a non-empty list of reasons when it is present and not null. An empty `on` would hold
26
+ * its Cell back under neither Objective while the guard's verdict still reads `tripped`.
27
+ */
28
+ export function tripFault(raw) {
29
+ const cell = typeof raw === "string" ? raw : raw?.cell;
30
+ if (typeof cell !== "string" || !CELL.test(cell)) return `\`tripped\` names ${JSON.stringify(raw)}, which is not a Cell`;
31
+ if (typeof raw !== "string" && raw.on != null && (!Array.isArray(raw.on) || raw.on.length === 0 || !raw.on.every((r) => TRIP_REASONS.includes(r)))) {
32
+ return `\`tripped\` names ${cell} on ${JSON.stringify(raw.on)}, which is not a list of ${TRIP_REASONS.join(", ")}`;
33
+ }
34
+ return null;
35
+ }
36
+
37
+ /** `raw` as `{ cell, on }`, `on` null for an entry that records none. Call only on an entry tripFault accepts. */
38
+ export const tripEntry = (raw) => (typeof raw === "string" ? { cell: raw, on: null } : { cell: raw.cell, on: raw.on == null ? null : [...new Set(raw.on)] });
39
+
40
+ /** Whether `entry` (tripEntry's) holds its Cell back under `objective`: on a reason the Objective excludes, or on none recorded. */
41
+ export const excludedUnder = (entry, objective) => entry.on === null || entry.on.some((r) => EXCLUDED_ON[objective].includes(r));
42
+
43
+ /** The Cells of `entries` (tripEntry's, or any entry tripFault accepts) that `objective` holds back, sorted, each once. */
44
+ export const excludedCells = (entries, objective) => [...new Set(entries.map(tripEntry).filter((e) => excludedUnder(e, objective)).map((e) => e.cell))].sort();
45
+
46
+ /** `entry` (tripEntry's) in words: the Cell, then its reasons in parentheses when it records any. */
47
+ export const tripWords = (entry) => (entry.on === null || entry.on.length === 0 ? entry.cell : `${entry.cell} (${entry.on.join(", ")})`);
@@ -40,9 +40,9 @@ Nothing in this phase, or in any later one, asks the maintainer which tickets to
40
40
  cell in this main checkout, without `--session`:
41
41
  `subprocess.run([os.path.expanduser("~/.omp/plugins/node_modules/@feigi/fleet-ctl/scripts/fleet-run"),
42
42
  "phase0.mjs", …], stderr=subprocess.STDOUT)`. Add `--in-flight <n>`,
43
- `--objective <o>` and `--merge` or `--no-merge` as `$ARGUMENTS` gave them, `--spend-dir <dir>` for the
43
+ `--objective <o>`, `--baseline-cell <c>` and `--merge` or `--no-merge` as `$ARGUMENTS` gave them, `--spend-dir <dir>` for the
44
44
  spend panel, and `--workflow <name>` or `--declare-no-ci`
45
- when the repository has no workflow named CI. Its steps and receipt: See
45
+ for no CI workflow. Its steps and receipt: See
46
46
  references/phase-0.md. Dispatch nothing before it exits 0. Exit 4 is a
47
47
  step that needs you: act on each `NEED` line below, then run it again. Once
48
48
  `rotate` has run, a re-run skips every `ok` step but `alarm` and resumes
@@ -74,7 +74,7 @@ One line per ticket, rewritten in place (`ledger.mjs row <ticket> <text>`; `ledg
74
74
  #<t5> excluded · behind-issue:#<t3>
75
75
  ```
76
76
 
77
- A row's cell is its `tier=` (the cell a draw picked), else its `cell=` (the cell the router printed for a Pull it routed without a draw, like `#<t6> impl-<t6> · cell=task-high`; `row` writes it, `token` refuses it), else the policy cell, `slow-high`.
77
+ A row's cell is its `tier=` (the cell a draw picked), else its `cell=` (the cell the router printed for a Pull it routed without a draw, like `#<t6> impl-<t6> · cell=task-high`; `row` writes it, `token` refuses it), else `slow-high`, the Cell a bare row runs whatever Baseline Cell routed it.
78
78
 
79
79
  ## Writing before dispatch
80
80
 
@@ -151,7 +151,7 @@ Each member's outcome arrives as its own job status. Settle (CONTEXT.md § Coord
151
151
 
152
152
  ## The implementer's tier is the definition's
153
153
 
154
- The tier lives in that definition's frontmatter (`agents/fleet-implementer-<cell>.agent.md`; `slow-high`, the policy cell, for a row with no `tier=` or `cell=`), which is what an omitted `model` takes first — the session's tier applies only when the definition names none, and a member dispatched with `model` set does not get the declared tier back. Omitting `model` is therefore still the mechanism; what changed is that the tier it resolves to is now declared and pinned rather than inherited by accident. Keep the `name` `DISPATCH` printed (`impl-<N>`, or the retry name the Pull chose when this session already used `impl-<N>`): the name is what makes a member, and both the spend classifier and `member-outcomes.mjs` read it.
154
+ The tier lives in that definition's frontmatter (`agents/fleet-implementer-<cell>.agent.md`; `slow-high`, the Cell a bare row runs, for a row with no `tier=` or `cell=`), which is what an omitted `model` takes first — the session's tier applies only when the definition names none, and a member dispatched with `model` set does not get the declared tier back. Omitting `model` is therefore still the mechanism; what changed is that the tier it resolves to is now declared and pinned rather than inherited by accident. Keep the `name` `DISPATCH` printed (`impl-<N>`, or the retry name the Pull chose when this session already used `impl-<N>`): the name is what makes a member, and both the spend classifier and `member-outcomes.mjs` read it.
155
155
 
156
156
  ## The merge bot's tier buys nothing its backstop does not cover
157
157
 
@@ -23,6 +23,27 @@ by it. It is fixed for the run: a resumed receipt keeps the one it records —
23
23
  other exits 2 naming both, leaving the receipt as it was. A resumed receipt
24
24
  recording anything other than `cost` or `speed` exits 3 naming the value.
25
25
 
26
+ `--baseline-cell <cell>` names the repository's Baseline Cell, the Cell the router
27
+ starts from, the cost guard compares every Cell with and the quality floor reads,
28
+ `slow-high` until a repository names its own. Phase 0 records the one it works out
29
+ in its receipt as `baselineCell` and prints it with where it came from. A valid
30
+ argument (a Cell with an implementer definition) is saved in
31
+ `.fleet/baseline-cell.json` and binds every later run until a run names another;
32
+ `--baseline-cell slow-high` goes back to the default. Phase 0 never refuses a Baseline
33
+ Cell argument or saved value and never asks: an invalid argument is a notice, is not
34
+ saved, and the run goes on to the saved value; an invalid saved value is a notice and
35
+ the run uses `slow-high`; a Cell the install cannot run is replaced for the run by the
36
+ nearest level of its role it does run, a notice naming both Cells; implementer
37
+ definitions that cannot be listed are a notice naming that as the cause. It also
38
+ notices when the run's Baseline Cell differs from the one the last cost guard recorded:
39
+ a switch, which resets nothing — a Cell is compared with the Baseline Cell only over
40
+ the stretches both were drawn in, so trips judged against the old one lift and burn-in
41
+ resumes until the starting set is judged. A last cost guard that is there but cannot
42
+ be read is a notice that whether the run is a switch is not known.
43
+ A resumed receipt keeps its `baselineCell`; an argument that would replace the saved
44
+ value is saved, and a notice says it applies from the next run. A resumed receipt
45
+ recording a value that is no Cell exits 3 naming it.
46
+
26
47
  `--merge` or `--no-merge` is whether the run's merge bot merges, which phase 0
27
48
  records in its receipt as `merge: true` or `merge: false`, `true` when neither
28
49
  is given; both together exit 2. With `no-merge` the fleet takes each PR as far
@@ -257,7 +257,7 @@ terminating in exactly one dispatch or an empty shortlist:
257
257
  the line verbatim under that name in `## Routed` in one write; then the
258
258
  dispatch at once: claim what you are about to dispatch; dispatch what you
259
259
  have just claimed. A Pull routed without a draw writes `cell=<CELL>` instead,
260
- unless `CELL` is the policy cell, `slow-high`, which a row with neither runs.
260
+ unless `CELL` is `slow-high`, the Cell a row with neither runs, whatever Baseline Cell routed the Pull.
261
261
  `ledger.mjs` refuses a line that is not a Routing and a second, different
262
262
  Routing for that name; the same line again — the row step re-run after its
263
263
  write landed — rewrites the row and leaves the entry as it was. Router
@@ -674,7 +674,7 @@ pooled across cells, and stop until
674
674
  there are at least ten of them across five or more distinct `run_date`s; below
675
675
  that, a comparison count is a number, not evidence. SKILL.md's **Report**
676
676
  reports the count `cell-readout.mjs` prints, which holds a cell below that
677
- floor to a count on stderr.
677
+ floor to a count on stderr. The readout compares each cell with the Baseline Cell (`slow-high` until the repository names its own).
678
678
 
679
679
  ## A Pull's entry and exits, in full
680
680