next-issue 5.6.1 → 5.6.2
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 +10 -6
- package/dist/handover.mjs +9 -0
- package/dist/ports.mjs +2 -1
- package/dist/worktree.mjs +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,12 +114,16 @@ the run handles one issue. For each issue:
|
|
|
114
114
|
of the pushed commit on the base branch. A repository that reports no
|
|
115
115
|
check keeps asking for `checkGraceSeconds`. A pending state waits again,
|
|
116
116
|
up to `checkTimeoutMinutes`. A read that fails is tried three times. When
|
|
117
|
-
the checks pass, the harness closes the issue and sets `status:done`,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
the checks pass, the harness closes the issue and sets `status:done`,
|
|
118
|
+
fetches the remote and fast-forwards the local base branch to the landed
|
|
119
|
+
commit when that is safe, and the worktree, the local branch and the state
|
|
120
|
+
file go away. A fetch that fails or a fast-forward that is not safe leaves
|
|
121
|
+
the local base branch as it is and writes a `base.behind` event, and the
|
|
122
|
+
issue is still done. When the checks fail, the harness reruns the failed
|
|
123
|
+
jobs once with `gh run rerun <id> --failed`, records a
|
|
124
|
+
`main-checks.rerun` event, saves the rerun in the state file and waits
|
|
125
|
+
again once the runs restart. When the rerun cannot start, or the checks
|
|
126
|
+
fail again, the fixer gets their logs from the check budget, and its fix lands
|
|
123
127
|
the same way. When the fixer cannot fix them, its fix cannot land, or the
|
|
124
128
|
budget runs out, the harness reverts every commit of the change on the
|
|
125
129
|
base branch, pushes the revert and hands the issue to a person. A resume
|
package/dist/handover.mjs
CHANGED
|
@@ -15,8 +15,17 @@ export async function finishDone(job) {
|
|
|
15
15
|
const { context, issue } = job;
|
|
16
16
|
await setStatus(context, issue.number, context.config.labels.done);
|
|
17
17
|
await context.ports.closeIssue(context.repo, issue.number);
|
|
18
|
+
await updateLocalBase(job);
|
|
18
19
|
return { done: true, report: await finish(job, 'done') };
|
|
19
20
|
}
|
|
21
|
+
async function updateLocalBase(job) {
|
|
22
|
+
const { context, log } = job;
|
|
23
|
+
const { repo, ports, config, base } = context;
|
|
24
|
+
const updated = await oneAtATime(repo.root, () => ports.fastForwardBase(repo, base, config.remote)).catch(() => false);
|
|
25
|
+
if (!updated) {
|
|
26
|
+
log.event('base.behind', { base }, 'quiet');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
20
29
|
export function stop(job) {
|
|
21
30
|
job.log.event('issue.stop', { phase: job.state.phase }, 'quiet');
|
|
22
31
|
return jobReport(job, 'stopped');
|
package/dist/ports.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { canWrite, closeIssue, commentOnIssue, issueComments, openBlockers, open
|
|
|
9
9
|
import { huntWorktree } from './hunt.mjs';
|
|
10
10
|
import { ensureLabel, setLabel } from './labels.mjs';
|
|
11
11
|
import { detectSetupCommand } from './setup.mjs';
|
|
12
|
-
import { addWorktree, findWorktree, removeWorktree } from './worktree.mjs';
|
|
12
|
+
import { addWorktree, fastForwardBase, findWorktree, removeWorktree } from './worktree.mjs';
|
|
13
13
|
async function runSetup(command, cwd, timeoutMs) {
|
|
14
14
|
return run('bash', ['-lc', command], { cwd, timeoutMs });
|
|
15
15
|
}
|
|
@@ -28,6 +28,7 @@ export const PORTS = {
|
|
|
28
28
|
disputeBranches,
|
|
29
29
|
ensureLabel,
|
|
30
30
|
failedBaseLogs,
|
|
31
|
+
fastForwardBase,
|
|
31
32
|
findWorktree,
|
|
32
33
|
huntWorktree,
|
|
33
34
|
isDirty,
|
package/dist/worktree.mjs
CHANGED
|
@@ -7,8 +7,7 @@ function worktreePath(repo, issue) {
|
|
|
7
7
|
export async function addWorktree(repo, issue, branch, base, remote, start) {
|
|
8
8
|
const upstream = remoteRef(remote, branch);
|
|
9
9
|
const remoteBase = remoteRef(remote, base);
|
|
10
|
-
await
|
|
11
|
-
const baseUpdated = await updateBase(repo, base, remote);
|
|
10
|
+
const baseUpdated = await fastForwardBase(repo, base, remote);
|
|
12
11
|
await git(repo.root, ['worktree', 'prune']);
|
|
13
12
|
const pushed = await hasBranch(repo, upstream, '--remotes');
|
|
14
13
|
const existing = await findWorktree(repo, branch);
|
|
@@ -38,6 +37,10 @@ async function hasBranch(repo, name, ...flags) {
|
|
|
38
37
|
const list = await git(repo.root, ['branch', '--list', ...flags, name]);
|
|
39
38
|
return list.length > 0;
|
|
40
39
|
}
|
|
40
|
+
export async function fastForwardBase(repo, base, remote) {
|
|
41
|
+
await git(repo.root, ['fetch', remote]);
|
|
42
|
+
return updateBase(repo, base, remote);
|
|
43
|
+
}
|
|
41
44
|
async function updateBase(repo, base, remote) {
|
|
42
45
|
const remoteBase = remoteRef(remote, base);
|
|
43
46
|
const args = (await currentBranch(repo.root)) === base
|