@oss-autopilot/core 3.30.0 → 3.31.1

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.
@@ -369,6 +369,11 @@ export class PRMonitor {
369
369
  // The commit date is only consulted (and only fetched) when the PR has an
370
370
  // unresponded maintainer comment or a changes-requested review — the shared
371
371
  // pipeline decides via `needCommitDate` and invokes this thunk lazily.
372
+ // A PR with a status override is the exception: override auto-clear keys
373
+ // on the commit date (#1713), so fetch it up front for those PRs only.
374
+ const commitInfo = config.statusOverrides?.[prUrl]
375
+ ? await this.fetchCommitInfo(owner, repo, ghPR.head.sha)
376
+ : () => this.fetchCommitInfo(owner, repo, ghPR.head.sha);
372
377
  return assembleFetchedPR({
373
378
  prUrl,
374
379
  owner,
@@ -384,7 +389,7 @@ export class PRMonitor {
384
389
  reviews,
385
390
  reviewComments,
386
391
  ciStatus,
387
- }, config, () => this.fetchCommitInfo(owner, repo, ghPR.head.sha));
392
+ }, config, commitInfo);
388
393
  }
389
394
  /**
390
395
  * Fetch the HEAD commit's author date and login via REST `repos.getCommit`.
@@ -419,8 +424,8 @@ export class PRMonitor {
419
424
  }
420
425
  /**
421
426
  * Assemble a {@link FetchedPR} from GraphQL-batched {@link NormalizedPRData}.
422
- * No network calls: the batch already carries the commit info, so the shared
423
- * pipeline's lazy commit thunk just returns it.
427
+ * No network calls: the batch already carries the commit info, so it is
428
+ * passed directly and always recorded on the PR.
424
429
  */
425
430
  assembleFromNormalized(ref, data) {
426
431
  const config = this.stateManager.getState().config;
@@ -439,7 +444,7 @@ export class PRMonitor {
439
444
  reviews: data.reviews,
440
445
  reviewComments: data.reviewComments,
441
446
  ciStatus: data.ciStatus,
442
- }, config, async () => data.commitInfo);
447
+ }, config, data.commitInfo);
443
448
  }
444
449
  /**
445
450
  * Fetch merged PR counts and latest merge dates per repository for the configured user.
@@ -98,7 +98,7 @@ export const PR_QUALITY_RUBRIC = [
98
98
  {
99
99
  id: 'screenshots',
100
100
  label: 'Screenshots',
101
- description: 'Included for UI changes',
101
+ description: 'Only for visible changes when the template or a maintainer asks',
102
102
  tier: 'optional',
103
103
  weight: null,
104
104
  },
@@ -8,7 +8,7 @@ import { AgentStateSchema } from './state-schema.js';
8
8
  import { loadState, saveState, reloadStateIfChanged, createFreshState, atomicWriteFileSync, } from './state-persistence.js';
9
9
  import * as repoScoring from './repo-score-manager.js';
10
10
  import { debug, warn } from './logger.js';
11
- import { errorMessage, ConfigurationError, ConcurrencyError, isTransientNetworkError } from './errors.js';
11
+ import { errorMessage, ConfigurationError, ConcurrencyError, isTransientNetworkError, GistFileSizeError, GIST_FILE_SIZE_REMEDY, } from './errors.js';
12
12
  import { GistStateStore } from './gist-state-store.js';
13
13
  import * as guidelinesStoreModule from './guidelines-store.js';
14
14
  /** Gist file that carries the rendered overnight report across machines (#1698). */
