next-issue 7.8.29 → 8.0.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/README.md CHANGED
@@ -46,7 +46,7 @@ issue ends, the run fetches the open issues again and claims the oldest unseen
46
46
  one for the free slot. Each issue has its own worktree and branch. Step 3 below
47
47
  and the removal of a worktree or branch run for one issue at a time, so two
48
48
  issues never change the git refs or worktrees of the repository at once. An issue blocked by a running issue is skipped and not tried again in
49
- that run, even when the blocker closes before the run ends. `--max <n>` counts the handled issues across the run, and with `--once`
49
+ that run, even when the blocker closes before the run ends. `--max <n>` counts the handled issues across the run, so with `--max 1`
50
50
  the run handles one issue. For each issue:
51
51
 
52
52
  1. Claim the issue only when it holds the `status:todo` label and holds no
@@ -824,7 +824,7 @@ that waits for a person and for one that a stop left behind. The run starts no
824
824
  agent and makes no push, revert, label change, close or comment, so a change
825
825
  that already landed stays on the base branch. A worktree or branch that cannot be
826
826
  removed stays, and the run log says so. The issue shows as `skipped` (`closed`)
827
- in the summary and does not count for `--max` or `--once`. A `--watch` run does
827
+ in the summary and does not count for `--max`. A `--watch` run does
828
828
  not claim an issue again once it ended in `error` in that run, so it leaves such
829
829
  an issue for the next run to clean up.
830
830
 
