@oss-autopilot/core 3.25.1 → 3.27.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.
@@ -124,7 +124,10 @@ export function formatSummary(digest, capacity, issueResponses = []) {
124
124
  const capacityIcon = capacity.hasCapacity ? '✅' : '⚠️';
125
125
  const capacityLabel = capacity.hasCapacity ? 'Ready for new work' : 'Focus on existing PRs';
126
126
  const shelvedNote = capacity.shelvedPRCount > 0 ? ` + ${capacity.shelvedPRCount} shelved` : '';
127
- lines.push(`**Capacity:** ${capacityIcon} ${capacityLabel} (${capacity.activePRCount}/${capacity.maxActivePRs} PRs${shelvedNote})`);
127
+ const countLabel = capacity.maxActivePRs > 0
128
+ ? `${capacity.activePRCount}/${capacity.maxActivePRs} PRs`
129
+ : `${capacity.activePRCount} PRs, no limit`;
130
+ lines.push(`**Capacity:** ${capacityIcon} ${capacityLabel} (${countLabel}${shelvedNote})`);
128
131
  return lines.join('\n');
129
132
  }
130
133
  /**
@@ -20,7 +20,7 @@
20
20
  */
21
21
  import { getStateManager } from '../core/index.js';
22
22
  import type { PRCheckFailure } from '../core/pr-monitor.js';
23
- import type { ActionableIssueType, OvernightPrepared } from '../core/types.js';
23
+ import type { ActionableIssueType, OvernightImplementAttempt, OvernightPrepared } from '../core/types.js';
24
24
  import type { DailyOutput, DailyWarning, PendingLearnings } from '../formatters/json.js';
25
25
  import type { AttentionSummary } from '../core/pr-attention.js';
26
26
  /** One item in either bucket; which bucket is the array it lives in. */
@@ -43,12 +43,18 @@ export interface OvernightOutput {
43
43
  warnings: DailyWarning[];
44
44
  /** Branches carried over from an earlier run on the same date (a re-run never drops recorded work). */
45
45
  carriedPrepared: number;
46
+ /**
47
+ * The one curated-list issue to implement tonight (#1715): first item of
48
+ * the list's Pursue tier whose repo has no open PR of yours and that no
49
+ * earlier run has attempted. Null when the list is absent or exhausted.
50
+ */
51
+ implement: OvernightImplementItem | null;
46
52
  /** Set when the run could not be pushed to the Gist; the local cache has it. */
47
53
  gistSyncWarning?: string;
48
54
  /** Repos whose merged-PR learnings the overnight run should extract (#1696); absent when none. */
49
55
  pendingLearnings?: PendingLearnings;
50
56
  }
51
- type ReportBody = Pick<OvernightOutput, 'runAt' | 'prepare' | 'judgment' | 'attention' | 'failures' | 'warnings'>;
57
+ type ReportBody = Pick<OvernightOutput, 'runAt' | 'prepare' | 'judgment' | 'attention' | 'failures' | 'warnings' | 'implement'>;
52
58
  /** Freshness block `startup` surfaces (#1574). */
