@oss-autopilot/core 3.42.5 → 3.44.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.
Files changed (192) hide show
  1. package/dist/cli-pre-action.js +8 -3
  2. package/dist/cli-registry.js +428 -27
  3. package/dist/cli.bundle.cjs +212 -156
  4. package/dist/commands/check-integration.js +5 -1
  5. package/dist/commands/cleanup.d.ts +80 -0
  6. package/dist/commands/cleanup.js +334 -0
  7. package/dist/commands/comments.d.ts +14 -1
  8. package/dist/commands/comments.js +17 -5
  9. package/dist/commands/config.d.ts +2 -0
  10. package/dist/commands/config.js +63 -6
  11. package/dist/commands/daily-dismiss-filter.d.ts +7 -0
  12. package/dist/commands/daily-dismiss-filter.js +17 -1
  13. package/dist/commands/daily-ledger.d.ts +150 -0
  14. package/dist/commands/daily-ledger.js +248 -0
  15. package/dist/commands/daily-recent-prs.d.ts +26 -0
  16. package/dist/commands/daily-recent-prs.js +55 -0
  17. package/dist/commands/daily-render.d.ts +2 -1
  18. package/dist/commands/daily-render.js +4 -1
  19. package/dist/commands/daily.d.ts +5 -1
  20. package/dist/commands/daily.js +83 -93
  21. package/dist/commands/dashboard-cache.d.ts +2 -0
  22. package/dist/commands/dashboard-cache.js +33 -8
  23. package/dist/commands/dashboard-data.js +113 -69
  24. package/dist/commands/dashboard-gist-sync.js +3 -1
  25. package/dist/commands/dashboard-lifecycle.d.ts +36 -8
  26. package/dist/commands/dashboard-lifecycle.js +132 -39
  27. package/dist/commands/dashboard-process.d.ts +49 -1
  28. package/dist/commands/dashboard-process.js +111 -12
  29. package/dist/commands/dashboard-server.js +89 -23
  30. package/dist/commands/detect-formatters.js +1 -0
  31. package/dist/commands/dismiss.js +11 -7
  32. package/dist/commands/doctor.d.ts +15 -1
  33. package/dist/commands/doctor.js +66 -5
  34. package/dist/commands/draft.d.ts +77 -0
  35. package/dist/commands/draft.js +218 -0
  36. package/dist/commands/eval.js +1 -0
  37. package/dist/commands/fork-prune.d.ts +58 -0
  38. package/dist/commands/fork-prune.js +247 -0
  39. package/dist/commands/guidelines.d.ts +69 -2
  40. package/dist/commands/guidelines.js +158 -14
  41. package/dist/commands/index.d.ts +29 -4
  42. package/dist/commands/index.js +20 -3
  43. package/dist/commands/issue-thread.d.ts +46 -0
  44. package/dist/commands/issue-thread.js +123 -0
  45. package/dist/commands/ledger-backfill.d.ts +9 -0
  46. package/dist/commands/ledger-backfill.js +44 -1
  47. package/dist/commands/list-mark-done.d.ts +2 -1
  48. package/dist/commands/list-mark-done.js +3 -1
  49. package/dist/commands/list-move-tier.d.ts +2 -1
  50. package/dist/commands/list-move-tier.js +3 -1
  51. package/dist/commands/local-repos.js +10 -5
  52. package/dist/commands/locate-issue-list.d.ts +40 -17
  53. package/dist/commands/locate-issue-list.js +148 -88
  54. package/dist/commands/move.js +7 -1
  55. package/dist/commands/overnight-handoff.d.ts +17 -7
  56. package/dist/commands/overnight-handoff.js +36 -14
  57. package/dist/commands/overnight-push-prep.d.ts +14 -8
  58. package/dist/commands/overnight-push-prep.js +107 -35
  59. package/dist/commands/overnight-tool-rules.d.ts +54 -0
  60. package/dist/commands/overnight-tool-rules.js +217 -0
  61. package/dist/commands/overnight.d.ts +5 -6
  62. package/dist/commands/overnight.js +61 -140
  63. package/dist/commands/parse-list.js +7 -1
  64. package/dist/commands/policy.d.ts +90 -0
  65. package/dist/commands/policy.js +276 -0
  66. package/dist/commands/pr-create.d.ts +48 -0
  67. package/dist/commands/pr-create.js +200 -0
  68. package/dist/commands/pr-preflight.d.ts +69 -0
  69. package/dist/commands/pr-preflight.js +348 -0
  70. package/dist/commands/repo-vet.d.ts +9 -0
  71. package/dist/commands/repo-vet.js +36 -11
  72. package/dist/commands/scout-bridge.js +18 -8
  73. package/dist/commands/search.js +7 -0
  74. package/dist/commands/setup.d.ts +3 -3
  75. package/dist/commands/setup.js +160 -48
  76. package/dist/commands/skip-add.js +10 -1
  77. package/dist/commands/startup.d.ts +12 -3
  78. package/dist/commands/startup.js +82 -49
  79. package/dist/commands/state-cmd.d.ts +2 -0
  80. package/dist/commands/state-cmd.js +5 -1
  81. package/dist/commands/stats.js +1 -0
  82. package/dist/commands/status.js +6 -0
  83. package/dist/commands/strategy.js +1 -0
  84. package/dist/commands/validation.d.ts +5 -0
  85. package/dist/commands/validation.js +5 -0
  86. package/dist/commands/vet-list.d.ts +6 -0
  87. package/dist/commands/vet-list.js +26 -1
  88. package/dist/commands/vet.d.ts +20 -0
  89. package/dist/commands/vet.js +133 -2
  90. package/dist/commands/work.d.ts +4 -0
  91. package/dist/commands/work.js +34 -11
  92. package/dist/core/__fixtures__/prompt-injection-payloads.js +31 -0
  93. package/dist/core/anti-llm-policy.d.ts +3 -0
  94. package/dist/core/anti-llm-policy.js +3 -0
  95. package/dist/core/auth.js +2 -0
  96. package/dist/core/ci-analysis.d.ts +7 -2
  97. package/dist/core/ci-analysis.js +76 -21
  98. package/dist/core/commit-date.d.ts +45 -0
  99. package/dist/core/commit-date.js +45 -0
  100. package/dist/core/compliance-score.d.ts +3 -0
  101. package/dist/core/compliance-score.js +13 -9
  102. package/dist/core/config-registry.d.ts +27 -2
  103. package/dist/core/config-registry.js +94 -7
  104. package/dist/core/contributing.d.ts +2 -3
  105. package/dist/core/contributing.js +2 -3
  106. package/dist/core/daily-logic.d.ts +30 -5
  107. package/dist/core/daily-logic.js +68 -19
  108. package/dist/core/errors.d.ts +37 -3
  109. package/dist/core/errors.js +54 -5
  110. package/dist/core/fork-prune.d.ts +149 -0
  111. package/dist/core/fork-prune.js +333 -0
  112. package/dist/core/gist-health.d.ts +15 -3
  113. package/dist/core/gist-health.js +8 -0
  114. package/dist/core/gist-state-store.d.ts +24 -4
  115. package/dist/core/gist-state-store.js +98 -51
  116. package/dist/core/github-stats.d.ts +110 -16
  117. package/dist/core/github-stats.js +295 -110
  118. package/dist/core/http-cache.d.ts +0 -10
  119. package/dist/core/http-cache.js +0 -19
  120. package/dist/core/index.d.ts +13 -6
  121. package/dist/core/index.js +16 -6
  122. package/dist/core/issue-conversation.d.ts +8 -2
  123. package/dist/core/issue-conversation.js +31 -12
  124. package/dist/core/local-config.d.ts +95 -0
  125. package/dist/core/local-config.js +270 -0
  126. package/dist/core/merged-pr-notes.d.ts +2 -2
  127. package/dist/core/pacing.d.ts +41 -0
  128. package/dist/core/pacing.js +115 -0
  129. package/dist/core/pagination.d.ts +55 -0
  130. package/dist/core/pagination.js +59 -0
  131. package/dist/core/paths.d.ts +7 -0
  132. package/dist/core/paths.js +9 -0
  133. package/dist/core/pr-assembly.d.ts +2 -0
  134. package/dist/core/pr-assembly.js +6 -2
  135. package/dist/core/pr-graphql.d.ts +53 -4
  136. package/dist/core/pr-graphql.js +87 -14
  137. package/dist/core/pr-monitor.d.ts +35 -12
  138. package/dist/core/pr-monitor.js +110 -26
  139. package/dist/core/pr-preflight.d.ts +154 -0
  140. package/dist/core/pr-preflight.js +753 -0
  141. package/dist/core/pr-quality-rubric.d.ts +0 -6
  142. package/dist/core/pr-quality-rubric.js +0 -8
  143. package/dist/core/pr-template.d.ts +2 -0
  144. package/dist/core/pr-template.js +5 -1
  145. package/dist/core/prose-script.d.ts +72 -0
  146. package/dist/core/prose-script.js +223 -0
  147. package/dist/core/repo-policy.d.ts +111 -0
  148. package/dist/core/repo-policy.js +428 -0
  149. package/dist/core/repo-score-manager.d.ts +66 -0
  150. package/dist/core/repo-score-manager.js +140 -1
  151. package/dist/core/review-analysis.d.ts +49 -21
  152. package/dist/core/review-analysis.js +89 -15
  153. package/dist/core/reviewed-prs-fetch.js +11 -29
  154. package/dist/core/reviewed-prs.js +8 -15
  155. package/dist/core/stale-data.d.ts +78 -0
  156. package/dist/core/stale-data.js +153 -0
  157. package/dist/core/state-persistence.d.ts +62 -27
  158. package/dist/core/state-persistence.js +338 -119
  159. package/dist/core/state-schema.d.ts +152 -210
  160. package/dist/core/state-schema.js +232 -80
  161. package/dist/core/state.d.ts +81 -8
  162. package/dist/core/state.js +239 -46
  163. package/dist/core/status-determination.js +32 -12
  164. package/dist/core/strategy.js +3 -1
  165. package/dist/core/types.d.ts +22 -1
  166. package/dist/core/types.js +1 -0
  167. package/dist/core/untrusted-content.d.ts +30 -11
  168. package/dist/core/untrusted-content.js +95 -42
  169. package/dist/core/urls.d.ts +33 -0
  170. package/dist/core/urls.js +94 -0
  171. package/dist/dashboard/assets/chart-panel-B-nLVgzQ.js +3 -0
  172. package/dist/dashboard/assets/index-5IvMGokL.js +55 -0
  173. package/dist/dashboard/index.html +1 -1
  174. package/dist/formatters/json.d.ts +432 -10
  175. package/dist/formatters/json.js +156 -1
  176. package/package.json +6 -6
  177. package/dist/core/ci-enforced-tools.d.ts +0 -35
  178. package/dist/core/ci-enforced-tools.js +0 -109
  179. package/dist/core/comment-decision.d.ts +0 -79
  180. package/dist/core/comment-decision.js +0 -82
  181. package/dist/core/extraction-categories.d.ts +0 -55
  182. package/dist/core/extraction-categories.js +0 -108
  183. package/dist/core/follow-up-history.d.ts +0 -40
  184. package/dist/core/follow-up-history.js +0 -71
  185. package/dist/core/issue-effort.d.ts +0 -29
  186. package/dist/core/issue-effort.js +0 -47
  187. package/dist/core/maintainer-hints.d.ts +0 -23
  188. package/dist/core/maintainer-hints.js +0 -36
  189. package/dist/core/workflow-state.d.ts +0 -56
  190. package/dist/core/workflow-state.js +0 -101
  191. package/dist/dashboard/assets/chart-panel-DPKNBUts.js +0 -3
  192. package/dist/dashboard/assets/index-B25bZOYX.js +0 -55