@@ -838,7 +838,6 @@ an issue for the next run to clean up.
838
838
  | `stop` | Stop the worker of this repository, see [Worker](#worker) |
839
839
  | `logs` | Show the latest run log and follow it, see [Observability](#observability) |
840
840
  | `--force` | Replace an existing config file, with `init` |
841
- | `--once` | Stop after the first handled issue, with `start` |
842
841
  | `--max <n>` | Handle at most n issues, with `start` |
843
842
  | `--watch` | Keep running, and read the open issues again after each pass, with `start` |
844
843
  | `--hunt` | Hunt the repository for bugs alongside the issues, with `start`, see [Hunt for bugs](#hunt-for-bugs) |
@@ -848,7 +847,7 @@ an issue for the next run to clean up.
848
847
  | `--quiet` | Show only the milestones and the summary |
849
848
  | `--help` | Show the option list |
850
849
 
851
- `--once`, `--max <n>`, `--watch`, `--hunt` and `--reset` belong to `start`, and
850
+ `--max <n>`, `--watch`, `--hunt` and `--reset` belong to `start`, and
852
851
  any other command refuses them. `next-issue` with no command prints the option
853
852
  list on standard error, starts nothing and exits with 1.
854
853
 
@@ -858,7 +857,9 @@ of the run.
858
857
 
859
858
  Versions before 7.0.0 started a run with no command, as `next-issue` or
860
859
  `next-issue --once`. From 7.0.0 a run needs `next-issue start`, and the old
861
- form starts nothing and exits with 1.
860
+ form starts nothing and exits with 1. Later versions dropped `--once`:
861
+ `next-issue start --once` fails with `Unknown argument: --once` and exits with
862
+ 1, so use `next-issue start --max 1`.
862
863
 
863
864
  ## Watch for new issues
864
865
 
@@ -866,8 +867,11 @@ A run without `--watch` ends when no unseen issue is left. With
866
867
  `next-issue start --watch`, the harness then waits, reads the open issues again
867
868
  and runs another pass, so it picks up an issue that someone opens during the run, or one whose blocker
868
869
  closes. Each pass tries every open issue again, also one that an earlier pass
869
- skipped. An issue that failed in an earlier pass is not tried again until the
870
- next run.
870
+ skipped. An issue that failed with an error before the claim is not tried
871
+ again until the next run. An issue that failed after the claim and was handed
872
+ over with the needs-human label is tried again in a later pass once a person
873
+ answers the hand-over or takes the label off. The hunter counts the same
874
+ issues as ready.
871
875
 
872
876
  The waits follow a fixed back-off in minutes: 1, 2, 3, 5, 10, then 10 from then
873
877
  on. A pass that handles an issue, with any outcome other than `skipped`, resets
@@ -877,8 +881,7 @@ pass.
877
881
 
878
882
  After each pass that handled an issue, the harness prints the summary of that
879
883
  pass. The token totals in it cover that pass only. The exit code at the end
880
- covers all passes. `--max <n>` counts the handled issues across all passes,
881
- and `--once` is the same as `--max 1`.
884
+ covers all passes. `--max <n>` counts the handled issues across all passes.
882
885
 
883
886
  The watch stops:
884
887
 
@@ -934,7 +937,7 @@ affect another. The worker:
934
937
  - runs at most one run at a time. A client starts it with
935
938
  `{ "type": "start", "root": "<path>", "args": [...] }`. Each run is like
936
939
  `next-issue start` with those args, or with none when `args` is left out. It takes
937
- `--once`, `--max <n>`, `--watch`, `--hunt`, `--reset`, `--verbose` and
940
+ `--max <n>`, `--watch`, `--hunt`, `--reset`, `--verbose` and
938
941
  `--quiet`, and refuses a command (`start` too), `--json`, `--force`, `--help` or an
939
942
  unknown argument with an `error` message;
940
943
  - sends every client the progress of every run when it connects and on every
@@ -975,8 +978,8 @@ affect another. The worker:
975
978
  started with `--watch` alone starts with it off. Off lets a hunt that is
976
979
  going finish, so the issues it files stay, and starts no new hunt. On wakes
977
980
  the hunter at once, with no back-off wait. A run that does not watch
978
- (`--once`, or `--max` without `--watch`) refuses on with an `error` message
979
- that says why, and goes on unchanged. With no run going, the message gets
981
+ (one started with neither `--watch` nor `--hunt`) refuses on with an
982
+ `error` message that says why, and goes on unchanged. With no run going, the message gets
980
983
  an `error` and starts nothing. The setting lasts for the run only: a new run
981
984
  takes it from its own flags. Only runs of the worker can switch; a
982
985
  command-line run keeps what `--hunt` gave it. The progress of each run
package/dist/args.mjs CHANGED
@@ -6,7 +6,6 @@ const SWITCHES = new Map([
6
6
  ['--watch', 'watch'],
7
7
  ['--hunt', 'hunt'],
8
8
  ['--reset', 'reset'],
9
- ['--once', 'once'],
10
9
  ]);
11
10
  const LEVELS = new Map([
12
11
  ['--verbose', 'verbose'],
@@ -15,7 +14,6 @@ const LEVELS = new Map([
15
14
  export const USAGE = `next-issue <command> [options]
16
15
 
17
16
  start start a run: claim issues, fix them and push them to the base branch
18
- --once stop after the first handled issue
19
17
  --max <n> handle at most n issues
20
18
  --watch keep running and read the issues again after each pass
21
19
  --hunt hunt the repository for bugs and file issues alongside the issues, turns on --watch
@@ -31,7 +29,7 @@ export const USAGE = `next-issue <command> [options]
31
29
  --quiet show only the milestones and the summary
32
30
  --help show this text
33
31
  `;
34
- const RUN_FLAGS = new Set(['--once', '--max', '--watch', '--hunt', '--reset']);
32
+ const RUN_FLAGS = new Set(['--max', '--watch', '--hunt', '--reset']);
35
33
  export function parseArgs(argv) {
36
34
  const { args, flag, runFlag } = readArgs(argv);
37
35
  if (args.help) {
@@ -50,7 +48,6 @@ export function parseArgs(argv) {
50
48
  }
51
49
  function readArgs(argv) {
52
50
  const args = {
53
- once: false,
54
51
  help: false,
55
52
  json: false,
56
53
  reset: false,
package/dist/handover.mjs CHANGED
@@ -201,9 +201,11 @@ export async function claimedError(context, log, issue, state, error, started) {
201
201
  // Saved with the hand-over, so later runs land nothing before the base is checked.
202
202
  state.halted = true;
203
203
  }
204
+ let handedOver = false;
204
205
  try {
205
206
  const earlier = error instanceof HandOverFailed ? error.pending : undefined;
206
207
  await handOver(context, log, issue.number, state, handOverReason(error, reason), earlier);
208
+ handedOver = true;
207
209
  }
208
210
  catch (failure) {
209
211
  log.event('hand-over.error', { error: message(failure) }, 'quiet');
@@ -211,7 +213,10 @@ export async function claimedError(context, log, issue, state, error, started) {
211
213
  // The issue ends (and the waiting questions go out) only once the hand-over is done.
212
214
  logIssueError(log, error, started);
213
215
  await cleanUp(context, log, state.branch);
214
- const report = issueReport(issue.number, 'error', state, started, reason);
216
+ const report = {
217
+ ...issueReport(issue.number, 'error', state, started, reason),
218
+ ...(handedOver ? { handedOver } : {}),
219
+ };
215
220
  if (!(error instanceof UnsettledBase)) {
216
221
  return report;
217
222
  }
package/dist/loop.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function runIssues(args, loop, seen = new Set()) {
2
- const limit = args.once ? Math.min(1, args.max ?? 1) : args.max;
2
+ const limit = args.max;
3
3
  const concurrency = loop.concurrency ?? 1;
4
4
  const reports = [];
5
5
  const running = new Map();
package/dist/watch.mjs CHANGED
@@ -91,11 +91,11 @@ async function huntIssues(hunter, hunting, running, failed, claims, refreshes, s
91
91
  }
92
92
  }
93
93
  async function watchPasses(args, failed, watch) {
94
- const limit = args.once ? 1 : args.max;
94
+ const limit = args.max;
95
95
  const reports = [];
96
96
  let step = 0;
97
97
  for (;;) {
98
- const pass = await runIssues({ once: false, max: limit === undefined ? undefined : limit - handled(reports) }, watch, new Set(failed));
98
+ const pass = await runIssues({ max: limit === undefined ? undefined : limit - handled(reports) }, watch, new Set(failed));
99
99
  addReports(reports, pass.reports);
100
100
  recordFailures(failed, pass.reports);
101
101
  if (handled(pass.reports) > 0) {
@@ -133,7 +133,7 @@ function addReports(reports, pass) {
133
133
  }
134
134
  function recordFailures(failed, reports) {
135
135
  for (const report of reports) {
136
- if (report.outcome === 'error') {
136
+ if (report.outcome === 'error' && report.handedOver !== true) {
137
137
  failed.add(report.issue);
138
138
  }
139
139
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "7.8.29",
3
+ "version": "8.0.0",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",