next-issue 14.9.0 → 15.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
@@ -90,7 +90,6 @@ A field that is not in the file keeps its default. See [Configuration](https://g
90
90
  | `start` | Start a run: claim issues, fix them and push them to the base branch |
91
91
  | `watch on\|off` | Switch watching of the going run |
92
92
  | `hunt on\|off` | Switch hunting of the going run |
93
- | `refresh` | Ask the going run to check for new issues now |
94
93
  | `init` | Write the config file with the defaults |
95
94
  | `serve` | Run the worker of this repository that the clients talk to |
96
95
  | `stop` | Stop the going run after its current issues |
@@ -16,25 +16,6 @@ export function switchInWorker(root, name, on) {
16
16
  return `next-issue: watching ${onOffText(progress.watching)}, hunting ${onOffText(progress.hunting)}\n`;
17
17
  });
18
18
  }
19
- export function refreshInWorker(root) {
20
- return inWorker(root, async (connection, progress) => {
21
- if (isNewer(await packageVersion(), connection.version)) {
22
- throw new Error('the worker of the going run is older than next-issue, so it cannot refresh. Stop the run, then start it again');
23
- }
24
- if (progress.status === 'stopping' && progress.upgrade !== undefined) {
25
- return 'next-issue: the run is stopping for an upgrade, so nothing was asked; it starts again on the newer worker and picks up new issues then\n';
26
- }
27
- if (progress.status === 'stopping') {
28
- return 'next-issue: the run is stopping, so nothing was asked\n';
29
- }
30
- if (progress.watching === false) {
31
- return 'next-issue: the run does not watch for new issues, so nothing was asked\n';
32
- }
33
- connection.send({ type: 'refresh', root });
34
- await connection.end();
35
- return 'next-issue: asked the run to check for new issues now\n';
36
- });
37
- }
38
19
  async function inWorker(root, act) {
39
20
  const connection = await findWorker(root);
40
21
  if (connection === undefined) {
package/dist/cli.mjs CHANGED
@@ -9,7 +9,7 @@ import { followLog, newestRunLog } from './cli/logs.mjs';
9
9
  import { serve } from './worker/serve.mjs';
10
10
  import { startInWorker } from './cli/start.mjs';
11
11
  import { STATE_DIR } from './shared/state.mjs';
12
- import { refreshInWorker, stopInWorker, switchInWorker } from './cli/switch-run.mjs';
12
+ import { stopInWorker, switchInWorker } from './cli/switch-run.mjs';
13
13
  import { chooseScope, installSkills } from './cli/update.mjs';
14
14
  import { WORKTREE_DIR } from './shared/worktree.mjs';
15
15
  function write(stream, text) {
@@ -44,10 +44,6 @@ async function main() {
44
44
  await write(process.stdout, await switchInWorker(root, args.command, args.on));
45
45
  return 0;
46
46
  }
47
- if (args.command === 'refresh') {
48
- await write(process.stdout, await refreshInWorker(root));
49
- return 0;
50
- }
51
47
  if (args.command === 'logs') {
52
48
  return logs(root);
53
49
  }
@@ -7,17 +7,7 @@ const RUN_FLAGS = new Map([
7
7
  ['--watch', 'watch'],
8
8
  ['--hunt', 'hunt'],
9
9
  ]);
10
- const COMMANDS = [
11
- 'start',
12
- 'init',
13
- 'serve',
14
- 'stop',
15
- 'logs',
16
- 'watch',
17
- 'hunt',
18
- 'refresh',
19
- 'update',
20
- ];
10
+ const COMMANDS = ['start', 'init', 'serve', 'stop', 'logs', 'watch', 'hunt', 'update'];
21
11
  export const USAGE = `next-issue <command> [options]
22
12
 
23
13
  start start a run: claim issues, fix them and push them to the base branch
@@ -25,7 +15,6 @@ export const USAGE = `next-issue <command> [options]
25
15
  --hunt on|off hunt the repository for bugs and file issues alongside the issues, needs watching (default off)
26
16
  watch on|off switch watching of the going run; off also turns hunting off
27
17
  hunt on|off switch hunting of the going run; on also turns watching on
28
- refresh ask the going run to check for new issues now
29
18
  init write ${CONFIG_FILE} with the defaults and add .next-issue/ and .worktrees/ to info/exclude
30
19
  serve run the worker of this repository that the clients talk to
31
20
  stop stop the going run after its current issues
@@ -24,22 +24,22 @@ export function deadline(ms, onExpire) {
24
24
  export function elapsedMs(started) {
25
25
  return Date.now() - started;
26
26
  }
27
- // Resolves false when woken, or when `refreshed` aborts.
28
- export function wakeableSleep(sleeper, ms, stopped, refreshed) {
27
+ // Resolves false when woken, or when `woken` aborts.
28
+ export function wakeableSleep(sleeper, ms, stopped, woken) {
29
29
  return new Promise((resolve) => {
30
- if (stopped || refreshed?.aborted === true) {
30
+ if (stopped || woken?.aborted === true) {
31
31
  resolve(false);
32
32
  return;
33
33
  }
34
34
  const settle = (slept) => {
35
35
  clearTimeout(timer);
36
- refreshed?.removeEventListener('abort', onRefresh);
36
+ woken?.removeEventListener('abort', onWoken);
37
37
  sleeper.wake = undefined;
38
38
  resolve(slept);
39
39
  };
40
- const onRefresh = () => settle(false);
40
+ const onWoken = () => settle(false);
41
41
  const timer = setTimeout(() => settle(true), timerMs(ms));
42
42
  sleeper.wake = () => settle(false);
43
- refreshed?.addEventListener('abort', onRefresh, { once: true });
43
+ woken?.addEventListener('abort', onWoken, { once: true });
44
44
  });
45
45
  }
@@ -10,97 +10,64 @@ export async function runIssues(loop, seen = new Set()) {
10
10
  let stopped = false;
11
11
  let unclaimed = true;
12
12
  let recount = false;
13
- const ended = new AbortController();
14
- let refresh = refreshes(loop, ended.signal);
15
13
  const tried = { ended: new Set(), labels: new Map(), blocked: new Set() };
16
- try {
17
- for (;;) {
18
- if (stopped && !loop.stop()) {
19
- stopped = false;
20
- stoppedAt = undefined;
21
- claiming = true;
22
- }
23
- if (claiming && (recount || (unclaimed && slots.open()))) {
24
- recount = false;
25
- refresh = refreshes(loop, ended.signal, refresh);
26
- try {
27
- ({ claiming, unclaimed } = await claimIssues(loop, seen, tried, { running, slots }));
28
- }
29
- catch (failure) {
30
- error = failure;
31
- claiming = false;
32
- }
33
- }
34
- if (running.size === 0) {
35
- break;
36
- }
37
- const settled = await Promise.race([...running.values(), slots.freed(), refresh.asked]);
38
- if (settled === 'refresh') {
39
- recount = true;
40
- refresh = refreshes(loop, ended.signal, refresh);
41
- continue;
42
- }
43
- if (settled === undefined) {
44
- continue;
45
- }
46
- const { issue, slot, report, failure } = settled;
47
- running.delete(issue);
48
- slot.free();
49
- unclaimed = true;
50
- recount = true;
51
- if (report === undefined) {
52
- crash ??= { failure };
53
- claiming = false;
54
- stopped = false;
55
- continue;
56
- }
57
- reports.push(report);
58
- if (retryable(report)) {
59
- tried.ended.add(issue);
60
- }
61
- if (report.blocked === true) {
62
- tried.blocked.add(issue);
63
- }
64
- if (report.outcome === 'done') {
65
- readmitBlocked(seen, tried);
14
+ for (;;) {
15
+ if (stopped && !loop.stop()) {
16
+ stopped = false;
17
+ stoppedAt = undefined;
18
+ claiming = true;
19
+ }
20
+ if (claiming && (recount || (unclaimed && slots.open()))) {
21
+ recount = false;
22
+ try {
23
+ ({ claiming, unclaimed } = await claimIssues(loop, seen, tried, { running, slots }));
66
24
  }
67
- if (claiming && (loop.stop() || report.halt === true)) {
68
- stoppedAt = issue;
25
+ catch (failure) {
26
+ error = failure;
69
27
  claiming = false;
70
- stopped = true;
71
- }
72
- if (report.halt === true) {
73
- stopped = false;
74
- }
75
- if (report.outcome === 'done' && !claiming) {
76
- await loop.issues().catch(() => undefined);
77
28
  }
78
29
  }
30
+ if (running.size === 0) {
31
+ break;
32
+ }
33
+ const settled = await Promise.race([...running.values(), slots.freed()]);
34
+ if (settled === undefined) {
35
+ continue;
36
+ }
37
+ const { issue, slot, report, failure } = settled;
38
+ running.delete(issue);
39
+ slot.free();
40
+ unclaimed = true;
41
+ recount = true;
42
+ if (report === undefined) {
43
+ crash ??= { failure };
44
+ claiming = false;
45
+ stopped = false;
46
+ continue;
47
+ }
48
+ reports.push(report);
49
+ if (retryable(report)) {
50
+ tried.ended.add(issue);
51
+ }
52
+ if (report.blocked === true) {
53
+ tried.blocked.add(issue);
54
+ }
55
+ if (report.outcome === 'done') {
56
+ readmitBlocked(seen, tried);
57
+ }
58
+ if (claiming && (loop.stop() || report.halt === true)) {
59
+ stoppedAt = issue;
60
+ claiming = false;
61
+ stopped = true;
62
+ }
63
+ if (report.halt === true) {
64
+ stopped = false;
65
+ }
66
+ if (report.outcome === 'done' && !claiming) {
67
+ await loop.issues().catch(() => undefined);
68
+ }
79
69
  }
80
- finally {
81
- ended.abort();
82
- }
83
- return { ...loopResult(reports, stoppedAt, error, crash), ...refreshedOf(refresh) };
84
- }
85
- function refreshedOf(refresh) {
86
- return refresh.signal === undefined ? {} : { refreshed: refresh.signal };
87
- }
88
- function refreshes(loop, ended, previous) {
89
- const signal = loop.refreshed?.();
90
- if (previous !== undefined && previous.signal === signal) {
91
- return previous;
92
- }
93
- return {
94
- signal,
95
- asked: new Promise((resolve) => {
96
- if (signal?.aborted === true) {
97
- resolve('refresh');
98
- }
99
- else {
100
- signal?.addEventListener('abort', () => resolve('refresh'), { once: true, signal: ended });
101
- }
102
- }),
103
- };
70
+ return loopResult(reports, stoppedAt, error, crash);
104
71
  }
105
72
  function loopResult(reports, stoppedAt, error, crash) {
106
73
  return {
@@ -7,7 +7,7 @@ export async function watchIssues(watch) {
7
7
  const ended = new AbortController();
8
8
  const hunting = watch.hunter === undefined
9
9
  ? undefined
10
- : huntIssues(watch.hunter, watch.hunting ?? onOff(true), running, failed, watch.issues, watch.refreshed, () => ended.signal.aborted || watch.stop(), ended.signal);
10
+ : huntIssues(watch.hunter, watch.hunting ?? onOff(true), running, failed, watch.issues, () => ended.signal.aborted || watch.stop(), ended.signal);
11
11
  try {
12
12
  return await watchPasses(failed, {
13
13
  ...watch,
@@ -39,7 +39,7 @@ function aborted(signal) {
39
39
  }
40
40
  });
41
41
  }
42
- async function huntIssues(hunter, hunting, running, failed, issues, refreshes, stopped, signal) {
42
+ async function huntIssues(hunter, hunting, running, failed, issues, stopped, signal) {
43
43
  let step = 0;
44
44
  while (!stopped()) {
45
45
  if (!hunting.on()) {
@@ -62,9 +62,8 @@ async function huntIssues(hunter, hunting, running, failed, issues, refreshes, s
62
62
  continue;
63
63
  }
64
64
  const changed = hunting.changed();
65
- const refreshed = refreshes?.() ?? new AbortController().signal;
66
- await hunter.wait(backOffMinutes(step), AbortSignal.any([signal, changed, refreshed]));
67
- if (changed.aborted || refreshed.aborted) {
65
+ await hunter.wait(backOffMinutes(step), AbortSignal.any([signal, changed]));
66
+ if (changed.aborted) {
68
67
  step = 0;
69
68
  }
70
69
  else {
@@ -79,9 +78,8 @@ async function watchPasses(failed, watch) {
79
78
  for (;;) {
80
79
  const pass = await runIssues(watch, new Set(failed));
81
80
  addReports(reports, pass.reports);
82
- const { refreshed, ...result } = pass;
83
81
  if (pass.crash !== undefined) {
84
- return { ...result, reports };
82
+ return { ...pass, reports };
85
83
  }
86
84
  recordFailures(failed, pass.reports);
87
85
  if (handled(pass.reports) > 0) {
@@ -89,15 +87,14 @@ async function watchPasses(failed, watch) {
89
87
  step = 0;
90
88
  }
91
89
  if (pass.error !== undefined || pass.stoppedAt !== undefined) {
92
- return { ...result, reports };
90
+ return { ...pass, reports };
93
91
  }
94
92
  if (watch.stop() || !watching()) {
95
93
  return { reports };
96
94
  }
97
95
  const minutes = backOffMinutes(step);
98
96
  step += 1;
99
- const signals = [refreshed ?? watch.refreshed?.(), watch.watching?.changed()].filter((signal) => signal !== undefined);
100
- const woken = signals.length === 0 ? undefined : AbortSignal.any(signals);
97
+ const woken = watch.watching?.changed();
101
98
  if (!(await watch.wait(minutes, woken))) {
102
99
  if (woken?.aborted !== true || watch.stop() || !watching()) {
103
100
  return { reports };
@@ -74,16 +74,15 @@ export function watchRun(args, loop, context, controls, print) {
74
74
  const hunt = hunter(context);
75
75
  return watchIssues({
76
76
  ...loop,
77
- wait: (minutes, refreshed) => {
77
+ wait: (minutes, woken) => {
78
78
  recorder.event('watch.wait', { minutes });
79
79
  passStart = recorder.summary();
80
- return interrupts.sleep(minutesToMs(minutes), () => hunt.busy(), refreshed);
80
+ return interrupts.sleep(minutesToMs(minutes), () => hunt.busy(), woken);
81
81
  },
82
82
  passEnd: (issues) => print({ ...recorder.summary(passStart), issues }),
83
83
  hunter: hunt,
84
84
  hunting: controls.hunting ?? onOff(args.hunt),
85
85
  watching: controls.watching,
86
- refreshed: controls.refreshed,
87
86
  });
88
87
  }
89
88
  function recordLoopEnd(recorder, stoppedAt, stopped, error) {
@@ -14,7 +14,7 @@ import { resumeOnSuccessor } from '../shared/worker-client.mjs';
14
14
  import { latestVersion, NPM_LATEST, npxLaunch } from './latest-version.mjs';
15
15
  import { keepLogTrimmed, LOG_CHECK_MS } from './worker-log.mjs';
16
16
  import { checkSocketPath, workerPaths } from '../shared/worker-paths.mjs';
17
- import { active, dropUpgrade, endStatus, newRun, requestRefresh, requestStop, requestUpgrade, runControls, runsMessage, setHunting, setWatching, startRefusal, stoppingMessage, stopPoint, switchRefusal, } from './worker-run.mjs';
17
+ import { active, dropUpgrade, endStatus, newRun, requestStop, requestUpgrade, runControls, runsMessage, setHunting, setWatching, startRefusal, stoppingMessage, stopPoint, switchRefusal, } from './worker-run.mjs';
18
18
  import { broadcast, closer, fileId, isLaunch, listen, parseMessage, removeOwned, send, sendAll, sendAllSent, shutdown, stopListening, } from './worker-server.mjs';
19
19
  const LOCK_WAIT_MS = 5_000;
20
20
  const IDLE_MS = 30_000;
@@ -229,9 +229,6 @@ export async function startWorker(options) {
229
229
  else if (value.type === 'watch') {
230
230
  toggle(refuse, value.root, value.on, setWatching);
231
231
  }
232
- else if (value.type === 'refresh') {
233
- requestRefresh(runs.get(value.root));
234
- }
235
232
  else if (value.type === 'rejoin') {
236
233
  followed = true;
237
234
  if (lateEnd !== undefined) {
@@ -3,14 +3,12 @@ import { wakeableSleep } from '../shared/durations.mjs';
3
3
  import { onOff } from '../shared/switch.mjs';
4
4
  import { applyEvent } from './progress.mjs';
5
5
  import { STOP_POINTS, } from '../shared/protocol.mjs';
6
- import { refresher } from './refresh.mjs';
7
6
  export function newRun(progress) {
8
7
  return {
9
8
  progress,
10
9
  children: runChildren(),
11
10
  watching: onOff(progress.watching === true),
12
11
  hunting: onOff(progress.hunting),
13
- refresher: refresher(),
14
12
  };
15
13
  }
16
14
  export function active(run) {
@@ -89,14 +87,6 @@ export function switchRefusal(run, on) {
89
87
  }
90
88
  return on && run.stoppedByPerson === true ? 'the run is stopping' : undefined;
91
89
  }
92
- // Only a running watch run refreshes: it wakes the wait between passes, or reads the open issues again during a pass.
93
- export function requestRefresh(run) {
94
- if (run?.progress.status !== 'running' || !run.watching.on() || run.stop !== undefined) {
95
- return false;
96
- }
97
- run.refresher.refresh();
98
- return true;
99
- }
100
90
  export function setHunting(run, on) {
101
91
  if (on) {
102
92
  run.watching.set(true);
@@ -119,9 +109,9 @@ function runInterrupts(run) {
119
109
  return {
120
110
  afterIssue: () => run.stop !== undefined,
121
111
  afterRound: () => run.stop === 'round' || run.stop === 'now',
122
- sleep: (ms, hunting, refreshed) => {
112
+ sleep: (ms, hunting, woken) => {
123
113
  run.huntBusy = hunting;
124
- return wakeableSleep(run, ms, run.stop !== undefined, refreshed);
114
+ return wakeableSleep(run, ms, run.stop !== undefined, woken);
125
115
  },
126
116
  };
127
117
  }
@@ -130,7 +120,6 @@ export function runControls(run, update) {
130
120
  interrupts: runInterrupts(run),
131
121
  hunting: run.hunting,
132
122
  watching: run.watching,
133
- refreshed: run.refresher.refreshed,
134
123
  onEvent: (record) => update(applyEvent(run.progress, record)),
135
124
  };
136
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "14.9.0",
3
+ "version": "15.0.0",
4
4
  "description": "Autonomous issue harness driven by the Claude Agent SDK",
5
5
  "keywords": [
6
6
  "github",
@@ -96,12 +96,6 @@ Help the user understand why the worker handed an issue over, then answer the ha
96
96
  gh issue edit --repo <repo> <number> --remove-label "<needs-human>" --add-label "<skip>"
97
97
  ```
98
98
 
99
- 10. After a retry, with or without guidance, run `next-issue refresh`, with no question first. When `next-issue` is not on the `PATH`, run `npx -y next-issue@latest` in its place, here and below. When it prints `asked the run to check for new issues now`, tell the user that the going run was asked to check for issues now. Ask no question.
100
-
101
- When it prints `no run is going in this repository`, ask only whether to start a run. On yes, run `next-issue start` in the background, such as with the `run_in_background` option of the Bash tool, since it goes on until the run ends, and tell the user that the run started. The run watches for new issues. On no, do nothing.
102
-
103
- When it prints `the run is stopping, so nothing was asked`, tell the user that the stopping run will not claim the issue. When it prints `the run is stopping for an upgrade`, tell the user that the run starts again on the newer worker and claims the issue then. Ask no question.
104
-
105
- When it prints `the run does not watch for new issues`, ask only whether to turn watching on. On yes, run `next-issue watch on`, then `next-issue refresh`, and tell the user what they print. On no, do nothing.
99
+ 10. After a retry, with or without guidance, tell the user what you did. Run no next-issue command and ask nothing about a run.
106
100
 
107
101
  11. Ask whether to answer another waiting issue. On yes, go back to step 3.
@@ -42,28 +42,21 @@ Turn the problem of the user into one GitHub issue, or a split of linked issues
42
42
 
43
43
  For a confirmed split, repeat steps 5 to 7 for each issue of the split, in order. Create each one with `--blocked-by` the issues of the split it depends on, so it is linked before you add its ready label.
44
44
 
45
- 8. Once the issue exists, or the last issue of a split, run `next-issue refresh`, with no question first. When `next-issue` is not on the `PATH`, run `npx -y next-issue@latest` in its place, here and below.
46
- 9. When it prints `asked the run to check for new issues now`, give the user the issue url, or each url of a split, and say that the going run was asked to check for new issues now. Ask no question.
45
+ 8. Once the issue exists, or the last issue of a split, give the user the issue url, or each url of a split, and stop. Run no next-issue command and ask nothing about a run.
47
46
 
48
- When it prints `no run is going in this repository`, give the user the url or urls and ask only whether to start a run. On yes, run `next-issue start` in the background, such as with the `run_in_background` option of the Bash tool, since it goes on until the run ends, and tell the user that the run started. The run watches for new issues. On no, do nothing.
47
+ 9. When the user asks for a change to the issue, make the change on GitHub. Write the new body into the temporary file and run:
49
48
 
50
- When it prints `the run is stopping, so nothing was asked`, give the user the url or urls and say that the stopping run will not claim the issue. When it prints `the run is stopping for an upgrade`, give the user the url or urls and say that the run starts again on the newer worker and claims the issue then. Ask no question.
51
-
52
- When it prints `the run does not watch for new issues`, give the user the url or urls and ask only whether to turn watching on. On yes, run `next-issue watch on`, then `next-issue refresh`, and tell the user what they print. On no, do nothing.
53
-
54
- 10. When the user asks for a change to the issue, make the change on GitHub. Write the new body into the temporary file and run:
55
-
56
- ```bash
57
- gh issue edit --repo <repo> <number> --body-file <file>
58
- ```
49
+ ```bash
50
+ gh issue edit --repo <repo> <number> --body-file <file>
51
+ ```
59
52
 
60
- To change the title, run:
53
+ To change the title, run:
61
54
 
62
- ```bash
63
- gh issue edit --repo <repo> <number> --title "<title>"
64
- ```
55
+ ```bash
56
+ gh issue edit --repo <repo> <number> --title "<title>"
57
+ ```
65
58
 
66
- Once the issue exists, do not implement it in this session. The next-issue worker does the work. Once the user answers whether to start a run, do not ask about a run again.
59
+ Once the issue exists, do not implement it in this session. The next-issue worker does the work.
67
60
 
68
61
  ## Sections
69
62
 
@@ -1,10 +0,0 @@
1
- export function refresher() {
2
- let controller = new AbortController();
3
- return {
4
- refreshed: () => controller.signal,
5
- refresh: () => {
6
- controller.abort();
7
- controller = new AbortController();
8
- },
9
- };
10
- }