@@ -4,20 +4,21 @@
4
4
  * and scoring logic to repo-score-manager.ts.
5
5
  */
6
6
  import * as fs from 'node:fs';
7
- import { AgentStateSchema } from './state-schema.js';
7
+ import { AgentStateSchema, GuidelinesReviewSchema } from './state-schema.js';
8
8
  import { activeWorkClaims, finishWorkClaim, workClaimKey } from './work-claims.js';
9
+ import { PACING_WINDOW_MS, isoAt } from './pacing.js';
9
10
  import { serializeState } from './state-prune.js';
10
- import { loadState, saveState, reloadStateIfChanged, createFreshState, atomicWriteFileSync, warnMalformedWorkClaims, } from './state-persistence.js';
11
+ import { loadState, saveState, reloadStateIfChanged, createFreshState, atomicWriteFileSync, assertNotNewerVersion, warnMalformedWorkClaims, } from './state-persistence.js';
11
12
  import * as repoScoring from './repo-score-manager.js';
12
13
  import { debug, warn } from './logger.js';
13
- import { errorMessage, ConfigurationError, ConcurrencyError, GistConcurrencyError, isTransientNetworkError, GistFileSizeError, GIST_FILE_SIZE_REMEDY, } from './errors.js';
14
+ import { errorMessage, ConfigurationError, ConcurrencyError, NewerStateVersionError, StateLockTimeoutError, GistConcurrencyError, isTransientNetworkError, GistDiscoveryError, GistFileSizeError, GIST_FILE_SIZE_REMEDY, } from './errors.js';
14
15
  import { GistStateStore } from './gist-state-store.js';
