@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.
- package/dist/cli.bundle.cjs +109 -108
- package/dist/commands/dashboard-server.js +5 -7
- package/dist/core/ci-analysis.js +15 -1
- package/dist/core/compliance-score.js +95 -15
- package/dist/core/errors.d.ts +14 -0
- package/dist/core/errors.js +18 -0
- package/dist/core/gist-state-store.d.ts +30 -0
- package/dist/core/gist-state-store.js +114 -15
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/pr-assembly.d.ts +9 -7
- package/dist/core/pr-assembly.js +14 -10
- package/dist/core/pr-monitor.d.ts +2 -2
- package/dist/core/pr-monitor.js +9 -4
- package/dist/core/pr-quality-rubric.js +1 -1
- package/dist/core/state.js +22 -9
- package/dist/core/strategy.js +22 -3
- package/package.json +1 -1
package/dist/core/state.js
CHANGED
|
@@ -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
|
-
|
|
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 = !
|
|
328
|
-
return
|
|
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
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
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;
|
package/dist/core/strategy.js
CHANGED
|
@@ -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
|
|
111
|
-
*
|
|
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
|
-
|
|
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;
|