next-issue 5.1.0 → 5.2.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
@@ -66,8 +66,10 @@ the run handles one issue. For each issue:
66
66
  base when there is none. A fast-forward of the base that is not safe
67
67
  leaves the local base branch as it is and writes a `base.behind` event. A
68
68
  new branch then starts from the remote base.
69
- 4. Let the implementer agent do the work, then commit it. The branch is not
70
- pushed. When a git
69
+ 4. Let the implementer agent do the work, then commit it. For a behaviour
70
+ change, the implementer writes the test first and quotes its failing output
71
+ in its reply. The harness keeps that reply in the state file for the
72
+ reviewer. The branch is not pushed. When a git
71
73
  hook stops a commit, the agent that made the change gets the hook output,
72
74
  fixes it, and the harness commits again. A `commit:` line in the reply of
73
75
  the agent replaces the subject, so a hook that rejects the subject can pass.
@@ -80,6 +82,10 @@ the run handles one issue. For each issue:
80
82
  reviewer reads files and runs commands in the worktree, so it can prove a
81
83
  finding with the tests or the type check. The harness then throws away every
82
84
  change that the reviewer left, so no such change can reach a later commit.
85
+ The first reviewer also gets the reply of the implementer, and raises a
86
+ finding when a behaviour change has no failing run of its test. A later
87
+ reviewer gets the reply of the last review fixer instead, who quotes the
88
+ failing run of a test for a behaviour change.
83
89
  The reviewer ends its last message with its verdict as a json block: a
84
90
  summary and one entry per finding, each rated `blocking` or `minor`. A
85
91
  reply without a valid block hands the issue to a person. The findings are the only ground
package/dist/fix.mjs CHANGED
@@ -19,6 +19,9 @@ export async function fixRound(job, reason, detail, earlier, kind) {
19
19
  const { ports } = context;
20
20
  const before = await ports.revision(worktree);
21
21
  const text = await runFixer(job, reason, detail, earlier, kind);
22
+ if (kind === 'review') {
23
+ job.state.fixerReply = text;
24
+ }
22
25
  const unrelated = parseUnrelated(text);
23
26
  if (unrelated !== undefined) {
24
27
  return disputedFix(job, before, reason, unrelated);
@@ -9,6 +9,7 @@ export async function implement(job) {
9
9
  const { context, issue, log, state, worktree, comments, reply } = job;
10
10
  const before = await context.ports.revision(worktree);
11
11
  const result = await log.step('implement', {}, () => runRole(job, 'implementer', implementPrompt(issue, comments, reply), CODING));
12
+ state.implementerReply = result.text;
12
13
  const subject = parseCommitSubject(result.text, fallbackTitle(issue));
13
14
  if (!(await commitWork(job, before, subject, 'implementer'))) {
14
15
  const escalated = await useEarlierCommit(job);
package/dist/prompts.mjs CHANGED
@@ -27,6 +27,7 @@ export function implementPrompt(issue, comments, reply = []) {
27
27
  '## Rules',
28
28
  'Read the repository conventions first. Keep the change minimal and focused on the issue.',
29
29
  'Add or update tests when the repository has a test suite.',
30
+ 'For a behaviour change, write the test first and run it before the change. Then quote its failing output in your final message.',
30
31
  COMMIT_RULES,
31
32
  ]);
32
33
  }
@@ -47,7 +48,10 @@ export function capDiff(diff, maxChars) {
47
48
  }
48
49
  function reviewScope(earlier) {
49
50
  return earlier.length === 0
50
- ? 'Check correctness, scope, repository conventions and test cover.'
51
+ ? [
52
+ 'Check correctness, scope, repository conventions and test cover.',
53
+ 'Raise a finding when a behaviour change has no failing run of its test in the reply of the implementer.',
54
+ ].join('\n')
51
55
  : [
52
56
  'This is a later round. Judge two things only:',
53
57
  'whether the earlier findings below are now fixed, and whether the new commits broke something.',
@@ -57,7 +61,8 @@ function reviewScope(earlier) {
57
61
  `## Earlier findings\n${earlier.join('\n')}`,
58
62
  ].join('\n');
59
63
  }
60
- export function reviewPrompt(issue, comments, diff, earlier) {
64
+ export function reviewPrompt(issue, comments, diff, earlier, reply) {
65
+ const role = earlier.length === 0 ? 'implementer' : 'fixer';
61
66
  return [
62
67
  'You are the reviewer. Judge whether the diff solves the issue correctly.',
63
68
  issueBlock(issue, comments),
@@ -65,6 +70,7 @@ export function reviewPrompt(issue, comments, diff, earlier) {
65
70
  '```diff',
66
71
  diff,
67
72
  '```',
73
+ `## Reply of the ${role}\n${reply ?? '(no reply)'}`,
68
74
  '## Rules',
69
75
  'Read files and run commands to prove what you say: the tests, the type check or the linter.',
70
76
  'The worktree is ready to use. Do not change a file. Do not write with git or gh.',
@@ -93,7 +99,10 @@ const CONFLICT_RULE = [
93
99
  ].join('\n');
94
100
  const KIND_RULES = {
95
101
  checks: UNRELATED_RULE,
96
- review: DISPUTE_RULE,
102
+ review: [
103
+ DISPUTE_RULE,
104
+ 'For a behaviour change, run its test before the change and quote its failing output in your final message.',
105
+ ].join('\n'),
97
106
  conflict: CONFLICT_RULE,
98
107
  };
99
108
  function earlierBlock(earlier) {
package/dist/review.mjs CHANGED
@@ -61,7 +61,7 @@ async function runReviewer(job, earlier) {
61
61
  cut: full.length > config.diffMaxChars,
62
62
  };
63
63
  const before = await ports.revision(worktree);
64
- const review = await log.step('review', fields, () => runRole(job, 'reviewer', reviewPrompt(issue, comments, patch, earlier), REVIEWING));
64
+ const review = await log.step('review', fields, () => runRole(job, 'reviewer', reviewPrompt(issue, comments, patch, earlier, earlier.length === 0 ? state.implementerReply : state.fixerReply), REVIEWING));
65
65
  if (await ports.discardChanges(worktree, before)) {
66
66
  log.event('review.discard', { round: state.reviewRounds }, 'quiet');
67
67
  }
package/dist/state.mjs CHANGED
@@ -47,6 +47,8 @@ function isState(value) {
47
47
  PHASES.includes(value.phase) &&
48
48
  typeof value.branch === 'string' &&
49
49
  isOptional(value.title, 'string') &&
50
+ isOptional(value.implementerReply, 'string') &&
51
+ isOptional(value.fixerReply, 'string') &&
50
52
  typeof value.ciFixes === 'number' &&
51
53
  isOptional(value.commitFixes, 'number') &&
52
54
  (value.landed === undefined || isLanded(value.landed)) &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",