15
16
  import * as guidelinesStoreModule from './guidelines-store.js';
16
17
  /** Gist file that carries the rendered overnight report across machines (#1698). */
17
18
  export const OVERNIGHT_REPORT_DOCUMENT = 'overnight-report.md';
18
- import { renderGistWarning } from './gist-health.js';
19
+ import { renderGistWarning, renderUnknownModeWarning } from './gist-health.js';
19
20
  import { getStatePath, getStateCachePath, getGistIdPath } from './paths.js';
20
- import { parseGitHubUrl, issueRefKey } from './urls.js';
21
+ import { parseGitHubUrl, issueRefKey, findRefKey } from './urls.js';
21
22
  export { acquireLock, releaseLock, atomicWriteFileSync } from './state-persistence.js';
22
23
  const MODULE = 'state';
23
24
  /**
@@ -163,7 +164,7 @@ function notSynced(callerModule, err) {
163
164
  export class StateManager {
164
165
  state;
165
166
  inMemoryOnly;
166
- lastLoadedMtimeMs = 0;
167
+ lastLoadedFileId = null;
167
168
  _batching = false;
168
169
  _batchDirty = false;
169
170
  gistStore = null;
@@ -189,7 +190,7 @@ export class StateManager {
189
190
  else {
190
191
  const result = loadState();
191
192
  this.state = result.state;
192
- this.lastLoadedMtimeMs = result.mtimeMs;
193
+ this.lastLoadedFileId = result.fileId;
193
194
  this.loadRecovery = result.recovery ?? null;
194
195
  this.tryReconcilePRCounts();
195
196
  }
@@ -379,10 +380,12 @@ export class StateManager {
379
380
  }
380
381
  // Local file mode with optimistic compare-and-swap.
381
382
  try {
382
- this.lastLoadedMtimeMs = saveState(this.state, this.lastLoadedMtimeMs);
383
+ this.lastLoadedFileId = saveState(this.state, this.lastLoadedFileId);
383
384
  }
384
385
  catch (err) {
385
- if (err instanceof ConcurrencyError && options.allowReloadAndLoseMutation) {
386
+ // A lock timeout is no external write: there is nothing to reload, and the mutation must not be dropped.
387
+ const isExternalWrite = err instanceof ConcurrencyError && !(err instanceof StateLockTimeoutError);
388
+ if (isExternalWrite && options.allowReloadAndLoseMutation) {
386
389
  warn(MODULE, `Concurrent external write detected; reloading and discarding in-memory mutation. ${err.message}`);
387
390
  this.reloadIfChanged();
388
391
  return;
@@ -436,6 +439,8 @@ export class StateManager {
436
439
  * `isGistDegraded()` at each call site.
437
440
  *
438
441
  * Composes the same primitive fields those accessors expose:
442
+ * - no gist store + config names a mode this release does not know →
443
+ * `unknown-mode` (#2005)
439
444
  * - no gist store + config asks for gist → `configured-but-local`
440
445
  * - gist store attached but disarmed (#1443) → `bootstrap-degraded`
441
446
  * (`since` comes from the staleness marker the degraded bootstrap seeds)
@@ -443,6 +448,10 @@ export class StateManager {
443
448
  */
