@oss-autopilot/core 3.31.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.
@@ -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.31.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": {