@feigi/fleet-ctl 3.158.15 → 3.158.16

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.158.15",
3
+ "version": "3.158.16",
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": {
@@ -120,6 +120,12 @@ function isSettledToken(word) {
120
120
  return t !== null && t.error === null && t.outcome !== null;
121
121
  }
122
122
 
123
+ /** Every settled member token of a row's text, in the row's order, duplicates
124
+ * kept: the tokens a rewrite of the row must carry (settledMemberRefusal). */
125
+ export function settledMemberTokens(text) {
126
+ return text.split(/\s+/).filter(isSettledToken);
127
+ }
128
+
123
129
  /** The dispatch-prompt.mjs role a member of `family` is rendered as. */
124
130
  export function memberRole(family) {
125
131
  return FAMILIES[family].role;
@@ -529,8 +535,7 @@ export function gateVerdictRefusal(oldLine, line) {
529
535
  * own malformed-token check), so a row can still be repaired.
530
536
  */
531
537
  export function settledMemberRefusal(oldLine, line) {
532
- const settled = (text) => (text === null ? [] : text.split(/\s+/).filter(isSettledToken));
533
- const lost = added(settled(line), settled(oldLine))[0];
538
+ const lost = added(settledMemberTokens(line ?? ""), settledMemberTokens(oldLine ?? ""))[0];
534
539
  if (lost === undefined) return null;
535
540
  return `drops settled member token '${lost}' — a rewrite must carry every settled member token as the row holds it; `
536
541
  + "pass the complete reconstructed line, use `ledger.mjs token` to add a non-member token, and `ledger.mjs read` to look a row up";
@@ -943,7 +948,8 @@ export function nextMergeBot(dispatched, names = []) {
943
948
  * one retry letter past the HIGHEST any of `names` on that number has used,
944
949
  * `name` itself included — not past `name`'s own, since a controller can
945
950
  * dispatch `-c` before `-b`. No suffix is the `a` attempt; `-z` is the
946
- * grammar's last, past which there is no legal name, so null. */
951
+ * grammar's last, past which there is no legal name, so null. `name` must
952
+ * already parse as a member name: parseMember's null is not guarded. */
947
953
  export function nextRetry(name, names) {
948
954
  const { family, number } = parseMember(name);
949
955
  const top = [name, ...names].map(parseMember).filter((m) => m !== null && m.family === family && m.number === number)
@@ -951,6 +957,33 @@ export function nextRetry(name, names) {
951
957
  return top === "z" ? null : `${family}-${number}-${String.fromCharCode(top.charCodeAt(0) + 1)}`;
952
958
  }
953
959
 
960
+ /** Every name this omp session has used beyond `## Dispatched`: each member
961
+ * token on any row, live or settled, and each name `## Retired` holds
962
+ * (`retired`, read through readRetired().names). */
963
+ export function sessionMemberNames(rows, retired) {
964
+ return [...rows.flatMap(memberTokens).map((t) => t.name), ...retired];
965
+ }
966
+
967
+ /** How `name` was already used this session, as `ledger.mjs dispatch` words it
968
+ * in its refusal, or undefined when no place holds it: a `## Dispatched`
969
+ * entry, a settled token on a row, or a `## Retired` line. `dispatched` is
970
+ * `## Dispatched` as its tokens. A row token whose outcome is out of
971
+ * vocabulary still counts as a use here, so its name is burnt, while
972
+ * isSettledToken leaves it out of the tokens a row rewrite carries. */
973
+ export function priorUse(name, rows, dispatched, retired) {
974
+ const settledOnRow = rows.flatMap(memberTokens).find((t) => t.name === name && t.outcome !== null);
975
+ return dispatched.find((e) => parseToken(e).name === name) ??
976
+ (settledOnRow ? `${settledOnRow.name}=${settledOnRow.outcome}` : retired.includes(name) ? "retired by rotate" : undefined);
977
+ }
978
+
979
+ /** The replacement name `ledger.mjs dispatch` spells out for `name`, one retry
980
+ * letter past the highest this session has used on its number wherever that
981
+ * name sits, or null when `-z` is used. `name` must already parse as a member
982
+ * name, as nextRetry requires. */
983
+ export function replacementName(name, rows, dispatched, retired) {
984
+ return nextRetry(name, [...dispatched.map((e) => parseToken(e).name), ...sessionMemberNames(rows, retired)]);
985
+ }
986
+
954
987
  // An implementer cell is `<role>-<level>` — an omp role and a thinking
955
988
  // level — and each cell is one definition, `fleet-implementer-<cell>`, whose
956
989
  // `model:` is `@<role>:<level>`. Nothing is named
@@ -74,7 +74,7 @@ import { spawnSync, execFileSync } from "node:child_process";
74
74
  import { makeDie, isFlagLike, hasEqualsForm, isDigits, writeAll } from "./arg.mjs";
75
75
  import { fleetFile, FleetDirUnresolvable } from "./fleet-dir.mjs";
76
76
  import { readReceipt } from "./phase0-receipt.mjs";
77
- import { parseMember, parseToken, memberTokens, nextMergeBot, nextRetry, liveOnLedger, settledOnLedger, retiredOnLedger, retiredName, readRetired, agentDefinition, expectedDefinition, CELL, POLICY_CELL, tierValues, cellValues, decidingCell, rowPr, rowNums, rowWriteRefusal, isReviewToken, addedReviewToken, isDispositionsWord, gateVerdictWriter, gateVerdictRefusal, settledMemberRefusal, newSplitRow, splitRowClause, added, premisesOf, MEMBER_FAMILIES, HALT_CAUSES, ROWS, DISPATCHED, ROUTED, FILED, RULED, DRAIN, RETIRED, RECEIPT, archiveStamp, receiptArchiveName, CLOSEOUT_RECEIPT, closeoutArchiveName, BRIEFS, briefsArchiveName, memberRole, parseDispatchedEntry, dispatchedEntry, parseRouting, parseRoutedEntry, routedEntry, headerRe, escapeText, ledgerSection, nextReviewerName, isOmpSessionDirName } from "./ledger-grammar.mjs";
77
+ import { parseMember, parseToken, memberTokens, nextMergeBot, sessionMemberNames, priorUse, replacementName, liveOnLedger, settledOnLedger, retiredOnLedger, retiredName, readRetired, agentDefinition, expectedDefinition, CELL, POLICY_CELL, tierValues, cellValues, decidingCell, rowPr, rowNums, rowWriteRefusal, isReviewToken, addedReviewToken, isDispositionsWord, gateVerdictWriter, gateVerdictRefusal, settledMemberRefusal, newSplitRow, splitRowClause, added, premisesOf, MEMBER_FAMILIES, HALT_CAUSES, ROWS, DISPATCHED, ROUTED, FILED, RULED, DRAIN, RETIRED, RECEIPT, archiveStamp, receiptArchiveName, CLOSEOUT_RECEIPT, closeoutArchiveName, BRIEFS, briefsArchiveName, memberRole, parseDispatchedEntry, dispatchedEntry, parseRouting, parseRoutedEntry, routedEntry, headerRe, escapeText, ledgerSection, nextReviewerName, isOmpSessionDirName } from "./ledger-grammar.mjs";
78
78
  import { deriveRun, foldLedger, liveFixers, LedgerError, labelOffMember, CONFLICT_HOLD, PARKED } from "./fleet-tick.mjs";
79
79
  import { stateFileIn, readState, writeState, assessBeat, stallsAt } from "./fleet-state.mjs";
80
80
  import { processSource, ancestry, controllerOf, judgeController, ProcUnreadable } from "./proc.mjs";
@@ -2416,7 +2416,7 @@ async function runDispatch() {
2416
2416
  // `## Dispatched`, on a row or in `## Retired` — so the controller never
2417
2417
  // counts. An explicit `merge-bot-<n>` is accepted only when it is that one.
2418
2418
  // `sessionNames` is every name beyond `## Dispatched` the session has used.
2419
- const sessionNames = [...data.rows.flatMap(memberTokens).map((t) => t.name), ...retired];
2419
+ const sessionNames = sessionMemberNames(data.rows, retired);
2420
2420
  const member = parseMember(name === "merge-bot" ? nextMergeBot(data.dispatched, sessionNames) : name);
2421
2421
  if (!member) die(unknownMember(name));
2422
2422
  if (member.bound === null) {
@@ -2443,16 +2443,11 @@ async function runDispatch() {
2443
2443
  // and omp still holds that peer under the name (see runRotate()). The
2444
2444
  // replacement's name is spelled out: one letter past the highest this
2445
2445
  // session has used on the number, wherever that name sits.
2446
- const settledOnRow = data.rows.flatMap(memberTokens).find((t) => t.name === member.name && t.outcome !== null);
2447
- const prior =
2448
- data.dispatched.find((e) => parseToken(e).name === member.name) ??
2449
- (settledOnRow && `${settledOnRow.name}=${settledOnRow.outcome}`) ??
2450
- (retired.includes(member.name) ? "retired by rotate" : undefined);
2446
+ const prior = priorUse(member.name, data.rows, data.dispatched, retired);
2451
2447
  if (prior !== undefined) {
2452
2448
  // Never a merge bot: it is accepted only as the number past every name
2453
2449
  // the session holds, so none of the three places above can name it.
2454
- const used = [...data.dispatched.map((e) => parseToken(e).name), ...sessionNames];
2455
- const next = nextRetry(member.name, used);
2450
+ const next = replacementName(member.name, data.rows, data.dispatched, retired);
2456
2451
  die(`${member.name} was already dispatched this session (${prior}) — a replacement takes a name of its own`
2457
2452
  + (next === null ? `, and ${member.name} has no retry letter left` : ` (${next})`));
2458
2453
  }
package/scripts/pull.mjs CHANGED
@@ -104,8 +104,16 @@
104
104
  // the brief's Out of scope section are printed as the
105
105
  // behind-issue candidates. Then `clear`, `behind-pr:#M`,
106
106
  // `behind-issue:#M`, or `paths <p>…`, which scans again and
107
- // asks again. An exclusion is a ledger row.
108
- // 6 claim `claim-ticket.sh <N> impl-<N> implementer --apply`.
107
+ // asks again. An exclusion is a ledger row, and the row's settled
108
+ // member tokens follow its `excluded · <token>`.
109
+ // 6 claim `claim-ticket.sh <N> impl-<N> implementer --apply`. The claim, the
110
+ // worktree and the branch always take the `impl-<N>` pair; the
111
+ // member that works the ticket is named first, from `ledger.mjs
112
+ // read`, the way `ledger.mjs dispatch` names a replacement:
113
+ // `impl-<N>` when this omp session has not used it (not
114
+ // dispatched, settled on a row or retired), else the next free
115
+ // retry name (`impl-<N>-b`, `-c`, …). With no retry letter left
116
+ // the Pull is left, exit 1, before anything is claimed.
109
117
  // 7 route `ticket-router.mjs route …`, which routes by the Objective
110
118
  // the phase-0 receipt records; a router that refuses releases
111
119
  // the claim, and a release that fails is exit 2 with the claim
@@ -113,8 +121,9 @@
113
121
  // `excluded · behind-issue:#<N>`: another open ticket
114
122
  // sequences after this one.
115
123
  // 8 row, render, dispatch `ledger.mjs row … --routing <line>`, the row and
116
- // the router's line in one write, `dispatch-prompt.mjs render
117
- // implementer --member impl-<N>`, `ledger.mjs dispatch`. The
124
+ // the router's line in one write — the row's settled member
125
+ // tokens carried, then the member —, `dispatch-prompt.mjs render
126
+ // implementer --member <member>`, `ledger.mjs dispatch`. The
118
127
  // brief and the staleness text are given as they are.
119
128
  //
120
129
  // THE STATE is `<scratch>/impl-<N>/pull.json`: every command run (script, its
@@ -137,7 +146,7 @@ import { FleetDirUnresolvable, fleetFile } from "./fleet-dir.mjs";
137
146
  import { gitEnv } from "./git-env.mjs";
138
147
  import { isCLI } from "./is-cli.mjs";
139
148
  import { LabelMapUnreadable, readLabelMap } from "./label-map.mjs";
140
- import { EXCLUDED_REASON, POLICY_CELL, memberTokens, parseRouting, premisesOf, pullEnded, tierValues } from "./ledger-grammar.mjs";
149
+ import { EXCLUDED_REASON, POLICY_CELL, memberTokens, parseRouting, parseToken, premisesOf, priorUse, pullEnded, readRetired, replacementName, settledMemberTokens, tierValues } from "./ledger-grammar.mjs";
141
150
  import { sessionFromReceipt } from "./phase0-receipt.mjs";
142
151
  import { LINE_REF, briefPaths, briefText, outOfScope, strandedRuling, ticketText } from "./ticket-text.mjs";
143
152
 
@@ -215,6 +224,24 @@ export function closeComment(commit, subject) {
215
224
  const rowKey = (row) => row.split(/\s/)[0];
216
225
  const isImplRow = (row) => memberTokens(row).some((t) => t.family === "impl");
217
226
 
227
+ /**
228
+ * The name a ticket is claimed under, and its worktree and branch are named
229
+ * for: the claim belongs to the ticket, whichever member works it.
230
+ */
231
+ const pairOf = (ticket) => `impl-${ticket}`;
232
+
233
+ /** `ticket`'s row in `rows`, or undefined. */
234
+ const rowOf = (rows, ticket) => rows.find((r) => rowKey(r) === `#${ticket}`);
235
+
236
+ /** The settled member tokens a rewrite of `ticket`'s row must carry, in the row's order. */
237
+ const carriedTokens = (rows, ticket) => {
238
+ const row = rowOf(rows, ticket);
239
+ return row === undefined ? [] : settledMemberTokens(row);
240
+ };
241
+
242
+ /** Whether `x` is an array of strings, the shape `ledger.mjs read` prints `rows`, `dispatched` and `retired` in. */
243
+ const strings = (x) => Array.isArray(x) && x.every((s) => typeof s === "string");
244
+
218
245
  /**
219
246
  * The `--impl-row` the router is given: the row count the Pull creates — or,
220
247
  * while an exploration assignment is rolling (the latest row 5k and every row
@@ -426,7 +453,7 @@ function goneBranches(out) {
426
453
  function fresh(ticket, session) {
427
454
  return {
428
455
  ticket,
429
- member: `impl-${ticket}`,
456
+ member: null,
430
457
  started: now(),
431
458
  status: "running",
432
459
  stage: "inflight",
@@ -632,16 +659,36 @@ class Pull {
632
659
  return result(10, block(qid, this.st.ticket, context));
633
660
  }
634
661
 
635
- ledgerRows() {
662
+ // `ledger.mjs read`'s JSON, refused when it is unreadable or carries no `rows`.
663
+ readLedger() {
636
664
  const r = this.script("ledger", "ledger.mjs", ["read"]);
637
665
  if (r.status !== 0) throw new Refusal(withText(`ledger.mjs read ${r.how}`, r));
666
+ let data = null;
638
667
  try {
639
- const { rows } = JSON.parse(r.stdout);
640
- if (Array.isArray(rows) && rows.every((x) => typeof x === "string")) return rows;
668
+ data = JSON.parse(r.stdout);
641
669
  } catch {
642
670
  // Falls through to the refusal below.
643
671
  }
644
- throw new Refusal("ledger.mjs read printed no {rows}");
672
+ if (!strings(data?.rows)) throw new Refusal("ledger.mjs read printed no {rows}");
673
+ return data;
674
+ }
675
+
676
+ // The ledger as `ledger.mjs read` prints it, the parts the member's name is picked from: `rows`, `dispatched`
677
+ // (`## Dispatched` as its tokens) and `retired` (the names `## Retired` holds). An entry or line the grammar cannot
678
+ // read is a refusal, as `ledger.mjs dispatch` refuses it, before anything is claimed.
679
+ ledger() {
680
+ const data = this.readLedger();
681
+ if (!strings(data.dispatched) || !strings(data.retired)) throw new Refusal("ledger.mjs read printed no {dispatched, retired}");
682
+ const bad = data.dispatched.find((e) => parseToken(e) === null);
683
+ if (bad !== undefined) throw new Refusal(`ledger.mjs read: ## Dispatched has an entry '${bad}' this grammar cannot parse — fix the ledger by hand`);
684
+ const { names, malformed } = readRetired(data.retired);
685
+ if (malformed.length > 0) throw new Refusal(`ledger.mjs read: ## Retired has a line '${malformed[0]}' that names no member or reviewer — fix the ledger by hand`);
686
+ return { rows: data.rows, dispatched: data.dispatched, retired: names };
687
+ }
688
+
689
+ // The rows alone, for the readers that write a row or route: a section only the name needs cannot block them.
690
+ ledgerRows() {
691
+ return this.readLedger().rows;
645
692
  }
646
693
 
647
694
  // ── the ticket, as read ──
@@ -908,7 +955,15 @@ class Pull {
908
955
  } catch (e) {
909
956
  return this.stop(e.message);
910
957
  }
911
- const r = this.script("claim", "claim-ticket.sh", [String(st.ticket), st.member, "implementer", "--apply"]);
958
+ // The claim belongs to the ticket, so it is made under the `impl-<N>` pair; the member that works it is the
959
+ // next name this session has not used on the number, and is chosen before anything is claimed.
960
+ const base = pairOf(st.ticket);
961
+ const { rows, dispatched, retired } = this.ledger();
962
+ const prior = priorUse(base, rows, dispatched, retired);
963
+ const member = prior === undefined ? base : replacementName(base, rows, dispatched, retired);
964
+ if (member === null) return this.leave(`no retry letter is left: ${base} was already used this session (${prior}) and every retry letter after it is taken`);
965
+ st.member = member;
966
+ const r = this.script("claim", "claim-ticket.sh", [String(st.ticket), base, "implementer", "--apply"]);
912
967
  if (r.status === 0) {
913
968
  st.stage = "route";
914
969
  return null;
@@ -931,7 +986,7 @@ class Pull {
931
986
  const routing = r.status === 0 ? parseRouting(line) : null;
932
987
  if (routing === null) {
933
988
  const said = r.status === 0 ? `printed no routing line: ${r.stdout}` : withText(`refused (${r.how})`, r);
934
- const rel = this.script("release", "release-ticket.sh", [String(st.ticket), st.member, "implementer", "--apply"]);
989
+ const rel = this.script("release", "release-ticket.sh", [String(st.ticket), pairOf(st.ticket), "implementer", "--apply"]);
935
990
  if (rel.status !== 0) {
936
991
  // The claim stands, so the Pull is not over: it stays at this step, and running it again routes, or refuses and releases, again.
937
992
  return this.stop(`ticket-router.mjs ${said}\n${withText(`its claim is STILL STANDING: release-ticket.sh failed (${rel.how})`, rel)}`);
@@ -950,9 +1005,12 @@ class Pull {
950
1005
  const { cell, draw } = st.route;
951
1006
  // `tier=` marks a draw; a Pull routed without one still dispatches at the
952
1007
  // cell the router printed, carried as `cell=` so the row reads as undrawn.
953
- // The Routing itself goes to `## Routed` in the same write.
1008
+ // The Routing itself goes to `## Routed` in the same write. The row's
1009
+ // settled member tokens are carried ahead of the member: a rewrite drops
1010
+ // none, and the earlier `tier=` and `cell=` words are the earlier member's.
954
1011
  const carrier = draw !== "-" ? ` · tier=${cell}` : cell !== POLICY_CELL ? ` · cell=${cell}` : "";
955
- const r = this.script("row", "ledger.mjs", ["row", String(st.ticket), `${st.member}${carrier}`, "--routing", st.route.line]);
1012
+ const text = [...carriedTokens(this.ledgerRows(), st.ticket), `${st.member}${carrier}`].join(" · ");
1013
+ const r = this.script("row", "ledger.mjs", ["row", String(st.ticket), text, "--routing", st.route.line]);
956
1014
  if (r.status !== 0) return this.stop(withText(`ledger.mjs row failed (${r.how})`, r));
957
1015
  st.stage = "render";
958
1016
  return null;
@@ -960,11 +1018,11 @@ class Pull {
960
1018
 
961
1019
  stage_render() {
962
1020
  const { st } = this;
963
- const worktree = join(this.p.cwd, ".worktrees", `${st.ticket}-${st.member}`);
1021
+ const worktree = join(this.p.cwd, ".worktrees", `${st.ticket}-${pairOf(st.ticket)}`);
964
1022
  const staleness = st.staleness.length === 0 ? "no probe was run" : st.staleness.join("; ");
965
1023
  const r = this.script("render", "dispatch-prompt.mjs", [
966
1024
  "render", "implementer", "--member", st.member, "--ticket", String(st.ticket), "--worktree", worktree,
967
- "--branch", `implementer/${st.ticket}-${st.member}`, "--scratch", this.p.scratch,
1025
+ "--branch", `implementer/${st.ticket}-${pairOf(st.ticket)}`, "--scratch", this.p.scratch,
968
1026
  "--brief", ticketText(this.issue()), "--staleness", staleness,
969
1027
  ]);
970
1028
  if (r.status !== 0) return this.stop(withText(`dispatch-prompt.mjs render refused (${r.how}) — the claim stands`, r));
@@ -1104,7 +1162,9 @@ class Pull {
1104
1162
  for (const p of text.split(/\s+/)) if (!st.addedPaths.includes(p)) st.addedPaths.push(p);
1105
1163
  return null;
1106
1164
  }
1107
- const r = this.script("exclude", "ledger.mjs", ["row", String(st.ticket), `excluded · ${token}`]);
1165
+ // An Exclusion still carries the row's settled member tokens: the rewrite drops none.
1166
+ const excluded = [`${EXCLUDED_REASON} ${token}`, ...carriedTokens(this.ledgerRows(), st.ticket)].join(" · ");
1167
+ const r = this.script("exclude", "ledger.mjs", ["row", String(st.ticket), excluded]);
1108
1168
  if (r.status !== 0) return this.stop(withText(`ledger.mjs row failed (${r.how})`, r));
1109
1169
  return this.leave(`${EXCLUDED_REASON} ${token}`);
1110
1170
  }
@@ -1160,7 +1220,7 @@ function readLedgerRows(p) {
1160
1220
  * could not read is a refusal (exit 2) that says the exclusion stands.
1161
1221
  */
1162
1222
  function heldOut(p, n) {
1163
- const row = readLedgerRows(p).find((r) => rowKey(r) === `#${n}`);
1223
+ const row = rowOf(readLedgerRows(p), n);
1164
1224
  const premises = row === undefined ? null : premisesOf(row);
1165
1225
  if (premises === null) return null;
1166
1226
  const standing = standingPremise(premises, p.cwd);
@@ -1199,7 +1259,7 @@ function shortlistHead(p, run) {
1199
1259
  // empty one.
1200
1260
  const unreadable = [];
1201
1261
  for (const { n } of list.shortlist) {
1202
- const row = rows.find((r) => rowKey(r) === `#${n}`);
1262
+ const row = rowOf(rows, n);
1203
1263
  if (row !== undefined && isImplRow(row)) continue;
1204
1264
  const premises = row === undefined ? null : premisesOf(row);
1205
1265
  const standing = premises === null ? null : standingPremise(premises, p.cwd);
@@ -511,7 +511,7 @@ worktree re-created for an already-open PR is in references/isolation.md.
511
511
  A dispatch is done when its `task` call is made, in the background, with the `agent` and the name `ledger.mjs dispatch` printed, and — for an implementer — the tier check has written its verdict: dispatch nothing on top of an unchecked one.
512
512
 
513
513
  - **One claim, one dispatch, no queue.** Claim one ticket, then dispatch one new member at once, under a name no member has held; nothing holds a queue. Record `ledger.mjs dispatch` before the call.
514
- - **The implementer.** Dispatch with the printed `agent`, omit `model`, keep `name: impl-<N>`. **No per-call tier or effort anywhere on this path**: tier stays the agent definition's own frontmatter, whichever `fleet-implementer-<cell>` definition the Pull names, and a member's Resolved tier stays readable from its transcript. The prompt carries only what varies, and the Pull's own read of the ticket is pasted, never a request to re-fetch. A member settling with nothing is not a bail. Confirm death first, exactly as the Member-killed row does (Failure handling, below) — its mtime discriminator, never silence alone. Only the member's own bail report counts. A confirmed-dead member recovers exactly as the Member-killed row says — new member, new name, the SAME ticket — never a demotion.
514
+ - **The implementer.** Dispatch with the printed `agent`, omit `model`, keep the `name` `DISPATCH` printed. **No per-call tier or effort anywhere on this path**: tier stays the agent definition's own frontmatter, whichever `fleet-implementer-<cell>` definition the Pull names, and a member's Resolved tier stays readable from its transcript. The prompt carries only what varies, and the Pull's own read of the ticket is pasted, never a request to re-fetch. A member settling with nothing is not a bail. Confirm death first, exactly as the Member-killed row does (Failure handling, below) — its mtime discriminator, never silence alone. Only the member's own bail report counts. A confirmed-dead member recovers exactly as the Member-killed row says — new member, new name, the SAME ticket — never a demotion.
515
515
  - **The tier check.** **Run the check right after the dispatch, and never reinstall the plugin or change `modelRoles` while any member is unchecked.** `tick --apply`, or `tier-check.mjs --batch <path>`, runs it. Dispatch nothing on top of an unchecked or mismatched member. **The tick holds the next Pull until that verdict exists.** Clear a mismatch by fixing the definition or the dispatch and dispatching the replacement at the right tier. A mismatch on a ticket whose issue is already CLOSED holds nothing. **After `/resume`, a carried implementer can hold the whole tick** with `HOLD (tier unchecked impl-<N>)` until it settles; reconcile its carried token meanwhile. See references/member-lifecycle.md.
516
516
  - **The exploration rule.** **Every 5th Pull by ledger count goes at an exploration cell.** See references/pull.md. The printed CELL line is the whole routing decision: never re-derive `CELL`, and never label a cell anywhere — the dispatch record already carries it. **The readout counts DELIBERATE comparisons.** See references/pull.md.
517
517
 
@@ -691,6 +691,22 @@ after a router refusal `next --head <N>` starts the ticket over; exit 3 is a
691
691
  usage mistake, or an answer the question does not take, and records nothing.
692
692
  The record is `<scratch>/impl-<N>/pull.json`.
693
693
 
694
+ **The Pull's member is named before anything is claimed, and the claim keeps the
695
+ pair.** The claim, the worktree and the branch always take the `impl-<N>` pair,
696
+ because the claim belongs to the ticket; only the member that works it is
697
+ named, from `ledger.mjs read`, the way `ledger.mjs dispatch` names a
698
+ replacement. When this omp session has not used `impl-<N>` — not dispatched,
699
+ not a settled token on a row, not under `## Retired` — the member is `impl-<N>`.
700
+ When it has, the member is the next free name (`impl-<N>-b`, `-c`, …), and a
701
+ replacement works in the same worktree and branch. A ticket whose retry letters
702
+ are all used leaves the Pull, exit 1, with a reason saying so, before any claim.
703
+ The row, the render's `--member`, `ledger.mjs dispatch`, the `DISPATCH` line's
704
+ `name` and the Routing under `## Routed` all carry that name. A row rewrite
705
+ carries the row's settled member tokens — `impl-<N>=released`, `=bailed`,
706
+ `=PR#<M>` — ahead of the member, in row order, and drops the earlier `tier=` and
707
+ `cell=` words; a `behind-*` answer writes `excluded · <token>` followed by the
708
+ same tokens, so no rewrite drops one.
709
+
694
710
  ## No multi-select, no maintainer tick
695
711
 
696
712
  **No multi-select, no maintainer tick.** Selection and ordering are batched —