444
449
  getGistHealth() {
445
450
  if (this.gistStore === null) {
451
+ const mode = this.state.config.persistence;
452
+ if (mode !== 'local' && mode !== 'gist') {
453
+ return { mode: 'local', degraded: { mode, cause: 'unknown-mode', recoverable: false } };
454
+ }
446
455
  return {
447
456
  mode: 'local',
448
457
  degraded: this.state.config.persistence === 'gist' ? { cause: 'configured-but-local', recoverable: true } : null,
@@ -491,6 +500,23 @@ export class StateManager {
491
500
  guidelinesStoreModule.deleteGuidelines(this.gistStore, repo);
492
501
  this.autoSave();
493
502
  }
503
+ /** Record that the user approved the guidelines text hashing to `sha256` for `repo` (#1929). */
504
+ markGuidelinesReviewed(repo, sha256, reviewedAt) {
505
+ this.state.guidelinesReviews = { ...this.state.guidelinesReviews, [repo]: { reviewedAt, sha256 } };
506
+ this.autoSave();
507
+ }
508
+ /** The review stamp for `repo`, or undefined when none is recorded or the entry is unreadable (#1929). */
509
+ getGuidelinesReview(repo) {
510
+ const parsed = GuidelinesReviewSchema.safeParse(this.state.guidelinesReviews?.[repo]);
511
+ return parsed.success ? parsed.data : undefined;
512
+ }
513
+ /** Store `policy` for `repo` (#1953), or delete the record when `policy` is null. Keys are lowercase. */
514
+ setRepoPolicy(repo, policy) {
515
+ const key = repo.toLowerCase();
516
+ const rest = Object.fromEntries(Object.entries(this.state.repoPolicies ?? {}).filter(([k]) => k !== key));
517
+ this.state.repoPolicies = policy ? { ...rest, [key]: policy } : rest;
518
+ this.autoSave();
519
+ }
494
520
  /** List repos with non-empty guidelines stored in the Gist. */
495
521
  listGuidelinesRepos() {
496
522
  return guidelinesStoreModule.listGuidelinesRepos(this.gistStore);
@@ -510,11 +536,11 @@ export class StateManager {
510
536
  return false;
511
537
  if (this.gistStore)
512
538
  return false; // Gist is the source of truth; skip local file reload
513
- const result = reloadStateIfChanged(this.lastLoadedMtimeMs);
539
+ const result = reloadStateIfChanged(this.lastLoadedFileId);
514
540
  if (!result)
515
541
  return false;
516
542
  this.state = result.state;
517
- this.lastLoadedMtimeMs = result.mtimeMs;
543
+ this.lastLoadedFileId = result.fileId;
518
544
  this.loadRecovery = result.recovery ?? null;
519
545
  this.tryReconcilePRCounts();
520
546
  return true;
@@ -637,9 +663,13 @@ export class StateManager {
637
663
  let rawState;
638
664
  try {
639
665
  rawState = JSON.parse(raw);
666
+ assertNotNewerVersion(rawState, 'Gist state');
640
667
  this.state = AgentStateSchema.parse(rawState);
641
668
  }
642
669
  catch (err) {
670
+ // Not a bad payload: staying on old in-memory state would push it over the newer Gist.
671
+ if (err instanceof NewerStateVersionError)
672
+ throw err;
643
673
  warn(MODULE, `Failed to parse refreshed Gist state: ${errorMessage(err)}`);
644
674
  // Same reasoning as the missing-file branch: parse failure leaves us
645
675
  // on stale in-memory state, so flag it.
@@ -743,11 +773,13 @@ export class StateManager {
743
773
  this.autoSave();
744
774
  }
745
775
  /**
746
- * Update the local repository cache.
747
- * @param cache - Local repository cache mapping repo names to paths
776
+ * Drop the synced copy of the local repository cache. The cache is
777
+ * per-machine and lives in `local-config.json` (#1950).
748
778
  */
749
- setLocalRepoCache(cache) {
750
- this.state.localRepoCache = cache;
779
+ clearSyncedLocalRepoCache() {
780
+ if (this.state.localRepoCache === undefined)
781
+ return;
782
+ delete this.state.localRepoCache;
751
783
  this.autoSave();
752
784
  }
753
785
  // === Merged PR Storage ===
@@ -798,6 +830,8 @@ export class StateManager {
798
830
  this.state.mergedPRs.push(...newPRs);
799
831
  this.state.mergedPRs.sort((a, b) => b.mergedAt.localeCompare(a.mergedAt));
800
832
  debug(MODULE, `Added ${newPRs.length} merged PRs (total: ${this.state.mergedPRs.length})`);
833
+ // A PR that merged after being recorded closed leaves the closed ledger (#1923).
834
+ repoScoring.evictClosedPRs(this.state, []);
801
835
  this.tryReconcilePRCounts();
802
836
  this.autoSave();
803
837
  return { added: newPRs.length, dropped };
@@ -830,7 +864,8 @@ export class StateManager {
830
864
  * this prevents the bad data from reaching disk in the first place).
831
865
  *
832
866
  * Re-seen URLs upgrade the stored entry's missing ledger fields in place
833
- * (#1461) — see {@link addMergedPRs} for the full semantics.
867
+ * (#1461) — see {@link addMergedPRs} for the full semantics. URLs already
868
+ * in the merged ledger are skipped (#1923).
834
869
  *
835
870
  * @param prs - Closed PRs to add (duplicates by URL upgrade in place)
836
871
  * @returns count of entries added vs. dropped (invalid URL)
@@ -839,7 +874,10 @@ export class StateManager {
839
874
  if (prs.length === 0)
840
875
  return { added: 0, dropped: 0 };
841
876
  const { valid: unpicked, dropped } = filterValidUrlEntries(prs, 'closed');
842
- const valid = unpicked.map((pr) => this.withPick(pr));
877
+ // A merged PR is never closed-without-merge: skip it so a caller holding
878
+ // a pre-eviction copy of the closed ledger cannot put it back (#1923).
879
+ const mergedUrls = new Set(this.getMergedPRs().map((pr) => pr.url));
880
+ const valid = unpicked.filter((pr) => !mergedUrls.has(pr.url)).map((pr) => this.withPick(pr));
843
881
  if (valid.length === 0)
844
882
  return { added: 0, dropped };
845
883
  if (!this.state.closedPRs)
@@ -866,6 +904,30 @@ export class StateManager {
866
904
  this.autoSave();
867
905
  return { added: newPRs.length, dropped };
868
906
  }
907
+ /**
908
+ * Remove closed-ledger entries that are open again (`openUrls`) or sit in
909
+ * the merged ledger, lowering the affected repos' closed counts with them
910
+ * (#1923). See repoScoring.evictClosedPRs.
911
+ * @returns the number of entries removed
912
+ */
913
+ evictClosedPRs(openUrls) {
914
+ const evicted = repoScoring.evictClosedPRs(this.state, openUrls);
915
+ if (evicted > 0)
916
+ this.autoSave();
917
+ return evicted;
918
+ }
919
+ /**
920
+ * Remove ledger rows and repoScores entries for repositories in
921
+ * `config.untrackedOrgs` and for `privateRepos`, which must hold only
922
+ * repositories GitHub reported private in this run (#1924). See
923
+ * repoScoring.evictExcludedRepos.
924
+ */
925
+ evictExcludedRepos(privateRepos) {
926
+ const evicted = repoScoring.evictExcludedRepos(this.state, privateRepos);
927
+ if (evicted.untrackedOrgRows + evicted.privateRows + evicted.repos > 0)
928
+ this.autoSave();
929
+ return evicted;
930
+ }
869
931
  /** Returns the most recent close date, used as a watermark for incremental fetching. */
870
932
  getClosedPRWatermark() {
871
933
  return this.state.closedPRs?.[0]?.closedAt || undefined;
@@ -922,6 +984,22 @@ export class StateManager {
922
984
  this.autoSave();
923
985
  }
924
986
  }
987
+ /**
988
+ * Stamp a written guideline proposal on the merged or closed PR matching
989
+ * `url` (#2041). `machineId` is omitted when this machine has none.
990
+ * No-op when no PR with that URL is stored.
991
+ */
992
+ markPRLearningsProposed(url, proposedAt, machineId) {
993
+ const entry = this.state.mergedPRs?.find((pr) => pr.url === url) ?? this.state.closedPRs?.find((pr) => pr.url === url);
994
+ if (!entry)
995
+ return;
996
+ entry.learningsProposedAt = proposedAt;
997
+ if (machineId === undefined)
998
+ delete entry.learningsProposedOn;
999
+ else
1000
+ entry.learningsProposedOn = machineId;
1001
+ this.autoSave();
1002
+ }
925
1003
  // === Configuration ===
926
1004
  /**
927
1005
  * Merge partial config updates into the current configuration.
@@ -1069,18 +1147,36 @@ export class StateManager {
1069
1147
  /**
1070
1148
  * Shelve a PR URL, hiding it from daily digest and capacity.
1071
1149
  * @param url - The PR URL to shelve
1150
+ * @param reasons - The PR's action reasons right now (`shelveReasonsOf`), when known
1072
1151
  * @returns true if newly shelved, false if already shelved
1073
1152
  */
1074
- shelvePR(url) {
1153
+ shelvePR(url, reasons) {
1075
1154
  if (!this.state.config.shelvedPRUrls) {
1076
1155
  this.state.config.shelvedPRUrls = [];
1077
1156
  }
1078
- if (this.state.config.shelvedPRUrls.includes(url)) {
1079
- return false;
1157
+ // Record every shelve, a repeat included (#1922): the daily run compares
1158
+ // maintainer activity and the action reasons against this, so re-shelving
1159
+ // a PR acknowledges everything up to now.
1160
+ const now = new Date();
1161
+ this.state.config.shelvedPRInfo = {
1162
+ ...this.state.config.shelvedPRInfo,
1163
+ [issueRefKey(url) ?? url]: { at: now.toISOString(), reasons },
1164
+ };
1165
+ const isNew = this.shelvedIndex(url) === -1;
1166
+ if (isNew) {
1167
+ this.state.config.shelvedPRUrls.push(url);
1080
1168
  }
1081
- this.state.config.shelvedPRUrls.push(url);
1082
1169
  this.autoSave();
1083
- return true;
1170
+ return isNew;
1171
+ }
1172
+ /**
1173
+ * Index of a PR in `shelvedPRUrls`, matched through {@link issueRefKey} so
1174
+ * a URL typed in different casing or with a trailing slash still finds the
1175
+ * entry (#1922). -1 when not shelved.
1176
+ */
1177
+ shelvedIndex(url) {
1178
+ const key = issueRefKey(url);
1179
+ return (this.state.config.shelvedPRUrls ?? []).findIndex((u) => (key ? issueRefKey(u) === key : u === url));
1084
1180
  }
1085
1181
  /**
1086
1182
  * Unshelve a PR URL, restoring it to daily digest.
@@ -1088,24 +1184,38 @@ export class StateManager {
1088
1184
  * @returns true if removed from shelf, false if not shelved
1089
1185
  */
1090
1186
  unshelvePR(url) {
1091
- if (!this.state.config.shelvedPRUrls) {
1092
- return false;
1093
- }
1094
- const index = this.state.config.shelvedPRUrls.indexOf(url);
1187
+ const index = this.shelvedIndex(url);
1095
1188
  if (index === -1) {
1096
1189
  return false;
1097
1190
  }
1098
1191
  this.state.config.shelvedPRUrls.splice(index, 1);
1192
+ if (this.state.config.shelvedPRInfo) {
1193
+ delete this.state.config.shelvedPRInfo[issueRefKey(url) ?? url];
1194
+ }
1099
1195
  this.autoSave();
1100
1196
  return true;
1101
1197
  }
1198
+ /**
1199
+ * Fill in the action reasons of a shelve record that has none yet (#1922):
1200
+ * the PR was not in the digest when it was shelved, so the first daily run
1201
+ * that sees it records them. Never changes reasons already recorded: a
1202
+ * reason that clears and comes back was there at shelve time and is not
1203
+ * new. No-op for a PR without a shelve record.
1204
+ */
1205
+ fillShelvedPRReasons(url, reasons) {
1206
+ const info = this.state.config.shelvedPRInfo?.[issueRefKey(url) ?? url];
1207
+ if (!info || info.reasons)
1208
+ return;
1209
+ info.reasons = reasons;
1210
+ this.autoSave();
1211
+ }
1102
1212
  /**
1103
1213
  * Check if a PR is currently shelved.
1104
1214
  * @param url - The PR URL to check
1105
1215
  * @returns true if the PR is shelved
1106
1216
  */
1107
1217
  isPRShelved(url) {
1108
- return this.state.config.shelvedPRUrls?.includes(url) ?? false;
1218
+ return this.shelvedIndex(url) !== -1;
1109
1219
  }
1110
1220
  // === Dismiss / Undismiss Issues ===
1111
1221
  /**
@@ -1127,11 +1237,14 @@ export class StateManager {
1127
1237
  if (!this.state.config.dismissedIssues) {
1128
1238
  this.state.config.dismissedIssues = {};
1129
1239
  }
1130
- if (url in this.state.config.dismissedIssues && !options.refresh) {
1240
+ // An existing entry for the same issue or PR keeps its key (#2001).
1241
+ const existing = findRefKey(this.state.config.dismissedIssues, url);
1242
+ if (existing !== undefined && !options.refresh) {
1131
1243
  return false;
1132
1244
  }
1133
- this.state.config.dismissedIssues[url] = timestamp;
1134
- this.setDismissedPRHead(url, options.headSha);
1245
+ const key = existing ?? url;
1246
+ this.state.config.dismissedIssues[key] = timestamp;
1247
+ this.setDismissedPRHead(key, options.headSha);
1135
1248
  this.autoSave();
1136
1249
  return true;
1137
1250
  }
@@ -1142,11 +1255,12 @@ export class StateManager {
1142
1255
  * @returns true if undismissed, false if not currently dismissed
1143
1256
  */
1144
1257
  undismissIssue(url) {
1145
- if (!this.state.config.dismissedIssues || !(url in this.state.config.dismissedIssues)) {
1258
+ const key = findRefKey(this.state.config.dismissedIssues, url);
1259
+ if (key === undefined) {
1146
1260
  return false;
1147
1261
  }
1148
- delete this.state.config.dismissedIssues[url];
1149
- this.setDismissedPRHead(url, undefined);
1262
+ delete this.state.config.dismissedIssues[key];
1263
+ this.setDismissedPRHead(key, undefined);
1150
1264
  this.autoSave();
1151
1265
  return true;
1152
1266
  }
@@ -1155,7 +1269,9 @@ export class StateManager {
1155
1269
  * @param url - The issue URL to check
1156
1270
  */
1157
1271
  getIssueDismissedAt(url) {
1158
- return this.state.config.dismissedIssues?.[url];
1272
+ const dismissed = this.state.config.dismissedIssues;
1273
+ const key = findRefKey(dismissed, url);
1274
+ return key === undefined ? undefined : dismissed[key];
1159
1275
  }
1160
1276
  /**
1161
1277
  * The head SHA recorded when a reviewed PR's follow-up was dismissed
@@ -1164,17 +1280,23 @@ export class StateManager {
1164
1280
  * @param url - The PR URL to check
1165
1281
  */
1166
1282
  getDismissedPRHead(url) {
1167
- return this.state.config.dismissedPRHeads?.[url];
1283
+ const heads = this.state.config.dismissedPRHeads;
1284
+ const key = findRefKey(heads, url);
1285
+ return key === undefined ? undefined : heads[key];
1168
1286
  }
1169
- /** Record or (with `undefined`) drop the dismiss head for `url`; no save. */
1287
+ /**
1288
+ * Record or (with `undefined`) drop the dismiss head for `url`, replacing
1289
+ * any head stored under another form of the same PR's URL (#2001); no save.
1290
+ */
1170
1291
  setDismissedPRHead(url, headSha) {
1171
1292
  if (!this.state.config.dismissedPRHeads) {
1172
1293
  this.state.config.dismissedPRHeads = {};
1173
1294
  }
1174
- if (headSha === undefined) {
1175
- delete this.state.config.dismissedPRHeads[url];
1295
+ const existing = findRefKey(this.state.config.dismissedPRHeads, url);
1296
+ if (existing !== undefined) {
1297
+ delete this.state.config.dismissedPRHeads[existing];
1176
1298
  }
1177
- else {
1299
+ if (headSha !== undefined) {
1178
1300
  this.state.config.dismissedPRHeads[url] = headSha;
1179
1301
  }
1180
1302
  }
@@ -1344,11 +1466,29 @@ export class StateManager {
1344
1466
  }
1345
1467
  return released;
1346
1468
  }
1469
+ /**
1470
+ * Record a PR the tool just opened (#1911) so the pacing caps count it
1471
+ * before the next `daily`. Idempotent per URL (the first open time is
1472
+ * kept); entries older than the 24-hour window are pruned in the same write.
1473
+ * @returns true when the PR was not recorded yet
1474
+ */
1475
+ recordNewPR(url, nowMs = Date.now()) {
1476
+ const key = url.toLowerCase();
1477
+ // A stamp from a host whose clock runs ahead is stored as now, so it ages out like the others.
1478
+ const kept = (this.state.recentNewPRs ?? [])
1479
+ .map((e) => (Date.parse(e.openedAt) > nowMs ? { ...e, openedAt: isoAt(nowMs) } : e))
1480
+ .filter((e) => Date.parse(e.openedAt) > nowMs - PACING_WINDOW_MS);
1481
+ const isNew = kept.every((e) => e.url.toLowerCase() !== key);
1482
+ this.state.recentNewPRs = isNew ? [...kept, { url, openedAt: isoAt(nowMs) }] : kept;
1483
+ this.autoSave();
1484
+ return isNew;
1485
+ }
1347
1486
  setStatusOverride(url, status, lastActivityAt) {
1348
1487
  if (!this.state.config.statusOverrides) {
1349
1488
  this.state.config.statusOverrides = {};
1350
1489
  }
1351
- this.state.config.statusOverrides[url] = {
1490
+ // An existing override for the same PR keeps its key (#2001).
1491
+ this.state.config.statusOverrides[findRefKey(this.state.config.statusOverrides, url) ?? url] = {
1352
1492
  status,
1353
1493
  setAt: new Date().toISOString(),
1354
1494
  lastActivityAt,
@@ -1361,10 +1501,11 @@ export class StateManager {
1361
1501
  * @returns true if an override was removed, false if none existed
1362
1502
  */
1363
1503
  clearStatusOverride(url) {
1364
- if (!this.state.config.statusOverrides || !(url in this.state.config.statusOverrides)) {
1504
+ const key = findRefKey(this.state.config.statusOverrides, url);
1505
+ if (!this.state.config.statusOverrides || key === undefined) {
1365
1506
  return false;
1366
1507
  }
1367
- delete this.state.config.statusOverrides[url];
1508
+ delete this.state.config.statusOverrides[key];
1368
1509
  this.autoSave();
1369
1510
  return true;
1370
1511
  }
@@ -1375,7 +1516,9 @@ export class StateManager {
1375
1516
  * @returns The override if still valid, undefined otherwise
1376
1517
  */
1377
1518
  getStatusOverride(url, currentUpdatedAt) {
1378
- const override = this.state.config.statusOverrides?.[url];
1519
+ const overrides = this.state.config.statusOverrides;
1520
+ const key = findRefKey(overrides, url);
1521
+ const override = key === undefined ? undefined : overrides?.[key];
1379
1522
  if (!override)
1380
1523
  return undefined;
1381
1524
  // Auto-clear if the PR has new activity since the override was set
@@ -1403,6 +1546,19 @@ export class StateManager {
1403
1546
  repoScoring.updateRepoScore(this.state, repo, updates);
1404
1547
  this.autoSave();
1405
1548
  }
1549
+ /** Record each repo's outcome evidence; see repoScoring.restoreUnchangedEvaluations. */
1550
+ snapshotRepoOutcomes() {
1551
+ return repoScoring.snapshotOutcomes(this.state);
1552
+ }
1553
+ /**
1554
+ * Put back `lastEvaluatedAt` for repos whose outcome evidence ends where
1555
+ * `snapshot` found it, so a count written in several steps that nets to no
1556
+ * change does not count as a re-evaluation (#2045).
1557
+ */
1558
+ restoreUnchangedEvaluations(snapshot) {
1559
+ if (repoScoring.restoreUnchangedEvaluations(this.state, snapshot) > 0)
1560
+ this.autoSave();
1561
+ }
1406
1562
  /** Returns repository names that have at least one merged PR. */
1407
1563
  getReposWithMergedPRs() {
1408
1564
  return repoScoring.getReposWithMergedPRs(this.state);
@@ -1604,7 +1760,9 @@ export async function ensureGistPersistence(token) {
1604
1760
  function peekGistArtifacts() {
1605
1761
  try {
1606
1762
  const raw = fs.readFileSync(getStateCachePath(), 'utf8');
1607
- return JSON.parse(raw)?.config?.persistence === 'gist' ? 'gist' : 'local';
1763
+ return JSON.parse(raw)?.config?.persistence === 'gist'
1764
+ ? 'gist'
1765
+ : 'local';
1608
1766
  }
1609
1767
  catch (err) {
1610
1768
  if (err.code !== 'ENOENT') {
@@ -1620,6 +1778,37 @@ function peekGistArtifacts() {
1620
1778
  return 'unreadable';
1621
1779
  }
1622
1780
  }
1781
+ /**
1782
+ * The warning for a persistence mode a newer release wrote (#2005), or null.
1783
+ * {@link ensureGistPersistence} reads such a mode as `'local-mode'`, so entry
1784
+ * points add this to their output: writes will not reach the Gist the newer
1785
+ * client syncs through. Reads state.json, or the state cache when state.json
1786
+ * is absent, as ensureGistPersistence does; any other read failure is that
1787
+ * function's to report.
1788
+ */
1789
+ export function unknownPersistenceModeWarning() {
1790
+ for (const file of [getStatePath(), getStateCachePath()]) {
1791
+ let raw;
1792
+ try {
1793
+ raw = fs.readFileSync(file, 'utf8');
1794
+ }
1795
+ catch (err) {
1796
+ if (err.code === 'ENOENT')
1797
+ continue;
1798
+ return null;
1799
+ }
1800
+ let parsed;
1801
+ try {
1802
+ parsed = JSON.parse(raw);
1803
+ }
1804
+ catch {
1805
+ return null;
1806
+ }
1807
+ const mode = parsed?.config?.persistence;
1808
+ return typeof mode === 'string' && mode !== 'local' && mode !== 'gist' ? renderUnknownModeWarning(mode) : null;
1809
+ }
1810
+ return null;
1811
+ }
1623
1812
  /**
1624
1813
  * Best-effort gist bootstrap for entry points WITHOUT the auth gate (#1431):
1625
1814
  * the CLI's localOnly commands (shelve/move/dismiss/override/config/setup/...)
@@ -1659,13 +1848,17 @@ export async function bootstrapGistBestEffort(fetchToken) {
1659
1848
  if (err instanceof GistFileSizeError) {
1660
1849
  reason = `Gist initialization failed (${errorMessage(err)}). To fix it, ${GIST_FILE_SIZE_REMEDY}.`;
1661
1850
  }
1662
- else if (err instanceof ConfigurationError) {
1851
+ else if (err instanceof ConfigurationError &&
1852
+ !(err instanceof GistDiscoveryError) &&
1853
+ !(err instanceof NewerStateVersionError)) {
1854
+ // A GistDiscoveryError or a newer-version error carries its own remedy; the scope hint would mislead (#1926).
1663
1855
  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`;
1664
1856
  }
1665
1857
  cause = { reason };
1666
1858
  }
1859
+ // Local mode, or a mode a newer release added, which runs local (#2005).
1667
1860
  if (cause === null)
1668
- return null;
1861
+ return unknownPersistenceModeWarning();
1669
1862
  return renderGistWarning(cause);
1670
1863
  }
1671
1864
  /**
@@ -105,6 +105,25 @@ function isChangesAddressedByCommit(commitDate, changesRequestedDate) {
105
105
  return false;
106
106
  return commitMs >= changesRequestedMs;
107
107
  }
108
+ /**
109
+ * Whether approval settles every unanswered maintainer comment, so the PR is
110
+ * just waiting to be merged (#1507): it is approved, CI is passing or unknown,
111
+ * and each comment's author has a standing approval submitted at or after that
112
+ * comment (the approving review's own note, or feedback its author then
113
+ * approved). Someone else's approval never settles a comment, and neither does
114
+ * the commenter's own earlier approval: both leave a question nobody answered
115
+ * (#1920).
116
+ *
117
+ * Fails closed (returns `false`) when the comments are not listed or a date is
118
+ * missing or unparseable: the safe direction is to surface the comment.
119
+ */
120
+ function isCommentSettledByApproval(input) {
121
+ const { reviewDecision, ciStatus, unansweredComments = [] } = input;
122
+ if (reviewDecision !== 'approved' || (ciStatus !== 'passing' && ciStatus !== 'unknown'))
123
+ return false;
124
+ return (unansweredComments.length > 0 &&
125
+ unansweredComments.every((c) => normalizeToEpochMs(c.createdAt) <= normalizeToEpochMs(c.authorApprovalDate)));
126
+ }
108
127
  /**
109
128
  * Collect all applicable action reasons independently, without short-circuiting (#675).
110
129
  * Used alongside the priority-based decision tree to surface secondary issues.
@@ -118,12 +137,10 @@ function collectAllActionReasons(input) {
118
137
  const { ciStatus, hasMergeConflict, hasUnrespondedComment, reviewDecision, lastMaintainerCommentDate, latestChangesRequestedDate, hasActionableCIFailure = true, } = input;
119
138
  const commitDate = resolveContributorCommitDate(input);
120
139
  const reasons = [];
121
- // An unresponded maintainer comment on an already-approved, passing/unknown
122
- // PR is an approval/LGTM note, not a request for action — it needs no
123
- // contributor response and the PR is just awaiting merge (#1507).
124
- const approvedAndMergeable = reviewDecision === 'approved' && (ciStatus === 'passing' || ciStatus === 'unknown');
140
+ // Unresponded maintainer comments their authors' approvals settle need no
141
+ // contributor response: the PR is just awaiting merge (#1507, #1920).
125
142
  if (hasUnrespondedComment &&
126
- !approvedAndMergeable &&
143
+ !isCommentSettledByApproval(input) &&
127
144
  !isCommentAddressedByCommit(commitDate, lastMaintainerCommentDate, latestChangesRequestedDate)) {
128
145
  reasons.push('needs_response');
129
146
  }
@@ -177,6 +194,16 @@ function determinePrimaryStatus(input) {
177
194
  const commitDate = resolveContributorCommitDate(input);
178
195
  // Priority order: needs_addressing (response/changes/ci/conflict/checklist) > waiting_on_maintainer (review/merge/addressed/ci_blocked)
179
196
  if (hasUnrespondedComment) {
197
+ // An unresponded comment its own author's approval settles is an
198
+ // approval/LGTM note (e.g. a re-approval dated after the contributor's last
199
+ // commit), not a request for changes. It needs no contributor response, so
200
+ // the PR is waiting to be merged: don't trap it in needs_response (#1507).
201
+ // Any other comment on an approved PR still needs one (#1920). Checked
202
+ // before the addressed-by-commit branch: once the commenter has approved
203
+ // the commit that answered them, the PR awaits merge, not re-review (#2044).
204
+ if (isCommentSettledByApproval(input)) {
205
+ return { status: 'waiting_on_maintainer', waitReason: 'pending_merge', stalenessTier };
206
+ }
180
207
  if (isCommentAddressedByCommit(commitDate, lastMaintainerCommentDate, latestChangesRequestedDate)) {
181
208
  if (ciStatus === 'failing' && hasActionableCIFailure)
182
209
  return { status: 'needs_addressing', actionReason: 'failing_ci', stalenessTier };
@@ -184,13 +211,6 @@ function determinePrimaryStatus(input) {
184
211
  // the contributor can't fix them, so the relevant status is "waiting for re-review" (#502)
185
212
  return { status: 'waiting_on_maintainer', waitReason: 'changes_addressed', stalenessTier };
186
213
  }
187
- // An unresponded comment on an already-approved, passing/unknown PR is an
188
- // approval/LGTM note (e.g. a re-approval dated after the contributor's last
189
- // commit), not a request for changes. It needs no contributor response, so
190
- // the PR is waiting to be merged — don't trap it in needs_response (#1507).
191
- if (reviewDecision === 'approved' && (ciStatus === 'passing' || ciStatus === 'unknown')) {
192
- return { status: 'waiting_on_maintainer', waitReason: 'pending_merge', stalenessTier };
193
- }
194
214
  return { status: 'needs_addressing', actionReason: 'needs_response', stalenessTier };
195
215
  }
196
216
  // Review requested changes but no unresponded comment.
@@ -13,6 +13,7 @@
13
13
  * doing X well, here's a growth opportunity") stays in the agent
14
14
  * prompt.
15
15
  */
16
+ import { findRefKey } from './urls.js';
16
17
  /** Minimum tracked PR history before strategy output is meaningful (#1243). */
17
18
  export const STRATEGY_MIN_PRS = 10;
18
19
  /** How many top-N items each "primary" / "favorite" list returns. */
@@ -133,7 +134,8 @@ function activityAt(pr) {
133
134
  function effectiveStatus(pr, state) {
134
135
  if (typeof pr.url !== 'string')
135
136
  return pr.status;
136
- const override = state.config.statusOverrides?.[pr.url];
137
+ const overrides = state.config.statusOverrides;
138
+ const override = overrides?.[findRefKey(overrides, pr.url) ?? pr.url];
137
139
  if (!override)
138
140
  return pr.status;
139
141
  const lastActivity = activityAt(pr);
@@ -2,7 +2,7 @@
2
2
  * Core types for the Open Source Contribution Agent
3
3
  */
4
4
  import type { FetchedPRStatus, RepoSignals, TrackedIssue, IssueVettingResult, IssueScope, DiffTool, AgentConfig, AgentState } from './state-schema.js';
5
- export type { IssueStatus, FetchedPRStatus, ProjectCategory, IssueScope, DiffTool, RepoSignals, RepoScore, StoredMergedPR, StoredClosedPR, AnalyzedIssueConversation, ContributionGuidelines, IssueVettingResult, TrackedIssue, ShelvedPRRef, StatusOverride, AgentConfig, LocalRepoCache, ClosedPR, MergedPR, DailyDigest, AgentState, SearchSeenEntry, PickSnapshot, OvernightPrepared, OvernightRecord, OvernightImplementAttempt, SearchRotation, WorkClaim, WorkClaimKind, WorkClaimStatus, } from './state-schema.js';
5
+ export type { IssueStatus, FetchedPRStatus, ProjectCategory, IssueScope, DiffTool, RepoSignals, RepoScore, StoredMergedPR, StoredClosedPR, ContributionGuidelines, IssueVettingResult, TrackedIssue, ShelvedPRRef, StatusOverride, AgentConfig, LocalRepoCache, ClosedPR, MergedPR, DailyDigest, AgentState, SearchSeenEntry, PickSnapshot, OvernightPrepared, OvernightRecord, OvernightImplementAttempt, SearchRotation, WorkClaim, WorkClaimKind, WorkClaimStatus, } from './state-schema.js';
6
6
  /** CI pipeline status for a PR's latest commit. */
7
7
  export type CIStatus = 'passing' | 'failing' | 'pending' | 'unknown';
8
8
  /**
@@ -98,6 +98,16 @@ export interface DetermineStatusInput {
98
98
  contributorUsername?: string;
99
99
  lastMaintainerCommentDate?: string;
100
100
  latestChangesRequestedDate?: string;
101
+ /**
102
+ * Every unanswered maintainer comment, each with the time its author
103
+ * submitted their own standing approval, if they have one. On an approved PR
104
+ * a comment still needs a response unless its author approved at or after
105
+ * writing it (#1920).
106
+ */
107
+ unansweredComments?: Array<{
108
+ createdAt: string;
109
+ authorApprovalDate?: string;
110
+ }>;
101
111
  /** True if at least one failing CI check is classified as 'actionable'. */
102
112
  hasActionableCIFailure?: boolean;
103
113
  }
@@ -381,7 +391,18 @@ export declare const INITIAL_STATE: AgentState;
381
391
  export declare const PROJECT_CATEGORIES: ("nonprofit" | "devtools" | "infrastructure" | "web-frameworks" | "data-ml" | "education")[];
382
392
  export declare const ISSUE_SCOPES: ("advanced" | "beginner" | "intermediate")[];
383
393
  export declare const DIFF_TOOLS: readonly DiffTool[];
394
+ /** @deprecated Since #1948; nothing reads it. Will be removed in the next major version. */
384
395
  export declare const SCOPE_LABELS: Record<IssueScope, string[]>;
396
+ /**
397
+ * Shape of the retired `analyzedIssueConversations` state entries.
398
+ *
399
+ * @deprecated Since #1948; the state field is no longer read or written. Will be removed in the next major version.
400
+ */
401
+ export interface AnalyzedIssueConversation {
402
+ url: string;
403
+ repo: string;
404
+ analyzedAt: string;
405
+ }
385
406
  /** Priority tier for issue search results. Ordered: merged_pr > preferred_org > starred > normal. */
386
407
  export type SearchPriority = 'merged_pr' | 'preferred_org' | 'starred' | 'normal';
387
408
  export interface IssueCandidate {