next-issue 9.8.2 → 9.8.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/README.md +2 -2
- package/dist/git.mjs +2 -13
- package/dist/hand-over-comments.mjs +5 -1
- package/dist/loop.mjs +3 -5
- package/dist/ports.mjs +1 -3
- package/dist/run.mjs +4 -1
- package/dist/watch.mjs +3 -0
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -136,7 +136,7 @@ No person checks a change before it lands. To replace those checks, [ADR 0004](h
|
|
|
136
136
|
Every run has an id, `<timestamp>`, and writes these under `.next-issue/runs/`:
|
|
137
137
|
|
|
138
138
|
- `<id>.jsonl` — one JSON object per event, with `ts`, `runId`, `kind`, and the `issue`, `role` or `round` in scope;
|
|
139
|
-
- `<id>.summary.json` — token totals per agent role, event counts, and one report per issue with the outcome, the reason and the budgets used (in a watch run, an issue skipped in several passes gets one report, and an issue handled in more than one pass keeps a report for each);
|
|
139
|
+
- `<id>.summary.json` — token totals per agent role, event counts, and one report per issue with the outcome, the reason and the budgets used (in a watch run, an issue skipped in several passes gets one report, and an issue handled in more than one pass keeps a report for each; when an issue crashes the run, the file still holds the reports of the issues that finished);
|
|
140
140
|
- `<id>/sessions/` — the full pi session of each agent call, with every message, tool call and tool result. The session id in a `usage` event is part of the file name.
|
|
141
141
|
|
|
142
142
|
At the start of a run, the harness deletes the files and folders under `.next-issue/runs/` that are older than `keepRunDays`. The age of a folder is the time since the last change to it or to anything inside it, so the sessions of a long run stay while it still writes them. Set the field to `0` to keep them all.
|
|
@@ -354,7 +354,7 @@ In a run of the `serve` worker, a client can switch hunting and watching on or o
|
|
|
354
354
|
- sends each `error` as `{ "type": "error", "root": "<path>", "message": "<text>" }`. When a `start`, `stop`, `watch`, `hunt` or `refresh` message carries an `"id"`, the `error` that refuses it carries the same `id`;
|
|
355
355
|
- runs at most one run at a time. A client starts it with `{ "type": "start", "root": "<path>", "args": [...] }`. Each run is like `next-issue start` with those args, or with none when `args` is left out (the pi extension sends none). It takes `--max <n>`, `--watch`, `--hunt`, `--reset`, `--verbose` and `--quiet`, and refuses a command (`start` too), `--json`, `--force`, `--help` or an unknown argument with an `error` message;
|
|
356
356
|
- sends every client the progress of every run when it connects and on every change: for each running issue the issue, the step, the tool count and the last tool, and the handled issues (an issue handled in more than one pass appears once for each);
|
|
357
|
-
- sends every client a `questions` message for each repository: the open issues with the `needsHuman` label, each with its number, title, the reason of the hand-over, the url of the comment that holds it, the `owner/name` repository, and the `needsHuman` and `
|
|
357
|
+
- sends every client a `questions` message for each repository: the open issues with the `needsHuman` label, each with its number, title, the reason of the hand-over, the url of the comment that holds it, the `owner/name` repository, and the `needsHuman`, `skip` and `ready` labels. It reads them from GitHub, so the list is the same after a restart. It sends them when a client connects, for its repository, after each issue of a run ends, and when a client sends `{ "type": "questions", "root": "<path>" }`. An issue that no longer has the label leaves the list, and so does an issue whose hand-over has an answer from a writer, the same answer that lets a run claim it. An issue that a person holds with the label stays in the list, even when an earlier hand-over has an answer. An issue with the label but no hand-over comment is in the list with an empty reason and url. The issues are read one at a time. A client never gets an older list after a newer one. When the client adds an `"id"` to its message, the list that answers it carries the same `id` and is read after the message arrived. When the list cannot be read, the client gets `{ "type": "questions-error", "root": "<path>", "message": "<text>" }`;
|
|
358
358
|
- answers `{ "type": "upcoming", "root": "<path>" }` with `{ "type": "upcoming", "root": "<path>", "claimable": [...], "blocked": [...] }`: the open issues with the `ready` label that a run would claim, oldest first, each with its `issue` number and `title`, without issues that have saved state or a label that stops a claim. An issue blocked by open issues is in `blocked` with their references in `blockers`. When the list cannot be read, the client gets `{ "type": "upcoming-error", "root": "<path>", "message": "<text>" }`;
|
|
359
359
|
- stops a run when a client sends `{ "type": "stop", "root": "<path>", "after": "issue" | "round" | "now" }`. With no `after`, it stops after `issue`. `issue` works like a first `Ctrl-C`: no new claim or hunt, and the held issues and a going hunt finish. `round` works like a second `Ctrl-C`: each running issue stops after its current round, with the state kept, and a going hunt ends first. `now` stops every agent, command and hunt of the run at once, and each running issue ends as `stopped` with its state and labels kept; the worker keeps running. A later point than one already asked for changes nothing, and an earlier one replaces it. An unknown `after` gets an `error` message;
|
|
360
360
|
- switches watching of a run on or off when a client sends `{ "type": "watch", "root": "<path>", "on": true | false }`. The run keeps its issues, worktrees and progress, and nothing restarts. A run started with `--watch` or `--hunt` starts with watching on, and any other run with it off. On keeps the run going after the current pass, as with `--watch`. Off ends the run after the current pass, or at once when it waits between passes, and also turns hunting off. With no run going, the message gets an `error` and starts nothing;
|
package/dist/git.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { must,
|
|
1
|
+
import { must, run, succeeded } from './exec.mjs';
|
|
2
2
|
import { oneAtATime } from './lock.mjs';
|
|
3
3
|
import { lines } from './text.mjs';
|
|
4
4
|
const REMOTE_PATTERNS = [
|
|
@@ -28,7 +28,7 @@ async function sshHost(url, host) {
|
|
|
28
28
|
if (host === 'github.com' || /^https?:/.test(url.trim())) {
|
|
29
29
|
return host;
|
|
30
30
|
}
|
|
31
|
-
const result = await run('ssh', ['-G', host]).catch(() => undefined);
|
|
31
|
+
const result = await run('ssh', ['-G', '--', host]).catch(() => undefined);
|
|
32
32
|
const resolved = /^hostname[^\S\r\n]+(\S+)$/m.exec(result?.stdout ?? '')?.[1];
|
|
33
33
|
return result !== undefined && succeeded(result) && resolved !== undefined
|
|
34
34
|
? githubHost(resolved)
|
|
@@ -113,10 +113,6 @@ export async function saveSetupOutput(cwd) {
|
|
|
113
113
|
}
|
|
114
114
|
export async function setAside(cwd, target, branch) {
|
|
115
115
|
await git(cwd, ['branch', branch]);
|
|
116
|
-
if (await isDirty(cwd)) {
|
|
117
|
-
await git(cwd, ['reset', '--soft', target]);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
116
|
await discardChanges(cwd, target);
|
|
121
117
|
}
|
|
122
118
|
export async function disputeBranches(repo, branch) {
|
|
@@ -127,9 +123,6 @@ export async function disputeBranches(repo, branch) {
|
|
|
127
123
|
]);
|
|
128
124
|
return lines(list);
|
|
129
125
|
}
|
|
130
|
-
export async function push(cwd, remote, branch, force = false) {
|
|
131
|
-
await oneFetchAtATime(() => git(cwd, ['push', '-u', ...optionalFlag(force, '--force'), remote, branch]));
|
|
132
|
-
}
|
|
133
126
|
export async function fetchBase(cwd, base, remote) {
|
|
134
127
|
await gitFetch(cwd, [remote, base]);
|
|
135
128
|
return remoteRef(remote, base);
|
|
@@ -140,10 +133,6 @@ export function oneFetchAtATime(work) {
|
|
|
140
133
|
export function gitFetch(cwd, args) {
|
|
141
134
|
return oneFetchAtATime(() => git(cwd, ['fetch', ...args]));
|
|
142
135
|
}
|
|
143
|
-
export async function resetToBase(cwd, base, remote) {
|
|
144
|
-
const target = await fetchBase(cwd, base, remote);
|
|
145
|
-
await git(cwd, ['reset', '--hard', target]);
|
|
146
|
-
}
|
|
147
136
|
export async function latestSubject(cwd, base, remote) {
|
|
148
137
|
const subject = await git(cwd, ['log', '-1', '--format=%s', `${remoteRef(remote, base)}..HEAD`]);
|
|
149
138
|
return subject === '' ? undefined : subject;
|
|
@@ -92,7 +92,11 @@ async function waitingQuestion(repo, config, ports, writer, issue) {
|
|
|
92
92
|
reason: comment?.body.slice(HAND_OVER.length).trim() ?? pending?.reason ?? '',
|
|
93
93
|
url: comment?.url ?? '',
|
|
94
94
|
repo: repoArg(repo),
|
|
95
|
-
labels: {
|
|
95
|
+
labels: {
|
|
96
|
+
needsHuman: config.labels.needsHuman,
|
|
97
|
+
skip: config.labels.skip,
|
|
98
|
+
ready: config.labels.ready,
|
|
99
|
+
},
|
|
96
100
|
};
|
|
97
101
|
}
|
|
98
102
|
export async function writerComments(context, log, issue) {
|
package/dist/loop.mjs
CHANGED
|
@@ -34,16 +34,14 @@ export async function runIssues(args, loop, seen = new Set()) {
|
|
|
34
34
|
claiming = false;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
throw crash.failure;
|
|
39
|
-
}
|
|
40
|
-
return loopResult(reports, stoppedAt, error);
|
|
37
|
+
return loopResult(reports, stoppedAt, error, crash);
|
|
41
38
|
}
|
|
42
|
-
function loopResult(reports, stoppedAt, error) {
|
|
39
|
+
function loopResult(reports, stoppedAt, error, crash) {
|
|
43
40
|
return {
|
|
44
41
|
reports,
|
|
45
42
|
...(stoppedAt === undefined ? {} : { stoppedAt }),
|
|
46
43
|
...(error === undefined ? {} : { error }),
|
|
44
|
+
...(crash === undefined ? {} : { crash }),
|
|
47
45
|
};
|
|
48
46
|
}
|
|
49
47
|
async function claimIssues(loop, seen, running, room) {
|
package/dist/ports.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { run } from './exec.mjs';
|
|
|
4
4
|
import { commitAll } from './git-commit.mjs';
|
|
5
5
|
import { baseMoved, pushToBase, reapplyRevert, revertOnBase, squashOnto } from './git-land.mjs';
|
|
6
6
|
import { abortMerge, commitMerge, startMerge } from './git-merge.mjs';
|
|
7
|
-
import { changedFiles, deleteBranch, diff, discardChanges, disputeBranches, isDirty, isLanded, isOnBase, latestSubject,
|
|
7
|
+
import { changedFiles, deleteBranch, diff, discardChanges, disputeBranches, isDirty, isLanded, isOnBase, latestSubject, revision, saveEdits, saveSetupOutput, setAside, } from './git.mjs';
|
|
8
8
|
import { canWrite, closeIssue, commentOnIssue, editIssueBody, issueComments, issueEditors, openBlockers, openIssues, reopenIssue, repositorySlug, threadComments, viewIssue, } from './github.mjs';
|
|
9
9
|
import { huntWorktree } from './hunt.mjs';
|
|
10
10
|
import { ensureLabel, setLabel } from './labels.mjs';
|
|
@@ -47,14 +47,12 @@ export const PORTS = {
|
|
|
47
47
|
latestSubject,
|
|
48
48
|
openBlockers,
|
|
49
49
|
openIssues,
|
|
50
|
-
push,
|
|
51
50
|
pushToBase,
|
|
52
51
|
reapplyRevert,
|
|
53
52
|
removeWorktree,
|
|
54
53
|
reopenIssue,
|
|
55
54
|
repositorySlug,
|
|
56
55
|
rerunFailedCi,
|
|
57
|
-
resetToBase,
|
|
58
56
|
revertOnBase,
|
|
59
57
|
revision,
|
|
60
58
|
runAgent,
|
package/dist/run.mjs
CHANGED
|
@@ -69,11 +69,14 @@ async function handle(args, config, repo, recorder, controls) {
|
|
|
69
69
|
concurrency: config.concurrency,
|
|
70
70
|
};
|
|
71
71
|
const print = controls.print ?? (async () => undefined);
|
|
72
|
-
const { reports, stoppedAt, error } = args.watch || controls.watching !== undefined
|
|
72
|
+
const { reports, stoppedAt, error, crash } = args.watch || controls.watching !== undefined
|
|
73
73
|
? await watchRun(args, loop, context, controls, print)
|
|
74
74
|
: await runIssues(args, loop);
|
|
75
75
|
recordLoopEnd(recorder, stoppedAt, error);
|
|
76
76
|
const summary = await endRun(recorder, reports);
|
|
77
|
+
if (crash !== undefined) {
|
|
78
|
+
throw crash.failure;
|
|
79
|
+
}
|
|
77
80
|
if (!args.watch) {
|
|
78
81
|
await print(summary);
|
|
79
82
|
}
|
package/dist/watch.mjs
CHANGED
|
@@ -98,6 +98,9 @@ async function watchPasses(args, failed, watch) {
|
|
|
98
98
|
for (;;) {
|
|
99
99
|
const pass = await runIssues({ max: limit === undefined ? undefined : limit - handled(reports) }, watch, new Set(failed));
|
|
100
100
|
addReports(reports, pass.reports);
|
|
101
|
+
if (pass.crash !== undefined) {
|
|
102
|
+
return { ...pass, reports };
|
|
103
|
+
}
|
|
101
104
|
recordFailures(failed, pass.reports);
|
|
102
105
|
if (handled(pass.reports) > 0) {
|
|
103
106
|
await watch.passEnd(pass.reports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-issue",
|
|
3
|
-
"version": "9.8.
|
|
3
|
+
"version": "9.8.3",
|
|
4
4
|
"description": "Autonomous issue harness driven by the pi SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github",
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@earendil-works/pi-coding-agent": "^1.5.2",
|
|
53
|
-
"typebox": "^1.4.7",
|
|
54
53
|
"ws": "^8.23.0"
|
|
55
54
|
}
|
|
56
55
|
}
|