@oss-autopilot/core 3.35.0 → 3.37.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.
- package/dist/cli-registry.js +25 -2
- package/dist/cli.bundle.cjs +142 -118
- package/dist/commands/daily.js +21 -2
- package/dist/commands/ledger-backfill.d.ts +7 -0
- package/dist/commands/ledger-backfill.js +116 -6
- package/dist/commands/repo-cap.d.ts +10 -0
- package/dist/commands/repo-cap.js +23 -0
- package/dist/commands/scout-bridge.js +8 -2
- package/dist/commands/search.js +7 -1
- package/dist/commands/setup.js +6 -4
- package/dist/commands/vet-list.js +20 -17
- package/dist/commands/vet.js +29 -2
- package/dist/core/ci-analysis.js +14 -1
- package/dist/core/comment-utils.d.ts +5 -2
- package/dist/core/comment-utils.js +11 -3
- package/dist/core/config-registry.js +12 -0
- package/dist/core/daily-logic.d.ts +36 -1
- package/dist/core/daily-logic.js +113 -3
- package/dist/core/eval-report.d.ts +8 -0
- package/dist/core/eval-report.js +81 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +4 -4
- package/dist/core/issue-verification.d.ts +12 -0
- package/dist/core/issue-verification.js +18 -0
- package/dist/core/pick-snapshot.d.ts +19 -2
- package/dist/core/pick-snapshot.js +27 -1
- package/dist/core/pr-assembly.d.ts +11 -1
- package/dist/core/pr-assembly.js +21 -4
- package/dist/core/pr-attention.d.ts +14 -0
- package/dist/core/pr-attention.js +18 -0
- package/dist/core/pr-graphql.d.ts +31 -1
- package/dist/core/pr-graphql.js +49 -5
- package/dist/core/pr-monitor.d.ts +37 -6
- package/dist/core/pr-monitor.js +41 -12
- package/dist/core/repo-cap.d.ts +46 -0
- package/dist/core/repo-cap.js +102 -0
- package/dist/core/repo-score-manager.d.ts +0 -13
- package/dist/core/repo-score-manager.js +0 -24
- package/dist/core/review-analysis.d.ts +98 -14
- package/dist/core/review-analysis.js +145 -25
- package/dist/core/state-schema.d.ts +58 -0
- package/dist/core/state-schema.js +37 -0
- package/dist/core/state.d.ts +8 -15
- package/dist/core/state.js +19 -24
- package/dist/core/status-determination.js +11 -11
- package/dist/core/types.d.ts +32 -2
- package/dist/formatters/json.d.ts +29 -0
- package/dist/formatters/json.js +17 -0
- package/package.json +1 -1
package/dist/core/state.js
CHANGED
|
@@ -46,6 +46,7 @@ const LEDGER_FIELDS = [
|
|
|
46
46
|
'lastReviewDecision',
|
|
47
47
|
'lastCiStatus',
|
|
48
48
|
'backfilledAt',
|
|
49
|
+
'responseRule',
|
|
49
50
|
'closeReason',
|
|
50
51
|
'selfCloseReason',
|
|
51
52
|
];
|
|
@@ -713,6 +714,24 @@ export class StateManager {
|
|
|
713
714
|
this.autoSave();
|
|
714
715
|
}
|
|
715
716
|
}
|
|
717
|
+
/**
|
|
718
|
+
* Overwrite the first-response lookup on the merged or closed PR matching
|
|
719
|
+
* `url`. Unlike addMergedPRs/addClosedPRs, which only fill missing fields,
|
|
720
|
+
* this replaces `firstMaintainerResponseAt` (clearing it when `at` is
|
|
721
|
+
* undefined) so ledger-backfill can recompute values recorded under an older
|
|
722
|
+
* maintainer rule. No-op when no PR with that URL is stored.
|
|
723
|
+
*/
|
|
724
|
+
setLedgerResponse(url, at, rule) {
|
|
725
|
+
const entry = this.state.mergedPRs?.find((pr) => pr.url === url) ?? this.state.closedPRs?.find((pr) => pr.url === url);
|
|
726
|
+
if (!entry)
|
|
727
|
+
return;
|
|
728
|
+
if (at === undefined)
|
|
729
|
+
delete entry.firstMaintainerResponseAt;
|
|
730
|
+
else
|
|
731
|
+
entry.firstMaintainerResponseAt = at;
|
|
732
|
+
entry.responseRule = rule;
|
|
733
|
+
this.autoSave();
|
|
734
|
+
}
|
|
716
735
|
/**
|
|
717
736
|
* Stamp `learningsExtractedAt` on the merged or closed PR matching `url` (#867).
|
|
718
737
|
* No-op when no PR with that URL is stored.
|
|
@@ -1040,30 +1059,6 @@ export class StateManager {
|
|
|
1040
1059
|
repoScoring.updateRepoScore(this.state, repo, updates);
|
|
1041
1060
|
this.autoSave();
|
|
1042
1061
|
}
|
|
1043
|
-
/**
|
|
1044
|
-
* Increment the merged PR count for a repository.
|
|
1045
|
-
* @param repo - Repository in "owner/repo" format
|
|
1046
|
-
*/
|
|
1047
|
-
incrementMergedCount(repo) {
|
|
1048
|
-
repoScoring.incrementMergedCount(this.state, repo);
|
|
1049
|
-
this.autoSave();
|
|
1050
|
-
}
|
|
1051
|
-
/**
|
|
1052
|
-
* Increment the closed-without-merge PR count.
|
|
1053
|
-
* @param repo - Repository in "owner/repo" format
|
|
1054
|
-
*/
|
|
1055
|
-
incrementClosedCount(repo) {
|
|
1056
|
-
repoScoring.incrementClosedCount(this.state, repo);
|
|
1057
|
-
this.autoSave();
|
|
1058
|
-
}
|
|
1059
|
-
/**
|
|
1060
|
-
* Mark a repository as hostile (score zeroed).
|
|
1061
|
-
* @param repo - Repository in "owner/repo" format
|
|
1062
|
-
*/
|
|
1063
|
-
markRepoHostile(repo) {
|
|
1064
|
-
repoScoring.markRepoHostile(this.state, repo);
|
|
1065
|
-
this.autoSave();
|
|
1066
|
-
}
|
|
1067
1062
|
/** Returns repository names that have at least one merged PR. */
|
|
1068
1063
|
getReposWithMergedPRs() {
|
|
1069
1064
|
return repoScoring.getReposWithMergedPRs(this.state);
|
|
@@ -108,9 +108,14 @@ function isChangesAddressedByCommit(commitDate, changesRequestedDate) {
|
|
|
108
108
|
/**
|
|
109
109
|
* Collect all applicable action reasons independently, without short-circuiting (#675).
|
|
110
110
|
* Used alongside the priority-based decision tree to surface secondary issues.
|
|
111
|
+
*
|
|
112
|
+
* `hasIncompleteChecklist` is deliberately NOT an action reason: the
|
|
113
|
+
* draft-first workflow tells the agent to leave template boxes unchecked, and
|
|
114
|
+
* many boxes are N/A or honor-system, so it is shown as a note on the PR's
|
|
115
|
+
* display description instead of counting as needs_addressing.
|
|
111
116
|
*/
|
|
112
117
|
function collectAllActionReasons(input) {
|
|
113
|
-
const { ciStatus, hasMergeConflict, hasUnrespondedComment,
|
|
118
|
+
const { ciStatus, hasMergeConflict, hasUnrespondedComment, reviewDecision, lastMaintainerCommentDate, latestChangesRequestedDate, hasActionableCIFailure = true, } = input;
|
|
114
119
|
const commitDate = resolveContributorCommitDate(input);
|
|
115
120
|
const reasons = [];
|
|
116
121
|
// An unresponded maintainer comment on an already-approved, passing/unknown
|
|
@@ -133,9 +138,6 @@ function collectAllActionReasons(input) {
|
|
|
133
138
|
if (hasMergeConflict) {
|
|
134
139
|
reasons.push('merge_conflict');
|
|
135
140
|
}
|
|
136
|
-
if (hasIncompleteChecklist) {
|
|
137
|
-
reasons.push('incomplete_checklist');
|
|
138
|
-
}
|
|
139
141
|
return reasons.length > 0 ? reasons : undefined;
|
|
140
142
|
}
|
|
141
143
|
/**
|
|
@@ -164,12 +166,13 @@ export function determineStatus(input) {
|
|
|
164
166
|
* this with the full `actionReasons` array.
|
|
165
167
|
*/
|
|
166
168
|
function determinePrimaryStatus(input) {
|
|
167
|
-
const { ciStatus, hasMergeConflict, hasUnrespondedComment,
|
|
168
|
-
// Compute staleness tier (independent of status)
|
|
169
|
+
const { ciStatus, hasMergeConflict, hasUnrespondedComment, reviewDecision, daysSinceActivity, daysSinceMaintainerActivity = daysSinceActivity, dormantThreshold, approachingThreshold, lastMaintainerCommentDate, latestChangesRequestedDate, hasActionableCIFailure = true, } = input;
|
|
170
|
+
// Compute staleness tier (independent of status) from the maintainer-side
|
|
171
|
+
// clock, so the contributor's own pings don't keep an ignored PR active.
|
|
169
172
|
let stalenessTier = 'active';
|
|
170
|
-
if (
|
|
173
|
+
if (daysSinceMaintainerActivity >= dormantThreshold)
|
|
171
174
|
stalenessTier = 'dormant';
|
|
172
|
-
else if (
|
|
175
|
+
else if (daysSinceMaintainerActivity >= approachingThreshold)
|
|
173
176
|
stalenessTier = 'approaching_dormant';
|
|
174
177
|
const commitDate = resolveContributorCommitDate(input);
|
|
175
178
|
// Priority order: needs_addressing (response/changes/ci/conflict/checklist) > waiting_on_maintainer (review/merge/addressed/ci_blocked)
|
|
@@ -214,9 +217,6 @@ function determinePrimaryStatus(input) {
|
|
|
214
217
|
if (hasMergeConflict) {
|
|
215
218
|
return { status: 'needs_addressing', actionReason: 'merge_conflict', stalenessTier };
|
|
216
219
|
}
|
|
217
|
-
if (hasIncompleteChecklist) {
|
|
218
|
-
return { status: 'needs_addressing', actionReason: 'incomplete_checklist', stalenessTier };
|
|
219
|
-
}
|
|
220
220
|
// Approved and CI passing/unknown = waiting on maintainer to merge
|
|
221
221
|
if (reviewDecision === 'approved' && (ciStatus === 'passing' || ciStatus === 'unknown')) {
|
|
222
222
|
return { status: 'waiting_on_maintainer', waitReason: 'pending_merge', stalenessTier };
|
package/dist/core/types.d.ts
CHANGED
|
@@ -83,6 +83,12 @@ export interface DetermineStatusInput {
|
|
|
83
83
|
hasIncompleteChecklist: boolean;
|
|
84
84
|
reviewDecision: ReviewDecision;
|
|
85
85
|
daysSinceActivity: number;
|
|
86
|
+
/**
|
|
87
|
+
* Days since the last activity by someone other than the contributor and
|
|
88
|
+
* not a bot (or since PR creation). Drives `stalenessTier`. Falls back to
|
|
89
|
+
* `daysSinceActivity` when omitted.
|
|
90
|
+
*/
|
|
91
|
+
daysSinceMaintainerActivity?: number;
|
|
86
92
|
dormantThreshold: number;
|
|
87
93
|
approachingThreshold: number;
|
|
88
94
|
latestCommitDate?: string;
|
|
@@ -142,7 +148,7 @@ export interface FetchedPR {
|
|
|
142
148
|
waitReason?: WaitReason;
|
|
143
149
|
/** All applicable action reasons, ordered by priority. Primary reason is first. */
|
|
144
150
|
actionReasons?: ActionReason[];
|
|
145
|
-
/** How stale the PR is
|
|
151
|
+
/** How stale the PR is, from `daysSinceMaintainerActivity` (not the contributor's own activity). Independent of status — a PR can be both needs_addressing and dormant. */
|
|
146
152
|
stalenessTier: StalenessTier;
|
|
147
153
|
/** Unified attention bucket (#1352), computed by `classifyAttentionBucket()`
|
|
148
154
|
* from status/ciStatus/reviewDecision/daysSinceActivity. Stamped by the
|
|
@@ -163,8 +169,32 @@ export interface FetchedPR {
|
|
|
163
169
|
* open set. Undefined when no maintainer has responded yet.
|
|
164
170
|
*/
|
|
165
171
|
firstMaintainerResponseAt?: string;
|
|
166
|
-
/**
|
|
172
|
+
/**
|
|
173
|
+
* Calendar days since the most recent activity of any kind (`updatedAt`),
|
|
174
|
+
* including the contributor's own comments, pushes and rebases. Used for
|
|
175
|
+
* follow-up timing (don't nudge right after a ping) and stale-CI demotion.
|
|
176
|
+
* NOT used for `stalenessTier`; see `daysSinceMaintainerActivity`.
|
|
177
|
+
*/
|
|
167
178
|
daysSinceActivity: number;
|
|
179
|
+
/**
|
|
180
|
+
* Timestamp of the latest maintainer activity, or `createdAt` when there is
|
|
181
|
+
* none (see `getLastMaintainerActivity`). Maintainer activity is: an issue
|
|
182
|
+
* comment by an OWNER / MEMBER / COLLABORATOR (any non-contributor non-bot
|
|
183
|
+
* author when the association is unknown); a review or inline review
|
|
184
|
+
* comment by any non-contributor non-bot user; a commit or force-push by
|
|
185
|
+
* someone else, including a maintainer's GitHub App but not auto-fixer or
|
|
186
|
+
* dependency bots; a review request or label by a non-contributor non-bot.
|
|
187
|
+
* Optional: absent on payloads from older producers.
|
|
188
|
+
*/
|
|
189
|
+
lastMaintainerActivityAt?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Calendar days since `lastMaintainerActivityAt`. This is the dormancy
|
|
192
|
+
* clock: `stalenessTier` is computed from it, so the contributor's own
|
|
193
|
+
* pings and rebases no longer keep an ignored PR "active".
|
|
194
|
+
*/
|
|
195
|
+
daysSinceMaintainerActivity?: number;
|
|
196
|
+
/** Contributor issue comments posted after `lastMaintainerActivityAt` (unanswered pings). */
|
|
197
|
+
authorPingsSinceMaintainerActivity?: number;
|
|
168
198
|
ciStatus: CIStatus;
|
|
169
199
|
/** Names of failing CI checks. Useful for distinguishing real CI failures from validation bots. */
|
|
170
200
|
failingCheckNames: string[];
|
|
@@ -6,6 +6,7 @@ import { z, type ZodType } from 'zod';
|
|
|
6
6
|
import type { AttentionSummary } from '../core/pr-attention.js';
|
|
7
7
|
import type { FetchedPR, DailyDigest, AgentState, RepoGroup, CommentedIssue, ShelvedPRRef, SearchPriority, CapacityAssessment, ActionableIssue, CompactActionableIssue, ActionMenu } from '../core/types.js';
|
|
8
8
|
import type { ContributionStats } from '../core/stats.js';
|
|
9
|
+
import type { RepoCapStatus } from '../core/repo-cap.js';
|
|
9
10
|
import type { PRCheckFailure } from '../core/pr-monitor.js';
|
|
10
11
|
import type { CIFormatterDiagnosis, FormatterDetectionResult } from '../core/formatter-detection.js';
|
|
11
12
|
import type { IssueAvailabilityVerdict, IssueVerification, VerifiedLinkedPR } from '../core/issue-verification.js';
|
|
@@ -674,6 +675,21 @@ export declare const CompactDailyOutputSchema: z.ZodObject<{
|
|
|
674
675
|
prCount: z.ZodNumber;
|
|
675
676
|
}, z.core.$strip>>;
|
|
676
677
|
}, z.core.$strip>;
|
|
678
|
+
/** Per-repo open-PR cap status (core/repo-cap.ts). */
|
|
679
|
+
export declare const RepoCapStatusSchema: z.ZodObject<{
|
|
680
|
+
repo: z.ZodString;
|
|
681
|
+
openPRCount: z.ZodNumber;
|
|
682
|
+
countSource: z.ZodEnum<{
|
|
683
|
+
digest: "digest";
|
|
684
|
+
github: "github";
|
|
685
|
+
}>;
|
|
686
|
+
mergedPRCount: z.ZodNumber;
|
|
687
|
+
cold: z.ZodBoolean;
|
|
688
|
+
cap: z.ZodNumber;
|
|
689
|
+
atCap: z.ZodBoolean;
|
|
690
|
+
excluded: z.ZodBoolean;
|
|
691
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
692
|
+
}, z.core.$strip>;
|
|
677
693
|
export declare const SearchOutputSchema: z.ZodObject<{
|
|
678
694
|
candidates: z.ZodArray<z.ZodObject<{
|
|
679
695
|
issue: z.ZodObject<{
|
|
@@ -727,6 +743,7 @@ export declare const SearchOutputSchema: z.ZodObject<{
|
|
|
727
743
|
excludedRepos: z.ZodArray<z.ZodString>;
|
|
728
744
|
aiPolicyBlocklist: z.ZodArray<z.ZodString>;
|
|
729
745
|
hiddenOwnPRCount: z.ZodNumber;
|
|
746
|
+
reposAtCap: z.ZodArray<z.ZodString>;
|
|
730
747
|
rateLimitWarning: z.ZodOptional<z.ZodString>;
|
|
731
748
|
skipListUnavailable: z.ZodOptional<z.ZodBoolean>;
|
|
732
749
|
}, z.core.$strip>;
|
|
@@ -904,6 +921,10 @@ export declare const VerifyIssueOutputSchema: z.ZodObject<{
|
|
|
904
921
|
}>>;
|
|
905
922
|
closedAt: z.ZodNullable<z.ZodString>;
|
|
906
923
|
assignees: z.ZodArray<z.ZodString>;
|
|
924
|
+
author: z.ZodNullable<z.ZodString>;
|
|
925
|
+
authorAssociation: z.ZodNullable<z.ZodString>;
|
|
926
|
+
authorIsBot: z.ZodBoolean;
|
|
927
|
+
commentCount: z.ZodNullable<z.ZodNumber>;
|
|
907
928
|
linkedPRs: z.ZodArray<z.ZodObject<{
|
|
908
929
|
number: z.ZodNumber;
|
|
909
930
|
url: z.ZodString;
|
|
@@ -1355,6 +1376,9 @@ export interface SearchOutput {
|
|
|
1355
1376
|
/** Candidates dropped because the authenticated user already has an open PR
|
|
1356
1377
|
* linked to the issue (#1354). Surfaced as a count so the filter is visible. */
|
|
1357
1378
|
hiddenOwnPRCount: number;
|
|
1379
|
+
/** Repos left out of discovery because they are at the per-repo open-PR
|
|
1380
|
+
* cap (`maxOpenPRsColdRepo` / `maxOpenPRsPerRepo`); empty when none. */
|
|
1381
|
+
reposAtCap: string[];
|
|
1358
1382
|
/** Set when the seen-set write could not be pushed to the Gist (#1629);
|
|
1359
1383
|
* the local cache has it but the next startup's Gist refetch will drop it. */
|
|
1360
1384
|
gistSyncWarning?: string;
|
|
@@ -1633,6 +1657,11 @@ export interface VetOutput {
|
|
|
1633
1657
|
score: number;
|
|
1634
1658
|
reason: string;
|
|
1635
1659
|
};
|
|
1660
|
+
/**
|
|
1661
|
+
* Present only when the issue's repo is at the per-repo open-PR cap or is
|
|
1662
|
+
* in `excludeRepos`; `reason` says which.
|
|
1663
|
+
*/
|
|
1664
|
+
repoCap?: RepoCapStatus;
|
|
1636
1665
|
/** Set when the vet-time prediction (#1824) could not be saved locally. */
|
|
1637
1666
|
pickRecordError?: string;
|
|
1638
1667
|
/** Set when the saved prediction could not be pushed to the Gist. */
|
package/dist/formatters/json.js
CHANGED
|
@@ -388,11 +388,24 @@ const SearchCandidateSchema = z.object({
|
|
|
388
388
|
* the user can see the counterweight working, not just its absence. */
|
|
389
389
|
diversitySlot: z.boolean().optional(),
|
|
390
390
|
});
|
|
391
|
+
/** Per-repo open-PR cap status (core/repo-cap.ts). */
|
|
392
|
+
export const RepoCapStatusSchema = z.object({
|
|
393
|
+
repo: z.string(),
|
|
394
|
+
openPRCount: z.number().int().nonnegative(),
|
|
395
|
+
countSource: z.enum(['digest', 'github']),
|
|
396
|
+
mergedPRCount: z.number().int().nonnegative(),
|
|
397
|
+
cold: z.boolean(),
|
|
398
|
+
cap: z.number().int().nonnegative(),
|
|
399
|
+
atCap: z.boolean(),
|
|
400
|
+
excluded: z.boolean(),
|
|
401
|
+
reason: z.string().optional(),
|
|
402
|
+
});
|
|
391
403
|
export const SearchOutputSchema = z.object({
|
|
392
404
|
candidates: z.array(SearchCandidateSchema),
|
|
393
405
|
excludedRepos: z.array(z.string()),
|
|
394
406
|
aiPolicyBlocklist: z.array(z.string()),
|
|
395
407
|
hiddenOwnPRCount: z.number().int().nonnegative(),
|
|
408
|
+
reposAtCap: z.array(z.string()),
|
|
396
409
|
rateLimitWarning: z.string().optional(),
|
|
397
410
|
// Skip file unreadable — search ran with an empty skip list (#1448).
|
|
398
411
|
// Optional: absent on clean runs.
|
|
@@ -477,6 +490,10 @@ export const VerifyIssueOutputSchema = z.object({
|
|
|
477
490
|
stateReason: z.enum(['completed', 'not_planned', 'reopened', 'duplicate']).nullable(),
|
|
478
491
|
closedAt: z.string().nullable(),
|
|
479
492
|
assignees: z.array(z.string()),
|
|
493
|
+
author: z.string().nullable(),
|
|
494
|
+
authorAssociation: z.string().nullable(),
|
|
495
|
+
authorIsBot: z.boolean(),
|
|
496
|
+
commentCount: z.number().int().nonnegative().nullable(),
|
|
480
497
|
linkedPRs: z.array(z.object({
|
|
481
498
|
number: z.number().int().positive(),
|
|
482
499
|
url: z.string(),
|