next-issue 17.2.12 → 17.2.13

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.
@@ -121,6 +121,15 @@ export async function issueEditors(repo, issue) {
121
121
  },
122
122
  };
123
123
  }
124
+ /** The person who last added the label to the issue, `ghost` for a deleted account, or undefined when nobody added it. */
125
+ export async function labeler(repo, issue, label) {
126
+ const raw = await ghApi(repo, `issues/${issue}/events`, '.[] | select(.event == "labeled") | [.label.name, .actor.login] | @json', { paginate: true });
127
+ const added = lines(raw)
128
+ .map((line) => parseJson(line, () => `gh gave a label event of #${issue} that is not valid JSON: ${line}`))
129
+ .filter(([name]) => name === label);
130
+ const last = added.at(-1);
131
+ return last === undefined ? undefined : (last[1] ?? GHOST);
132
+ }
124
133
  const REPOSITORY_SLUG = '(.repository_url | split("/") | .[-2:] | join("/"))';
125
134
  export async function openBlockers(repo, issue) {
126
135
  const raw = await ghApi(repo, `issues/${issue}/dependencies/blocked_by`, `.[] | select(.state == "open") | ${REPOSITORY_SLUG} + "#" + (.number | tostring)`, { paginate: true });
@@ -5,7 +5,7 @@ import { commitAll } from './git-commit.mjs';
5
5
  import { baseMoved, pushToBase, reapplyRevert, revertOnBase, squashOnto } from './git-land.mjs';
6
6
  import { abortMerge, commitMerge, startMerge } from './git-merge.mjs';
7
7
  import { changedFiles, deleteBranch, diff, discardChanges, disputeBranches, isDirty, isLanded, isOnBase, latestSubject, revision, saveEdits, saveSetupOutput, setAside, } from './git.mjs';
8
- import { canWrite, closeIssue, commentOnIssue, editIssueBody, issueComments, issueEditors, openBlockers, openIssues, reopenIssue, repositorySlug, threadComments, viewIssue, } from './github.mjs';
8
+ import { canWrite, closeIssue, commentOnIssue, editIssueBody, issueComments, issueEditors, labeler, 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';
@@ -44,6 +44,7 @@ export const PORTS = {
44
44
  isOnBase,
45
45
  issueComments,
46
46
  issueEditors,
47
+ labeler,
47
48
  latestSubject,
48
49
  openBlockers,
49
50
  openIssues,
@@ -55,7 +55,9 @@ export async function skipReport(context, log, issue, saved, started) {
55
55
  log.event('issue.skip', { title: issue.title, reason: skip });
56
56
  if (saved?.halted === true && hasLabel(issue.labels, context.config.labels.skip)) {
57
57
  try {
58
- await release(context, log, saved);
58
+ if (await skippedByWriter(context, issue)) {
59
+ await release(context, log, saved);
60
+ }
59
61
  }
60
62
  catch (error) {
61
63
  return readError(log, issue, saved, error, started);
@@ -98,6 +100,11 @@ async function release(context, log, saved) {
98
100
  await writeState(context.repo, saved);
99
101
  log.event('land.released', { held: heldOnBase(saved, context.base) });
100
102
  }
103
+ async function skippedByWriter(context, issue) {
104
+ const { ports, repo, config } = context;
105
+ const login = await ports.labeler(repo, issue.number, config.labels.skip);
106
+ return login !== undefined && (await ports.canWrite(repo, login));
107
+ }
101
108
  async function hasAnswer(context, issue, saved) {
102
109
  if (!hasLabel(issue.labels, context.config.labels.needsHuman)) {
103
110
  return false;
@@ -17,7 +17,7 @@ export function holdsOnBase(state) {
17
17
  return heldOnBase(state, '') !== '';
18
18
  }
19
19
  /** What a halt with an unchecked commit on the base means for the next runs. */
20
- export const HALT_NOTE = 'The run halts, and no run lands another change until this issue resumes (after an answer or once the label is off) and checks the base, or a person gives it up with the skip label.';
20
+ export const HALT_NOTE = 'The run halts, and no run lands another change until this issue resumes (after an answer or once the label is off) and checks the base, or a person with write access gives it up with the skip label.';
21
21
  /** Whether this state keeps every run from landing: it halted with a commit on the base whose checks are still unknown. */
22
22
  export function blocksLanding(state, base) {
23
23
  return state.halted === true && state.closing !== true && heldOnBase(state, base) !== '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "17.2.12",
3
+ "version": "17.2.13",
4
4
  "description": "Autonomous issue harness driven by the Claude Agent SDK",
5
5
  "keywords": [
6
6
  "github",