next-issue 6.3.0 → 6.3.1
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 +24 -19
- package/dist/agent-reply.mjs +4 -0
- package/dist/fix.mjs +10 -5
- package/dist/git-land.mjs +8 -1
- package/dist/prompts.mjs +9 -2
- package/dist/review.mjs +11 -4
- package/dist/state.mjs +2 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -137,7 +137,11 @@ the run handles one issue. For each issue:
|
|
|
137
137
|
and into the next round, where it answers every finding of its own
|
|
138
138
|
round, so the reviewer withdraws them all or repeats them all. With only
|
|
139
139
|
some findings wrong, the fixer fixes the correct ones, and the next round
|
|
140
|
-
holds the rest.
|
|
140
|
+
holds the rest. A fixer that settles every finding with no code change,
|
|
141
|
+
for example by showing a failing test run, changes nothing and ends with a
|
|
142
|
+
`resolved:` line instead. The note goes on the issue and into the next
|
|
143
|
+
round in the same way, and a change it leaves behind is handled as for a
|
|
144
|
+
dispute.
|
|
141
145
|
|
|
142
146
|
## Issue format
|
|
143
147
|
|
|
@@ -157,23 +161,24 @@ The harness hands the issue to a person, with the `status:needs-human` label,
|
|
|
157
161
|
and comments the reason on the issue, when:
|
|
158
162
|
|
|
159
163
|
- the check budget or the review budget runs out. A finding that the reviewer
|
|
160
|
-
repeats, even one that the fixer disputed, goes back to the fixer
|
|
161
|
-
review budget runs out;
|
|
164
|
+
repeats, even one that the fixer disputed or settled, goes back to the fixer
|
|
165
|
+
until the review budget runs out;
|
|
162
166
|
- a fixer round adds no commit and gives no reason, so there is no progress;
|
|
163
167
|
- the fixer reports that the checks fail for a reason the change did not cause,
|
|
164
168
|
such as a test already broken on the base branch or one that fails only under
|
|
165
169
|
load. It changes nothing and the reason reaches the issue, rather than
|
|
166
170
|
the fixer spending its whole budget on a failure it cannot fix. A commit it
|
|
167
171
|
makes anyway moves aside, as for a dispute of the findings;
|
|
168
|
-
- a fixer disputes the findings and leaves a change behind, either
|
|
169
|
-
worktree or in a commit of its own. A dispute carries a reason, not a
|
|
170
|
-
so the harness throws none of it away: an unclean worktree stays on
|
|
171
|
-
disk, and a commit of the fixer moves to a new local
|
|
172
|
-
`<n>-dispute-<commit>` branch, so the `<n>` branch keeps only what will
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
- a fixer disputes or settles the findings and leaves a change behind, either
|
|
173
|
+
in the worktree or in a commit of its own. A dispute carries a reason, not a
|
|
174
|
+
diff, so the harness throws none of it away: an unclean worktree stays on
|
|
175
|
+
the disk, and a commit of the fixer moves to a new local
|
|
176
|
+
`<n>-dispute-<commit>` branch, so the `<n>` branch keeps only what will
|
|
177
|
+
land. The worktree drops the change of that commit, unless the fixer edited
|
|
178
|
+
the worktree after the commit: then the worktree keeps both and stays on the
|
|
179
|
+
disk. Neither lands. The issue holds the reason of the dispute, and the
|
|
180
|
+
change is on the machine that ran the harness. The `<n>-dispute-<commit>`
|
|
181
|
+
branches go away with the `<n>` branch when the issue is done;
|
|
177
182
|
- the reviewer gives no verdict, or the checks do not finish in time;
|
|
178
183
|
- the push to the base branch fails three times;
|
|
179
184
|
- the checks on the base branch fail and the fixer cannot fix them, or they
|
|
@@ -191,13 +196,13 @@ its own disputes next to them. From round two, the reviewer judges only the
|
|
|
191
196
|
earlier findings and any regression.
|
|
192
197
|
|
|
193
198
|
Each agent that writes to the issue names itself in the first line of the
|
|
194
|
-
comment: `### Review: approved`, `### Review: changes requested
|
|
195
|
-
`### Fixer: no change
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
through the state file.
|
|
200
|
-
exception is the answer to a hand-over, see
|
|
199
|
+
comment: `### Review: approved`, `### Review: changes requested`,
|
|
200
|
+
`### Fixer: no change` and `### Fixer: settled with no change`. The account is
|
|
201
|
+
the same for all of them, so the heading, not the author, tells them apart.
|
|
202
|
+
The agents get no comment that starts with one of these headings or with
|
|
203
|
+
`next-issue needs help:`, so a comment of an agent never returns to a
|
|
204
|
+
prompt: the dispute of the fixer reaches the reviewer through the state file.
|
|
205
|
+
The one exception is the answer to a hand-over, see
|
|
201
206
|
[Retry an issue that waits for a person](#retry-an-issue-that-waits-for-a-person).
|
|
202
207
|
|
|
203
208
|
## Stop a run
|
package/dist/agent-reply.mjs
CHANGED
|
@@ -5,6 +5,10 @@ export function parseUnrelated(text) {
|
|
|
5
5
|
const note = lastMatch(text, /^unrelated:\s*(.+)$/gim);
|
|
6
6
|
return note === '' ? undefined : note;
|
|
7
7
|
}
|
|
8
|
+
export function parseResolved(text) {
|
|
9
|
+
const note = lastMatch(text, /^resolved:\s*(.+)$/gim);
|
|
10
|
+
return note === '' ? undefined : note;
|
|
11
|
+
}
|
|
8
12
|
export function parseCommitSubject(text, fallback) {
|
|
9
13
|
const subject = lastMatch(text, /^commit:\s*(.+)$/gim)
|
|
10
14
|
?.replace(/^`+|`+$/g, '')
|
package/dist/fix.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseCommitSubject, parseUnrelated } from './agent-reply.mjs';
|
|
1
|
+
import { parseCommitSubject, parseResolved, parseUnrelated } from './agent-reply.mjs';
|
|
2
2
|
import { CODING } from './agents.mjs';
|
|
3
3
|
import { budgetUse } from './budget.mjs';
|
|
4
4
|
import { message } from './errors.mjs';
|
|
@@ -24,7 +24,11 @@ export async function fixRound(job, reason, detail, earlier, kind) {
|
|
|
24
24
|
}
|
|
25
25
|
const unrelated = parseUnrelated(text);
|
|
26
26
|
if (unrelated !== undefined) {
|
|
27
|
-
return disputedFix(job, before, reason, unrelated);
|
|
27
|
+
return disputedFix(job, before, reason, { unrelated });
|
|
28
|
+
}
|
|
29
|
+
const resolved = kind === 'review' ? parseResolved(text) : undefined;
|
|
30
|
+
if (resolved !== undefined) {
|
|
31
|
+
return disputedFix(job, before, reason, { resolved });
|
|
28
32
|
}
|
|
29
33
|
const subject = parseCommitSubject(text, `fix: address feedback on issue #${issue.number}`);
|
|
30
34
|
if (!(await commitWork(job, before, subject, 'fixer'))) {
|
|
@@ -41,7 +45,7 @@ export async function runFixer(job, reason, detail, earlier, kind) {
|
|
|
41
45
|
function fixBudget(job, kind) {
|
|
42
46
|
return budgetUse(job, kind === 'review' ? 'reviewRounds' : 'ciFixes');
|
|
43
47
|
}
|
|
44
|
-
async function disputedFix(job, before, reason,
|
|
48
|
+
async function disputedFix(job, before, reason, note) {
|
|
45
49
|
const { context, log, worktree, branch } = job;
|
|
46
50
|
const { ports } = context;
|
|
47
51
|
const disputed = await ports.revision(worktree);
|
|
@@ -52,8 +56,9 @@ async function disputedFix(job, before, reason, unrelated) {
|
|
|
52
56
|
log.event('fix.aside', { branch: aside }, 'quiet');
|
|
53
57
|
}
|
|
54
58
|
const stray = moved || (await ports.isDirty(worktree));
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
const event = 'unrelated' in note ? 'fix.unrelated' : 'fix.resolved';
|
|
60
|
+
log.event(event, { reason, note: Object.values(note)[0], stray }, 'quiet');
|
|
61
|
+
return { committed: false, ...note, stray };
|
|
57
62
|
}
|
|
58
63
|
export async function commitWork(job, before, subject, role, commit) {
|
|
59
64
|
const { context, issue, log, state, worktree } = job;
|
package/dist/git-land.mjs
CHANGED
|
@@ -5,8 +5,15 @@ export async function squashOnto(cwd, base, remote, message) {
|
|
|
5
5
|
if (await succeeds(cwd, ['diff', '--quiet', target])) {
|
|
6
6
|
return false;
|
|
7
7
|
}
|
|
8
|
+
const head = await revision(cwd);
|
|
8
9
|
await git(cwd, ['reset', '--soft', target]);
|
|
9
|
-
|
|
10
|
+
try {
|
|
11
|
+
await commitEverything(cwd, message);
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
await git(cwd, ['reset', '--soft', head]);
|
|
15
|
+
throw error;
|
|
16
|
+
}
|
|
10
17
|
return true;
|
|
11
18
|
}
|
|
12
19
|
export async function pushToBase(cwd, remote, base) {
|
package/dist/prompts.mjs
CHANGED
|
@@ -73,6 +73,8 @@ function reviewScope(earlier) {
|
|
|
73
73
|
'Do not raise a new point of taste. Do not repeat a finding that is fixed.',
|
|
74
74
|
'A `The fixer disputed every finding of this round` line answers all of the findings of that round, not one of them.',
|
|
75
75
|
'Withdraw every finding of that round if the dispute is correct. Repeat them all if the dispute is wrong.',
|
|
76
|
+
'A `The fixer settled every finding of this round with no code change` line also answers all of the findings of that round.',
|
|
77
|
+
'Withdraw every finding of that round if they are settled. Repeat them all if they are not.',
|
|
76
78
|
`## Earlier findings\n${earlier.join('\n')}`,
|
|
77
79
|
].join('\n');
|
|
78
80
|
}
|
|
@@ -105,6 +107,8 @@ const DISPUTE_RULE = [
|
|
|
105
107
|
'A finding can be wrong: it can miss a convention of this repository, ask for work that the issue does not want, or describe behaviour that the code does not have.',
|
|
106
108
|
'Establish that before you change anything. If every finding is wrong, change nothing and end your final message with one line in the form `unrelated: <one sentence on why the findings are wrong>`.',
|
|
107
109
|
'If only some of the findings are wrong, fix the correct ones and change nothing for the wrong ones. Write no `unrelated` line in that round. The next round holds only the findings that are left, and you can dispute them there.',
|
|
110
|
+
'A finding can also be right and need no code change, for example when it asks for proof such as a failing test run.',
|
|
111
|
+
'If every finding is settled with no code change, change nothing and end your final message with one line in the form `resolved: <how the findings were settled>`.',
|
|
108
112
|
'The reviewer reads that line in the next round. Do not make a change that you hold to be wrong only to end the round.',
|
|
109
113
|
].join('\n');
|
|
110
114
|
const CONFLICT_RULE = [
|
|
@@ -145,9 +149,12 @@ export function fixPrompt(issue, reason, detail, earlier, kind, reply = []) {
|
|
|
145
149
|
export function history(rounds) {
|
|
146
150
|
return rounds.map((round) => {
|
|
147
151
|
const head = `Round ${round.round}:\n${round.findings}`;
|
|
148
|
-
|
|
152
|
+
if (round.dispute !== undefined) {
|
|
153
|
+
return `${head}\nThe fixer disputed every finding of this round: ${round.dispute}`;
|
|
154
|
+
}
|
|
155
|
+
return round.settled === undefined
|
|
149
156
|
? head
|
|
150
|
-
: `${head}\nThe fixer
|
|
157
|
+
: `${head}\nThe fixer settled every finding of this round with no code change: ${round.settled}`;
|
|
151
158
|
});
|
|
152
159
|
}
|
|
153
160
|
const HUNT_DEFAULT = [
|
package/dist/review.mjs
CHANGED
|
@@ -70,15 +70,22 @@ async function runReviewer(job, earlier) {
|
|
|
70
70
|
async function unfixedRound(job, fix) {
|
|
71
71
|
const { context, issue, state } = job;
|
|
72
72
|
const { repo, ports } = context;
|
|
73
|
-
const note = fix.unrelated;
|
|
73
|
+
const note = fix.unrelated ?? fix.resolved;
|
|
74
74
|
if (note === undefined) {
|
|
75
75
|
return escalateAndFinish(job, 'The fixer added no commit for the review findings.', 'no fix commit');
|
|
76
76
|
}
|
|
77
77
|
if (fix.stray === true) {
|
|
78
|
-
return escalateAndFinish(job, `The fixer disputed the findings and left a change behind: ${note}`, 'dispute with changes');
|
|
78
|
+
return escalateAndFinish(job, `The fixer ${fix.unrelated === undefined ? 'settled' : 'disputed'} the findings and left a change behind: ${note}`, 'dispute with changes');
|
|
79
|
+
}
|
|
80
|
+
const round = state.reviewLog.at(-1);
|
|
81
|
+
if (fix.unrelated === undefined) {
|
|
82
|
+
round.settled = note;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
round.dispute = note;
|
|
79
86
|
}
|
|
80
|
-
state.reviewLog.at(-1).dispute = note;
|
|
81
87
|
await writeState(repo, state);
|
|
82
|
-
|
|
88
|
+
const heading = fix.unrelated === undefined ? 'settled with no change' : 'no change';
|
|
89
|
+
await ports.commentOnIssue(repo, issue.number, `### Fixer: ${heading}\n\n${note}`);
|
|
83
90
|
return ROUND_CONTINUE;
|
|
84
91
|
}
|
package/dist/state.mjs
CHANGED
|
@@ -42,7 +42,8 @@ function isReviewRound(value) {
|
|
|
42
42
|
return (isRecord(value) &&
|
|
43
43
|
typeof value.round === 'number' &&
|
|
44
44
|
typeof value.findings === 'string' &&
|
|
45
|
-
isOptional(value.dispute, 'string')
|
|
45
|
+
isOptional(value.dispute, 'string') &&
|
|
46
|
+
isOptional(value.settled, 'string'));
|
|
46
47
|
}
|
|
47
48
|
function isState(value) {
|
|
48
49
|
return (isRecord(value) &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-issue",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.1",
|
|
4
4
|
"description": "Autonomous issue harness driven by the pi SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github",
|
|
@@ -42,16 +42,16 @@
|
|
|
42
42
|
"prepublishOnly": "npm run typecheck && npm test"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@earendil-works/pi-ai": "^1.5.
|
|
45
|
+
"@earendil-works/pi-ai": "^1.5.2",
|
|
46
46
|
"@types/node": "^26.6.6",
|
|
47
47
|
"@types/ws": "^8.18.2",
|
|
48
|
-
"oxfmt": "^0.
|
|
49
|
-
"oxlint": "^1.
|
|
48
|
+
"oxfmt": "^0.78.0",
|
|
49
|
+
"oxlint": "^1.93.0",
|
|
50
50
|
"typescript": "^7.0.2"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@earendil-works/pi-coding-agent": "^1.5.
|
|
54
|
-
"typebox": "^1.4.
|
|
55
|
-
"ws": "^8.
|
|
53
|
+
"@earendil-works/pi-coding-agent": "^1.5.2",
|
|
54
|
+
"typebox": "^1.4.7",
|
|
55
|
+
"ws": "^8.23.0"
|
|
56
56
|
}
|
|
57
57
|
}
|