@@ -314,7 +314,17 @@ export class StateManager {
314
314
  if (!this.gistStore)
315
315
  return true; // not in Gist mode
316
316
  this.gistStore.setState(JSON.stringify(this.state, null, 2));
317
- const pushed = await this.gistStore.push();
317
+ let isPushed;
318
+ try {
319
+ isPushed = await this.gistStore.push();
320
+ }
321
+ catch (err) {
322
+ // A file too large to sync fails every checkpoint until state shrinks,
323
+ // so it is a degradation, not a one-off error.
324
+ if (err instanceof GistFileSizeError)
325
+ this.gistDegraded = true;
326
+ throw err;
327
+ }
318
328
  // A push that fails after its internal retry means the Gist is no longer
319
329
  // the authoritative copy of our in-memory state — surface that as degraded
320
330
  // so `state --show`, the daily check, and doctor stop reporting healthy
@@ -324,8 +334,8 @@ export class StateManager {
324
334
  // unnecessary re-bootstrap. A thrown GistConcurrencyError is deliberately
325
335
  // left untouched here — a concurrent remote write is recoverable (refresh +
326
336
  // retry), not a degradation of the Gist itself.
327
- this.gistDegraded = !pushed;
328
- return pushed;
337
+ this.gistDegraded = !isPushed;
338
+ return isPushed;
329
339
  }
330
340
  /** Whether this StateManager is backed by a Gist. */
331
341
  isGistMode() {
@@ -1246,11 +1256,14 @@ export async function bootstrapGistBestEffort(fetchToken) {
1246
1256
  cause = 'init-fallback';
1247
1257
  }
1248
1258
  catch (err) {
1249
- cause = {
1250
- reason: err instanceof ConfigurationError
1251
- ? `Gist initialization failed (${errorMessage(err)}) — fix the Gist setup (check the token's gist scope, or run state-show / setup) before relying on sync`
1252
- : `Gist initialization failed: ${errorMessage(err)}`,
1253
- };
1259
+ let reason = `Gist initialization failed: ${errorMessage(err)}`;
1260
+ if (err instanceof GistFileSizeError) {
1261
+ reason = `Gist initialization failed (${errorMessage(err)}). To fix it, ${GIST_FILE_SIZE_REMEDY}.`;
1262
+ }
1263
+ else if (err instanceof ConfigurationError) {
1264
+ reason = `Gist initialization failed (${errorMessage(err)}) — fix the Gist setup (check the token's gist scope, or run state-show / setup) before relying on sync`;
1265
+ }
1266
+ cause = { reason };
1254
1267
  }
1255
1268
  if (cause === null)
1256
1269
  return null;
@@ -105,10 +105,28 @@ function recommendForOverExtension(openPRCount, dormantPRCount, overExtended) {
105
105
  return 'open_more';
106
106
  return null;
107
107
  }
108
+ /**
109
+ * Same activity timestamp as `latestActivityAt` in daily-logic.ts (latest
110
+ * commit or maintainer comment, falling back to `updatedAt`), over the
111
+ * loosely typed persisted digest. Kept local so this module stays free of
112
+ * the state imports daily-logic pulls in.
113
+ */
114
+ function activityAt(pr) {
115
+ const commentAt = pr.lastMaintainerComment?.createdAt;
116
+ let latest;
117
+ for (const d of [pr.latestCommitDate, commentAt]) {
118
+ if (typeof d === 'string' && d !== '' && (latest === undefined || d > latest))
119
+ latest = d;
120
+ }
121
+ if (latest !== undefined)
122
+ return latest;
123
+ return typeof pr.updatedAt === 'string' ? pr.updatedAt : undefined;
124
+ }
108
125
  /**
109
126
  * Read-only mirror of the status-override lookup (#1416): same staleness
110
- * rule as `StateManager.getStatusOverride` (an override recorded against
111
- * older activity than the PR's `updatedAt` is ignored), but with NO
127
+ * rule the daily pipeline applies via `StateManager.getStatusOverride` and
128
+ * `latestActivityAt` (an override recorded against older activity than the
129
+ * PR's latest commit or maintainer comment is ignored), but with NO
112
130
  * auto-clear write — this module stays pure/no-I/O, and the daily and
113
131
  * dashboard pipelines own clearing stale overrides.
114
132
  */
@@ -118,7 +136,8 @@ function effectiveStatus(pr, state) {
118
136
  const override = state.config.statusOverrides?.[pr.url];
119
137
  if (!override)
120
138
  return pr.status;
121
- if (typeof pr.updatedAt === 'string' && pr.updatedAt > override.lastActivityAt)
139
+ const lastActivity = activityAt(pr);
140
+ if (lastActivity !== undefined && lastActivity > override.lastActivityAt)
122
141
  return pr.status;
123
142
  if (override.status !== 'needs_addressing' && override.status !== 'waiting_on_maintainer')
124
143
  return pr.status;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oss-autopilot/core",
3
- "version": "3.30.0",
3
+ "version": "3.31.1",
4
4
  "description": "CLI and core library for managing open source contributions",
5
5
  "type": "module",
6
6
  "bin": {
@@ -55,7 +55,7 @@
55
55
  "@octokit/plugin-retry": "^8.1.1",
56
56
  "@octokit/plugin-throttling": "^11.0.5",
57
57
  "@octokit/rest": "^22.0.1",
58
- "@oss-scout/core": "^1.8.1",
58
+ "@oss-scout/core": "^1.9.0",
59
59
  "commander": "^15.0.0",
60
60
  "zod": "^4.5.4"
61
61
  },