@oss-autopilot/core 3.22.3 → 3.24.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.
@@ -13,11 +13,14 @@
13
13
  * the launchd plist that runs the plugin command headlessly.
14
14
  *
15
15
  * Hard gate: nothing in this module pushes, posts, or merges. That gate is the
16
- * feature, not a limitation.
16
+ * feature, not a limitation. The one deliberate exception, `overnight
17
+ * push-prep` (#1698), lives in `overnight-push-prep.ts` and is never run by
18
+ * the model: a scheduler runs it after the tick, and it only pushes to
19
+ * `prep/*` on the user's own fork.
17
20
  */
18
21
  import type { PRCheckFailure } from '../core/pr-monitor.js';
19
22
  import type { ActionableIssueType, OvernightPrepared } from '../core/types.js';
20
- import type { DailyOutput, DailyWarning } from '../formatters/json.js';
23
+ import type { DailyOutput, DailyWarning, PendingLearnings } from '../formatters/json.js';
21
24
  import type { AttentionSummary } from '../core/pr-attention.js';
22
25
  /** One item in either bucket; which bucket is the array it lives in. */
23
26
  export interface OvernightItem {
@@ -41,6 +44,8 @@ export interface OvernightOutput {
41
44
  carriedPrepared: number;
42
45
  /** Set when the run could not be pushed to the Gist; the local cache has it. */
43
46
  gistSyncWarning?: string;
47
+ /** Repos whose merged-PR learnings the overnight run should extract (#1696); absent when none. */
48
+ pendingLearnings?: PendingLearnings;
44
49
  }
45
50
  type ReportBody = Pick<OvernightOutput, 'runAt' | 'prepare' | 'judgment' | 'attention' | 'failures' | 'warnings'>;
46
51
  /** Freshness block `startup` surfaces (#1574). */
@@ -62,6 +67,15 @@ export declare function bucketize(daily: Pick<DailyOutput, 'actionableIssues' |
62
67
  };
63
68
  /** Pure: the "Prepared branches" section; `record` rewrites just this part. */
64
69
  export declare function renderPreparedSection(prepared: OvernightPrepared[]): string;
70
+ /**
71
+ * Rewrite the "Prepared branches" section of `reportPath` from `prepared`
72
+ * (state is the source of truth for the list, so the heading count stays
73
+ * right). A report someone deleted is recreated with just this section
74
+ * rather than failing the caller; `reportRecreated` says so.
75
+ */
76
+ export declare function writePreparedSection(reportPath: string, prepared: OvernightPrepared[]): {
77
+ reportRecreated: boolean;
78
+ };
65
79
  /** Pure: the morning report. Prepared branches are appended by `record`. */
66
80
  export declare function renderReport(out: ReportBody, prepared?: OvernightPrepared[]): string;
67
81
  /** Local calendar date: the job fires at a local hour, so the report is filed under the local day. */
@@ -13,7 +13,10 @@
13
13
  * the launchd plist that runs the plugin command headlessly.
14
14
  *
15
15
  * Hard gate: nothing in this module pushes, posts, or merges. That gate is the
16
- * feature, not a limitation.
16
+ * feature, not a limitation. The one deliberate exception, `overnight
17
+ * push-prep` (#1698), lives in `overnight-push-prep.ts` and is never run by
18
+ * the model: a scheduler runs it after the tick, and it only pushes to
19
+ * `prep/*` on the user's own fork.
17
20
  */
18
21
  import * as fs from 'node:fs';
19
22
  import * as os from 'node:os';
@@ -64,11 +67,30 @@ export function renderPreparedSection(prepared) {
64
67
  if (prepared.length === 0)
65
68
  lines.push('_None recorded yet._');
66
69
  for (const p of prepared) {
67
- lines.push(`- ${p.url} — branch \`${p.branch}\`${p.worktree ? ` at ${p.worktree}` : ''}${p.note ? `: ${p.note}` : ''}`);
70
+ const pushed = p.pushedRef
71
+ ? ` (pushed to \`${p.pushedRef}\`${p.compareUrl ? `, compare ${p.compareUrl}` : ''})`
72
+ : p.pushProblem
73
+ ? ` (NOT pushed: ${p.pushProblem})`
74
+ : '';
75
+ lines.push(`- ${p.url} — branch \`${p.branch}\`${p.worktree ? ` at ${p.worktree}` : ''}${pushed}${p.note ? `: ${p.note}` : ''}`);
68
76
  }
69
77
  lines.push('');
70
78
  return lines.join('\n');
71
79
  }
80
+ /**
81
+ * Rewrite the "Prepared branches" section of `reportPath` from `prepared`
82
+ * (state is the source of truth for the list, so the heading count stays
83
+ * right). A report someone deleted is recreated with just this section
84
+ * rather than failing the caller; `reportRecreated` says so.
85
+ */
86
+ export function writePreparedSection(reportPath, prepared) {
87
+ const reportExists = fs.existsSync(reportPath);
88
+ if (!reportExists)
89
+ warn(MODULE, `Report ${reportPath} is missing; recreating it with only the prepared section`);
90
+ const reportBody = reportExists ? fs.readFileSync(reportPath, 'utf8') : '';
91
+ fs.writeFileSync(reportPath, replacePreparedSection(reportBody, renderPreparedSection(prepared)), { mode: 0o600 });
92
+ return { reportRecreated: !reportExists };
93
+ }
72
94
  /** Pure: the morning report. Prepared branches are appended by `record`. */
73
95
  export function renderReport(out, prepared = []) {
74
96
  const lines = [];
@@ -136,7 +158,13 @@ export async function runOvernight() {
136
158
  // executeDailyCheck already checkpointed the Gist; this write came after it,
137
159
  // and in Gist mode setLastOvernight only reaches the local cache (#1629 class).
138
160
  const gistSyncWarning = await maybeCheckpoint(sm, MODULE);
139
- return { ...body, reportPath, carriedPrepared: carried.length, ...(gistSyncWarning ? { gistSyncWarning } : {}) };
161
+ return {
162
+ ...body,
163
+ reportPath,
164
+ carriedPrepared: carried.length,
165
+ ...(gistSyncWarning ? { gistSyncWarning } : {}),
166
+ ...(daily.pendingLearnings ? { pendingLearnings: daily.pendingLearnings } : {}),
167
+ };
140
168
  }
141
169
  /** Append one prepared branch to state and to the report of the latest run. */
142
170
  export async function runOvernightRecord(options) {
@@ -153,21 +181,12 @@ export async function runOvernightRecord(options) {
153
181
  };
154
182
  const prepared = [...last.prepared, entry];
155
183
  sm.setLastOvernight({ ...last, prepared });
156
- // Rewrite the section in place (state is the source of truth for the
157
- // list) so its heading count stays right; a report someone deleted is
158
- // recreated with just this section rather than failing the record.
159
- const reportExists = fs.existsSync(last.reportPath);
160
- if (!reportExists)
161
- warn(MODULE, `Report ${last.reportPath} is missing; recreating it with only the prepared section`);
162
- const reportBody = reportExists ? fs.readFileSync(last.reportPath, 'utf8') : '';
163
- fs.writeFileSync(last.reportPath, replacePreparedSection(reportBody, renderPreparedSection(prepared)), {
164
- mode: 0o600,
165
- });
184
+ const { reportRecreated } = writePreparedSection(last.reportPath, prepared);
166
185
  const gistSyncWarning = await maybeCheckpoint(sm, MODULE);
167
186
  return {
168
187
  reportPath: last.reportPath,
169
188
  preparedCount: prepared.length,
170
- ...(reportExists ? {} : { reportRecreated: true }),
189
+ ...(reportRecreated ? { reportRecreated: true } : {}),
171
190
  ...(gistSyncWarning ? { gistSyncWarning } : {}),
172
191
  };
173
192
  }
@@ -3,7 +3,8 @@
3
3
  * Maps state fields and creates scout instances for search/vet commands.
4
4
  */
5
5
  import { createScout } from '@oss-scout/core';
6
- import { getStateManager, isLinkedPRStalled, requireGitHubToken } from '../core/index.js';
6
+ import { getStateManager, isLinkedPRStalled, parseGitHubUrl, requireGitHubToken } from '../core/index.js';
7
+ import { SearchRotationSchema } from '../core/state-schema.js';
7
8
  import { computeStrategy } from '../core/strategy.js';
8
9
  import { loadSkippedIssuesDetailed } from './skip-file-parser.js';
9
10
  /**
@@ -87,6 +88,27 @@ export function buildScoutState(diagnostics) {
87
88
  if ((skippedIssuesLoad.readError !== undefined || skippedIssuesLoad.notFound) && diagnostics) {
88
89
  diagnostics.skipListUnavailable = true;
89
90
  }
91
+ // Dismissed issues (`/oss dismiss`, dashboard) count as skipped for scout too.
92
+ // Without this, scout's own recently-surfaced window (7 days) was the only
93
+ // thing keeping a dismissed issue out of `search`, so it came back once the
94
+ // window lapsed. `undismiss` deletes the map entry, so only current
95
+ // dismissals are merged. Scout filters by URL alone; repo/number are
96
+ // best-effort from the URL and title is unknown, same as the skip file.
97
+ const skippedIssues = [...skippedIssuesLoad.issues];
98
+ const skippedUrls = new Set(skippedIssues.map((s) => s.url));
99
+ for (const [url, dismissedAt] of Object.entries(config.dismissedIssues ?? {})) {
100
+ if (skippedUrls.has(url))
101
+ continue;
102
+ const parsed = parseGitHubUrl(url);
103
+ skippedIssues.push({
104
+ url,
105
+ repo: parsed ? `${parsed.owner}/${parsed.repo}` : '',
106
+ number: parsed?.number ?? 0,
107
+ title: '',
108
+ skippedAt: dismissedAt,
109
+ reason: 'dismissed',
110
+ });
111
+ }
90
112
  // Strategy-derived personalization (#1464). `computeStrategy` returns null
91
113
  // below the merged-PR floor — empty lists then read as "no bias" on scout's
92
114
  // side. Baking the bias into the preferences (rather than only per-call
@@ -112,8 +134,15 @@ export function buildScoutState(diagnostics) {
112
134
  maxIssueAgeDays: config.maxIssueAgeDays,
113
135
  includeDocIssues: config.includeDocIssues,
114
136
  minRepoScoreThreshold: config.minRepoScoreThreshold,
115
- interPhaseDelayMs: 30_000,
116
- broadPhaseDelayMs: 90_000,
137
+ // No inter-phase or broad-phase cooldown. Scout's broad phase runs on
138
+ // GraphQL now (its schema default for broadPhaseDelayMs is 0), and the
139
+ // 30s/90s pins formerly here cost ~2 minutes per search. Both must be
140
+ // passed explicitly: scout does not schema-parse a provided initialState,
141
+ // so an omitted field falls through to its hard-coded 30s/90s fallbacks.
142
+ // OSS_AUTOPILOT_SCOUT_{INTER,BROAD}_PHASE_DELAY_MS (search.ts) override
143
+ // per call for hosts that need spacing.
144
+ interPhaseDelayMs: 0,
145
+ broadPhaseDelayMs: 0,
117
146
  skipBroadWhenSufficientResults: config.skipBroadWhenSufficientResults,
118
147
  persistence: config.persistence,
119
148
  slmTriageModel: config.slmTriageModel,
@@ -196,14 +225,15 @@ export function buildScoutState(diagnostics) {
196
225
  lastSeenAt: s.lastSeenAt,
197
226
  lastScore: 0,
198
227
  })),
199
- skippedIssues: skippedIssuesLoad.issues,
228
+ skippedIssues,
200
229
  lastRunAt: state.lastRunAt,
201
- // Broad-phase language rotation cursor (#1630). Scout advances it in its
202
- // own state after a search whose broad phase ran; under
230
+ // Scout's rotation cursors (#1630): the broad-phase language cursor, the
231
+ // capped phases' repo windows, and the round-robin strategy cursor. Scout
232
+ // advances them in its own state after a search; under
203
233
  // persistence:'provided' that write is discarded with the process, so
204
234
  // search.ts copies it back into AgentState and it is fed in from there.
205
- // Scout's documented default (offset 0) applies until the first search.
206
- searchRotation: state.searchRotation ?? { languageOffset: 0 },
235
+ // The schema defaults (all offsets 0) apply until the first search.
236
+ searchRotation: state.searchRotation ?? SearchRotationSchema.parse({}),
207
237
  };
208
238
  }
209
239
  /**
@@ -5,7 +5,7 @@
5
5
  import { adaptScoutLinkedPR, buildCandidateLinkedPR, createAutopilotScout, SEARCH_DIVERSITY_RATIO, } from './scout-bridge.js';
6
6
  import { SearchStrategySchema } from '@oss-scout/core';
7
7
  import { classifyLinkedPR, getStateManager, maybeCheckpoint } from '../core/index.js';
8
- import { gradeFromCandidate } from '../core/issue-grading.js';
8
+ import { gradeFromCandidate, reconcileRecommendation } from '../core/issue-grading.js';
9
9
  import { computeStrategy } from '../core/strategy.js';
10
10
  import { refreshStarredReposIfStale } from '../core/starred-repos.js';
11
11
  import { debug, warn } from '../core/logger.js';
@@ -92,17 +92,16 @@ function sanitizeViabilityScore(raw) {
92
92
  /**
93
93
  * Read a non-negative integer scout-delay override from an env var.
94
94
  *
95
- * Scout spaces its multi-phase `/search/issues` calls with an inter-phase
96
- * delay (default 30s) and a broad-phase delay (default 90s) to stay under
97
- * GitHub's secondary rate limit (see `buildScoutState`). Those delays make a
98
- * single `search` invocation take ~100s, which is fine in normal use but makes
99
- * the live-API e2e suite (`search.e2e.test.ts`, run only in the nightly
100
- * workflow — see #1452) impractically slow. These env vars let that suite
101
- * collapse the delays so the test completes in a realistic CI window.
95
+ * Scout can space its multi-phase `/search/issues` calls with an inter-phase
96
+ * delay and a broad-phase delay to stay under GitHub's secondary rate limit.
97
+ * `buildScoutState` sets both to 0 (the broad phase runs on GraphQL now), so
98
+ * these env vars are the knob for hosts that still need spacing, including
99
+ * the live-API e2e suite (`search.e2e.test.ts`, nightly only, see #1452),
100
+ * which restores a modest gap on shared CI runner IPs.
102
101
  *
103
102
  * Returns `undefined` when the var is unset/empty or not a parseable
104
103
  * non-negative integer, so scout falls back to its preference value and
105
- * production behavior is unchanged. Only the live test/nightly run sets them.
104
+ * production behavior is unchanged.
106
105
  */
107
106
  function readScoutDelayOverride(envVar) {
108
107
  const raw = process.env[envVar];
@@ -170,9 +169,8 @@ export async function runSearch(options) {
170
169
  if (preferLanguages?.length || preferRepos?.length) {
171
170
  debug(MODULE, `Applying strategy bias to search: preferLanguages=${JSON.stringify(preferLanguages ?? [])}, preferRepos=${JSON.stringify(preferRepos ?? [])}`);
172
171
  }
173
- // Live-API test/nightly affordance (#1452): collapse scout's inter-phase
174
- // delays so the e2e suite finishes in a realistic window. Unset in normal
175
- // use → undefined → scout falls back to the 30s/90s preference defaults.
172
+ // Per-call delay override (#1452). Unset in normal use → undefined → scout
173
+ // uses the bridge preferences (0/0, see buildScoutState).
176
174
  const interPhaseDelayMs = readScoutDelayOverride('OSS_AUTOPILOT_SCOUT_INTER_PHASE_DELAY_MS');
177
175
  const broadPhaseDelayMs = readScoutDelayOverride('OSS_AUTOPILOT_SCOUT_BROAD_PHASE_DELAY_MS');
178
176
  const result = await scout.search({
@@ -212,23 +210,19 @@ export async function runSearch(options) {
212
210
  const searchOutput = {
213
211
  candidates: visibleCandidates.map((c) => {
214
212
  const repoScoreRecord = stateManager.getRepoScore(c.issue.repo);
215
- // Scout's `search` does not emit per-candidate projectHealth (only
216
- // `vetIssue` does). Pass a sentinel `checkFailed: true` so the grader
217
- // correctly treats scout-side signals as unknown and grades purely from
218
- // the autopilot-tracked repoScore. Candidates without a repoScore
219
- // receive 'F' — that's an honest signal for "we haven't seen this repo
220
- // before" rather than a fabricated score.
221
- //
222
- // Note (#1465): repoScore here is the cached HISTORY score (the user's
223
- // own merge outcomes — docs/repo-scores.md §History score), so this
224
- // grade reflects history only; `vet` later re-grades the same issue
225
- // with freshly fetched repo health and can legitimately disagree.
213
+ // Grade from the health scout fetched while vetting this candidate
214
+ // (#332). Search used to pass a `checkFailed` sentinel and grade from
215
+ // the user's own history alone, so every repo without a merged PR of
216
+ // ours scored the bottom band regardless of how healthy it was, and a
217
+ // grade-1 "approve" looked like a contradiction. `repoScore` is still
218
+ // the cached HISTORY score (#1465); `vet` re-grades with fresh health.
219
+ // Scout always supplies health; the fallback only serves bare fixtures.
226
220
  const grade = gradeFromCandidate({
227
221
  repo: c.issue.repo,
228
- projectHealth: {
222
+ projectHealth: c.projectHealth ?? {
229
223
  repo: c.issue.repo,
230
224
  checkFailed: true,
231
- failureReason: 'health not fetched on the multi-issue search surface',
225
+ failureReason: 'health not supplied by the caller',
232
226
  },
233
227
  getRepoScore: (repo) => {
234
228
  const score = stateManager.getRepoScore(repo);
@@ -251,7 +245,7 @@ export async function runSearch(options) {
251
245
  url: c.issue.url,
252
246
  labels: c.issue.labels,
253
247
  },
254
- recommendation: c.recommendation,
248
+ recommendation: reconcileRecommendation(c.recommendation, grade),
255
249
  reasonsToApprove: c.reasonsToApprove,
256
250
  reasonsToSkip: c.reasonsToSkip,
257
251
  searchPriority: c.searchPriority,
@@ -133,6 +133,15 @@ export async function runSetup(options) {
133
133
  results[key] = value || '(cleared)';
134
134
  break;
135
135
  }
136
+ case 'autoExtractLearnings': {
137
+ if (value !== 'true' && value !== 'false') {
138
+ throw new ValidationError(`Invalid value for autoExtractLearnings: "${value}". Must be "true" or "false".`);
139
+ }
140
+ const enabled = value === 'true';
141
+ stateManager.updateConfig({ autoExtractLearnings: enabled });
142
+ results[key] = String(enabled);
143
+ break;
144
+ }
136
145
  case 'autoFormatBeforePush': {
137
146
  if (value !== 'true' && value !== 'false') {
138
147
  throw new ValidationError(`Invalid value for autoFormatBeforePush: "${value}". Must be "true" or "false".`);
@@ -227,6 +227,12 @@ export const CONFIG_KEY_REGISTRY = [
227
227
  settableVia: 'setup',
228
228
  valueHint: 'one of: local,gist',
229
229
  },
230
+ {
231
+ key: 'autoExtractLearnings',
232
+ description: 'Extract per-repo learnings from freshly merged PRs automatically at /oss startup and overnight (#1696). false restores the extract_learnings action-menu item.',
233
+ settableVia: 'setup',
234
+ valueHint: 'true|false',
235
+ },
230
236
  {
231
237
  key: 'autoFormatBeforePush',
232
238
  description: 'No effect. The hook that used this setting was removed in #1642; the key is kept in the schema for state-file compatibility.',
@@ -41,11 +41,11 @@ export declare const KEEP_GRADE_THRESHOLD = 4;
41
41
  * sees can't flatly contradict. Any non-approve recommendation is returned
42
42
  * unchanged.
43
43
  *
44
- * Apply this ONLY where the grade is high-fidelity — i.e. computed from freshly
45
- * fetched health (the `vet` / `vet-list` surfaces). The `search` and `features`
46
- * surfaces pass a `checkFailed` health sentinel and grade from history alone, so
47
- * any repo we lack history with scores the bottom band for missing data, not for
48
- * being bad; reconciling there would wrongly downgrade well-vetted candidates.
44
+ * Every surface grades from the health scout fetched while vetting (`search`
45
+ * and `features` included since #332), so the grade is high-fidelity
46
+ * everywhere and this applies everywhere. A `checkFailed` health (transient API
47
+ * error) still grades the bottom band for missing data; that downgrade to
48
+ * "needs_review" is the honest answer for an unverified repo.
49
49
  */
50
50
  export declare function reconcileRecommendation(recommendation: IssueRecommendation, grade: GradeResult): IssueRecommendation;
51
51
  /**
@@ -94,11 +94,9 @@ export declare function deriveGradeSignals(params: {
94
94
  * Which "repo score" this grades from (#1465): the `getRepoScore` input is
95
95
  * the cached HISTORY record (the user's own merge outcomes, see
96
96
  * docs/repo-scores.md §History score) — NOT `repo-vet`'s fresh health
97
- * rubric. The fresh side only enters through `projectHealth`, and only when
98
- * scout actually fetched it: the `search` surface passes a `checkFailed`
99
- * sentinel (health not fetched per candidate), so search grades purely from
100
- * history-side signals, while `vet` re-grades with fresh health. Same 1-10
101
- * scale, different inputs — the two surfaces can legitimately disagree.
97
+ * rubric. The fresh side enters through `projectHealth`, which scout fetches
98
+ * per candidate on every surface (#332); `vet` re-fetches it later, so the
99
+ * two surfaces can still disagree when the repo changed in between.
102
100
  */
103
101
  export declare function gradeFromCandidate(params: {
104
102
  repo: string;
@@ -24,11 +24,11 @@ export const KEEP_GRADE_THRESHOLD = 4;
24
24
  * sees can't flatly contradict. Any non-approve recommendation is returned
25
25
  * unchanged.
26
26
  *
27
- * Apply this ONLY where the grade is high-fidelity — i.e. computed from freshly
28
- * fetched health (the `vet` / `vet-list` surfaces). The `search` and `features`
29
- * surfaces pass a `checkFailed` health sentinel and grade from history alone, so
30
- * any repo we lack history with scores the bottom band for missing data, not for
31
- * being bad; reconciling there would wrongly downgrade well-vetted candidates.
27
+ * Every surface grades from the health scout fetched while vetting (`search`
28
+ * and `features` included since #332), so the grade is high-fidelity
29
+ * everywhere and this applies everywhere. A `checkFailed` health (transient API
30
+ * error) still grades the bottom band for missing data; that downgrade to
31
+ * "needs_review" is the honest answer for an unverified repo.
32
32
  */
33
33
  export function reconcileRecommendation(recommendation, grade) {
34
34
  return recommendation === 'approve' && grade.score < KEEP_GRADE_THRESHOLD ? 'needs_review' : recommendation;
@@ -135,11 +135,9 @@ export function deriveGradeSignals(params) {
135
135
  * Which "repo score" this grades from (#1465): the `getRepoScore` input is
136
136
  * the cached HISTORY record (the user's own merge outcomes, see
137
137
  * docs/repo-scores.md §History score) — NOT `repo-vet`'s fresh health
138
- * rubric. The fresh side only enters through `projectHealth`, and only when
139
- * scout actually fetched it: the `search` surface passes a `checkFailed`
140
- * sentinel (health not fetched per candidate), so search grades purely from
141
- * history-side signals, while `vet` re-grades with fresh health. Same 1-10
142
- * scale, different inputs — the two surfaces can legitimately disagree.
138
+ * rubric. The fresh side enters through `projectHealth`, which scout fetches
139
+ * per candidate on every surface (#332); `vet` re-fetches it later, so the
140
+ * two surfaces can still disagree when the repo changed in between.
143
141
  */
144
142
  export function gradeFromCandidate(params) {
145
143
  const repoScore = params.getRepoScore(params.repo);
@@ -297,6 +297,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
297
297
  vscode: "vscode";
298
298
  }>>;
299
299
  diffToolCustomCommand: z.ZodOptional<z.ZodString>;
300
+ autoExtractLearnings: z.ZodDefault<z.ZodBoolean>;
300
301
  autoFormatBeforePush: z.ZodDefault<z.ZodBoolean>;
301
302
  trustOwnRepoWrites: z.ZodDefault<z.ZodBoolean>;
302
303
  healthCheckFreshnessMinutes: z.ZodDefault<z.ZodNumber>;
@@ -419,13 +420,21 @@ export declare const SearchSeenEntrySchema: z.ZodObject<{
419
420
  url: z.ZodString;
420
421
  lastSeenAt: z.ZodString;
421
422
  }, z.core.$strip>;
422
- /** One branch an overnight agent prepared locally (#1574). Never pushed by the run. */
423
+ /**
424
+ * One branch an overnight agent prepared locally (#1574). Never pushed by the
425
+ * run; `overnight push-prep` (#1698) may later stage it under `prep/*` on the
426
+ * user's fork and fills in `pushedRef`, `pushedAt` and `compareUrl`.
427
+ */
423
428
  export declare const OvernightPreparedSchema: z.ZodObject<{
424
429
  url: z.ZodString;
425
430
  branch: z.ZodString;
426
431
  worktree: z.ZodOptional<z.ZodString>;
427
432
  note: z.ZodOptional<z.ZodString>;
428
433
  recordedAt: z.ZodString;
434
+ pushedRef: z.ZodOptional<z.ZodString>;
435
+ pushedAt: z.ZodOptional<z.ZodString>;
436
+ compareUrl: z.ZodOptional<z.ZodString>;
437
+ pushProblem: z.ZodOptional<z.ZodString>;
429
438
  }, z.core.$strip>;
430
439
  /** The latest overnight run (#1574); `startup` surfaces its freshness. */
431
440
  export declare const OvernightRecordSchema: z.ZodObject<{
@@ -439,11 +448,25 @@ export declare const OvernightRecordSchema: z.ZodObject<{
439
448
  worktree: z.ZodOptional<z.ZodString>;
440
449
  note: z.ZodOptional<z.ZodString>;
441
450
  recordedAt: z.ZodString;
451
+ pushedRef: z.ZodOptional<z.ZodString>;
452
+ pushedAt: z.ZodOptional<z.ZodString>;
453
+ compareUrl: z.ZodOptional<z.ZodString>;
454
+ pushProblem: z.ZodOptional<z.ZodString>;
442
455
  }, z.core.$strip>>>;
443
456
  }, z.core.$strip>;
444
- /** Mirrors oss-scout's `searchRotation` (broad-phase language cursor). */
457
+ /**
458
+ * Mirrors oss-scout's `searchRotation`: the broad-phase language cursor, the
459
+ * repo-window cursors of the capped phases, and the round-robin strategy
460
+ * cursor (oss-scout 1.7.0). Every field must be listed: z.object strips
461
+ * unknown keys, so a cursor missing here would be dropped on every load and
462
+ * scout's rotation would restart from 0 each search.
463
+ */
445
464
  export declare const SearchRotationSchema: z.ZodObject<{
446
465
  languageOffset: z.ZodDefault<z.ZodNumber>;
466
+ phase0Offset: z.ZodDefault<z.ZodNumber>;
467
+ starredOffset: z.ZodDefault<z.ZodNumber>;
468
+ maintainedOffset: z.ZodDefault<z.ZodNumber>;
469
+ strategyOffset: z.ZodDefault<z.ZodNumber>;
447
470
  lastRotatedAt: z.ZodOptional<z.ZodString>;
448
471
  }, z.core.$strip>;
449
472
  export declare const AgentStateSchema: z.ZodObject<{
@@ -526,6 +549,7 @@ export declare const AgentStateSchema: z.ZodObject<{
526
549
  vscode: "vscode";
527
550
  }>>;
528
551
  diffToolCustomCommand: z.ZodOptional<z.ZodString>;
552
+ autoExtractLearnings: z.ZodDefault<z.ZodBoolean>;
529
553
  autoFormatBeforePush: z.ZodDefault<z.ZodBoolean>;
530
554
  trustOwnRepoWrites: z.ZodDefault<z.ZodBoolean>;
531
555
  healthCheckFreshnessMinutes: z.ZodDefault<z.ZodNumber>;
@@ -706,10 +730,18 @@ export declare const AgentStateSchema: z.ZodObject<{
706
730
  worktree: z.ZodOptional<z.ZodString>;
707
731
  note: z.ZodOptional<z.ZodString>;
708
732
  recordedAt: z.ZodString;
733
+ pushedRef: z.ZodOptional<z.ZodString>;
734
+ pushedAt: z.ZodOptional<z.ZodString>;
735
+ compareUrl: z.ZodOptional<z.ZodString>;
736
+ pushProblem: z.ZodOptional<z.ZodString>;
709
737
  }, z.core.$strip>>>;
710
738
  }, z.core.$strip>>;
711
739
  searchRotation: z.ZodOptional<z.ZodObject<{
712
740
  languageOffset: z.ZodDefault<z.ZodNumber>;
741
+ phase0Offset: z.ZodDefault<z.ZodNumber>;
742
+ starredOffset: z.ZodDefault<z.ZodNumber>;
743
+ maintainedOffset: z.ZodDefault<z.ZodNumber>;
744
+ strategyOffset: z.ZodDefault<z.ZodNumber>;
713
745
  lastRotatedAt: z.ZodOptional<z.ZodString>;
714
746
  }, z.core.$strip>>;
715
747
  }, z.core.$strip>;
@@ -235,6 +235,12 @@ export const AgentConfigSchema = z.object({
235
235
  preferredOrgs: z.array(z.string()).default([]),
236
236
  diffTool: DiffToolSchema.default('inline'),
237
237
  diffToolCustomCommand: z.string().optional(),
238
+ /**
239
+ * Extract per-repo learnings from freshly merged PRs automatically at
240
+ * `/oss` startup and in `/oss-overnight` (#1696). When false, `daily`
241
+ * offers the extraction as an `extract_learnings` action-menu item instead.
242
+ */
243
+ autoExtractLearnings: z.boolean().default(true),
238
244
  /**
239
245
  * No effect since the hook was removed in #1642; kept for state-file
240
246
  * compatibility.
@@ -374,13 +380,24 @@ export const SearchSeenEntrySchema = z.object({
374
380
  url: z.string(),
375
381
  lastSeenAt: z.string(),
376
382
  });
377
- /** One branch an overnight agent prepared locally (#1574). Never pushed by the run. */
383
+ /**
384
+ * One branch an overnight agent prepared locally (#1574). Never pushed by the
385
+ * run; `overnight push-prep` (#1698) may later stage it under `prep/*` on the
386
+ * user's fork and fills in `pushedRef`, `pushedAt` and `compareUrl`.
387
+ */
378
388
  export const OvernightPreparedSchema = z.object({
379
389
  url: z.string(),
380
390
  branch: z.string(),
381
391
  worktree: z.string().optional(),
382
392
  note: z.string().optional(),
383
393
  recordedAt: z.string(),
394
+ /** Branch name on the fork (`prep/<branch>`), set by `overnight push-prep`. */
395
+ pushedRef: z.string().optional(),
396
+ pushedAt: z.string().optional(),
397
+ /** `<fork>/compare/<pr-head>...prep/<branch>`; absent when the PR head could not be read. */
398
+ compareUrl: z.string().optional(),
399
+ /** Why the last `overnight push-prep` did not push this branch; cleared once it is pushed. */
400
+ pushProblem: z.string().optional(),
384
401
  });
385
402
  /** The latest overnight run (#1574); `startup` surfaces its freshness. */
386
403
  export const OvernightRecordSchema = z.object({
@@ -390,9 +407,19 @@ export const OvernightRecordSchema = z.object({
390
407
  judgmentCount: z.number().int().nonnegative(),
391
408
  prepared: z.array(OvernightPreparedSchema).default([]),
392
409
  });
393
- /** Mirrors oss-scout's `searchRotation` (broad-phase language cursor). */
410
+ /**
411
+ * Mirrors oss-scout's `searchRotation`: the broad-phase language cursor, the
412
+ * repo-window cursors of the capped phases, and the round-robin strategy
413
+ * cursor (oss-scout 1.7.0). Every field must be listed: z.object strips
414
+ * unknown keys, so a cursor missing here would be dropped on every load and
415
+ * scout's rotation would restart from 0 each search.
416
+ */
394
417
  export const SearchRotationSchema = z.object({
395
418
  languageOffset: z.number().int().nonnegative().default(0),
419
+ phase0Offset: z.number().int().nonnegative().default(0),
420
+ starredOffset: z.number().int().nonnegative().default(0),
421
+ maintainedOffset: z.number().int().nonnegative().default(0),
422
+ strategyOffset: z.number().int().nonnegative().default(0),
396
423
  lastRotatedAt: z.string().optional(),
397
424
  });
398
425
  export const AgentStateSchema = z.object({
@@ -147,6 +147,19 @@ export interface DailyOutput {
147
147
  * omit the field entirely so existing consumers and goldens see no change.
148
148
  */
149
149
  listUpdates?: MergedPRListUpdate[];
150
+ /**
151
+ * Recently merged PRs whose learnings the host extracts in the background
152
+ * at startup (#1696). Present only in auto mode with Gist persistence and
153
+ * at least one unextracted merge; see {@link PendingLearnings}.
154
+ */
155
+ pendingLearnings?: PendingLearnings;
156
+ }
157
+ /** Work order for the host's background learnings extraction (#1696). */
158
+ export interface PendingLearnings {
159
+ /** `owner/repo` slugs with at least one unextracted recent merge, sorted. */
160
+ repos: string[];
161
+ /** Total unextracted recently merged PRs across those repos. */
162
+ prCount: number;
150
163
  }
151
164
  /**
152
165
  * Compact version of DailyOutput for reduced JSON payload size (#763).
@@ -178,6 +191,8 @@ export interface CompactDailyOutput {
178
191
  strategySummary?: import('../core/strategy.js').StrategyResult | null;
179
192
  /** Curated-list entries auto-marked done this run (#1463). See {@link DailyOutput.listUpdates}. */
180
193
  listUpdates?: MergedPRListUpdate[];
194
+ /** Background extraction work order (#1696). See {@link DailyOutput.pendingLearnings}. */
195
+ pendingLearnings?: PendingLearnings;
181
196
  }
182
197
  /**
183
198
  * Strip a full DailyOutput down to the compact subset (#763).
@@ -497,6 +512,10 @@ export declare const DailyOutputSchema: z.ZodObject<{
497
512
  listPath: z.ZodString;
498
513
  repoHeadingStruck: z.ZodBoolean;
499
514
  }, z.core.$strip>>>;
515
+ pendingLearnings: z.ZodOptional<z.ZodObject<{
516
+ repos: z.ZodArray<z.ZodString>;
517
+ prCount: z.ZodNumber;
518
+ }, z.core.$strip>>;
500
519
  }, z.core.$strip>;
501
520
  export declare const CompactDailyOutputSchema: z.ZodObject<{
502
521
  digest: z.ZodObject<{
@@ -651,6 +670,10 @@ export declare const CompactDailyOutputSchema: z.ZodObject<{
651
670
  listPath: z.ZodString;
652
671
  repoHeadingStruck: z.ZodBoolean;
653
672
  }, z.core.$strip>>>;
673
+ pendingLearnings: z.ZodOptional<z.ZodObject<{
674
+ repos: z.ZodArray<z.ZodString>;
675
+ prCount: z.ZodNumber;
676
+ }, z.core.$strip>>;
654
677
  }, z.core.$strip>;
655
678
  export declare const SearchOutputSchema: z.ZodObject<{
656
679
  candidates: z.ZodArray<z.ZodObject<{
@@ -1205,6 +1228,33 @@ export declare const LocalReposOutputSchema: z.ZodObject<{
1205
1228
  cachedAt: z.ZodString;
1206
1229
  fromCache: z.ZodBoolean;
1207
1230
  }, z.core.$strip>;
1231
+ export declare const OvernightPushPrepOutputSchema: z.ZodObject<{
1232
+ dryRun: z.ZodBoolean;
1233
+ login: z.ZodString;
1234
+ reportPath: z.ZodString;
1235
+ results: z.ZodArray<z.ZodObject<{
1236
+ url: z.ZodString;
1237
+ branch: z.ZodString;
1238
+ status: z.ZodEnum<{
1239
+ skipped: "skipped";
1240
+ failed: "failed";
1241
+ pushed: "pushed";
1242
+ planned: "planned";
1243
+ }>;
1244
+ remote: z.ZodOptional<z.ZodString>;
1245
+ repo: z.ZodOptional<z.ZodString>;
1246
+ ref: z.ZodOptional<z.ZodString>;
1247
+ compareUrl: z.ZodOptional<z.ZodString>;
1248
+ reason: z.ZodOptional<z.ZodString>;
1249
+ }, z.core.$strip>>;
1250
+ pushed: z.ZodNumber;
1251
+ planned: z.ZodNumber;
1252
+ skipped: z.ZodNumber;
1253
+ failed: z.ZodNumber;
1254
+ reportRecreated: z.ZodOptional<z.ZodLiteral<true>>;
1255
+ reportWarning: z.ZodOptional<z.ZodString>;
1256
+ gistSyncWarning: z.ZodOptional<z.ZodString>;
1257
+ }, z.core.$strip>;
1208
1258
  /**
1209
1259
  * Compact summary of an issue's first linked PR, surfaced on candidate
1210
1260
  * outputs (#97 / scout 0.9.0). `isStalled` is `true` when the PR is open