next-issue 6.6.60 → 6.6.62

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
@@ -535,7 +535,10 @@ Every hand-over comment is cut to fit a GitHub comment, whatever the reason, so
535
535
  long reply or a long run error does not lose it. A cut comment ends with a line
536
536
  that says so.
537
537
 
538
- A hand-over marks the state file as handed over. To give the issue another try,
538
+ A hand-over marks the state file as handed over once its label and comment
539
+ reach GitHub. When either fails, or the run stops during it, the state keeps its
540
+ budgets and findings, and a later hand-over of the issue keeps the first
541
+ reason. To give the issue another try,
539
542
  take the `status:needs-human` label off, or answer the hand-over. The next run
540
543
  that claims the issue puts the budgets and the findings back to zero, clears
541
544
  the mark and keeps the branch and the step that the last run reached, so the
package/dist/handover.mjs CHANGED
@@ -103,9 +103,24 @@ async function cleanUp(context, log, branch) {
103
103
  async function handOver(context, log, issue, state, reason) {
104
104
  const { repo, ports, config } = context;
105
105
  log.event('hand-over', { reason }, 'quiet');
106
+ try {
107
+ await setStatus(context, issue, config.labels.needsHuman);
108
+ await ports.commentOnIssue(repo, issue, handOverComment(reason));
109
+ }
110
+ catch (error) {
111
+ throw new HandOverFailed(reason, error);
112
+ }
106
113
  await writeState(repo, { ...state, handedOver: true });
107
- await setStatus(context, issue, config.labels.needsHuman);
108
- await ports.commentOnIssue(repo, issue, handOverComment(reason));
114
+ }
115
+ class HandOverFailed extends Error {
116
+ reason;
117
+ constructor(reason, cause) {
118
+ super(message(cause), { cause });
119
+ this.reason = reason;
120
+ }
121
+ }
122
+ function handOverReason(error, reason) {
123
+ return error instanceof HandOverFailed ? error.reason : `The run failed: ${reason}`;
109
124
  }
110
125
  const CUT = '\n\nThe reason was too long for a GitHub comment and was cut.';
111
126
  function handOverComment(reason) {
@@ -114,7 +129,7 @@ function handOverComment(reason) {
114
129
  export async function claimedError(context, log, issue, state, error, started) {
115
130
  const { reason } = logIssueError(log, error, started);
116
131
  try {
117
- await handOver(context, log, issue.number, state, `The run failed: ${reason}`);
132
+ await handOver(context, log, issue.number, state, handOverReason(error, reason));
118
133
  }
119
134
  catch (failure) {
120
135
  log.event('hand-over.error', { error: message(failure) }, 'quiet');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.60",
3
+ "version": "6.6.62",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",