next-issue 6.6.61 → 6.6.63
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 +5 -2
- package/dist/github.mjs +3 -0
- package/dist/handover.mjs +18 -3
- package/dist/hunt.mjs +17 -6
- package/dist/ports.mjs +2 -1
- package/package.json +1 -1
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
|
|
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
|
|
@@ -616,7 +619,7 @@ With `--hunt`, which turns on `--watch`, the harness runs a hunter agent at the
|
|
|
616
619
|
- files up to `huntCap` less that count, worked out just before the hunt, its most serious findings first, each with the `labels.ready` label, the `labels.hunt` label and the sections of the [issue format](#issue-format), after a search for duplicates. It files and searches with `gh --repo <owner>/<name>` of the configured `remote`, so another GitHub remote, such as `upstream` in a fork, never gets its issues. The `labels.hunt` label, `source:hunt` by default, marks the issue as one the hunter filed. The harness creates the `labels.ready` and `labels.hunt` labels before the hunt when they are missing. It compares label names without case, as GitHub does, so a label that exists in another case, such as `Source:Hunt`, counts as there and keeps its name. When the create fails, it reads the labels again, so a label that someone else created meanwhile counts as there too. It files nothing when it finds no real problem or a duplicate exists;
|
|
617
620
|
- runs no test suite and changes no file. It gets the tools of the reviewer.
|
|
618
621
|
|
|
619
|
-
With `huntCap` at 1 and no ready issue, a hunt files at most one issue. The hunter ends its reply with one `issue:` line for each issue it filed, or one `issue: none` line; a url that is not an issue of the repository of `remote` does not count as filed,
|
|
622
|
+
With `huntCap` at 1 and no ready issue, a hunt files at most one issue. The hunter ends its reply with one `issue:` line for each issue it filed, or one `issue: none` line; a url that is not an issue of the repository of `remote` does not count as filed. When the `remote` url holds an old owner or name that GitHub redirects after a rename or transfer, the harness asks GitHub for the new one, so an issue url with the new name counts too. The run log holds one `hunt.issue` event with the `url` for each, or one with `none`. A hunt that fails writes a `hunt.error` event and the watch goes on. The hunter then waits before the next hunt, with a `hunt.wait` event and the same back-off, so a failure, or a hunt that files nothing, that repeats waits 1, 2, 3, 5, 10, then 10 minutes, and the back-off goes back to 1 minute after a hunt that files at least one issue. The next pass claims the new issues like any other. At the first `Ctrl-C` the hunter stops after its current hunt, and the watch ends once the hunt and the running issues end. A first `Ctrl-C` during the watch wait tells you so while a hunt runs, and the third press stops the hunter at once. The hunter stops too when the watch ends for another reason.
|
|
620
623
|
|
|
621
624
|
## Worker
|
|
622
625
|
|
package/dist/github.mjs
CHANGED
|
@@ -74,6 +74,9 @@ export async function openBlockers(repo, issue) {
|
|
|
74
74
|
return prefix === undefined ? ref : ref.slice(prefix.length - 1);
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
+
export async function repositorySlug(repo) {
|
|
78
|
+
return repeatable(repo, ['api', `repos/${slug(repo)}`, '--jq', '.full_name']);
|
|
79
|
+
}
|
|
77
80
|
export async function reopenIssue(repo, issue) {
|
|
78
81
|
await gh(repo, ['issue', 'reopen', String(issue)]);
|
|
79
82
|
}
|
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
|
-
|
|
108
|
-
|
|
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,
|
|
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/dist/hunt.mjs
CHANGED
|
@@ -27,9 +27,22 @@ export async function huntWorktree(repo, base, remote) {
|
|
|
27
27
|
}
|
|
28
28
|
return path;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
function issueSlug(url) {
|
|
31
|
+
return /^https:\/\/github\.com\/([^/]+\/[^/]+)\/issues\/\d+\/?$/i.exec(url)?.[1]?.toLowerCase();
|
|
32
|
+
}
|
|
33
|
+
async function issuesOf(context, urls) {
|
|
34
|
+
const found = urls.flatMap((url) => {
|
|
35
|
+
const repository = issueSlug(url);
|
|
36
|
+
return repository === undefined ? [] : [{ url, repository }];
|
|
37
|
+
});
|
|
38
|
+
const slugs = [slug(context.repo).toLowerCase()];
|
|
39
|
+
if (found.some(({ repository }) => !slugs.includes(repository))) {
|
|
40
|
+
const canonical = await context.ports.repositorySlug(context.repo).catch(() => undefined);
|
|
41
|
+
if (canonical !== undefined) {
|
|
42
|
+
slugs.push(canonical.trim().toLowerCase());
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return found.filter(({ repository }) => slugs.includes(repository)).map(({ url }) => url);
|
|
33
46
|
}
|
|
34
47
|
export async function hunt(context, count) {
|
|
35
48
|
const { repo, config, base, recorder, ports } = context;
|
|
@@ -48,9 +61,7 @@ export async function hunt(context, count) {
|
|
|
48
61
|
profile: REVIEWING,
|
|
49
62
|
timeoutMs: minutesToMs(config.agentTimeoutMinutes),
|
|
50
63
|
});
|
|
51
|
-
const urls = [...result.text.matchAll(FILED)]
|
|
52
|
-
.map((match) => match[1])
|
|
53
|
-
.filter((url) => isIssueOf(repo, url));
|
|
64
|
+
const urls = await issuesOf(context, [...result.text.matchAll(FILED)].map((match) => match[1]));
|
|
54
65
|
for (const url of urls.length === 0 ? ['none'] : urls) {
|
|
55
66
|
recorder.event('hunt.issue', { url }, 'quiet');
|
|
56
67
|
}
|
package/dist/ports.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { commitAll } from './git-commit.mjs';
|
|
|
5
5
|
import { pushToBase, reapplyRevert, revertOnBase, squashOnto } from './git-land.mjs';
|
|
6
6
|
import { abortMerge, commitMerge, startMerge } from './git-merge.mjs';
|
|
7
7
|
import { deleteBranch, diff, discardChanges, disputeBranches, isDirty, isLanded, isOnBase, latestSubject, push, resetToBase, revision, setAside, } from './git.mjs';
|
|
8
|
-
import { canWrite, closeIssue, commentOnIssue, issueComments, openBlockers, openIssues, reopenIssue, threadComments, viewIssue, } from './github.mjs';
|
|
8
|
+
import { canWrite, closeIssue, commentOnIssue, issueComments, openBlockers, openIssues, reopenIssue, repositorySlug, threadComments, viewIssue, } from './github.mjs';
|
|
9
9
|
import { huntWorktree } from './hunt.mjs';
|
|
10
10
|
import { ensureLabel, setLabel } from './labels.mjs';
|
|
11
11
|
import { detectSetupCommand } from './setup.mjs';
|
|
@@ -43,6 +43,7 @@ export const PORTS = {
|
|
|
43
43
|
reapplyRevert,
|
|
44
44
|
removeWorktree,
|
|
45
45
|
reopenIssue,
|
|
46
|
+
repositorySlug,
|
|
46
47
|
rerunFailedBase,
|
|
47
48
|
resetToBase,
|
|
48
49
|
revertOnBase,
|