@feigi/fleet-ctl 3.158.1 → 3.158.3

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.1",
3
+ "version": "3.158.3",
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": {
@@ -959,6 +959,16 @@ export function runnerTestCmdRefusal(testCmd) {
959
959
  return `args.testCmd is required — the Test entrypoint the shared run executes, got ${JSON.stringify(testCmd)}`;
960
960
  }
961
961
 
962
+ // The worktree refusal the two share, for the reason the rules above are: the
963
+ // snapshot agent interpolates `worktree` into its shell, so a value that is
964
+ // not a string with non-whitespace content snapshots nothing, and only the
965
+ // runner's refusal, before its first attempt, keeps that from being retried.
966
+ // Refused, never trimmed or coerced. Null when `worktree` is acceptable.
967
+ export function runnerWorktreeRefusal(worktree) {
968
+ if (typeof worktree === "string" && worktree.trim() !== "") return null;
969
+ return `args.worktree is required — the checkout the review snapshots, got ${JSON.stringify(worktree)}`;
970
+ }
971
+
962
972
  // --- Orchestration ----------------------------------------------------
963
973
  // `host` supplies `agent(prompt, opts)` (must resolve to PARSED DATA — a
964
974
  // rejection or an unresolvable dispatch must resolve to `null`, the
@@ -1086,6 +1096,8 @@ async function reviewRun(host, args, run) {
1086
1096
  const verifiersForRun = verifiersFor(A);
1087
1097
 
1088
1098
  if (!pr || !worktree) throw new Error("review-pr: args.pr and args.worktree are required");
1099
+ const worktreeRefusal = runnerWorktreeRefusal(worktree);
1100
+ if (worktreeRefusal) throw new Error(`review-pr: ${worktreeRefusal}`);
1089
1101
 
1090
1102
  // The truthiness check above is what made the CLI fail-open REACHABLE:
1091
1103
  // `pr` is interpolated into `gh pr diff ${pr}`, `gh pr view ${pr}` and
@@ -1094,7 +1106,9 @@ async function reviewRun(host, args, run) {
1094
1106
  // snapshot is a real diff belonging to whatever PR that branch heads while
1095
1107
  // every return value here still reports the string that was passed. It is
1096
1108
  // also a PATH component by then (`scratch`, `runRootParent` below), so a
1097
- // value like `../x` names a run root outside the scratch tree.
1109
+ // value like `../x` names a run root outside the scratch tree. A truthy
1110
+ // `worktree` that is blank or not a string is refused by the shared rule
1111
+ // just below the truthiness check, not by the check itself.
1098
1112
  //
1099
1113
  // REFUSED, never coerced. `Number(pr)` would make a bad value the string
1100
1114
  // "NaN" at every one of those interpolation sites — a plausible-looking
@@ -32,7 +32,7 @@
32
32
  // strings are.
33
33
  import { mkdir, unlink, writeFile } from "node:fs/promises";
34
34
  import { basename, dirname, isAbsolute, join, normalize } from "node:path";
35
- import { digestOf, runReview, runnerPrRefusal, runnerScratchRefusal, runnerTestCmdRefusal } from "./review-core.mjs";
35
+ import { digestOf, runReview, runnerPrRefusal, runnerScratchRefusal, runnerTestCmdRefusal, runnerWorktreeRefusal } from "./review-core.mjs";
36
36
 
37
37
  // eval's `agent()` returns a HANDLE, not data: `agent(prompt,
38
38
  // opts)` resolves near-instantly to an `AgentHandle` with `.wait()`, and only
@@ -158,7 +158,7 @@ export async function runReviewOnOmp(args) {
158
158
  // that is not a PR number, a scratch that is not absolute (eval's cwd is the
159
159
  // MAIN CHECKOUT, so a relative one would put the file there), a scratch that
160
160
  // already ends in `pr<N>`, a testCmd that is not a non-blank string, a
161
- // worktree that is absent or empty
161
+ // worktree that is not a non-blank string
162
162
  // — throws before any run: it is not a review failure, and retrying or falling
163
163
  // back would only repeat it. So does a write fault other than a file already
164
164
  // at the path: the review ran, the environment could not keep it. `run` is the
@@ -175,9 +175,8 @@ export async function runReviewToFile(args, run = runReviewOnOmp) {
175
175
  if (scratchRefusal) throw new Error(`review-runner: ${scratchRefusal}`);
176
176
  const testCmdRefusal = runnerTestCmdRefusal(args.testCmd);
177
177
  if (testCmdRefusal) throw new Error(`review-runner: ${testCmdRefusal}`);
178
- if (!args.worktree) {
179
- throw new Error(`review-runner: args.worktree is required — the checkout the review snapshots, got ${JSON.stringify(args.worktree)}`);
180
- }
178
+ const worktreeRefusal = runnerWorktreeRefusal(args.worktree);
179
+ if (worktreeRefusal) throw new Error(`review-runner: ${worktreeRefusal}`);
181
180
  const errors = [];
182
181
  for (let attempt = 1; attempt <= 2; attempt++) {
183
182
  let result;