@defrex/autobuild 1.6.0 → 1.8.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/README.md +1 -1
- package/SPEC.md +423 -57
- package/docs/agent-runtimes.md +1 -1
- package/docs/answering-blocked-builds.md +44 -3
- package/docs/architecture.md +124 -29
- package/docs/cli.md +1 -0
- package/docs/configuration-overview.md +11 -1
- package/docs/configuration.md +334 -14
- package/docs/dispatcher.md +1 -1
- package/docs/forges.md +1 -0
- package/docs/integration-overview.md +2 -2
- package/docs/integration-tree.md +7 -4
- package/docs/merge-policy.md +78 -6
- package/docs/migration-1.0.md +4 -2
- package/docs/operating.md +3 -2
- package/docs/operator-api.md +45 -13
- package/docs/operator-surfaces.md +16 -3
- package/docs/plugin-authoring.md +45 -7
- package/docs/remote-store-protocol.md +28 -7
- package/docs/restacking.md +35 -11
- package/docs/ticket-dependencies.md +9 -4
- package/docs/ticket-sources.md +34 -6
- package/docs/tickets.md +7 -1
- package/docs/troubleshooting.md +1 -1
- package/docs/workspaces.md +1 -1
- package/package.json +3 -3
- package/packages/core/src/cli/attention.ts +2 -0
- package/packages/core/src/cli/binary-direct.ts +1 -0
- package/packages/core/src/cli/build-control.ts +65 -7
- package/packages/core/src/cli/context.ts +55 -14
- package/packages/core/src/cli/dashboard/actions.ts +13 -4
- package/packages/core/src/cli/dashboard/landing-display.ts +32 -8
- package/packages/core/src/cli/dashboard/model.ts +61 -8
- package/packages/core/src/cli/dashboard/render.ts +28 -3
- package/packages/core/src/cli/dashboard/tree.ts +9 -1
- package/packages/core/src/cli/dispatch-frontend.ts +10 -14
- package/packages/core/src/cli/dispatch-preflight.ts +1 -0
- package/packages/core/src/cli/dispatch-repository-feed.ts +145 -109
- package/packages/core/src/cli/dispatch.ts +9 -3
- package/packages/core/src/cli/help.ts +80 -11
- package/packages/core/src/cli/init-validation.ts +14 -1
- package/packages/core/src/cli/landings.ts +1 -1
- package/packages/core/src/cli/main.ts +60 -9
- package/packages/core/src/cli/publication-settlement.ts +10 -0
- package/packages/core/src/cli/repository-status.ts +37 -2
- package/packages/core/src/cli/status.ts +186 -12
- package/packages/core/src/cli/terminals.ts +197 -4
- package/packages/core/src/cli/ticket.ts +22 -4
- package/packages/core/src/cli/wait.ts +1 -0
- package/packages/core/src/cli/watch.ts +73 -0
- package/packages/core/src/config/landing.ts +12 -0
- package/packages/core/src/config/live.ts +4 -0
- package/packages/core/src/config/path-selectors.ts +68 -0
- package/packages/core/src/config/profiles.ts +96 -0
- package/packages/core/src/config/ready-assignee.ts +43 -11
- package/packages/core/src/config/roles.ts +33 -10
- package/packages/core/src/config/schema.ts +205 -81
- package/packages/core/src/events/catalog.ts +17 -3
- package/packages/core/src/events/compatibility.ts +4 -1
- package/packages/core/src/events/forge-degradation-policy.ts +16 -2
- package/packages/core/src/events/head-paths-limits.ts +25 -0
- package/packages/core/src/events/payloads.ts +323 -20
- package/packages/core/src/events/policy.ts +22 -0
- package/packages/core/src/events/repository.ts +47 -1
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +320 -130
- package/packages/core/src/kernel/build-creation.ts +29 -0
- package/packages/core/src/kernel/consent-revocation.ts +72 -0
- package/packages/core/src/kernel/dispatch-capacity.ts +19 -8
- package/packages/core/src/kernel/engine.ts +48 -8
- package/packages/core/src/kernel/forge-health.ts +47 -0
- package/packages/core/src/kernel/guarded-forge.ts +76 -18
- package/packages/core/src/kernel/head-paths-state.ts +63 -0
- package/packages/core/src/kernel/head-paths.ts +401 -0
- package/packages/core/src/kernel/landing-policy-identity.ts +20 -0
- package/packages/core/src/kernel/landing-policy.ts +55 -2
- package/packages/core/src/kernel/landing-readiness.ts +104 -9
- package/packages/core/src/kernel/landing-state.ts +44 -4
- package/packages/core/src/kernel/leaf-restack-state.ts +50 -2
- package/packages/core/src/kernel/log-index.ts +27 -1
- package/packages/core/src/kernel/node-parent.ts +2 -0
- package/packages/core/src/kernel/node-polling.ts +13 -3
- package/packages/core/src/kernel/node-restack-state.ts +8 -1
- package/packages/core/src/kernel/node-restack-transaction.ts +45 -0
- package/packages/core/src/kernel/read-deferrals.ts +3 -1
- package/packages/core/src/kernel/read-facts.ts +37 -2
- package/packages/core/src/kernel/reducer-registry.ts +22 -1
- package/packages/core/src/kernel/reducer.ts +332 -16
- package/packages/core/src/kernel/target-observation.ts +2 -5
- package/packages/core/src/kernel/terminal-guard.ts +52 -3
- package/packages/core/src/kernel/ticket-handbacks.ts +40 -0
- package/packages/core/src/kernel/ticket-preparation.ts +15 -1
- package/packages/core/src/kernel/ticket-wait.ts +345 -0
- package/packages/core/src/kernel/verify-applicability.ts +9 -19
- package/packages/core/src/ontology.ts +1 -0
- package/packages/core/src/operator/annotations.ts +6 -0
- package/packages/core/src/operator/index.ts +3 -0
- package/packages/core/src/operator/protocol.ts +25 -2
- package/packages/core/src/operator/query.ts +1 -1
- package/packages/core/src/operator/registry.ts +122 -10
- package/packages/core/src/operator/repository-events.ts +67 -0
- package/packages/core/src/operator/sandbox-host.ts +3 -0
- package/packages/core/src/operator/tickets.ts +15 -3
- package/packages/core/src/plugin-sdk/index.ts +4 -0
- package/packages/core/src/ports/forge/create.ts +6 -0
- package/packages/core/src/ports/forge/github-transport.ts +40 -3
- package/packages/core/src/ports/forge/github.ts +12 -1
- package/packages/core/src/ports/forge/workspace-ancestry.ts +60 -0
- package/packages/core/src/ports/forge-failure.ts +31 -2
- package/packages/core/src/ports/runner/routing.ts +66 -5
- package/packages/core/src/ports/tickets/assignees.ts +54 -0
- package/packages/core/src/ports/tickets/contract.ts +164 -4
- package/packages/core/src/ports/tickets/create.ts +17 -3
- package/packages/core/src/ports/tickets/fake.ts +5 -0
- package/packages/core/src/ports/tickets/github-fake.ts +18 -2
- package/packages/core/src/ports/tickets/github.ts +247 -29
- package/packages/core/src/ports/tickets/hosted-index.ts +1 -0
- package/packages/core/src/ports/tickets/operations.ts +6 -1
- package/packages/core/src/ports/tickets/tree.ts +12 -2
- package/packages/core/src/ports/tickets/update.ts +6 -2
- package/packages/core/src/ports/types.ts +36 -5
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +9 -0
- package/packages/core/src/processes/build-child.ts +28 -7
- package/packages/core/src/processes/build-execution-state.ts +34 -2
- package/packages/core/src/processes/build-runner.ts +165 -19
- package/packages/core/src/processes/dispatcher.ts +837 -115
- package/packages/core/src/processes/execution-no-progress.ts +22 -2
- package/packages/core/src/processes/harvest-child.ts +4 -0
- package/packages/core/src/processes/harvest-runner.ts +5 -0
- package/packages/core/src/processes/phase-failure-budget.ts +1 -0
- package/packages/core/src/processes/publication-state.ts +6 -1
- package/packages/core/src/processes/repo-view.ts +2 -0
- package/packages/core/src/scenarios/harness.ts +15 -1
- package/packages/core/src/store/digest.ts +41 -2
- package/packages/core/src/store/reduced-reads.ts +4 -1
- package/packages/core/src/store/reducer-value-shapes.json +10310 -8441
- package/packages/core/src/store/remote/client.ts +49 -10
- package/packages/core/src/store/remote/index.ts +4 -0
- package/packages/core/src/store/remote/protocol.ts +18 -1
- package/packages/core/src/store/remote/released-clients.json +22 -0
- package/packages/core/src/store/remote/released-reducer-values/1.7.0.json +27366 -0
- package/packages/core/src/store/remote/released-reducer-values/1.8.0.json +29043 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +4 -0
- package/packages/core/src/store/repo-state-events.ts +3 -0
- package/packages/core/src/store/types.ts +27 -0
- package/packages/core/src/testing/dispatch-read-budget.ts +84 -58
- package/packages/core/src/testing/index.ts +2 -0
- package/packages/core/src/testing/reduced-read-budget.ts +419 -9
- package/skills/code-review/SKILL.md +8 -0
- package/skills/finalize/SKILL.md +4 -0
- package/skills/guide/SKILL.md +241 -47
- package/skills/guide/references/integration-tree.md +7 -4
- package/skills/guide/references/merge-policy.md +78 -6
- package/skills/guide/references/migration-1.0.md +4 -2
- package/skills/guide/references/operator-api.md +45 -13
- package/skills/guide/references/plugin-authoring.md +45 -7
- package/skills/guide/references/remote-store-protocol.md +28 -7
- package/skills/guide/references/restacking.md +35 -11
- package/skills/guide/references/ticket-dependencies.md +9 -4
- package/skills/implement/SKILL.md +15 -1
- package/skills/operate/SKILL.md +133 -16
- package/skills/plan/SKILL.md +17 -2
- package/skills/plan-review/SKILL.md +8 -0
- package/skills/reconcile/SKILL.md +21 -5
- package/skills/tickets/SKILL.md +23 -6
- package/templates/hosted-service/package.json +2 -2
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { proveTargetLineage } from '../kernel/target-lineage'
|
|
2
|
+
import {
|
|
3
|
+
computeHeadPaths,
|
|
4
|
+
headPathsFor,
|
|
5
|
+
headPathsWrite,
|
|
6
|
+
readHeadPaths,
|
|
7
|
+
type HeadPathsArtifact,
|
|
8
|
+
} from '../kernel/head-paths'
|
|
2
9
|
import {
|
|
3
10
|
isRepositoryAuthorityLapse,
|
|
4
11
|
RepositoryAuthorityLapsed,
|
|
@@ -55,6 +62,7 @@ import {
|
|
|
55
62
|
MixedVersionDeferral,
|
|
56
63
|
} from '../kernel/mixed-version'
|
|
57
64
|
import { guardForge, ForgeCooldown } from '../kernel/guarded-forge'
|
|
65
|
+
import { leafLandingDeclineReason } from '../kernel/landing-readiness'
|
|
58
66
|
import {
|
|
59
67
|
escalationsBeyondJanitor,
|
|
60
68
|
janitorBlocked,
|
|
@@ -82,7 +90,18 @@ import {
|
|
|
82
90
|
slotRequest,
|
|
83
91
|
type CapacityBuild,
|
|
84
92
|
} from '../kernel/dispatch-capacity'
|
|
93
|
+
import {
|
|
94
|
+
openTicketWait,
|
|
95
|
+
pendingWaitRequest,
|
|
96
|
+
ticketWaitRelease,
|
|
97
|
+
waitParked,
|
|
98
|
+
waitReleasedText,
|
|
99
|
+
waitResumeDue,
|
|
100
|
+
waitUnresolvableQuestion,
|
|
101
|
+
} from '../kernel/ticket-wait'
|
|
102
|
+
import { changeBlockers } from '../ports/tickets/operations'
|
|
85
103
|
import { evaluateLandingPolicy } from '../kernel/landing-policy'
|
|
104
|
+
import { landingPolicyIdentity } from '../kernel/landing-policy-identity'
|
|
86
105
|
import {
|
|
87
106
|
landingAuthorized,
|
|
88
107
|
nativeLandingApplied,
|
|
@@ -181,13 +200,21 @@ import type { Config } from '../config/schema'
|
|
|
181
200
|
import { DISPATCHER, KERNEL, agentActor } from '../events/envelope'
|
|
182
201
|
import { isRemoteWorkspace } from '../events/workspace-remote'
|
|
183
202
|
import type { AbEvent, EventWrite } from '../events/catalog'
|
|
184
|
-
import type { EventPayload, PinnedAsset } from '../events/payloads'
|
|
203
|
+
import type { AbortDestination, EventPayload, PinnedAsset } from '../events/payloads'
|
|
204
|
+
import type { RepositoryEventPayload } from '../events/repository'
|
|
205
|
+
import { handbackIdentity } from '../kernel/ticket-handbacks'
|
|
185
206
|
import type { IdSource } from '../ids'
|
|
186
207
|
import { recordAutoMergeDeferralObservation } from '../kernel/auto-merge'
|
|
187
208
|
import type { AutoMergeDefaultFact } from '../kernel/auto-merge-default'
|
|
188
209
|
import { decideNextFromFacts, landingRestackDue } from '../kernel/engine'
|
|
189
210
|
import { composeBuildConfig } from '../config/live'
|
|
190
|
-
import {
|
|
211
|
+
import { profileConflictDiagnostic, selectProfile } from '../config/profiles'
|
|
212
|
+
import {
|
|
213
|
+
BUILD_EFFECTIVE_CONFIG_ARTIFACT,
|
|
214
|
+
EffectivePipelineUnreadable,
|
|
215
|
+
parseEffectiveBuildConfig,
|
|
216
|
+
readEffectivePipeline,
|
|
217
|
+
} from './build-execution-state'
|
|
191
218
|
import {
|
|
192
219
|
DEFAULT_MAX_HARVEST_RECOVERY_ATTEMPTS,
|
|
193
220
|
decideHarvestControl,
|
|
@@ -213,7 +240,15 @@ import {
|
|
|
213
240
|
nodeIssueLinksSyncPending,
|
|
214
241
|
} from '../kernel/node-issue-links'
|
|
215
242
|
import type { Exec, ExecResult } from '../ports/workspace/git-worktree'
|
|
216
|
-
import type {
|
|
243
|
+
import type {
|
|
244
|
+
ArtifactMeta,
|
|
245
|
+
BuildDigest,
|
|
246
|
+
BuildDigestTicketWait,
|
|
247
|
+
BuildRecord,
|
|
248
|
+
BuildStore,
|
|
249
|
+
Clock,
|
|
250
|
+
} from '../store/types'
|
|
251
|
+
import { creationBuildSlug } from '../kernel/build-creation'
|
|
217
252
|
import { preparePinnedAssets } from '../store/ticket-assets'
|
|
218
253
|
import { resolveRepoOrigin } from '../cli/repo-state'
|
|
219
254
|
import { specConformance } from '../spec-standard'
|
|
@@ -871,7 +906,10 @@ export class Dispatcher {
|
|
|
871
906
|
return nodeTicketObservationKey(state, await this.nodePollingChildren(slug))
|
|
872
907
|
}
|
|
873
908
|
private async nodePollingChildren(slug: string, refresh = false) {
|
|
874
|
-
const children: {
|
|
909
|
+
const children: {
|
|
910
|
+
slug: string
|
|
911
|
+
state: Pick<BuildState, 'pollingActivity'>
|
|
912
|
+
}[] = []
|
|
875
913
|
for (const { record, digest } of await this.repoBuildDigests()) {
|
|
876
914
|
if (record.slug === slug) continue
|
|
877
915
|
// The digest names every node a build ever targeted, so a build it does
|
|
@@ -979,23 +1017,29 @@ export class Dispatcher {
|
|
|
979
1017
|
}
|
|
980
1018
|
}
|
|
981
1019
|
if (pinned === undefined) {
|
|
982
|
-
let
|
|
983
|
-
if (artifact === null) {
|
|
984
|
-
this.sweepPins.delete(slug)
|
|
985
|
-
return decideNextFromFacts(state, log, this.deps.config)
|
|
986
|
-
}
|
|
987
|
-
revision = artifact.meta.revision
|
|
1020
|
+
let latest: Awaited<ReturnType<typeof readEffectivePipeline>>
|
|
988
1021
|
try {
|
|
989
|
-
|
|
1022
|
+
latest = await readEffectivePipeline(this.store, slug)
|
|
990
1023
|
} catch (error) {
|
|
1024
|
+
if (!(error instanceof EffectivePipelineUnreadable)) throw error
|
|
1025
|
+
revision = error.revision
|
|
991
1026
|
this.sweepPins.delete(slug)
|
|
992
1027
|
if (this.deps.repairBuildConfig === undefined) throw error
|
|
993
1028
|
await this.deps.repairBuildConfig(slug)
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1029
|
+
try {
|
|
1030
|
+
latest = await readEffectivePipeline(this.store, slug)
|
|
1031
|
+
} catch (retry) {
|
|
1032
|
+
if (retry instanceof EffectivePipelineUnreadable) revision = retry.revision
|
|
1033
|
+
throw retry
|
|
1034
|
+
}
|
|
1035
|
+
if (latest === null) throw new Error('configuration repair deposited no pipeline')
|
|
998
1036
|
}
|
|
1037
|
+
if (latest === null) {
|
|
1038
|
+
this.sweepPins.delete(slug)
|
|
1039
|
+
return decideNextFromFacts(state, log, this.deps.config)
|
|
1040
|
+
}
|
|
1041
|
+
revision = latest.revision
|
|
1042
|
+
pinned = latest.config
|
|
999
1043
|
if (cacheable) {
|
|
1000
1044
|
// A concurrent deposit may have advanced the revision after the probe:
|
|
1001
1045
|
// label the bytes with the full response's revision, never the probe's.
|
|
@@ -1201,7 +1245,9 @@ export class Dispatcher {
|
|
|
1201
1245
|
// A frozen or non-writable message falls through to a wrapper.
|
|
1202
1246
|
}
|
|
1203
1247
|
}
|
|
1204
|
-
return new AggregateError([error], `${String(error)}; ${lines}`, {
|
|
1248
|
+
return new AggregateError([error], `${String(error)}; ${lines}`, {
|
|
1249
|
+
cause: error,
|
|
1250
|
+
})
|
|
1205
1251
|
}
|
|
1206
1252
|
|
|
1207
1253
|
private async runTick(opts: TickOpts): Promise<TickReport> {
|
|
@@ -1255,6 +1301,8 @@ export class Dispatcher {
|
|
|
1255
1301
|
if (this.outOfBudget(opts)) return report
|
|
1256
1302
|
await this.janitor(report, launched, opts)
|
|
1257
1303
|
if (this.outOfBudget(opts)) return report
|
|
1304
|
+
await this.settleHandbacks()
|
|
1305
|
+
if (this.outOfBudget(opts)) return report
|
|
1258
1306
|
await this.recoverDispatches(report, launched, paused, opts)
|
|
1259
1307
|
if (this.outOfBudget(opts)) return report
|
|
1260
1308
|
if (opts.resumeCurrent === true) await this.resumeCurrent(report, launched, paused, opts)
|
|
@@ -1371,7 +1419,11 @@ export class Dispatcher {
|
|
|
1371
1419
|
await this.store.appendRepo(this.deps.repo, {
|
|
1372
1420
|
actor: DISPATCHER,
|
|
1373
1421
|
type: 'dispatcher.ticket-source-recovered',
|
|
1374
|
-
payload: {
|
|
1422
|
+
payload: {
|
|
1423
|
+
source: current.source,
|
|
1424
|
+
cause: current.cause,
|
|
1425
|
+
operation: current.operation,
|
|
1426
|
+
},
|
|
1375
1427
|
})
|
|
1376
1428
|
}
|
|
1377
1429
|
if (next !== undefined) {
|
|
@@ -1426,6 +1478,104 @@ export class Dispatcher {
|
|
|
1426
1478
|
).id
|
|
1427
1479
|
}
|
|
1428
1480
|
|
|
1481
|
+
/** The ticket ref a hand-back actually moved: its current id. */
|
|
1482
|
+
private async handbackTicket(record: BuildRecord): Promise<TicketRef> {
|
|
1483
|
+
return { ...record.ticket!, id: await this.currentTicketId(record) }
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
/** Report a build's committed ticket hand-back once. The journal view is
|
|
1487
|
+
* refreshed first, so a report whose append committed but whose
|
|
1488
|
+
* acknowledgement was lost is seen and never repeated. */
|
|
1489
|
+
private async reportBuildHandback(
|
|
1490
|
+
slug: string,
|
|
1491
|
+
payload: RepositoryEventPayload<'ticket.handed-back'>,
|
|
1492
|
+
): Promise<void> {
|
|
1493
|
+
await this.store.ensureRepo(this.deps.repo)
|
|
1494
|
+
await this.store.refreshJournal()
|
|
1495
|
+
if (this.store.repositoryFacts().handbacks[handbackIdentity(slug)] !== undefined) return
|
|
1496
|
+
await this.store.appendRepo(this.deps.repo, {
|
|
1497
|
+
actor: DISPATCHER,
|
|
1498
|
+
type: 'ticket.handed-back',
|
|
1499
|
+
payload,
|
|
1500
|
+
})
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
/** Prune a completed build's hand-back identity. Best effort: a failure is
|
|
1504
|
+
* retried by `settleHandbacks` on a later tick. */
|
|
1505
|
+
private async settleBuildHandback(slug: string): Promise<void> {
|
|
1506
|
+
try {
|
|
1507
|
+
await this.store.appendRepo(this.deps.repo, {
|
|
1508
|
+
actor: DISPATCHER,
|
|
1509
|
+
type: 'ticket.handback-settled',
|
|
1510
|
+
payload: { build: slug },
|
|
1511
|
+
})
|
|
1512
|
+
} catch (error) {
|
|
1513
|
+
rethrowAuthorityLapse(error)
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
/** Settle reported build hand-backs whose build is complete (or gone).
|
|
1518
|
+
* Zero reads and appends while no hand-back is open. */
|
|
1519
|
+
private async settleHandbacks(): Promise<void> {
|
|
1520
|
+
const open = Object.keys(this.store.repositoryFacts().handbacks)
|
|
1521
|
+
if (open.length === 0) return
|
|
1522
|
+
const digests = new Map(
|
|
1523
|
+
(await this.repoBuildDigests(true)).map(({ record, digest }) => [record.slug, digest]),
|
|
1524
|
+
)
|
|
1525
|
+
for (const identity of open) {
|
|
1526
|
+
const slug = identity.slice('build:'.length)
|
|
1527
|
+
const digest = digests.get(slug)
|
|
1528
|
+
if (digest === undefined || digest.terminal === 'done') await this.settleBuildHandback(slug)
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
/** Report a preparation attempt's committed hand-back once. */
|
|
1533
|
+
private async reportPreparationHandback(
|
|
1534
|
+
attempt: TicketPreparation,
|
|
1535
|
+
payload: RepositoryEventPayload<'ticket.handed-back'>,
|
|
1536
|
+
): Promise<void> {
|
|
1537
|
+
await this.store.refreshJournal()
|
|
1538
|
+
if (this.store.repositoryFacts().preparation[attempt.attempt]?.reported) return
|
|
1539
|
+
await this.store.appendRepo(this.deps.repo, {
|
|
1540
|
+
actor: DISPATCHER,
|
|
1541
|
+
type: 'ticket.handed-back',
|
|
1542
|
+
payload,
|
|
1543
|
+
})
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
/** Return a build's ticket once for a closed PR or a discard, behind the
|
|
1547
|
+
* `build.ticket-returned` checkpoint, then report the hand-back. */
|
|
1548
|
+
private async returnBuildTicket(
|
|
1549
|
+
record: BuildRecord,
|
|
1550
|
+
events: CurrentBuildFacts,
|
|
1551
|
+
cause: 'pr-closed' | 'discard',
|
|
1552
|
+
role: AbortDestination,
|
|
1553
|
+
comment: (state: string) => string,
|
|
1554
|
+
): Promise<void> {
|
|
1555
|
+
if (record.ticket === undefined) return
|
|
1556
|
+
let checkpoint = events.latestTicketReturned
|
|
1557
|
+
if (!events.seenTypes.includes('build.ticket-returned')) {
|
|
1558
|
+
const state = role === 'ready' ? this.deps.config.tickets.readyState : this.triageState()
|
|
1559
|
+
const id = await this.currentTicketId(record)
|
|
1560
|
+
await this.deps.tickets.transition(id, state)
|
|
1561
|
+
await this.deps.tickets.comment(id, comment(state))
|
|
1562
|
+
checkpoint = await this.store.append(record.slug, {
|
|
1563
|
+
actor: DISPATCHER,
|
|
1564
|
+
type: 'build.ticket-returned',
|
|
1565
|
+
payload: { ticket: record.ticket, state, cause, role },
|
|
1566
|
+
} satisfies EventWrite<'build.ticket-returned'>)
|
|
1567
|
+
}
|
|
1568
|
+
if (checkpoint === undefined)
|
|
1569
|
+
throw new Error(`build ${record.slug} lost its ticket-returned checkpoint`)
|
|
1570
|
+
await this.reportBuildHandback(record.slug, {
|
|
1571
|
+
ticket: await this.handbackTicket(record),
|
|
1572
|
+
build: record.slug,
|
|
1573
|
+
cause,
|
|
1574
|
+
state: checkpoint.payload.state,
|
|
1575
|
+
role: checkpoint.payload.role ?? role,
|
|
1576
|
+
})
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1429
1579
|
private async activeTicketIdentities(refs: TicketRef[], listed: Ticket[]): Promise<Set<string>> {
|
|
1430
1580
|
const key = (ref: TicketRef) => `${ref.source}:${ref.id}`
|
|
1431
1581
|
const migrations = this.store.repositoryFacts().ticketMigrations
|
|
@@ -1483,9 +1633,15 @@ export class Dispatcher {
|
|
|
1483
1633
|
if (record.ticket && digest.terminal === undefined) refs.push(record.ticket)
|
|
1484
1634
|
}
|
|
1485
1635
|
const activeTicketIds = await this.activeTicketIdentities(refs, listing.tickets)
|
|
1636
|
+
const conflicts = this.profileConflicts(
|
|
1637
|
+
listing.tickets.filter(
|
|
1638
|
+
(ticket) => !activeTicketIds.has(`${ticket.ref.source}:${ticket.ref.id}`),
|
|
1639
|
+
),
|
|
1640
|
+
)
|
|
1486
1641
|
report.queued = listing.tickets.filter(
|
|
1487
1642
|
(ticket) =>
|
|
1488
1643
|
!activeTicketIds.has(`${ticket.ref.source}:${ticket.ref.id}`) &&
|
|
1644
|
+
!conflicts.tickets.has(ticket) &&
|
|
1489
1645
|
!Object.values(this.store.repositoryFacts().preparation).some((attempt) => {
|
|
1490
1646
|
const ref = resolveTicketRef(
|
|
1491
1647
|
this.store.repositoryFacts().ticketMigrations,
|
|
@@ -1496,8 +1652,8 @@ export class Dispatcher {
|
|
|
1496
1652
|
return ref.source === ticket.ref.source && ref.id === ticket.ref.id
|
|
1497
1653
|
}),
|
|
1498
1654
|
).length
|
|
1499
|
-
report.invalidTickets = listing.diagnostics.length
|
|
1500
|
-
report.ticketDiagnostics = [...listing.diagnostics]
|
|
1655
|
+
report.invalidTickets = listing.diagnostics.length + conflicts.diagnostics.length
|
|
1656
|
+
report.ticketDiagnostics = [...listing.diagnostics, ...conflicts.diagnostics]
|
|
1501
1657
|
report.dependencyBlocked = 0
|
|
1502
1658
|
report.dependencyDiagnostics = []
|
|
1503
1659
|
report.creationWithheld = 0
|
|
@@ -1553,7 +1709,12 @@ export class Dispatcher {
|
|
|
1553
1709
|
startedAt,
|
|
1554
1710
|
intervalMs: this.deps.config.ticketScanIntervalSeconds * 1000,
|
|
1555
1711
|
}
|
|
1556
|
-
const checkpoint = {
|
|
1712
|
+
const checkpoint = {
|
|
1713
|
+
startedAt,
|
|
1714
|
+
mode,
|
|
1715
|
+
readinessFingerprint,
|
|
1716
|
+
criteriaFingerprint,
|
|
1717
|
+
}
|
|
1557
1718
|
// The journal measurement alone proves deferral, so the cadence row is not read.
|
|
1558
1719
|
if (ticketScanDeferredByJournal(input))
|
|
1559
1720
|
return { ...checkpoint, allowClockRollback: false, due: false }
|
|
@@ -1702,7 +1863,12 @@ export class Dispatcher {
|
|
|
1702
1863
|
this.workspaceOwner(facts.workspace)?.recovery !== undefined
|
|
1703
1864
|
)
|
|
1704
1865
|
return 'already-active'
|
|
1705
|
-
|
|
1866
|
+
// A build leaving a ticket wait decides its resume restack against a
|
|
1867
|
+
// fresh observation: one forge read per wait end, no event rows.
|
|
1868
|
+
if (
|
|
1869
|
+
(facts.log.restack.target === undefined || waitResumeDue(facts.state)) &&
|
|
1870
|
+
facts.lastCreated !== undefined
|
|
1871
|
+
) {
|
|
1706
1872
|
const branch = facts.lastCreated.payload.baseBranch
|
|
1707
1873
|
await this.observeTarget(slug, branch, undefined, report)
|
|
1708
1874
|
}
|
|
@@ -1835,7 +2001,11 @@ export class Dispatcher {
|
|
|
1835
2001
|
// Conservatism: an unresolvable observation (provider error) throws
|
|
1836
2002
|
// and is contained below — it never reaps.
|
|
1837
2003
|
if (observation.state === 'running') continue
|
|
1838
|
-
let snapshots: {
|
|
2004
|
+
let snapshots: {
|
|
2005
|
+
outcome: 'confirmed' | 'unknown'
|
|
2006
|
+
deleted?: number
|
|
2007
|
+
error?: string
|
|
2008
|
+
} = {
|
|
1839
2009
|
outcome: 'unknown',
|
|
1840
2010
|
error: 'provider did not report the snapshot purge',
|
|
1841
2011
|
}
|
|
@@ -2626,7 +2796,9 @@ export class Dispatcher {
|
|
|
2626
2796
|
!executionLeaseLive
|
|
2627
2797
|
) {
|
|
2628
2798
|
operation = 'node cascade'
|
|
2629
|
-
await this.prepareIntegration(record, state, report, launched, {
|
|
2799
|
+
await this.prepareIntegration(record, state, report, launched, {
|
|
2800
|
+
refreshOnly: true,
|
|
2801
|
+
})
|
|
2630
2802
|
;({ state, workspace, log } = await this.store.buildFacts(record.slug))
|
|
2631
2803
|
await this.cascadeNode(record, state, report, launched, opts)
|
|
2632
2804
|
loaded = undefined
|
|
@@ -2884,7 +3056,11 @@ export class Dispatcher {
|
|
|
2884
3056
|
reason: string,
|
|
2885
3057
|
report: TickReport,
|
|
2886
3058
|
) {
|
|
2887
|
-
const rejection = {
|
|
3059
|
+
const rejection = {
|
|
3060
|
+
revision: ticket.revision,
|
|
3061
|
+
target: ticket.target ?? null,
|
|
3062
|
+
reason,
|
|
3063
|
+
}
|
|
2888
3064
|
const state = (await this.store.buildFacts(record.slug)).state
|
|
2889
3065
|
if (!sameParentRejection(state.nodeRestack?.parentRejection, rejection))
|
|
2890
3066
|
await this.store.append(record.slug, {
|
|
@@ -3021,7 +3197,10 @@ export class Dispatcher {
|
|
|
3021
3197
|
await this.store.appendIfCurrent(record.slug, state.lastSeq, {
|
|
3022
3198
|
actor: DISPATCHER,
|
|
3023
3199
|
type: 'node.parent-cancelled',
|
|
3024
|
-
payload: {
|
|
3200
|
+
payload: {
|
|
3201
|
+
id: request.id,
|
|
3202
|
+
reason: 'source readback does not confirm requested target',
|
|
3203
|
+
},
|
|
3025
3204
|
})
|
|
3026
3205
|
return
|
|
3027
3206
|
}
|
|
@@ -3152,7 +3331,7 @@ export class Dispatcher {
|
|
|
3152
3331
|
private async leafAdmission(slug: string): Promise<boolean> {
|
|
3153
3332
|
const { state } = await this.store.buildFacts(slug)
|
|
3154
3333
|
if (
|
|
3155
|
-
!epilogueLeaf(state) ||
|
|
3334
|
+
!(epilogueLeaf(state) || waitParked(state)) ||
|
|
3156
3335
|
state.pendingCommands.some(
|
|
3157
3336
|
(command) => command.command === 'abort' || command.command === 'pause',
|
|
3158
3337
|
)
|
|
@@ -3445,23 +3624,46 @@ export class Dispatcher {
|
|
|
3445
3624
|
if (record.ticket !== undefined && !has('abort.ticket-returned')) {
|
|
3446
3625
|
const label = 'autobuild:aborted'
|
|
3447
3626
|
try {
|
|
3448
|
-
const
|
|
3627
|
+
const id = await this.currentTicketId(record)
|
|
3628
|
+
const current = await tickets.get(id)
|
|
3449
3629
|
if (current === null) throw new Error(`ticket no longer exists in ${tickets.name}`)
|
|
3630
|
+
// Labels are a union-only update, so blockedBy is never touched.
|
|
3450
3631
|
if (!current.labels.includes(label)) {
|
|
3451
|
-
await tickets.update(
|
|
3632
|
+
await tickets.update(id, {
|
|
3452
3633
|
labels: [...current.labels, label],
|
|
3453
3634
|
})
|
|
3454
3635
|
}
|
|
3636
|
+
const requested = events.latestAbort?.payload.to ?? 'triage'
|
|
3637
|
+
const reason = events.latestAbort?.payload.reason?.trim() || undefined
|
|
3638
|
+
const missing =
|
|
3639
|
+
requested === 'ready' ? specConformance(current.body).missing : ([] as string[])
|
|
3640
|
+
const role: AbortDestination =
|
|
3641
|
+
requested === 'ready' && missing.length === 0 ? 'ready' : 'triage'
|
|
3455
3642
|
const triageState = this.triageState()
|
|
3456
|
-
|
|
3643
|
+
const state = role === 'ready' ? this.deps.config.tickets.readyState : triageState
|
|
3644
|
+
// The one ticket move: straight to the destination, never via triage.
|
|
3645
|
+
await tickets.transition(id, state)
|
|
3457
3646
|
await tickets.comment(
|
|
3458
|
-
|
|
3459
|
-
|
|
3647
|
+
id,
|
|
3648
|
+
(missing.length > 0
|
|
3649
|
+
? `build ${record.slug} aborted — returned to ${state} instead of ${this.deps.config.tickets.readyState}: ` +
|
|
3650
|
+
'the ticket does not conform to the spec standard (.agents/skills/ab-guide/references/spec-standard.md).\n' +
|
|
3651
|
+
`Missing: ${missing.join('; ')}.`
|
|
3652
|
+
: `build ${record.slug} aborted — returned to ${state}`) +
|
|
3653
|
+
(reason !== undefined ? `\nReason: ${reason}` : ''),
|
|
3460
3654
|
)
|
|
3461
3655
|
await append({
|
|
3462
3656
|
actor: DISPATCHER,
|
|
3463
3657
|
type: 'abort.ticket-returned',
|
|
3464
|
-
payload: {
|
|
3658
|
+
payload: {
|
|
3659
|
+
ticket: record.ticket,
|
|
3660
|
+
state,
|
|
3661
|
+
label,
|
|
3662
|
+
role,
|
|
3663
|
+
...(requested !== role ? { requested } : {}),
|
|
3664
|
+
...(reason !== undefined ? { reason: reason.slice(0, 2000) } : {}),
|
|
3665
|
+
...(missing.length > 0 ? { missing } : {}),
|
|
3666
|
+
},
|
|
3465
3667
|
})
|
|
3466
3668
|
} catch (error) {
|
|
3467
3669
|
fail('ticket handback', `${tickets.name} ticket ${record.ticket.id}`, error)
|
|
@@ -3469,11 +3671,39 @@ export class Dispatcher {
|
|
|
3469
3671
|
}
|
|
3470
3672
|
}
|
|
3471
3673
|
|
|
3674
|
+
// Reported from the checkpoint, never a re-read of the ticket, so a
|
|
3675
|
+
// retry reports exactly what the committed move did.
|
|
3676
|
+
if (record.ticket !== undefined) {
|
|
3677
|
+
try {
|
|
3678
|
+
const returned = events.latestTicketReturned
|
|
3679
|
+
if (returned?.type !== 'abort.ticket-returned')
|
|
3680
|
+
throw new Error('abort.ticket-returned checkpoint is not readable')
|
|
3681
|
+
const checkpoint = returned.payload
|
|
3682
|
+
const role: AbortDestination =
|
|
3683
|
+
checkpoint.role ??
|
|
3684
|
+
(checkpoint.state === this.deps.config.tickets.readyState ? 'ready' : 'triage')
|
|
3685
|
+
await this.reportBuildHandback(record.slug, {
|
|
3686
|
+
ticket: await this.handbackTicket(record),
|
|
3687
|
+
build: record.slug,
|
|
3688
|
+
cause: 'abort',
|
|
3689
|
+
state: checkpoint.state,
|
|
3690
|
+
role,
|
|
3691
|
+
...(checkpoint.requested !== undefined ? { requested: checkpoint.requested } : {}),
|
|
3692
|
+
...(checkpoint.reason !== undefined ? { reason: checkpoint.reason } : {}),
|
|
3693
|
+
...(checkpoint.missing !== undefined ? { missing: checkpoint.missing } : {}),
|
|
3694
|
+
})
|
|
3695
|
+
} catch (error) {
|
|
3696
|
+
fail('hand-back report', `build ${record.slug}`, error)
|
|
3697
|
+
return
|
|
3698
|
+
}
|
|
3699
|
+
}
|
|
3700
|
+
|
|
3472
3701
|
await append({
|
|
3473
3702
|
actor: DISPATCHER,
|
|
3474
3703
|
type: 'build.completed',
|
|
3475
3704
|
payload: { outcome: 'abandoned' },
|
|
3476
3705
|
})
|
|
3706
|
+
if (record.ticket !== undefined) await this.settleBuildHandback(record.slug)
|
|
3477
3707
|
await this.reclaimPrAttachments(record.slug, events)
|
|
3478
3708
|
report.abandoned += 1
|
|
3479
3709
|
}
|
|
@@ -3487,26 +3717,23 @@ export class Dispatcher {
|
|
|
3487
3717
|
report: TickReport,
|
|
3488
3718
|
): Promise<void> {
|
|
3489
3719
|
const store = this.store
|
|
3490
|
-
const { tickets } = this.deps
|
|
3491
3720
|
await this.releaseWorkspace(record.slug, events, 'discard')
|
|
3492
3721
|
if (record.lease !== undefined) {
|
|
3493
3722
|
await store.releaseLease(record.slug, record.lease.holder)
|
|
3494
3723
|
}
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
`build ${record.slug} was discarded during dispatch — returned to ${this.deps.config.tickets.readyState}`,
|
|
3503
|
-
)
|
|
3504
|
-
}
|
|
3724
|
+
await this.returnBuildTicket(
|
|
3725
|
+
record,
|
|
3726
|
+
events,
|
|
3727
|
+
'discard',
|
|
3728
|
+
'ready',
|
|
3729
|
+
(state) => `build ${record.slug} was discarded during dispatch — returned to ${state}`,
|
|
3730
|
+
)
|
|
3505
3731
|
await store.append(record.slug, {
|
|
3506
3732
|
actor: DISPATCHER,
|
|
3507
3733
|
type: 'build.completed',
|
|
3508
3734
|
payload: { outcome: 'discarded' },
|
|
3509
3735
|
} satisfies EventWrite<'build.completed'>)
|
|
3736
|
+
if (record.ticket !== undefined) await this.settleBuildHandback(record.slug)
|
|
3510
3737
|
report.discarded += 1
|
|
3511
3738
|
}
|
|
3512
3739
|
|
|
@@ -3518,12 +3745,18 @@ export class Dispatcher {
|
|
|
3518
3745
|
kind?: 'work' | 'node',
|
|
3519
3746
|
): Promise<{ sha: string; buildTrailerPresent?: boolean }> {
|
|
3520
3747
|
if (kind === 'node')
|
|
3521
|
-
await this.recoverNodeContributions(await this.repoBuildDigests(), {
|
|
3748
|
+
await this.recoverNodeContributions(await this.repoBuildDigests(), {
|
|
3749
|
+
slug: record.slug,
|
|
3750
|
+
sha,
|
|
3751
|
+
})
|
|
3522
3752
|
const read = this.deps.forge.readCommitMessage
|
|
3523
3753
|
if (read === undefined) return { sha }
|
|
3524
3754
|
try {
|
|
3525
3755
|
const message = await read.call(this.deps.forge, workspacePath, sha)
|
|
3526
|
-
return {
|
|
3756
|
+
return {
|
|
3757
|
+
sha,
|
|
3758
|
+
buildTrailerPresent: hasBuildTrailer(message, record.slug),
|
|
3759
|
+
}
|
|
3527
3760
|
} catch (error) {
|
|
3528
3761
|
rethrowAuthorityLapse(error)
|
|
3529
3762
|
await this.store.append(record.slug, {
|
|
@@ -3615,12 +3848,14 @@ export class Dispatcher {
|
|
|
3615
3848
|
// finished after the publisher confirmed cancellation.
|
|
3616
3849
|
const ready = async (candidate: BuildState): Promise<boolean> => {
|
|
3617
3850
|
if (
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3851
|
+
integration
|
|
3852
|
+
? executionLeaseLive ||
|
|
3853
|
+
candidate.status === 'paused' ||
|
|
3854
|
+
candidate.status === 'done' ||
|
|
3855
|
+
candidate.status === 'aborted' ||
|
|
3856
|
+
escalationsBeyondJanitor(candidate).length ||
|
|
3857
|
+
candidate.pendingCommands.length
|
|
3858
|
+
: leafLandingDeclineReason(candidate) !== undefined
|
|
3624
3859
|
)
|
|
3625
3860
|
return false
|
|
3626
3861
|
if (integration) {
|
|
@@ -3649,7 +3884,8 @@ export class Dispatcher {
|
|
|
3649
3884
|
parent: current.integration.cycle.parent,
|
|
3650
3885
|
cycle: current.integration.cycle.id,
|
|
3651
3886
|
}
|
|
3652
|
-
:
|
|
3887
|
+
: // The leaf candidate's shared definition is `leafLandingCandidate`.
|
|
3888
|
+
current.pr && {
|
|
3653
3889
|
head: current.pr.headSha,
|
|
3654
3890
|
parent:
|
|
3655
3891
|
(await store.buildFacts(record.slug)).log.restack.completed?.targetBase ??
|
|
@@ -3684,6 +3920,15 @@ export class Dispatcher {
|
|
|
3684
3920
|
state = current
|
|
3685
3921
|
break
|
|
3686
3922
|
}
|
|
3923
|
+
// A deferred candidate waits for its recorded changed paths: no ticket
|
|
3924
|
+
// read, evaluation or append until the head or the policy changes.
|
|
3925
|
+
const rules = this.deps.config.landing
|
|
3926
|
+
const policy = landingPolicyIdentity(rules)
|
|
3927
|
+
const deferral = current.landing?.deferral
|
|
3928
|
+
if (deferral?.policy === policy && sameLandingCandidate(candidate, deferral.candidate)) {
|
|
3929
|
+
isReady = false
|
|
3930
|
+
break
|
|
3931
|
+
}
|
|
3687
3932
|
if (!record.ticket) throw new Error('Merge policy requires a readable source ticket')
|
|
3688
3933
|
const ticket = await tickets.get(await this.currentTicketId(record))
|
|
3689
3934
|
if (!ticket)
|
|
@@ -3705,11 +3950,53 @@ export class Dispatcher {
|
|
|
3705
3950
|
: { kind: 'root' as const },
|
|
3706
3951
|
labels: ticket.labels,
|
|
3707
3952
|
}
|
|
3708
|
-
|
|
3953
|
+
// Path predicates read the head's already-reduced summary. Only a
|
|
3954
|
+
// reached path rule on a head beyond the preview reads the complete
|
|
3955
|
+
// set, once per new candidate.
|
|
3956
|
+
const recorded = headPathsFor(current, candidate.head)
|
|
3957
|
+
let decision = evaluateLandingPolicy(
|
|
3958
|
+
rules,
|
|
3959
|
+
input,
|
|
3960
|
+
recorded.recorded
|
|
3961
|
+
? {
|
|
3962
|
+
recorded: true,
|
|
3963
|
+
complete: recorded.record.total === recorded.record.preview.length,
|
|
3964
|
+
paths: recorded.record.preview,
|
|
3965
|
+
}
|
|
3966
|
+
: { recorded: false },
|
|
3967
|
+
)
|
|
3968
|
+
if ('deferred' in decision && decision.deferred === 'paths-incomplete' && recorded.recorded)
|
|
3969
|
+
decision = evaluateLandingPolicy(rules, input, {
|
|
3970
|
+
recorded: true,
|
|
3971
|
+
complete: true,
|
|
3972
|
+
paths: (await readHeadPaths(store, record.slug, recorded.record)).paths,
|
|
3973
|
+
})
|
|
3709
3974
|
if (!(await ready(current))) {
|
|
3710
3975
|
isReady = false
|
|
3711
3976
|
break
|
|
3712
3977
|
}
|
|
3978
|
+
if ('deferred' in decision) {
|
|
3979
|
+
if (decision.deferred !== 'paths-unrecorded')
|
|
3980
|
+
throw new Error(
|
|
3981
|
+
`Merge policy evaluation stayed ${decision.deferred} on a complete path set`,
|
|
3982
|
+
)
|
|
3983
|
+
if (
|
|
3984
|
+
await store.appendIfCurrent(record.slug, current.lastSeq, {
|
|
3985
|
+
actor: DISPATCHER,
|
|
3986
|
+
type: 'landing.deferred',
|
|
3987
|
+
payload: {
|
|
3988
|
+
candidate,
|
|
3989
|
+
reason: decision.deferred,
|
|
3990
|
+
rule: decision.rule,
|
|
3991
|
+
policy,
|
|
3992
|
+
},
|
|
3993
|
+
})
|
|
3994
|
+
) {
|
|
3995
|
+
isReady = false
|
|
3996
|
+
break
|
|
3997
|
+
}
|
|
3998
|
+
continue
|
|
3999
|
+
}
|
|
3713
4000
|
if (
|
|
3714
4001
|
await store.appendIfCurrent(record.slug, current.lastSeq, {
|
|
3715
4002
|
actor: DISPATCHER,
|
|
@@ -3790,7 +4077,7 @@ export class Dispatcher {
|
|
|
3790
4077
|
retained !== null &&
|
|
3791
4078
|
this.workspaceOwner(retained)?.recovery !== undefined &&
|
|
3792
4079
|
(events.lastExecution === 'lost' || events.lastExecution === 'stopped') &&
|
|
3793
|
-
epilogueLeaf(events.state)
|
|
4080
|
+
(epilogueLeaf(events.state) || waitParked(events.state))
|
|
3794
4081
|
) {
|
|
3795
4082
|
report.conflicted += 1
|
|
3796
4083
|
return
|
|
@@ -4120,7 +4407,10 @@ export class Dispatcher {
|
|
|
4120
4407
|
await store.append(record.slug, {
|
|
4121
4408
|
actor: DISPATCHER,
|
|
4122
4409
|
type: 'landing.native-applied',
|
|
4123
|
-
payload: {
|
|
4410
|
+
payload: {
|
|
4411
|
+
enabled: false,
|
|
4412
|
+
...(enableSeq !== undefined ? { enableSeq } : {}),
|
|
4413
|
+
},
|
|
4124
4414
|
})
|
|
4125
4415
|
}
|
|
4126
4416
|
} else if (result.kind === 'deferred' && result.reason) {
|
|
@@ -4285,19 +4575,20 @@ export class Dispatcher {
|
|
|
4285
4575
|
} satisfies EventWrite<'pr.closed'>)
|
|
4286
4576
|
}
|
|
4287
4577
|
await this.releaseWorkspace(record.slug, events)
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4578
|
+
await this.returnBuildTicket(
|
|
4579
|
+
record,
|
|
4580
|
+
events,
|
|
4581
|
+
'pr-closed',
|
|
4582
|
+
'triage',
|
|
4583
|
+
(state) =>
|
|
4584
|
+
`build ${record.slug} PR closed without merging (${pr.url}) — returned to ${state}`,
|
|
4585
|
+
)
|
|
4296
4586
|
await store.append(record.slug, {
|
|
4297
4587
|
actor: DISPATCHER,
|
|
4298
4588
|
type: 'build.completed',
|
|
4299
4589
|
payload: { outcome: 'closed-unmerged' },
|
|
4300
4590
|
} satisfies EventWrite<'build.completed'>)
|
|
4591
|
+
if (record.ticket) await this.settleBuildHandback(record.slug)
|
|
4301
4592
|
await this.reclaimPrAttachments(record.slug, events)
|
|
4302
4593
|
report.closed += 1
|
|
4303
4594
|
return
|
|
@@ -4376,7 +4667,9 @@ export class Dispatcher {
|
|
|
4376
4667
|
// Same predicate preservation archives under: only local-git keeps
|
|
4377
4668
|
// archive refs in the local repository.
|
|
4378
4669
|
...(restoration?.length
|
|
4379
|
-
? {
|
|
4670
|
+
? {
|
|
4671
|
+
restorationArchives: this.deps.forge.name === 'local-git' ? 'local' : 'remote',
|
|
4672
|
+
}
|
|
4380
4673
|
: {}),
|
|
4381
4674
|
})
|
|
4382
4675
|
const skipped = [
|
|
@@ -4680,11 +4973,36 @@ export class Dispatcher {
|
|
|
4680
4973
|
/** The claim-time `build.created` payload. Assets and issue links are
|
|
4681
4974
|
* omitted when the ticket had none, so such a build's log is exactly what it
|
|
4682
4975
|
* was before. */
|
|
4976
|
+
/** Ready tickets whose labels select two or more profiles (SPEC §9). They
|
|
4977
|
+
* are never claimed; each gets a ticket diagnostic until relabelled. Pure
|
|
4978
|
+
* over the listing the scan already holds. */
|
|
4979
|
+
private profileConflicts(tickets: readonly Ticket[]): {
|
|
4980
|
+
tickets: Set<Ticket>
|
|
4981
|
+
diagnostics: string[]
|
|
4982
|
+
} {
|
|
4983
|
+
const conflicting = new Set<Ticket>()
|
|
4984
|
+
const diagnostics: string[] = []
|
|
4985
|
+
for (const ticket of tickets) {
|
|
4986
|
+
const selection = selectProfile(this.deps.config.profiles, ticket.labels)
|
|
4987
|
+
if (selection.kind !== 'conflict') continue
|
|
4988
|
+
conflicting.add(ticket)
|
|
4989
|
+
diagnostics.push(profileConflictDiagnostic(ticket.ref.id, selection.matches))
|
|
4990
|
+
}
|
|
4991
|
+
return { tickets: conflicting, diagnostics }
|
|
4992
|
+
}
|
|
4993
|
+
|
|
4994
|
+
/** The profile a ticket's labels select at claim, if exactly one. */
|
|
4995
|
+
private selectedProfile(ticket: Ticket): { profile: string } | Record<string, never> {
|
|
4996
|
+
const selection = selectProfile(this.deps.config.profiles, ticket.labels)
|
|
4997
|
+
return selection.kind === 'selected' ? { profile: selection.name } : {}
|
|
4998
|
+
}
|
|
4999
|
+
|
|
4683
5000
|
private buildCreatedPayload(
|
|
4684
5001
|
ticket: TicketRef,
|
|
4685
5002
|
repo: string,
|
|
4686
5003
|
seed:
|
|
4687
5004
|
| {
|
|
5005
|
+
profile?: string
|
|
4688
5006
|
autoMergeUser?: string
|
|
4689
5007
|
autoMergeDefaultSeq?: number
|
|
4690
5008
|
assets?: PinnedAsset[]
|
|
@@ -4709,8 +5027,14 @@ export class Dispatcher {
|
|
|
4709
5027
|
...(config.pr !== undefined ? { pr: config.pr } : {}),
|
|
4710
5028
|
...(seed?.assets !== undefined && seed.assets.length > 0 ? { assets: seed.assets } : {}),
|
|
4711
5029
|
...(seed?.issueLinks !== undefined && seed.issueLinks.length > 0
|
|
4712
|
-
? {
|
|
5030
|
+
? {
|
|
5031
|
+
issueLinks: seed.issueLinks.map(({ issue, intent }) => ({
|
|
5032
|
+
issue,
|
|
5033
|
+
intent,
|
|
5034
|
+
})),
|
|
5035
|
+
}
|
|
4713
5036
|
: {}),
|
|
5037
|
+
...(seed?.profile !== undefined ? { profile: seed.profile } : {}),
|
|
4714
5038
|
}
|
|
4715
5039
|
}
|
|
4716
5040
|
|
|
@@ -4780,6 +5104,7 @@ export class Dispatcher {
|
|
|
4780
5104
|
...(seed?.ticket.issueLinks !== undefined
|
|
4781
5105
|
? { issueLinks: seed.ticket.issueLinks }
|
|
4782
5106
|
: {}),
|
|
5107
|
+
...(seed !== undefined ? this.selectedProfile(seed.ticket) : {}),
|
|
4783
5108
|
}),
|
|
4784
5109
|
})
|
|
4785
5110
|
events = (await readBuildFacts(store, record.slug)).value
|
|
@@ -4967,7 +5292,10 @@ export class Dispatcher {
|
|
|
4967
5292
|
await store.appendWithArtifacts(record.slug, [spec], (deposited) => ({
|
|
4968
5293
|
actor: DISPATCHER,
|
|
4969
5294
|
type: 'spec.imported' as const,
|
|
4970
|
-
payload: {
|
|
5295
|
+
payload: {
|
|
5296
|
+
artifact: artifactRefOf(deposited),
|
|
5297
|
+
ticket: ticket!.ref,
|
|
5298
|
+
},
|
|
4971
5299
|
}))
|
|
4972
5300
|
}
|
|
4973
5301
|
}
|
|
@@ -5128,6 +5456,239 @@ export class Dispatcher {
|
|
|
5128
5456
|
}
|
|
5129
5457
|
}
|
|
5130
5458
|
|
|
5459
|
+
// ── c'. Ticket waits (SPEC §11 "Ticket waits") ─────────────────────────────
|
|
5460
|
+
|
|
5461
|
+
/**
|
|
5462
|
+
* Validate every pending `wait.requested` against the ticket source: the
|
|
5463
|
+
* dispatcher holds the source for local and hosted builds alike, so a
|
|
5464
|
+
* build session needs no ticket credential to declare a wait. Accepted, the
|
|
5465
|
+
* missing blockers are added to the build's ticket and `wait.entered` parks
|
|
5466
|
+
* the build; refused, `wait.refused` writes nothing to the ticket and the
|
|
5467
|
+
* declaring phase re-runs with the reason as guidance.
|
|
5468
|
+
*
|
|
5469
|
+
* Runs from the lease sweep's per-build pass, before that build's sweep,
|
|
5470
|
+
* whether or not the repository is paused or accepting new work: waits are
|
|
5471
|
+
* bookkeeping for existing work.
|
|
5472
|
+
*
|
|
5473
|
+
* Per-tick cost: none beyond the digest listing the sweep already makes.
|
|
5474
|
+
* Only a build whose digest marks a pending request (`waitPending`) is read
|
|
5475
|
+
* further — one reduced `buildFacts` read plus its ticket-source calls. A
|
|
5476
|
+
* request is pending for one tick per declaration, plus retries after a
|
|
5477
|
+
* source failure, plus the ticks its remote commit publication takes to
|
|
5478
|
+
* settle (no ticket calls while it does).
|
|
5479
|
+
*/
|
|
5480
|
+
private async serviceWaitRequests(record: BuildRecord, report: TickReport): Promise<void> {
|
|
5481
|
+
const { state } = await this.store.buildFacts(record.slug)
|
|
5482
|
+
const request = pendingWaitRequest(state)
|
|
5483
|
+
if (request === undefined || state.kind === 'node') return
|
|
5484
|
+
try {
|
|
5485
|
+
await this.serviceWaitRequest(record, state, request)
|
|
5486
|
+
} catch (error) {
|
|
5487
|
+
rethrowAuthorityLapse(error)
|
|
5488
|
+
// A source failure writes nothing; the request is decided next tick.
|
|
5489
|
+
const message =
|
|
5490
|
+
error instanceof Error || isForgeFailure(error) ? error.message : String(error)
|
|
5491
|
+
report.janitorFailed += 1
|
|
5492
|
+
report.janitorDiagnostics.push(
|
|
5493
|
+
`build ${record.slug}: ticket wait ${request.id} not checked — ${message}`,
|
|
5494
|
+
)
|
|
5495
|
+
}
|
|
5496
|
+
}
|
|
5497
|
+
|
|
5498
|
+
private async serviceWaitRequest(
|
|
5499
|
+
record: BuildRecord,
|
|
5500
|
+
state: BuildState,
|
|
5501
|
+
request: NonNullable<BuildState['waitRequest']>,
|
|
5502
|
+
): Promise<void> {
|
|
5503
|
+
const refuse = async (
|
|
5504
|
+
cause: EventPayload<'wait.refused'>['cause'],
|
|
5505
|
+
tickets: string[],
|
|
5506
|
+
message: string,
|
|
5507
|
+
): Promise<void> => {
|
|
5508
|
+
await this.store.appendIfCurrent(record.slug, state.lastSeq, {
|
|
5509
|
+
actor: DISPATCHER,
|
|
5510
|
+
type: 'wait.refused',
|
|
5511
|
+
payload: { id: request.id, cause, tickets, message },
|
|
5512
|
+
})
|
|
5513
|
+
}
|
|
5514
|
+
// An implement declaration's commits are published before the wait is
|
|
5515
|
+
// entered. Until the settlement stage records `wait.published` the
|
|
5516
|
+
// request stays pending; a recorded loss refuses it.
|
|
5517
|
+
const publication = request.publication
|
|
5518
|
+
if (publication !== undefined && !publication.published) {
|
|
5519
|
+
if (publication.lost)
|
|
5520
|
+
return refuse(
|
|
5521
|
+
'publication-lost',
|
|
5522
|
+
request.tickets,
|
|
5523
|
+
"publishing this build's commits before the wait failed: the publication was lost, " +
|
|
5524
|
+
'so your local commits were not published; continue, or declare the wait again',
|
|
5525
|
+
)
|
|
5526
|
+
return
|
|
5527
|
+
}
|
|
5528
|
+
const tickets = this.deps.tickets
|
|
5529
|
+
if (!record.ticket)
|
|
5530
|
+
return refuse(
|
|
5531
|
+
'no-source-ticket',
|
|
5532
|
+
request.tickets,
|
|
5533
|
+
'this build has no source ticket to record blockers on; continue without waiting, or escalate',
|
|
5534
|
+
)
|
|
5535
|
+
const found: Ticket[] = []
|
|
5536
|
+
const unknown: string[] = []
|
|
5537
|
+
for (const id of request.tickets) {
|
|
5538
|
+
const ticket = await tickets.get(id)
|
|
5539
|
+
if (ticket === null) unknown.push(id)
|
|
5540
|
+
else found.push(ticket)
|
|
5541
|
+
}
|
|
5542
|
+
if (unknown.length)
|
|
5543
|
+
return refuse(
|
|
5544
|
+
'unknown-ticket',
|
|
5545
|
+
unknown,
|
|
5546
|
+
`not found in the ${tickets.name} ticket source: ${unknown.join(', ')}; check the ids and declare the wait again, or continue without it`,
|
|
5547
|
+
)
|
|
5548
|
+
const ownId = await this.currentTicketId(record)
|
|
5549
|
+
const own = found.filter((ticket) => ticket.ref.id === ownId).map((ticket) => ticket.ref.id)
|
|
5550
|
+
if (own.length)
|
|
5551
|
+
return refuse(
|
|
5552
|
+
'own-ticket',
|
|
5553
|
+
own,
|
|
5554
|
+
`${ownId} is this build's own ticket; a build cannot wait on itself`,
|
|
5555
|
+
)
|
|
5556
|
+
const rejectedState = this.rejectedState()
|
|
5557
|
+
const completed = found
|
|
5558
|
+
.filter((ticket) => ticket.resolved && !holdsState(ticket.state, rejectedState))
|
|
5559
|
+
.map((ticket) => ticket.ref.id)
|
|
5560
|
+
if (completed.length)
|
|
5561
|
+
return refuse(
|
|
5562
|
+
'completed',
|
|
5563
|
+
completed,
|
|
5564
|
+
`already completed: ${completed.join(', ')}; continue without waiting on them`,
|
|
5565
|
+
)
|
|
5566
|
+
const canonical = [...new Map(found.map((ticket) => [ticket.ref.id, ticket.ref])).values()]
|
|
5567
|
+
const self = await tickets.get(ownId)
|
|
5568
|
+
if (self === null) throw new Error(`build ticket ${ownId} is missing from ${tickets.name}`)
|
|
5569
|
+
const missing = canonical
|
|
5570
|
+
.map((ref) => ref.id)
|
|
5571
|
+
.filter((id) => !(self.blockedBy ?? []).includes(id))
|
|
5572
|
+
if (missing.length) await changeBlockers(tickets, ownId, missing, 'block')
|
|
5573
|
+
const escalation = this.deps.ids('esc')
|
|
5574
|
+
const names = canonical.map((ref) => ref.id).join(', ')
|
|
5575
|
+
await this.store.appendIfCurrent(record.slug, state.lastSeq, {
|
|
5576
|
+
actor: DISPATCHER,
|
|
5577
|
+
type: 'wait.entered',
|
|
5578
|
+
payload: {
|
|
5579
|
+
id: request.id,
|
|
5580
|
+
escalation,
|
|
5581
|
+
tickets: canonical.map((ref) => ({
|
|
5582
|
+
source: ref.source,
|
|
5583
|
+
id: ref.id,
|
|
5584
|
+
...(ref.url !== undefined ? { url: ref.url } : {}),
|
|
5585
|
+
...(ref.title !== undefined ? { title: ref.title } : {}),
|
|
5586
|
+
})),
|
|
5587
|
+
reason: request.reason,
|
|
5588
|
+
question:
|
|
5589
|
+
`Waiting on ${names} to complete: ${request.reason}. ` +
|
|
5590
|
+
`The wait ends when they all complete; answer to end it early, and ${request.phase} resumes with the answer.`,
|
|
5591
|
+
},
|
|
5592
|
+
})
|
|
5593
|
+
}
|
|
5594
|
+
|
|
5595
|
+
/**
|
|
5596
|
+
* End open ticket waits whose tickets settled (SPEC §11 "Ticket waits").
|
|
5597
|
+
* Every waited ticket completed: `wait.ended {cause: automatic}`, and the
|
|
5598
|
+
* build resumes ahead of new claims. Any waited ticket rejected (the
|
|
5599
|
+
* configured rejected role) or deleted: one `policy/wait-unresolvable`
|
|
5600
|
+
* escalation naming it, which the reducer reads as the wait's end. A wait
|
|
5601
|
+
* with tickets still pending stays in place.
|
|
5602
|
+
*
|
|
5603
|
+
* Runs once per tick from the lease sweep, before its per-build pass,
|
|
5604
|
+
* whether or not the repository is paused or accepting new work.
|
|
5605
|
+
*
|
|
5606
|
+
* Per-tick cost: the open waits come from the digests the sweep already
|
|
5607
|
+
* read (`ticketWait`), so no store read is added. With no open wait it
|
|
5608
|
+
* makes no call; otherwise one batched `dependencyStates` over the unique
|
|
5609
|
+
* waited ids. A build's reduced `buildFacts` is read only when the stage
|
|
5610
|
+
* is about to write for it — once per wait end. A source failure writes
|
|
5611
|
+
* nothing and the waits are checked again next tick.
|
|
5612
|
+
*/
|
|
5613
|
+
private async releaseTicketWaits(
|
|
5614
|
+
entries: readonly { record: BuildRecord; digest: BuildDigest }[],
|
|
5615
|
+
report: TickReport,
|
|
5616
|
+
opts: TickOpts,
|
|
5617
|
+
): Promise<void> {
|
|
5618
|
+
const tickets = this.deps.tickets
|
|
5619
|
+
const migrations = this.store.repositoryFacts().ticketMigrations
|
|
5620
|
+
const waiting: { record: BuildRecord; wait: BuildDigestTicketWait; ids: string[] }[] = []
|
|
5621
|
+
for (const { record, digest } of entries) {
|
|
5622
|
+
const wait = digest.ticketWait
|
|
5623
|
+
if (digest.terminal !== undefined || digest.kind === 'node' || wait === undefined) continue
|
|
5624
|
+
try {
|
|
5625
|
+
const ids = wait.tickets.map(
|
|
5626
|
+
(ref) => resolveTicketRef(migrations, ref, tickets.name, record.slug).id,
|
|
5627
|
+
)
|
|
5628
|
+
waiting.push({ record, wait, ids })
|
|
5629
|
+
} catch (error) {
|
|
5630
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
5631
|
+
report.janitorFailed += 1
|
|
5632
|
+
report.janitorDiagnostics.push(
|
|
5633
|
+
`build ${record.slug}: ticket wait ${wait.id} not checked — ${message}`,
|
|
5634
|
+
)
|
|
5635
|
+
}
|
|
5636
|
+
}
|
|
5637
|
+
if (waiting.length === 0 || this.outOfBudget(opts)) return
|
|
5638
|
+
const nodes = new Map<string, DependencyNode>()
|
|
5639
|
+
try {
|
|
5640
|
+
const rejectedState = this.rejectedState()
|
|
5641
|
+
const states = await tickets.dependencyStates([...new Set(waiting.flatMap(({ ids }) => ids))])
|
|
5642
|
+
for (const state of states) nodes.set(state.id, markRejected(state, rejectedState))
|
|
5643
|
+
} catch (error) {
|
|
5644
|
+
rethrowAuthorityLapse(error)
|
|
5645
|
+
const message =
|
|
5646
|
+
error instanceof Error || isForgeFailure(error) ? error.message : String(error)
|
|
5647
|
+
report.janitorFailed += 1
|
|
5648
|
+
report.janitorDiagnostics.push(`ticket waits not checked — ${message}`)
|
|
5649
|
+
return
|
|
5650
|
+
}
|
|
5651
|
+
for (const { record, wait, ids } of waiting) {
|
|
5652
|
+
const release = ticketWaitRelease(ids, nodes)
|
|
5653
|
+
if (release === undefined) continue
|
|
5654
|
+
if (this.outOfBudget(opts)) return
|
|
5655
|
+
try {
|
|
5656
|
+
const { state } = await this.store.buildFacts(record.slug)
|
|
5657
|
+
const open = openTicketWait(state)
|
|
5658
|
+
if (open?.id !== wait.id) continue
|
|
5659
|
+
// A stale append is skipped; the next tick decides again.
|
|
5660
|
+
if (release.kind === 'complete')
|
|
5661
|
+
await this.store.appendIfCurrent(record.slug, state.lastSeq, {
|
|
5662
|
+
actor: DISPATCHER,
|
|
5663
|
+
type: 'wait.ended',
|
|
5664
|
+
payload: { id: open.id, cause: 'automatic', message: waitReleasedText(ids) },
|
|
5665
|
+
})
|
|
5666
|
+
else
|
|
5667
|
+
await this.store.appendIfCurrent(record.slug, state.lastSeq, {
|
|
5668
|
+
actor: DISPATCHER,
|
|
5669
|
+
type: 'escalation.raised',
|
|
5670
|
+
payload: {
|
|
5671
|
+
id: this.deps.ids('esc'),
|
|
5672
|
+
phase: open.phase,
|
|
5673
|
+
round: open.round,
|
|
5674
|
+
source: 'policy',
|
|
5675
|
+
policyCause: 'wait-unresolvable',
|
|
5676
|
+
question: waitUnresolvableQuestion(ids, release.tickets, tickets.name),
|
|
5677
|
+
refs: release.tickets.map((ticket) => ticket.id),
|
|
5678
|
+
},
|
|
5679
|
+
})
|
|
5680
|
+
} catch (error) {
|
|
5681
|
+
rethrowAuthorityLapse(error)
|
|
5682
|
+
const message =
|
|
5683
|
+
error instanceof Error || isForgeFailure(error) ? error.message : String(error)
|
|
5684
|
+
report.janitorFailed += 1
|
|
5685
|
+
report.janitorDiagnostics.push(
|
|
5686
|
+
`build ${record.slug}: ticket wait ${wait.id} not released — ${message}`,
|
|
5687
|
+
)
|
|
5688
|
+
}
|
|
5689
|
+
}
|
|
5690
|
+
}
|
|
5691
|
+
|
|
5131
5692
|
// ── d. Lease sweep (SPEC §15.6-C) ──────────────────────────────────────────
|
|
5132
5693
|
|
|
5133
5694
|
/**
|
|
@@ -5160,12 +5721,17 @@ export class Dispatcher {
|
|
|
5160
5721
|
opts: TickOpts = {},
|
|
5161
5722
|
): Promise<void> {
|
|
5162
5723
|
const now = this.deps.clock().getTime()
|
|
5724
|
+
const entries = await this.repoBuildDigests()
|
|
5725
|
+
await this.releaseTicketWaits(entries, report, opts)
|
|
5163
5726
|
// Terminal builds are filtered on the digest before the lease and TTL
|
|
5164
5727
|
// checks, so a zero TTL cannot fall through to a log read.
|
|
5165
|
-
for (const record of
|
|
5166
|
-
if (
|
|
5728
|
+
for (const { record, digest } of entries) {
|
|
5729
|
+
if (digest.terminal !== undefined) continue
|
|
5167
5730
|
// Budget gate: the sweep re-attaches runners per expired build.
|
|
5168
5731
|
if (this.outOfBudget(opts)) break
|
|
5732
|
+
if (digest.waitPending && digest.kind !== 'node')
|
|
5733
|
+
await this.serviceWaitRequests(record, report)
|
|
5734
|
+
if (launched.has(record.slug)) continue
|
|
5169
5735
|
try {
|
|
5170
5736
|
await this.sweepBuild(record, report, launched, paused, now)
|
|
5171
5737
|
} catch (error) {
|
|
@@ -5224,7 +5790,12 @@ export class Dispatcher {
|
|
|
5224
5790
|
if (retryIntent && state.pendingCommands.length === 0) {
|
|
5225
5791
|
try {
|
|
5226
5792
|
await publicationRetryGate(
|
|
5227
|
-
{
|
|
5793
|
+
{
|
|
5794
|
+
store: this.store,
|
|
5795
|
+
slug: record.slug,
|
|
5796
|
+
clock: this.deps.clock,
|
|
5797
|
+
actor: DISPATCHER,
|
|
5798
|
+
},
|
|
5228
5799
|
retryIntent.operation,
|
|
5229
5800
|
retryIntent.id,
|
|
5230
5801
|
)
|
|
@@ -5347,10 +5918,15 @@ export class Dispatcher {
|
|
|
5347
5918
|
if (runs && state.kind !== 'node' && !(await this.leafAdmission(record.slug))) return
|
|
5348
5919
|
// A finished parked leaf keeps its workspace until merge or close; a
|
|
5349
5920
|
// stale environment is reaped only for an admitted replacement.
|
|
5921
|
+
// A leaf waiting on tickets, or on the dispatcher's check of its wait,
|
|
5922
|
+
// keeps its workspace, branch and phase work the same way.
|
|
5350
5923
|
if (
|
|
5351
5924
|
!runs &&
|
|
5352
5925
|
state.kind !== 'node' &&
|
|
5353
|
-
((decision.kind === 'wait' && decision.reason === 'awaiting-pr') ||
|
|
5926
|
+
((decision.kind === 'wait' && decision.reason === 'awaiting-pr') ||
|
|
5927
|
+
epilogueLeaf(state) ||
|
|
5928
|
+
waitParked(state) ||
|
|
5929
|
+
pendingWaitRequest(state) !== undefined)
|
|
5354
5930
|
)
|
|
5355
5931
|
return
|
|
5356
5932
|
// A provider- or log-proved END in the same generation re-attaches in
|
|
@@ -5481,30 +6057,69 @@ export class Dispatcher {
|
|
|
5481
6057
|
this.tickAbandonments.push(abandonedPreparationDiagnostic(attempt, recorded))
|
|
5482
6058
|
}
|
|
5483
6059
|
|
|
6060
|
+
/** Whether the build at `slug` was created for this attempt's ticket. */
|
|
6061
|
+
private async preparationOwns(attempt: TicketPreparation, record: BuildRecord): Promise<boolean> {
|
|
6062
|
+
const created = (await this.store.buildFacts(record.slug)).created
|
|
6063
|
+
return (
|
|
6064
|
+
record.repo === this.deps.repo &&
|
|
6065
|
+
record.ticket?.source === attempt.ticket.source &&
|
|
6066
|
+
record.ticket?.id === attempt.ticket.id &&
|
|
6067
|
+
created?.payload.repo === this.deps.repo &&
|
|
6068
|
+
created.payload.ticket?.source === attempt.ticket.source &&
|
|
6069
|
+
created.payload.ticket?.id === attempt.ticket.id
|
|
6070
|
+
)
|
|
6071
|
+
}
|
|
6072
|
+
|
|
5484
6073
|
private async recoverTicketPreparation(attempt: TicketPreparation): Promise<void> {
|
|
5485
6074
|
try {
|
|
5486
6075
|
// A rejected create can have committed. Unavailable or conflicting readback
|
|
5487
|
-
// is never absence and must not authorize a ticket transition.
|
|
6076
|
+
// is never absence and must not authorize a ticket transition. A keyed
|
|
6077
|
+
// attempt's build is at its proposed slug (exact-slug store) or the slug
|
|
6078
|
+
// its own key derives (allocating store): at most two point reads, and
|
|
6079
|
+
// never another attempt's build.
|
|
5488
6080
|
if (attempt.slug) {
|
|
5489
|
-
const
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
6081
|
+
const candidates = attempt.creationKey
|
|
6082
|
+
? [attempt.slug, creationBuildSlug(this.deps.repo, attempt.slug, attempt.creationKey)]
|
|
6083
|
+
: [attempt.slug]
|
|
6084
|
+
const found: BuildRecord[] = []
|
|
6085
|
+
for (const slug of candidates) {
|
|
6086
|
+
const record = await this.store.getBuild(slug)
|
|
6087
|
+
if (record) found.push(record)
|
|
6088
|
+
}
|
|
6089
|
+
if (found.length > 1)
|
|
6090
|
+
return await this.abandonPreparation(
|
|
6091
|
+
attempt,
|
|
6092
|
+
`Ambiguous creation identity: builds at ${found.map((record) => record.slug).join(' and ')} both answer this attempt; ticket unchanged. Inspect ownership before manually retrying. Original failure: ${attempt.error ?? 'unknown'}`,
|
|
5499
6093
|
)
|
|
6094
|
+
const [record] = found
|
|
6095
|
+
if (record) {
|
|
6096
|
+
if (!(await this.preparationOwns(attempt, record)))
|
|
5500
6097
|
return await this.abandonPreparation(
|
|
5501
6098
|
attempt,
|
|
5502
|
-
`Conflicting build ownership at ${
|
|
6099
|
+
`Conflicting build ownership at ${record.slug}; ticket unchanged. Inspect ownership before manually retrying. Original failure: ${attempt.error ?? 'unknown'}`,
|
|
5503
6100
|
)
|
|
5504
6101
|
await this.preparationResolved(attempt, 'owned')
|
|
5505
6102
|
return
|
|
5506
6103
|
}
|
|
6104
|
+
// Absence is evidence only where the creation slug is known: an
|
|
6105
|
+
// allocating store may have committed an unkeyed create under a slug
|
|
6106
|
+
// no point read can find, and enumerating builds is never a fallback.
|
|
6107
|
+
if (!attempt.creationKey && (await this.store.buildCreationIdentity?.()) !== undefined)
|
|
6108
|
+
return await this.abandonPreparation(
|
|
6109
|
+
attempt,
|
|
6110
|
+
`Creation outcome unknown: the build store allocates canonical slugs and this attempt recorded no creation key, so a build created under an unrecorded slug cannot be ruled out; ticket unchanged. Inspect the repository's builds for ticket ${attempt.ticket.id} before manually retrying. Original failure: ${attempt.error ?? 'unknown'}`,
|
|
6111
|
+
)
|
|
5507
6112
|
}
|
|
6113
|
+
// A committed `ticket.handed-back` whose acknowledgement or resolution
|
|
6114
|
+
// was lost means the hand-back already happened, and a watcher may have
|
|
6115
|
+
// moved the ticket since. Resolve without touching the ticket.
|
|
6116
|
+
const handback = attempt.handback ?? attempt.readyState
|
|
6117
|
+
await this.store.refreshJournal()
|
|
6118
|
+
if (this.store.repositoryFacts().preparation[attempt.attempt]?.reported)
|
|
6119
|
+
return await this.preparationResolved(
|
|
6120
|
+
attempt,
|
|
6121
|
+
handback === attempt.readyState ? 'handed-back' : 'bounced',
|
|
6122
|
+
)
|
|
5508
6123
|
const ref = resolveTicketRef(
|
|
5509
6124
|
this.store.repositoryFacts().ticketMigrations,
|
|
5510
6125
|
attempt.ticket,
|
|
@@ -5520,8 +6135,22 @@ export class Dispatcher {
|
|
|
5520
6135
|
'Ticket state is unavailable; ticket unchanged. Inspect the provider record before manually retrying.',
|
|
5521
6136
|
)
|
|
5522
6137
|
const state = (value: string) => value.toLowerCase()
|
|
5523
|
-
|
|
6138
|
+
// Only a confirmed claim left Ready; an unconfirmed one that stayed
|
|
6139
|
+
// Ready was never handed back and gets no report.
|
|
6140
|
+
const reportHandback = async (): Promise<void> => {
|
|
6141
|
+
if (!attempt.claimed) return
|
|
6142
|
+
const ready = handback === attempt.readyState
|
|
6143
|
+
await this.reportPreparationHandback(attempt, {
|
|
6144
|
+
ticket: ref,
|
|
6145
|
+
attempt: attempt.attempt,
|
|
6146
|
+
cause: ready ? 'preparation-failed' : 'spec-bounce',
|
|
6147
|
+
state: handback,
|
|
6148
|
+
role: ready ? 'ready' : 'triage',
|
|
6149
|
+
...(attempt.missing && attempt.missing.length > 0 ? { missing: attempt.missing } : {}),
|
|
6150
|
+
})
|
|
6151
|
+
}
|
|
5524
6152
|
if (state(ticket.state) === state(handback)) {
|
|
6153
|
+
await reportHandback()
|
|
5525
6154
|
await this.preparationResolved(
|
|
5526
6155
|
attempt,
|
|
5527
6156
|
handback === attempt.readyState ? 'handed-back' : 'bounced',
|
|
@@ -5539,6 +6168,7 @@ export class Dispatcher {
|
|
|
5539
6168
|
`Confirmed claim but ticket externally changed to state ${ticket.state}; ticket unchanged. Inspect ownership before manually retrying. Original failure: ${attempt.error ?? 'unknown'}`,
|
|
5540
6169
|
)
|
|
5541
6170
|
await this.deps.tickets.transition(ref.id, handback)
|
|
6171
|
+
await reportHandback()
|
|
5542
6172
|
await this.preparationResolved(
|
|
5543
6173
|
attempt,
|
|
5544
6174
|
handback === attempt.readyState ? 'handed-back' : 'bounced',
|
|
@@ -5639,9 +6269,12 @@ export class Dispatcher {
|
|
|
5639
6269
|
)
|
|
5640
6270
|
// Urgent first, each class in source order (stable). Every gate below is
|
|
5641
6271
|
// unchanged; a source without the priority capability is all normal.
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
6272
|
+
// A ticket whose labels select two profiles is never claimed (SPEC §9).
|
|
6273
|
+
const conflicts = this.profileConflicts(eligible)
|
|
6274
|
+
const claimable = eligible.filter((ticket) => !conflicts.tickets.has(ticket))
|
|
6275
|
+
const ready = this.deps.tickets.priority ? urgentFirst(claimable) : claimable
|
|
6276
|
+
report.invalidTickets += listing.diagnostics.length + conflicts.diagnostics.length
|
|
6277
|
+
report.ticketDiagnostics.push(...listing.diagnostics, ...conflicts.diagnostics)
|
|
5645
6278
|
report.queued = ready.length
|
|
5646
6279
|
const withheld = new Set<string>()
|
|
5647
6280
|
for (const ticket of ready) {
|
|
@@ -5726,7 +6359,10 @@ export class Dispatcher {
|
|
|
5726
6359
|
)
|
|
5727
6360
|
})
|
|
5728
6361
|
const destinationHeads = new Map<string, PresenceObservation>()
|
|
5729
|
-
const demands: {
|
|
6362
|
+
const demands: {
|
|
6363
|
+
slug: string
|
|
6364
|
+
request: EventPayload<'node.restack-requested'>
|
|
6365
|
+
}[] = []
|
|
5730
6366
|
const verdicts = new Map<string, DependencyVerdict>()
|
|
5731
6367
|
const failed = new Set<string>()
|
|
5732
6368
|
const targetBlocked = new Set<string>()
|
|
@@ -5953,13 +6589,29 @@ export class Dispatcher {
|
|
|
5953
6589
|
}
|
|
5954
6590
|
if (!conformance.conforms) {
|
|
5955
6591
|
attempt.handback = this.triageState()
|
|
6592
|
+
const missing = conformance.missing.length > 0 ? conformance.missing : undefined
|
|
6593
|
+
if (missing) attempt.missing = missing
|
|
5956
6594
|
await store.appendRepo(this.deps.repo, {
|
|
5957
6595
|
actor: DISPATCHER,
|
|
5958
6596
|
type: 'ticket-preparation.handback-selected',
|
|
5959
|
-
payload: {
|
|
6597
|
+
payload: {
|
|
6598
|
+
attempt: attempt.attempt,
|
|
6599
|
+
ticket: attempt.ticket,
|
|
6600
|
+
state: attempt.handback,
|
|
6601
|
+
...(missing ? { missing } : {}),
|
|
6602
|
+
},
|
|
5960
6603
|
})
|
|
5961
6604
|
stage = 'bounce'
|
|
5962
6605
|
await this.bounce(ticket, conformance.missing)
|
|
6606
|
+
stage = 'handback-report'
|
|
6607
|
+
await this.reportPreparationHandback(attempt, {
|
|
6608
|
+
ticket: ticket.ref,
|
|
6609
|
+
attempt: attempt.attempt,
|
|
6610
|
+
cause: 'spec-bounce',
|
|
6611
|
+
state: attempt.handback,
|
|
6612
|
+
role: 'triage',
|
|
6613
|
+
...(missing ? { missing } : {}),
|
|
6614
|
+
})
|
|
5963
6615
|
await this.preparationResolved(attempt, 'bounced')
|
|
5964
6616
|
report.bounced += 1
|
|
5965
6617
|
report.queued -= 1
|
|
@@ -5972,6 +6624,10 @@ export class Dispatcher {
|
|
|
5972
6624
|
const slug = await this.uniqueSlug(baseSlug, prefix)
|
|
5973
6625
|
const branch = `${prefix}/${slug}`
|
|
5974
6626
|
const repoOrigin = await this.resolveRepoOriginOnce()
|
|
6627
|
+
// Recorded only on the store's attestation, so recovery never treats
|
|
6628
|
+
// an unkeyed creation's absence at the derived slug as evidence.
|
|
6629
|
+
const creationKey =
|
|
6630
|
+
(await store.buildCreationIdentity?.()) === 'keyed' ? attempt.attempt : undefined
|
|
5975
6631
|
createdSeed = {
|
|
5976
6632
|
...(ticket.kind === 'node' ? { kind: ticket.kind } : {}),
|
|
5977
6633
|
...(target !== undefined ? { target: target.target, baseBranch: target.branch } : {}),
|
|
@@ -5988,15 +6644,23 @@ export class Dispatcher {
|
|
|
5988
6644
|
// Frozen from the same claimed ticket sample as the body (SPEC
|
|
5989
6645
|
// "Forge issue links"); later ticket edits never reach this build.
|
|
5990
6646
|
...(ticket.issueLinks !== undefined ? { issueLinks: ticket.issueLinks } : {}),
|
|
6647
|
+
// Fixed at claim from the same sample: relabelling never changes it.
|
|
6648
|
+
...this.selectedProfile(ticket),
|
|
5991
6649
|
}
|
|
5992
6650
|
// `build.created` rides with the record so the pinned assets and the
|
|
5993
6651
|
// record exist together or not at all.
|
|
5994
6652
|
stage = 'creation-identity'
|
|
5995
6653
|
attempt.slug = slug
|
|
6654
|
+
if (creationKey !== undefined) attempt.creationKey = creationKey
|
|
5996
6655
|
await store.appendRepo(this.deps.repo, {
|
|
5997
6656
|
actor: DISPATCHER,
|
|
5998
6657
|
type: 'ticket-preparation.creation-selected',
|
|
5999
|
-
payload: {
|
|
6658
|
+
payload: {
|
|
6659
|
+
attempt: attempt.attempt,
|
|
6660
|
+
ticket: attempt.ticket,
|
|
6661
|
+
slug,
|
|
6662
|
+
...(creationKey !== undefined ? { creationKey } : {}),
|
|
6663
|
+
},
|
|
6000
6664
|
})
|
|
6001
6665
|
stage = 'create-build'
|
|
6002
6666
|
record = await store.createBuild({
|
|
@@ -6005,6 +6669,7 @@ export class Dispatcher {
|
|
|
6005
6669
|
ticket: ticket.ref,
|
|
6006
6670
|
branch,
|
|
6007
6671
|
...(repoOrigin !== undefined ? { repoOrigin } : {}),
|
|
6672
|
+
...(creationKey !== undefined ? { creationKey } : {}),
|
|
6008
6673
|
created: {
|
|
6009
6674
|
actor: DISPATCHER,
|
|
6010
6675
|
type: 'build.created',
|
|
@@ -6074,7 +6739,10 @@ export class Dispatcher {
|
|
|
6074
6739
|
ticket: Ticket,
|
|
6075
6740
|
scan: TargetScan,
|
|
6076
6741
|
): Promise<
|
|
6077
|
-
| {
|
|
6742
|
+
| {
|
|
6743
|
+
target: NonNullable<EventPayload<'build.created'>['target']>
|
|
6744
|
+
branch: string
|
|
6745
|
+
}
|
|
6078
6746
|
| string
|
|
6079
6747
|
| undefined
|
|
6080
6748
|
> {
|
|
@@ -6422,7 +7090,12 @@ export class Dispatcher {
|
|
|
6422
7090
|
)
|
|
6423
7091
|
continue
|
|
6424
7092
|
await suspendNativeLanding(
|
|
6425
|
-
{
|
|
7093
|
+
{
|
|
7094
|
+
store: this.store,
|
|
7095
|
+
forge,
|
|
7096
|
+
slug: child.record.slug,
|
|
7097
|
+
workspacePath: checkout,
|
|
7098
|
+
},
|
|
6426
7099
|
`node:${record.slug}:${operation}`,
|
|
6427
7100
|
)
|
|
6428
7101
|
}
|
|
@@ -6660,6 +7333,7 @@ export class Dispatcher {
|
|
|
6660
7333
|
head: exact.headSha,
|
|
6661
7334
|
}
|
|
6662
7335
|
let context: string | undefined
|
|
7336
|
+
let headPaths: HeadPathsArtifact | undefined
|
|
6663
7337
|
await this.withKernelRepository(async (path) => {
|
|
6664
7338
|
const head = await forge.rewrite!.snapshot({
|
|
6665
7339
|
workspacePath: path,
|
|
@@ -6673,22 +7347,29 @@ export class Dispatcher {
|
|
|
6673
7347
|
ref: `refs/autobuild/archive/${record.slug}/${head}`,
|
|
6674
7348
|
sha: head,
|
|
6675
7349
|
})
|
|
7350
|
+
const exec = forge.kernelExec ?? this.deps.exec
|
|
7351
|
+
// Snapshot fetch brings the complete head ancestry, including merge sides.
|
|
7352
|
+
// A parent may have advanced independently and need its own fetch.
|
|
7353
|
+
const parent = await exec(['git', 'cat-file', '-e', `${exact.parentSha}^{commit}`], {
|
|
7354
|
+
cwd: path,
|
|
7355
|
+
})
|
|
7356
|
+
if (parent.exitCode !== 0) {
|
|
7357
|
+
const fetched = await exec(['git', 'fetch', '--no-tags', 'origin', exact.parentSha], {
|
|
7358
|
+
cwd: path,
|
|
7359
|
+
})
|
|
7360
|
+
if (fetched.exitCode !== 0)
|
|
7361
|
+
throw new Error(`cannot fetch node verification parent: ${fetched.stderr}`)
|
|
7362
|
+
}
|
|
7363
|
+
// The cycle's candidate head is recorded once, with the cycle.
|
|
7364
|
+
if (!headPathsFor(current, exact.headSha).recorded)
|
|
7365
|
+
headPaths = await computeHeadPaths(exec, path, {
|
|
7366
|
+
source: 'integration',
|
|
7367
|
+
head: exact.headSha,
|
|
7368
|
+
destination: exact.parentSha,
|
|
7369
|
+
})
|
|
6676
7370
|
if (
|
|
6677
7371
|
config.verify.steps.some((step) => config.verify.stepConfigs[step]?.kind === 'agent')
|
|
6678
7372
|
) {
|
|
6679
|
-
const exec = forge.kernelExec ?? this.deps.exec
|
|
6680
|
-
// Snapshot fetch brings the complete head ancestry, including merge sides.
|
|
6681
|
-
// A parent may have advanced independently and need its own fetch.
|
|
6682
|
-
const parent = await exec(['git', 'cat-file', '-e', `${exact.parentSha}^{commit}`], {
|
|
6683
|
-
cwd: path,
|
|
6684
|
-
})
|
|
6685
|
-
if (parent.exitCode !== 0) {
|
|
6686
|
-
const fetched = await exec(['git', 'fetch', '--no-tags', 'origin', exact.parentSha], {
|
|
6687
|
-
cwd: path,
|
|
6688
|
-
})
|
|
6689
|
-
if (fetched.exitCode !== 0)
|
|
6690
|
-
throw new Error(`cannot fetch node verification parent: ${fetched.stderr}`)
|
|
6691
|
-
}
|
|
6692
7373
|
context = await prepareNodeVerificationContext(
|
|
6693
7374
|
this.store,
|
|
6694
7375
|
record.repo,
|
|
@@ -6699,9 +7380,21 @@ export class Dispatcher {
|
|
|
6699
7380
|
}
|
|
6700
7381
|
})
|
|
6701
7382
|
if (!(await this.store.renewNodeWriter(record.slug, holder))) return
|
|
7383
|
+
let expectedSeq = current.lastSeq
|
|
7384
|
+
if (headPaths !== undefined) {
|
|
7385
|
+
const { artifacts, makeEvent } = headPathsWrite(headPaths, 'integration', DISPATCHER)
|
|
7386
|
+
const recorded = await this.store.appendWithArtifactsIfCurrent(
|
|
7387
|
+
record.slug,
|
|
7388
|
+
expectedSeq,
|
|
7389
|
+
artifacts,
|
|
7390
|
+
makeEvent,
|
|
7391
|
+
)
|
|
7392
|
+
if (!recorded) return
|
|
7393
|
+
expectedSeq = recorded.event.seq
|
|
7394
|
+
}
|
|
6702
7395
|
const prepared = await this.store.appendWithArtifactsIfCurrent(
|
|
6703
7396
|
record.slug,
|
|
6704
|
-
|
|
7397
|
+
expectedSeq,
|
|
6705
7398
|
context === undefined ? [] : [{ kind: NODE_VERIFICATION_CONTEXT, content: context }],
|
|
6706
7399
|
(deposited) => ({
|
|
6707
7400
|
actor: DISPATCHER,
|
|
@@ -6710,7 +7403,12 @@ export class Dispatcher {
|
|
|
6710
7403
|
...cycle,
|
|
6711
7404
|
config: integrationConfig(config),
|
|
6712
7405
|
...(deposited[0]
|
|
6713
|
-
? {
|
|
7406
|
+
? {
|
|
7407
|
+
context: {
|
|
7408
|
+
kind: NODE_VERIFICATION_CONTEXT,
|
|
7409
|
+
rev: deposited[0].revision,
|
|
7410
|
+
},
|
|
7411
|
+
}
|
|
6714
7412
|
: {}),
|
|
6715
7413
|
},
|
|
6716
7414
|
}),
|
|
@@ -6822,7 +7520,11 @@ export class Dispatcher {
|
|
|
6822
7520
|
return
|
|
6823
7521
|
throw error
|
|
6824
7522
|
}
|
|
6825
|
-
await this.store.append(record.slug, {
|
|
7523
|
+
await this.store.append(record.slug, {
|
|
7524
|
+
actor: DISPATCHER,
|
|
7525
|
+
type: 'pr.opened',
|
|
7526
|
+
payload: { pr },
|
|
7527
|
+
})
|
|
6826
7528
|
}
|
|
6827
7529
|
|
|
6828
7530
|
/** Recover manifests after merge-observation crashes as well as before
|
|
@@ -6850,7 +7552,10 @@ export class Dispatcher {
|
|
|
6850
7552
|
try {
|
|
6851
7553
|
await this.withKernelRepository(async (path) => {
|
|
6852
7554
|
const forge = this.kernelForge()
|
|
6853
|
-
const git = {
|
|
7555
|
+
const git = {
|
|
7556
|
+
exec: forge.kernelExec ?? this.deps.exec,
|
|
7557
|
+
workspacePath: path,
|
|
7558
|
+
}
|
|
6854
7559
|
const visiting = new Set<string>()
|
|
6855
7560
|
const recover = async (slug: string): Promise<void> => {
|
|
6856
7561
|
if (visiting.has(slug)) throw new Error('cyclic node contribution evidence')
|
|
@@ -6923,7 +7628,11 @@ export class Dispatcher {
|
|
|
6923
7628
|
state.nodeRestack ??= { items: [] }
|
|
6924
7629
|
state.nodeRestack.contribution = payload
|
|
6925
7630
|
entry.digest.nodeContribution = payload
|
|
6926
|
-
inputs.landings.push({
|
|
7631
|
+
inputs.landings.push({
|
|
7632
|
+
slug,
|
|
7633
|
+
sha: landing,
|
|
7634
|
+
contribution: identities,
|
|
7635
|
+
})
|
|
6927
7636
|
visiting.delete(slug)
|
|
6928
7637
|
}
|
|
6929
7638
|
for (const entry of pending) {
|
|
@@ -7063,11 +7772,17 @@ export class Dispatcher {
|
|
|
7063
7772
|
private async presenceVerdict(
|
|
7064
7773
|
ticket: Ticket,
|
|
7065
7774
|
target:
|
|
7066
|
-
| {
|
|
7775
|
+
| {
|
|
7776
|
+
target: NonNullable<EventPayload<'build.created'>['target']>
|
|
7777
|
+
branch: string
|
|
7778
|
+
}
|
|
7067
7779
|
| undefined,
|
|
7068
7780
|
nodes: Map<string, DependencyNode>,
|
|
7069
7781
|
inputs: PresenceInputs,
|
|
7070
|
-
demands: {
|
|
7782
|
+
demands: {
|
|
7783
|
+
slug: string
|
|
7784
|
+
request: EventPayload<'node.restack-requested'>
|
|
7785
|
+
}[],
|
|
7071
7786
|
observations: Map<string, PresenceObservation>,
|
|
7072
7787
|
): Promise<DependencyVerdict> {
|
|
7073
7788
|
const branch = target?.branch ?? this.deps.config.baseBranch
|
|
@@ -7144,9 +7859,12 @@ export class Dispatcher {
|
|
|
7144
7859
|
),
|
|
7145
7860
|
]
|
|
7146
7861
|
if (target && missing.length) {
|
|
7147
|
-
const path: {
|
|
7148
|
-
|
|
7149
|
-
|
|
7862
|
+
const path: {
|
|
7863
|
+
slug?: string
|
|
7864
|
+
identities: string[]
|
|
7865
|
+
branch: string
|
|
7866
|
+
head: string
|
|
7867
|
+
}[] = [{ slug: target.target.build, ...observed }]
|
|
7150
7868
|
const seen = new Set<string>()
|
|
7151
7869
|
let slug: string | undefined = target.target.build
|
|
7152
7870
|
while (slug) {
|
|
@@ -7363,7 +8081,11 @@ export class Dispatcher {
|
|
|
7363
8081
|
} catch {
|
|
7364
8082
|
return pending
|
|
7365
8083
|
}
|
|
7366
|
-
this.foreignBranchCache.set(target, {
|
|
8084
|
+
this.foreignBranchCache.set(target, {
|
|
8085
|
+
fingerprint,
|
|
8086
|
+
branch,
|
|
8087
|
+
scan: scan.generation,
|
|
8088
|
+
})
|
|
7367
8089
|
}
|
|
7368
8090
|
return branch === null
|
|
7369
8091
|
? pending
|