53
59
  export interface OvernightFreshness {
54
60
  runAt: string;
@@ -63,8 +69,46 @@ export interface OvernightFreshness {
63
69
  /** `local`: the file at `reportPath` is here. `gist`: only the published copy, read it with `overnight report`. */
64
70
  reportAvailable: ReportAvailability;
65
71
  }
72
+ /**
73
+ * Languages whose test suites the headless allowlist can actually run: it
74
+ * grants node, pnpm and npm and nothing else (OVERNIGHT_ALLOWED_TOOLS). A
75
+ * preparer on a Rust or Python repo can diagnose but never reach "Verify", so
76
+ * two nights of that ended blocked (#1697). Repos with a known primary
77
+ * language outside this set go to judgment instead of burning a preparer;
78
+ * a repo whose language is unknown (never scored) is given the benefit of
79
+ * the doubt. GitHub's `language` names, case-insensitive.
80
+ */
81
+ export declare const VERIFIABLE_LANGUAGES: string[];
82
+ /** Pure: null when the repo's suite can be run, else why not. */
83
+ export declare function toolchainSkipReason(language: string | null | undefined): string | null;
84
+ /** A curated-list issue picked for implementation (#1715). */
85
+ export interface OvernightImplementItem {
86
+ url: string;
87
+ repo: string;
88
+ number: number;
89
+ title: string;
90
+ /** Why this one: the tier it came from and the list path. */
91
+ reason: string;
92
+ }
93
+ /** The tier name the curated list uses for issues John already vetted and wants done. */
94
+ export declare const IMPLEMENT_TIER = "Pursue";
95
+ /**
96
+ * Pure: the one list issue to implement tonight, or null. First Pursue item
97
+ * (list order is the user's priority order) whose repo has no open PR of the
98
+ * user's (one PR per repo at a time keeps maintainers' review load sane and
99
+ * respects repos with a one-open-PR rule) and that no earlier run attempted.
100
+ */
101
+ export declare function pickImplementCandidate(items: {
102
+ url: string;
103
+ repo: string;
104
+ number: number;
105
+ title: string;
106
+ tier: string;
107
+ }[], openPRs: {
108
+ repo: string;
109
+ }[], attempts: OvernightImplementAttempt[], listPath: string, languageOf?: (repo: string) => string | null | undefined): OvernightImplementItem | null;
66
110
  /** Pure: split the daily check into prepare vs judgment items. */
67
- export declare function bucketize(daily: Pick<DailyOutput, 'actionableIssues' | 'commentedIssues'>): {
111
+ export declare function bucketize(daily: Pick<DailyOutput, 'actionableIssues' | 'commentedIssues'>, languageOf?: (repo: string) => string | null | undefined): {
68
112
  prepare: OvernightItem[];
69
113
  judgment: OvernightItem[];
70
114
  };
@@ -84,6 +128,22 @@ export declare function renderReport(out: ReportBody, prepared?: OvernightPrepar
84
128
  /** Local calendar date: the job fires at a local hour, so the report is filed under the local day. */
85
129
  export declare function reportDateFor(d: Date): string;
86
130
  export declare function runOvernight(): Promise<OvernightOutput>;
131
+ export interface OvernightImplementBlockedOptions {
132
+ url: string;
133
+ note?: string;
134
+ }
135
+ export interface OvernightImplementBlockedOutput {
136
+ url: string;
137
+ attemptCount: number;
138
+ gistSyncWarning?: string;
139
+ }
140
+ /**
141
+ * `overnight implement-blocked` (#1715): the preparer could not produce a
142
+ * branch for tonight's list issue. Remember that so the next run picks the
143
+ * next Pursue item instead of retrying this one every night; the note lands
144
+ * in the report's Blocked section like any other blocked item.
145
+ */
146
+ export declare function runOvernightImplementBlocked(options: OvernightImplementBlockedOptions): Promise<OvernightImplementBlockedOutput>;
87
147
  export interface OvernightRecordOptions {
88
148
  url: string;
89
149
  branch: string;
@@ -144,11 +204,22 @@ export declare const LAUNCHD_LABEL = "com.oss-autopilot.overnight";
144
204
  */
145
205
  export declare const OVERNIGHT_DISALLOWED_TOOLS: string;
146
206
  export declare const OVERNIGHT_ALLOWED_TOOLS: string;
207
+ /**
208
+ * The settings layer the scheduled job runs with instead of the user's own
209
+ * (#1697). Permission allow rules union across settings layers, and a user
210
+ * whose day-to-day settings allow bare `Bash` would otherwise void the
211
+ * enumerated allowlist entirely: only the deny list would apply. So the job
212
+ * drops user, project and local settings (`--setting-sources ""`) and gets
213
+ * this file, which carries only what it needs from them: the plugin itself.
214
+ */
215
+ export declare function renderOvernightSettings(): string;
147
216
  /** Pure: the launchd plist that runs `/oss-overnight` headlessly. */
148
- export declare function renderLaunchdPlist(options: Pick<ScheduleOptions, 'hour' | 'claudePath'>, logPath: string): string;
217
+ export declare function renderLaunchdPlist(options: Pick<ScheduleOptions, 'hour' | 'claudePath'>, logPath: string, settingsPath: string): string;
149
218
  export interface ScheduleOutput {
150
219
  plist: string;
151
220
  plistPath: string;
221
+ /** The settings layer the job runs with (see renderOvernightSettings); written with --install. */
222
+ settingsPath: string;
152
223
  installed: boolean;
153
224
  /** The one command the user runs to (re)load the job. */
154
225
  loadCommand: string;
@@ -21,9 +21,11 @@
21
21
  import * as fs from 'node:fs';
22
22
  import * as os from 'node:os';
23
23
  import * as path from 'node:path';
24
- import { errorMessage, getStateManager, maybeCheckpoint, requireGitHubToken } from '../core/index.js';
24
+ import { errorMessage, getStateManager, maybeCheckpoint, parseGitHubUrl, requireGitHubToken } from '../core/index.js';
25
25
  import { warn } from '../core/logger.js';
26
26
  import { getReportsDir } from '../core/paths.js';
27
+ import { detectIssueListPath } from './locate-issue-list.js';
28
+ import { parseIssueList } from './parse-list.js';
27
29
  import { executeDailyCheck } from './daily.js';
28
30
  const MODULE = 'overnight';
29
31
  // ponytail: static table, not a classifier. Every ActionableIssueType is
@@ -42,17 +44,82 @@ const BUCKET_BY_TYPE = {
42
44
  },
43
45
  needs_response: { bucket: 'judgment', reason: 'a maintainer is waiting on your reply' },
44
46
  };
47
+ /**
48
+ * Languages whose test suites the headless allowlist can actually run: it
49
+ * grants node, pnpm and npm and nothing else (OVERNIGHT_ALLOWED_TOOLS). A
50
+ * preparer on a Rust or Python repo can diagnose but never reach "Verify", so
51
+ * two nights of that ended blocked (#1697). Repos with a known primary
52
+ * language outside this set go to judgment instead of burning a preparer;
53
+ * a repo whose language is unknown (never scored) is given the benefit of
54
+ * the doubt. GitHub's `language` names, case-insensitive.
55
+ */
56
+ export const VERIFIABLE_LANGUAGES = ['javascript', 'typescript'];
57
+ /** Pure: null when the repo's suite can be run, else why not. */
58
+ export function toolchainSkipReason(language) {
59
+ if (!language)
60
+ return null;
61
+ return VERIFIABLE_LANGUAGES.includes(language.toLowerCase())
62
+ ? null
63
+ : `${language} repo: the headless run cannot execute its test suite (node/pnpm/npm only)`;
64
+ }
65
+ /** The tier name the curated list uses for issues John already vetted and wants done. */
66
+ export const IMPLEMENT_TIER = 'Pursue';
67
+ /**
68
+ * Pure: the one list issue to implement tonight, or null. First Pursue item
69
+ * (list order is the user's priority order) whose repo has no open PR of the
70
+ * user's (one PR per repo at a time keeps maintainers' review load sane and
71
+ * respects repos with a one-open-PR rule) and that no earlier run attempted.
72
+ */
73
+ export function pickImplementCandidate(items, openPRs, attempts, listPath, languageOf = () => undefined) {
74
+ const busyRepos = new Set(openPRs.map((p) => p.repo.toLowerCase()));
75
+ const tried = new Set(attempts.map((a) => a.url));
76
+ for (const it of items) {
77
+ if (it.tier !== IMPLEMENT_TIER)
78
+ continue;
79
+ if (tried.has(it.url))
80
+ continue;
81
+ if (busyRepos.has(it.repo.toLowerCase()))
82
+ continue;
83
+ if (toolchainSkipReason(languageOf(it.repo)))
84
+ continue;
85
+ return {
86
+ url: it.url,
87
+ repo: it.repo,
88
+ number: it.number,
89
+ title: it.title,
90
+ reason: `${IMPLEMENT_TIER} tier of ${listPath}, no open PR of yours on ${it.repo}`,
91
+ };
92
+ }
93
+ return null;
94
+ }
95
+ /** The curated list's available items, or null when there is no readable list. */
96
+ function loadListItems() {
97
+ const located = detectIssueListPath();
98
+ if (!located)
99
+ return null;
100
+ try {
101
+ return { items: parseIssueList(fs.readFileSync(located.path, 'utf8')).available, path: located.path };
102
+ }
103
+ catch (err) {
104
+ warn(MODULE, `Could not read the issue list at ${located.path}: ${errorMessage(err)}`);
105
+ return null;
106
+ }
107
+ }
45
108
  /** Pure: split the daily check into prepare vs judgment items. */
46
- export function bucketize(daily) {
109
+ export function bucketize(daily, languageOf = () => undefined) {
47
110
  const prepare = [];
48
111
  const judgment = [];
49
112
  for (const issue of daily.actionableIssues) {
50
113
  const rule = BUCKET_BY_TYPE[issue.type];
51
- (rule.bucket === 'prepare' ? prepare : judgment).push({
114
+ // A CI fix needs the suite to run; a rebase or a requested edit can still
115
+ // be prepared and verified by hand in the morning.
116
+ const parsed = issue.type === 'ci_failing' ? parseGitHubUrl(issue.prUrl) : null;
117
+ const noToolchain = parsed ? toolchainSkipReason(languageOf(`${parsed.owner}/${parsed.repo}`)) : null;
118
+ (rule.bucket === 'prepare' && !noToolchain ? prepare : judgment).push({
52
119
  url: issue.prUrl,
53
120
  type: issue.type,
54
121
  label: issue.label,
55
- reason: rule.reason,
122
+ reason: noToolchain ? `${noToolchain}; rerun or fix it from a machine that can` : rule.reason,
56
123
  });
57
124
  }
58
125
  for (const c of daily.commentedIssues) {
@@ -105,6 +172,12 @@ export function renderReport(out, prepared = []) {
105
172
  lines.push(`Run at ${out.runAt}. Nothing was pushed, posted, or merged.`, '');
106
173
  lines.push(`Attention: ${out.attention.needsAttention} need attention, ${out.attention.stuckCI} stuck CI, ${out.attention.dormantFollowup} dormant, ${out.attention.waiting} waiting.`, '');
107
174
  lines.push(renderPreparedSection(prepared));
175
+ lines.push(`## Implement tonight (${out.implement ? 1 : 0})`, '');
176
+ if (out.implement)
177
+ lines.push(`- ${out.implement.repo}#${out.implement.number} ${out.implement.url} — ${out.implement.reason}`);
178
+ else
179
+ lines.push('_No list issue queued: the Pursue tier is empty, exhausted, or every repo has an open PR of yours._');
180
+ lines.push('');
108
181
  lines.push(`## Queued for preparation (${out.prepare.length})`, '');
109
182
  if (out.prepare.length === 0)
110
183
  lines.push('_Nothing to prepare._');
@@ -140,11 +213,21 @@ export async function runOvernight() {
140
213
  const daily = await executeDailyCheck(requireGitHubToken());
141
214
  const now = new Date();
142
215
  const runAt = now.toISOString();
143
- const { prepare, judgment } = bucketize(daily);
216
+ const languageOf = (repo) => sm.getRepoScore(repo)?.language;
217
+ const { prepare, judgment } = bucketize(daily, languageOf);
218
+ const previous = sm.getLastOvernight();
219
+ const list = loadListItems();
220
+ // Attempts survive across runs; the ones whose issue left the list are
221
+ // dropped so a re-added issue can be tried again.
222
+ const attempts = (previous?.implementAttempts ?? []).filter((a) => !list || list.items.some((i) => i.url === a.url));
223
+ const implement = list
224
+ ? pickImplementCandidate(list.items, daily.digest.openPRs, attempts, list.path, languageOf)
225
+ : null;
144
226
  const body = {
145
227
  runAt,
146
228
  prepare,
147
229
  judgment,
230
+ implement,
148
231
  attention: daily.attention,
149
232
  failures: daily.failures,
150
233
  warnings: daily.warnings,
@@ -152,7 +235,6 @@ export async function runOvernight() {
152
235
  const reportPath = reportPathFor(now);
153
236
  // A re-run on the same date (launchd retry, manual) must not drop branches
154
237
  // already recorded: they are still on disk, so keep them in state and report.
155
- const previous = sm.getLastOvernight();
156
238
  const carried = previous?.reportPath === reportPath ? previous.prepared : [];
157
239
  fs.writeFileSync(reportPath, renderReport(body, carried), { mode: 0o600 });
158
240
  publishReport(sm, reportPath);
@@ -162,6 +244,8 @@ export async function runOvernight() {
162
244
  prepareCount: prepare.length,
163
245
  judgmentCount: judgment.length,
164
246
  prepared: carried,
247
+ ...(implement ? { implementUrl: implement.url } : {}),
248
+ implementAttempts: attempts,
165
249
  });
166
250
  // executeDailyCheck already checkpointed the Gist; this write came after it,
167
251
  // and in Gist mode setLastOvernight only reaches the local cache (#1629 class).
@@ -174,6 +258,28 @@ export async function runOvernight() {
174
258
  ...(daily.pendingLearnings ? { pendingLearnings: daily.pendingLearnings } : {}),
175
259
  };
176
260
  }
261
+ /**
262
+ * `overnight implement-blocked` (#1715): the preparer could not produce a
263
+ * branch for tonight's list issue. Remember that so the next run picks the
264
+ * next Pursue item instead of retrying this one every night; the note lands
265
+ * in the report's Blocked section like any other blocked item.
266
+ */
267
+ export async function runOvernightImplementBlocked(options) {
268
+ const sm = getStateManager();
269
+ const last = sm.getLastOvernight();
270
+ if (!last)
271
+ throw new Error('No overnight run recorded yet; run `overnight` first.');
272
+ if (options.url !== last.implementUrl) {
273
+ throw new Error(`${options.url} is not tonight's implement item (${last.implementUrl ?? 'none queued'})`);
274
+ }
275
+ const implementAttempts = [
276
+ ...(last.implementAttempts ?? []),
277
+ { url: options.url, attemptedAt: new Date().toISOString(), outcome: 'blocked', note: options.note },
278
+ ];
279
+ sm.setLastOvernight({ ...last, implementAttempts });
280
+ const gistSyncWarning = await maybeCheckpoint(sm, MODULE);
281
+ return { url: options.url, attemptCount: implementAttempts.length, ...(gistSyncWarning ? { gistSyncWarning } : {}) };
282
+ }
177
283
  /** Append one prepared branch to state and to the report of the latest run. */
178
284
  export async function runOvernightRecord(options) {
179
285
  const sm = getStateManager();
@@ -188,7 +294,15 @@ export async function runOvernightRecord(options) {
188
294
  recordedAt: new Date().toISOString(),
189
295
  };
190
296
  const prepared = [...last.prepared, entry];
191
- sm.setLastOvernight({ ...last, prepared });
297
+ // Recording the branch for tonight's list issue is what marks the attempt
298
+ // as prepared, so the next run moves on to the next Pursue item.
299
+ const implementAttempts = options.url === last.implementUrl
300
+ ? [
301
+ ...(last.implementAttempts ?? []),
302
+ { url: options.url, attemptedAt: entry.recordedAt, outcome: 'prepared' },
303
+ ]
304
+ : last.implementAttempts;
305
+ sm.setLastOvernight({ ...last, prepared, implementAttempts });
192
306
  const { reportRecreated } = writePreparedSection(last.reportPath, prepared);
193
307
  publishReport(sm, last.reportPath);
194
308
  const gistSyncWarning = await maybeCheckpoint(sm, MODULE);
@@ -361,17 +475,34 @@ export const OVERNIGHT_ALLOWED_TOOLS = [
361
475
  function xmlEscape(s) {
362
476
  return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
363
477
  }
478
+ /**
479
+ * The settings layer the scheduled job runs with instead of the user's own
480
+ * (#1697). Permission allow rules union across settings layers, and a user
481
+ * whose day-to-day settings allow bare `Bash` would otherwise void the
482
+ * enumerated allowlist entirely: only the deny list would apply. So the job
483
+ * drops user, project and local settings (`--setting-sources ""`) and gets
484
+ * this file, which carries only what it needs from them: the plugin itself.
485
+ */
486
+ export function renderOvernightSettings() {
487
+ return `${JSON.stringify({ enabledPlugins: { 'oss-autopilot@oss-autopilot': true } }, null, 2)}\n`;
488
+ }
364
489
  /** Pure: the launchd plist that runs `/oss-overnight` headlessly. */
365
- export function renderLaunchdPlist(options, logPath) {
490
+ export function renderLaunchdPlist(options, logPath, settingsPath) {
366
491
  // Headless `-p` starts in manual permission mode, where any unapproved tool
367
492
  // call fails (nobody can answer). `dontAsk` + the enumerated allowlist above
368
- // is the documented unattended shape and the enforcement half of the gate.
493
+ // is the documented unattended shape and the enforcement half of the gate,
494
+ // and only holds with the user's own settings out of the picture (see
495
+ // renderOvernightSettings).
369
496
  const args = [
370
497
  options.claudePath,
371
498
  '-p',
372
499
  '/oss-overnight',
373
500
  '--permission-mode',
374
501
  'dontAsk',
502
+ '--setting-sources',
503
+ '',
504
+ '--settings',
505
+ settingsPath,
375
506
  '--allowedTools',
376
507
  OVERNIGHT_ALLOWED_TOOLS,
377
508
  '--disallowedTools',
@@ -430,14 +561,18 @@ export function runOvernightSchedule(options) {
430
561
  const claudePath = resolveClaudePath(options.claudePath);
431
562
  const plistPath = path.join(os.homedir(), 'Library', 'LaunchAgents', `${LAUNCHD_LABEL}.plist`);
432
563
  const logPath = path.join(getReportsDir(), 'overnight-launchd.log');
433
- const plist = renderLaunchdPlist({ hour: options.hour, claudePath }, logPath);
564
+ const settingsPath = path.join(getReportsDir(), 'overnight-settings.json');
565
+ const plist = renderLaunchdPlist({ hour: options.hour, claudePath }, logPath, settingsPath);
434
566
  if (options.install) {
435
567
  fs.mkdirSync(path.dirname(plistPath), { recursive: true });
436
568
  fs.writeFileSync(plistPath, plist, { mode: 0o644 });
569
+ fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
570
+ fs.writeFileSync(settingsPath, renderOvernightSettings(), { mode: 0o600 });
437
571
  }
438
572
  return {
439
573
  plist,
440
574
  plistPath,
575
+ settingsPath,
441
576
  installed: options.install,
442
577
  loadCommand: `launchctl bootout gui/$(id -u) ${plistPath} 2>/dev/null; launchctl bootstrap gui/$(id -u) ${plistPath}`,
443
578
  };
@@ -66,7 +66,7 @@ export async function runSetup(options) {
66
66
  break;
67
67
  }
68
68
  case 'maxActivePRs': {
69
- const maxPRs = parsePositiveInt(value, 'maxActivePRs');
69
+ const maxPRs = parseNonNegativeInt(value, 'maxActivePRs');
70
70
  stateManager.updateConfig({ maxActivePRs: maxPRs });
71
71
  results[key] = String(maxPRs);
72
72
  break;
@@ -27,9 +27,9 @@ export const CONFIG_KEY_REGISTRY = [
27
27
  // ── Capacity / dormancy ──────────────────────────────────────────────
28
28
  {
29
29
  key: 'maxActivePRs',
30
- description: 'Soft cap on how many active PRs you want to juggle at once.',
30
+ description: 'Soft cap on how many active PRs you want to juggle at once. 0 disables the cap.',
31
31
  settableVia: 'setup',
32
- valueHint: 'positive integer',
32
+ valueHint: 'non-negative integer (0 = no limit)',
33
33
  },
34
34
  {
35
35
  key: 'dormantDays',
@@ -232,15 +232,19 @@ export function computeRepoSignals(prs) {
232
232
  export function assessCapacity(activePRs, maxActivePRs, shelvedPRCount) {
233
233
  const activePRCount = activePRs.length;
234
234
  const criticalIssueCount = activePRs.filter((pr) => pr.status === 'needs_addressing' && pr.actionReason && CRITICAL_ACTION_REASONS.has(pr.actionReason)).length;
235
- // Has capacity if: under PR limit AND no critical issues
236
- const underPRLimit = activePRCount < maxActivePRs;
235
+ // Has capacity if: under PR limit AND no critical issues. A limit of 0 means no limit.
236
+ const unlimited = maxActivePRs <= 0;
237
+ const underPRLimit = unlimited || activePRCount < maxActivePRs;
237
238
  const noCriticalIssues = criticalIssueCount === 0;
238
239
  const hasCapacity = underPRLimit && noCriticalIssues;
239
240
  // Generate reason
240
241
  let reason;
241
242
  const shelvedNote = shelvedPRCount > 0 ? ` + ${shelvedPRCount} shelved` : '';
243
+ const countLabel = unlimited
244
+ ? `${activePRCount} active PRs (no limit)`
245
+ : `${activePRCount}/${maxActivePRs} active PRs`;
242
246
  if (hasCapacity) {
243
- reason = `You have capacity: ${activePRCount}/${maxActivePRs} active PRs${shelvedNote}, no critical issues`;
247
+ reason = `You have capacity: ${countLabel}${shelvedNote}, no critical issues`;
244
248
  }
245
249
  else {
246
250
  const reasons = [];
@@ -437,7 +441,7 @@ export function computeActionMenu(actionableIssues, capacity, commentedIssues =
437
441
  description: 'Look for new contribution opportunities',
438
442
  };
439
443
  if (!capacity.hasCapacity) {
440
- const atLimit = capacity.activePRCount >= capacity.maxActivePRs;
444
+ const atLimit = capacity.maxActivePRs > 0 && capacity.activePRCount >= capacity.maxActivePRs;
441
445
  const hasCritical = capacity.criticalIssueCount > 0;
442
446
  if (atLimit && hasCritical) {
443
447
  searchItem.capacityWarning = `You're at ${capacity.activePRCount}/${capacity.maxActivePRs} active PRs and have ${capacity.criticalIssueCount} critical issue(s). Resolve existing work before claiming new issues.`;
@@ -437,6 +437,20 @@ export declare const OvernightPreparedSchema: z.ZodObject<{
437
437
  pushProblem: z.ZodOptional<z.ZodString>;
438
438
  }, z.core.$strip>;
439
439
  /** The latest overnight run (#1574); `startup` surfaces its freshness. */
440
+ /**
441
+ * One list issue the overnight run tried to implement (#1715). Kept across
442
+ * runs so a blocked issue is not retried every night; cleared when the
443
+ * issue leaves the list.
444
+ */
445
+ export declare const OvernightImplementAttemptSchema: z.ZodObject<{
446
+ url: z.ZodString;
447
+ attemptedAt: z.ZodString;
448
+ outcome: z.ZodEnum<{
449
+ blocked: "blocked";
450
+ prepared: "prepared";
451
+ }>;
452
+ note: z.ZodOptional<z.ZodString>;
453
+ }, z.core.$strip>;
440
454
  export declare const OvernightRecordSchema: z.ZodObject<{
441
455
  runAt: z.ZodString;
442
456
  reportPath: z.ZodString;
@@ -453,6 +467,16 @@ export declare const OvernightRecordSchema: z.ZodObject<{
453
467
  compareUrl: z.ZodOptional<z.ZodString>;
454
468
  pushProblem: z.ZodOptional<z.ZodString>;
455
469
  }, z.core.$strip>>>;
470
+ implementUrl: z.ZodOptional<z.ZodString>;
471
+ implementAttempts: z.ZodOptional<z.ZodArray<z.ZodObject<{
472
+ url: z.ZodString;
473
+ attemptedAt: z.ZodString;
474
+ outcome: z.ZodEnum<{
475
+ blocked: "blocked";
476
+ prepared: "prepared";
477
+ }>;
478
+ note: z.ZodOptional<z.ZodString>;
479
+ }, z.core.$strip>>>;
456
480
  }, z.core.$strip>;
457
481
  /**
458
482
  * Mirrors oss-scout's `searchRotation`: the broad-phase language cursor, the
@@ -735,6 +759,16 @@ export declare const AgentStateSchema: z.ZodObject<{
735
759
  compareUrl: z.ZodOptional<z.ZodString>;
736
760
  pushProblem: z.ZodOptional<z.ZodString>;
737
761
  }, z.core.$strip>>>;
762
+ implementUrl: z.ZodOptional<z.ZodString>;
763
+ implementAttempts: z.ZodOptional<z.ZodArray<z.ZodObject<{
764
+ url: z.ZodString;
765
+ attemptedAt: z.ZodString;
766
+ outcome: z.ZodEnum<{
767
+ blocked: "blocked";
768
+ prepared: "prepared";
769
+ }>;
770
+ note: z.ZodOptional<z.ZodString>;
771
+ }, z.core.$strip>>>;
738
772
  }, z.core.$strip>>;
739
773
  searchRotation: z.ZodOptional<z.ZodObject<{
740
774
  languageOffset: z.ZodDefault<z.ZodNumber>;
@@ -753,6 +787,7 @@ export type DiffTool = z.infer<typeof DiffToolSchema>;
753
787
  export type SearchSeenEntry = z.infer<typeof SearchSeenEntrySchema>;
754
788
  export type OvernightPrepared = z.infer<typeof OvernightPreparedSchema>;
755
789
  export type OvernightRecord = z.infer<typeof OvernightRecordSchema>;
790
+ export type OvernightImplementAttempt = z.infer<typeof OvernightImplementAttemptSchema>;
756
791
  export type SearchRotation = z.infer<typeof SearchRotationSchema>;
757
792
  export type RepoSignals = z.infer<typeof RepoSignalsSchema>;
758
793
  export type RepoScore = z.infer<typeof RepoScoreSchema>;
@@ -400,12 +400,26 @@ export const OvernightPreparedSchema = z.object({
400
400
  pushProblem: z.string().optional(),
401
401
  });
402
402
  /** The latest overnight run (#1574); `startup` surfaces its freshness. */
403
+ /**
404
+ * One list issue the overnight run tried to implement (#1715). Kept across
405
+ * runs so a blocked issue is not retried every night; cleared when the
406
+ * issue leaves the list.
407
+ */
408
+ export const OvernightImplementAttemptSchema = z.object({
409
+ url: z.string(),
410
+ attemptedAt: z.string(),
411
+ outcome: z.enum(['prepared', 'blocked']),
412
+ note: z.string().optional(),
413
+ });
403
414
  export const OvernightRecordSchema = z.object({
404
415
  runAt: z.string(),
405
416
  reportPath: z.string(),
406
417
  prepareCount: z.number().int().nonnegative(),
407
418
  judgmentCount: z.number().int().nonnegative(),
408
419
  prepared: z.array(OvernightPreparedSchema).default([]),
420
+ /** The one curated-list issue picked for implementation this run, if any (#1715). */
421
+ implementUrl: z.string().optional(),
422
+ implementAttempts: z.array(OvernightImplementAttemptSchema).optional(),
409
423
  });
410
424
  /**
411
425
  * Mirrors oss-scout's `searchRotation`: the broad-phase language cursor, the
@@ -2,7 +2,7 @@
2
2
  * Core types for the Open Source Contribution Agent
3
3
  */
4
4
  import type { FetchedPRStatus, RepoSignals, TrackedIssue, IssueVettingResult, IssueScope, DiffTool, AgentConfig, AgentState } from './state-schema.js';
5
- export type { IssueStatus, FetchedPRStatus, ProjectCategory, IssueScope, DiffTool, RepoSignals, RepoScore, StoredMergedPR, StoredClosedPR, AnalyzedIssueConversation, ContributionGuidelines, IssueVettingResult, TrackedIssue, ShelvedPRRef, StatusOverride, AgentConfig, LocalRepoCache, ClosedPR, MergedPR, DailyDigest, AgentState, SearchSeenEntry, OvernightPrepared, OvernightRecord, SearchRotation, } from './state-schema.js';
5
+ export type { IssueStatus, FetchedPRStatus, ProjectCategory, IssueScope, DiffTool, RepoSignals, RepoScore, StoredMergedPR, StoredClosedPR, AnalyzedIssueConversation, ContributionGuidelines, IssueVettingResult, TrackedIssue, ShelvedPRRef, StatusOverride, AgentConfig, LocalRepoCache, ClosedPR, MergedPR, DailyDigest, AgentState, SearchSeenEntry, OvernightPrepared, OvernightRecord, OvernightImplementAttempt, SearchRotation, } from './state-schema.js';
6
6
  /** CI pipeline status for a PR's latest commit. */
7
7
  export type CIStatus = 'passing' | 'failing' | 'pending' | 'unknown';
8
8
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oss-autopilot/core",
3
- "version": "3.25.1",
3
+ "version": "3.27.0",
4
4
  "description": "CLI and core library for managing open source contributions",
5
5
  "type": "module",
6
6
  "bin": {