next-issue 5.2.0 → 5.4.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 +19 -10
- package/dist/hand-over-comments.mjs +1 -1
- package/dist/job.mjs +10 -3
- package/dist/prompts.mjs +14 -0
- package/dist/skip.mjs +18 -3
- package/dist/state.mjs +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,7 +48,8 @@ the run handles one issue. For each issue:
|
|
|
48
48
|
1. Claim the issue only when it holds the `status:todo` label and holds no
|
|
49
49
|
`status:in-progress` or `status:in-review` label. A `status:done`,
|
|
50
50
|
`status:needs-human` or `status:blocked` label always stops the claim, a
|
|
51
|
-
resume too
|
|
51
|
+
resume too, except a `status:needs-human` issue with an answer to its
|
|
52
|
+
hand-over. An issue that GitHub lists as blocked by an open issue waits,
|
|
52
53
|
because its blocker closes only when the change of the blocker lands.
|
|
53
54
|
An issue with saved state under `.next-issue/` resumes instead, whatever its
|
|
54
55
|
other labels and blockers.
|
|
@@ -411,22 +412,30 @@ run stopped. A state file that is not valid JSON, or that does not hold a valid
|
|
|
411
412
|
state, gives the issue an `error` outcome that names the file, rather than a
|
|
412
413
|
silent skip.
|
|
413
414
|
|
|
415
|
+
Every agent prompt holds `.next-issue/notes.md` when it exists, so lessons
|
|
416
|
+
such as test commands, tool quirks and deliberate behaviour carry over from one
|
|
417
|
+
issue to the next. The implementer and the fixer may add a short note to it, and
|
|
418
|
+
the prompt asks them to keep only what still holds. The reviewer only reads it.
|
|
419
|
+
|
|
414
420
|
## Retry an issue that waits for a person
|
|
415
421
|
|
|
416
422
|
A hand-over marks the state file as handed over. To give the issue another try,
|
|
417
|
-
take the `status:needs-human` label off. The next run
|
|
418
|
-
the budgets and the findings back to zero, clears
|
|
419
|
-
and the step that the last run reached, so the
|
|
420
|
-
stopped. After a revert, the branch holds the change
|
|
421
|
-
revert, so the change goes back to the review. An issue
|
|
423
|
+
take the `status:needs-human` label off, or answer the hand-over. The next run
|
|
424
|
+
that claims the issue puts the budgets and the findings back to zero, clears
|
|
425
|
+
the mark and keeps the branch and the step that the last run reached, so the
|
|
426
|
+
work carries on where it stopped. After a revert, the branch holds the change
|
|
427
|
+
again on top of the revert, so the change goes back to the review. An issue
|
|
428
|
+
that still has the label is not claimed, unless it has an answer to the
|
|
429
|
+
hand-over: then the run claims it and takes the label off.
|
|
422
430
|
|
|
423
431
|
To give guidance, answer the hand-over with a comment on the issue. When the run
|
|
424
432
|
resumes the issue, it reads the comments posted after its last
|
|
425
433
|
`next-issue needs help:` comment there. Only comments from users with write
|
|
426
|
-
access to the repository count, for the hand-over comment too.
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
434
|
+
access to the repository count, for the hand-over comment too. A comment that
|
|
435
|
+
starts with one of the headings of the harness never counts as an answer. The
|
|
436
|
+
implementer and every fixer of that run get them in their prompt, under the
|
|
437
|
+
heading `Answer of a person to the hand-over`. A short reply such as "ready,
|
|
438
|
+
take it" is enough. With no such comment, the run resumes with no guidance.
|
|
430
439
|
|
|
431
440
|
The `--reset` flag does the same for any issue that the run handles, whether or
|
|
432
441
|
not it was handed over. It touches only an issue that the run handles, so the
|
package/dist/job.mjs
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { managedLabels } from './config.mjs';
|
|
2
2
|
import { minutesToMs } from './durations.mjs';
|
|
3
|
+
import { readTextIfPresent } from './files.mjs';
|
|
4
|
+
import { notesBlock } from './prompts.mjs';
|
|
5
|
+
import { notesPath } from './state.mjs';
|
|
6
|
+
import { paragraphs } from './text.mjs';
|
|
3
7
|
export const ROUND_CONTINUE = { done: false };
|
|
4
8
|
export const GATE_PASSED = { done: false, fixed: false };
|
|
5
9
|
export const GATE_FIXED = { done: false, fixed: true };
|
|
@@ -9,12 +13,15 @@ export function gateRound(gate) {
|
|
|
9
13
|
}
|
|
10
14
|
return gate.fixed ? ROUND_CONTINUE : undefined;
|
|
11
15
|
}
|
|
12
|
-
export function runRole(job, role, prompt, profile) {
|
|
13
|
-
const { config, ports } = job.context;
|
|
16
|
+
export async function runRole(job, role, prompt, profile) {
|
|
17
|
+
const { config, ports, repo } = job.context;
|
|
18
|
+
const path = notesPath(repo.root);
|
|
19
|
+
const notes = await readTextIfPresent(path);
|
|
20
|
+
const writable = role === 'implementer' || role === 'fixer';
|
|
14
21
|
return ports.runAgent(job.log, {
|
|
15
22
|
name: role,
|
|
16
23
|
cwd: job.worktree,
|
|
17
|
-
prompt,
|
|
24
|
+
prompt: paragraphs([notesBlock(path, notes, writable), prompt]),
|
|
18
25
|
profile,
|
|
19
26
|
model: config.models[role],
|
|
20
27
|
timeoutMs: minutesToMs(config.agentTimeoutMinutes),
|
package/dist/prompts.mjs
CHANGED
|
@@ -41,6 +41,20 @@ export function hookPrompt(issue, comments, role, output) {
|
|
|
41
41
|
COMMIT_RULES,
|
|
42
42
|
]);
|
|
43
43
|
}
|
|
44
|
+
export function notesBlock(path, notes, writable) {
|
|
45
|
+
const kept = notes?.trim() ?? '';
|
|
46
|
+
return paragraphs([
|
|
47
|
+
kept === ''
|
|
48
|
+
? ''
|
|
49
|
+
: `## Shared notes\nEarlier agents left these notes for this repository.\n\n${kept}`,
|
|
50
|
+
writable
|
|
51
|
+
? [
|
|
52
|
+
`When you learn something that the next issue needs, such as a test command, a tool quirk or deliberate behaviour, add a short note to ${path}.`,
|
|
53
|
+
'Keep the file short: keep only what still holds, and remove a note that no longer holds.',
|
|
54
|
+
].join('\n')
|
|
55
|
+
: '',
|
|
56
|
+
]);
|
|
57
|
+
}
|
|
44
58
|
export function capDiff(diff, maxChars) {
|
|
45
59
|
return diff.length <= maxChars
|
|
46
60
|
? diff
|
package/dist/skip.mjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { elapsedMs } from './durations.mjs';
|
|
2
2
|
import { message } from './errors.mjs';
|
|
3
|
-
|
|
3
|
+
import { handOverReply } from './hand-over-comments.mjs';
|
|
4
|
+
export function skipReason(issue, config, resuming, answered = false) {
|
|
4
5
|
const labels = new Set(issue.labels);
|
|
5
6
|
const names = config.labels;
|
|
6
|
-
|
|
7
|
+
const waiting = labels.has(names.needsHuman) && !answered;
|
|
8
|
+
if (labels.has(names.done) || waiting || labels.has(names.skip)) {
|
|
7
9
|
return 'stop-label';
|
|
8
10
|
}
|
|
9
11
|
if (resuming) {
|
|
@@ -18,7 +20,14 @@ export function skipReason(issue, config, resuming) {
|
|
|
18
20
|
return undefined;
|
|
19
21
|
}
|
|
20
22
|
export async function skipReport(context, log, issue, saved, started) {
|
|
21
|
-
|
|
23
|
+
let answered;
|
|
24
|
+
try {
|
|
25
|
+
answered = await hasAnswer(context, issue);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return unclaimedError(log, issue, error, started);
|
|
29
|
+
}
|
|
30
|
+
const skip = skipReason(issue, context.config, saved !== undefined, answered);
|
|
22
31
|
if (skip !== undefined) {
|
|
23
32
|
log.event('issue.skip', { title: issue.title, reason: skip });
|
|
24
33
|
return skipped(issue);
|
|
@@ -39,6 +48,12 @@ export async function skipReport(context, log, issue, saved, started) {
|
|
|
39
48
|
}
|
|
40
49
|
return undefined;
|
|
41
50
|
}
|
|
51
|
+
async function hasAnswer(context, issue) {
|
|
52
|
+
if (!issue.labels.includes(context.config.labels.needsHuman)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return (await handOverReply(context, issue.number)).length > 0;
|
|
56
|
+
}
|
|
42
57
|
export function unclaimedError(log, issue, error, started) {
|
|
43
58
|
const { reason, ms } = logIssueError(log, error, started);
|
|
44
59
|
return { ...skipped(issue), outcome: 'error', reason, ms };
|
package/dist/state.mjs
CHANGED
|
@@ -7,6 +7,9 @@ export const STATE_DIR = '.next-issue';
|
|
|
7
7
|
export function stateDir(root) {
|
|
8
8
|
return join(root, STATE_DIR);
|
|
9
9
|
}
|
|
10
|
+
export function notesPath(root) {
|
|
11
|
+
return join(stateDir(root), 'notes.md');
|
|
12
|
+
}
|
|
10
13
|
export function runsDir(root) {
|
|
11
14
|
return join(stateDir(root), 'runs');
|
|
12
15
|
}
|