@defrex/autobuild 1.6.0 → 1.7.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 +107 -10
- package/docs/agent-runtimes.md +1 -1
- package/docs/architecture.md +62 -22
- package/docs/configuration-overview.md +10 -0
- package/docs/configuration.md +285 -5
- package/docs/forges.md +1 -0
- package/docs/operator-api.md +19 -8
- package/docs/operator-surfaces.md +6 -3
- package/docs/plugin-authoring.md +44 -6
- package/docs/remote-store-protocol.md +19 -6
- package/docs/restacking.md +12 -7
- package/docs/ticket-sources.md +34 -6
- package/docs/tickets.md +6 -0
- package/docs/workspaces.md +1 -1
- package/package.json +3 -3
- package/packages/core/src/cli/attention.ts +1 -0
- package/packages/core/src/cli/binary-direct.ts +1 -0
- 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 +11 -4
- package/packages/core/src/cli/init-validation.ts +14 -1
- package/packages/core/src/cli/repository-status.ts +37 -2
- package/packages/core/src/cli/status.ts +8 -0
- package/packages/core/src/cli/ticket.ts +22 -4
- package/packages/core/src/cli/watch.ts +2 -0
- package/packages/core/src/config/live.ts +4 -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 +166 -24
- package/packages/core/src/events/compatibility.ts +3 -1
- package/packages/core/src/events/forge-degradation-policy.ts +16 -2
- package/packages/core/src/events/payloads.ts +8 -0
- package/packages/core/src/events/policy.ts +1 -0
- package/packages/core/src/events/repository.ts +17 -0
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +73 -124
- package/packages/core/src/kernel/build-creation.ts +29 -0
- 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/node-parent.ts +2 -0
- package/packages/core/src/kernel/read-facts.ts +9 -1
- package/packages/core/src/kernel/reducer.ts +18 -1
- package/packages/core/src/kernel/ticket-preparation.ts +4 -1
- package/packages/core/src/operator/protocol.ts +10 -0
- package/packages/core/src/operator/query.ts +1 -1
- package/packages/core/src/operator/registry.ts +25 -5
- 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/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 +33 -3
- 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 +4 -1
- package/packages/core/src/processes/build-runner.ts +15 -1
- package/packages/core/src/processes/dispatcher.ts +98 -18
- 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/repo-view.ts +2 -0
- package/packages/core/src/scenarios/harness.ts +15 -1
- package/packages/core/src/store/reducer-value-shapes.json +3119 -2926
- package/packages/core/src/store/remote/client.ts +21 -8
- package/packages/core/src/store/remote/index.ts +4 -0
- package/packages/core/src/store/remote/protocol.ts +7 -0
- package/packages/core/src/store/remote/released-clients.json +11 -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/index.ts +2 -0
- package/packages/core/src/store/repo-state-events.ts +1 -0
- package/packages/core/src/store/types.ts +11 -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 +72 -9
- package/skills/guide/SKILL.md +116 -21
- package/skills/guide/references/operator-api.md +19 -8
- package/skills/guide/references/plugin-authoring.md +44 -6
- package/skills/guide/references/remote-store-protocol.md +19 -6
- package/skills/guide/references/restacking.md +12 -7
- package/skills/operate/SKILL.md +29 -3
- package/skills/tickets/SKILL.md +18 -2
- package/templates/hosted-service/package.json +2 -2
|
@@ -28,8 +28,11 @@ import {
|
|
|
28
28
|
} from '../ports/workspace/provider-capabilities'
|
|
29
29
|
import { defineEntry, openMap, ownEntries, parseEntry } from '../open-map'
|
|
30
30
|
import { forwardIssues } from '../zod-issues'
|
|
31
|
-
import { effectiveRuntimeReferences } from './roles'
|
|
31
|
+
import { displayName, effectiveRuntimeReferences, RESERVED_ROLE } from './roles'
|
|
32
|
+
import { normalizeProfileLabel, profileRoles } from './profiles'
|
|
32
33
|
import {
|
|
34
|
+
createAssigneeUnsupported,
|
|
35
|
+
GITHUB_CREATE_ASSIGNEE,
|
|
33
36
|
GITHUB_READY_ASSIGNEE,
|
|
34
37
|
LINEAR_READY_ASSIGNEE,
|
|
35
38
|
readyAssigneeUnsupported,
|
|
@@ -727,6 +730,51 @@ documentSchema(roleSchema.shape.alternates, {
|
|
|
727
730
|
})
|
|
728
731
|
export type RoleConfig = z.infer<typeof roleSchema>
|
|
729
732
|
|
|
733
|
+
// ── [profiles] ───────────────────────────────────────────────────────────────
|
|
734
|
+
//
|
|
735
|
+
// Open map: profile → one ticket label plus role entries (SPEC §9). A build
|
|
736
|
+
// whose ticket carries the label at claim resolves its roles through this
|
|
737
|
+
// overlay. Label uniqueness, nonblank labels, the refused `default` entry and
|
|
738
|
+
// overlaid account selection are cross-validated in configSchema below;
|
|
739
|
+
// runtime and model compatibility is checked by the eager resolver.
|
|
740
|
+
|
|
741
|
+
const profileRoleSchema = roleSchema.extend({
|
|
742
|
+
// A distinct field schema so its reference names the profile inheritance
|
|
743
|
+
// order; the repository role's own budget sits between the entry and default.
|
|
744
|
+
sessionBudgetSeconds: z.number().int().positive().optional(),
|
|
745
|
+
})
|
|
746
|
+
documentSchema(profileRoleSchema.shape.sessionBudgetSeconds, {
|
|
747
|
+
description:
|
|
748
|
+
'Active-time budget for each build phase session routed through this role in a profiled build. Suspended intervals are excluded; native continuation retains the original ceiling and accumulated active time. One budget covers the primary and every alternate target.',
|
|
749
|
+
constraints:
|
|
750
|
+
'Omission inherits roles.<role>.sessionBudgetSeconds, then roles.default.sessionBudgetSeconds, otherwise policy.sessionBudgetSeconds.',
|
|
751
|
+
})
|
|
752
|
+
documentSchema(profileRoleSchema, {
|
|
753
|
+
description:
|
|
754
|
+
"Role override for builds whose ticket carries the profile's label. Omitted fields inherit `[roles.<role>]`, then `[roles.default]`; a declared alternates list, including [], replaces the inherited list.",
|
|
755
|
+
})
|
|
756
|
+
|
|
757
|
+
const profileSchema = z.strictObject({
|
|
758
|
+
label: z.string(),
|
|
759
|
+
roles: openMap('[profiles.<name>.roles]', profileRoleSchema),
|
|
760
|
+
})
|
|
761
|
+
documentFields(profileSchema, {
|
|
762
|
+
label:
|
|
763
|
+
"Ticket label that selects this profile, matched case-insensitively after trimming. A ticket carrying two profiles' labels is not claimed.",
|
|
764
|
+
roles:
|
|
765
|
+
'Role entries this profile overrides. Any role name is accepted except the reserved default.',
|
|
766
|
+
})
|
|
767
|
+
documentSchema(profileSchema.shape.label, {
|
|
768
|
+
constraints: 'Nonblank; unique across profiles after trimming and case folding.',
|
|
769
|
+
})
|
|
770
|
+
documentSchema(profileSchema.shape.roles, {
|
|
771
|
+
constraints: 'An entry named default is refused',
|
|
772
|
+
})
|
|
773
|
+
documentSchema(profileSchema, {
|
|
774
|
+
description:
|
|
775
|
+
"Named role profile. The build's profile is fixed when its ticket is claimed; the profile's contents are read at each session boundary.",
|
|
776
|
+
})
|
|
777
|
+
|
|
730
778
|
// ── [policy] ─────────────────────────────────────────────────────────────────
|
|
731
779
|
|
|
732
780
|
const DISPATCH_LEASE_PAIR_MESSAGE =
|
|
@@ -871,6 +919,21 @@ export const ticketsInputSchema = z.strictObject({
|
|
|
871
919
|
'[tickets].readyAssignee must be a nonblank value with no surrounding whitespace',
|
|
872
920
|
)
|
|
873
921
|
.optional(),
|
|
922
|
+
/**
|
|
923
|
+
* Assigns every ticket Autobuild creates (`ab ticket create`, operator
|
|
924
|
+
* `tickets.create`, harvest proposals) to one user unless the create names
|
|
925
|
+
* its own assignees. A ticket-source capability: the source must declare
|
|
926
|
+
* `assignees`. github takes `"me"` (the owner of the creating credential —
|
|
927
|
+
* for harvest, the filing dispatcher's) or a username. Absent sends no
|
|
928
|
+
* assignee.
|
|
929
|
+
*/
|
|
930
|
+
createAssignee: z
|
|
931
|
+
.string()
|
|
932
|
+
.refine(
|
|
933
|
+
(s) => s.trim().length > 0 && s === s.trim(),
|
|
934
|
+
'[tickets].createAssignee must be a nonblank value with no surrounding whitespace',
|
|
935
|
+
)
|
|
936
|
+
.optional(),
|
|
874
937
|
/** Backend team key (e.g. "ENG") — required for linear and hosted;
|
|
875
938
|
* forbidden for github. */
|
|
876
939
|
teamKey: z.string().min(1).optional(),
|
|
@@ -946,6 +1009,8 @@ documentFields(ticketsInputSchema, {
|
|
|
946
1009
|
readyState: 'The one workflow state eligible for dispatch.',
|
|
947
1010
|
readyAssignee:
|
|
948
1011
|
'Require the ticket to be assigned to one user, in addition to the state and label gates.',
|
|
1012
|
+
createAssignee:
|
|
1013
|
+
'Assign every ticket Autobuild creates (`ab ticket create`, operator `tickets.create`, harvest proposals) to one user unless the create names its own assignees.',
|
|
949
1014
|
teamKey: 'Backend team key such as `"ENG"`, or an existing plugin config field.',
|
|
950
1015
|
claimedState: 'Workflow state entered when a ticket is claimed.',
|
|
951
1016
|
doneState: 'Project completion state and merged-ticket transition.',
|
|
@@ -978,6 +1043,10 @@ documentSchema(ticketsInputSchema.shape.readyAssignee, {
|
|
|
978
1043
|
constraints:
|
|
979
1044
|
'Allowed for sources that can filter by assignee: linear ("me" or an email), github ("me" or a GitHub username, including managed-user logins such as mona_acme), and plugin sources that declare readyAssignee. Refused for file and hosted.',
|
|
980
1045
|
})
|
|
1046
|
+
documentSchema(ticketsInputSchema.shape.createAssignee, {
|
|
1047
|
+
constraints:
|
|
1048
|
+
'Allowed for github ("me" or a GitHub username) and plugin sources that declare assignees. Refused for file, hosted and linear.',
|
|
1049
|
+
})
|
|
981
1050
|
documentSchema(ticketsInputSchema.shape.readyLabels, {
|
|
982
1051
|
constraints:
|
|
983
1052
|
'Omission uses source readiness defaults (Linear and GitHub: autobuild label; file: none). Explicit [] disables label gating.',
|
|
@@ -1202,6 +1271,7 @@ export const configRootSchema = z.strictObject({
|
|
|
1202
1271
|
// therefore include the complete materialized runtime list in its diagnostic.
|
|
1203
1272
|
accounts: openMap('[accounts]', accountSchema).default({}),
|
|
1204
1273
|
roles: openMap('[roles]', roleSchema),
|
|
1274
|
+
profiles: openMap('[profiles]', profileSchema),
|
|
1205
1275
|
policy: policySchema.prefault({}),
|
|
1206
1276
|
orchestrator: orchestratorSchema.prefault({}),
|
|
1207
1277
|
// An absent [tickets] table must NOT silently default past the mandatory
|
|
@@ -1238,6 +1308,8 @@ documentFields(configRootSchema, {
|
|
|
1238
1308
|
accounts:
|
|
1239
1309
|
'Named Claude subscription, Kimi Code, or ChatGPT subscription billing accounts. Descriptors contain credential variable names only.',
|
|
1240
1310
|
roles: 'Named agent roles. The reserved default role provides inherited runtime axes.',
|
|
1311
|
+
profiles:
|
|
1312
|
+
'Named role profiles selected by ticket label. A profile overrides only the role fields it declares, for the builds that selected it.',
|
|
1241
1313
|
policy: 'Lifecycle budgets, retries, convergence and harvest limits.',
|
|
1242
1314
|
orchestrator:
|
|
1243
1315
|
'Operator-agent sandbox settings. This table does not start or host an operator agent.',
|
|
@@ -1315,31 +1387,79 @@ export const configSchema = normalizedConfigSchema.superRefine((config, ctx) =>
|
|
|
1315
1387
|
path: ['orchestrator', 'sandbox', 'environmentVariables'],
|
|
1316
1388
|
message: `Account credential variable ${JSON.stringify(name)} cannot enter an operator sandbox`,
|
|
1317
1389
|
})
|
|
1318
|
-
const
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
const
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
]
|
|
1331
|
-
targets.forEach((target, index) => {
|
|
1332
|
-
try {
|
|
1333
|
-
selectAccount(
|
|
1334
|
-
config.accounts,
|
|
1335
|
-
target.runtime,
|
|
1336
|
-
target.account,
|
|
1337
|
-
`role ${JSON.stringify(role)}${index ? ` alternate[${index - 1}]` : ''}`,
|
|
1338
|
-
)
|
|
1339
|
-
} catch (error) {
|
|
1340
|
-
ctx.addIssue({ code: 'custom', path: ['roles', role], message: (error as Error).message })
|
|
1390
|
+
const checkRoleAccounts = (
|
|
1391
|
+
roles: Record<string, RoleConfig>,
|
|
1392
|
+
keys: readonly string[],
|
|
1393
|
+
path: (role: string) => (string | number)[],
|
|
1394
|
+
label: (role: string) => string,
|
|
1395
|
+
) => {
|
|
1396
|
+
const defaults = roles.default ?? {}
|
|
1397
|
+
for (const role of keys) {
|
|
1398
|
+
const spec = roles[role]!
|
|
1399
|
+
const primary = {
|
|
1400
|
+
runtime: spec.runtime ?? defaults.runtime,
|
|
1401
|
+
account: spec.account ?? defaults.account,
|
|
1341
1402
|
}
|
|
1403
|
+
const targets = [
|
|
1404
|
+
primary,
|
|
1405
|
+
...(spec.alternates ?? defaults.alternates ?? []).map((alt) => ({
|
|
1406
|
+
runtime: alt.runtime ?? primary.runtime,
|
|
1407
|
+
account: alt.account ?? primary.account,
|
|
1408
|
+
})),
|
|
1409
|
+
]
|
|
1410
|
+
targets.forEach((target, index) => {
|
|
1411
|
+
try {
|
|
1412
|
+
selectAccount(
|
|
1413
|
+
config.accounts,
|
|
1414
|
+
target.runtime,
|
|
1415
|
+
target.account,
|
|
1416
|
+
`${label(role)}${index ? ` alternate[${index - 1}]` : ''}`,
|
|
1417
|
+
)
|
|
1418
|
+
} catch (error) {
|
|
1419
|
+
ctx.addIssue({ code: 'custom', path: path(role), message: (error as Error).message })
|
|
1420
|
+
}
|
|
1421
|
+
})
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
checkRoleAccounts(
|
|
1425
|
+
config.roles,
|
|
1426
|
+
Object.keys(config.roles),
|
|
1427
|
+
(role) => ['roles', role],
|
|
1428
|
+
(role) => `role ${JSON.stringify(role)}`,
|
|
1429
|
+
)
|
|
1430
|
+
|
|
1431
|
+
const profileLabels = new Map<string, string>()
|
|
1432
|
+
for (const [name, profile] of Object.entries(config.profiles ?? {})) {
|
|
1433
|
+
const normalized = normalizeProfileLabel(profile.label)
|
|
1434
|
+
if (normalized.length === 0) {
|
|
1435
|
+
ctx.addIssue({
|
|
1436
|
+
code: 'custom',
|
|
1437
|
+
path: ['profiles', name, 'label'],
|
|
1438
|
+
message: `profile ${displayName(name)} needs a nonblank label`,
|
|
1439
|
+
})
|
|
1440
|
+
} else if (profileLabels.has(normalized)) {
|
|
1441
|
+
ctx.addIssue({
|
|
1442
|
+
code: 'custom',
|
|
1443
|
+
path: ['profiles', name, 'label'],
|
|
1444
|
+
message: `profiles ${displayName(profileLabels.get(normalized)!)} and ${displayName(name)} both declare label ${displayName(profile.label.trim())}; each profile needs its own label`,
|
|
1445
|
+
})
|
|
1446
|
+
} else profileLabels.set(normalized, name)
|
|
1447
|
+
const keys = Object.keys(profile.roles).filter((role) => {
|
|
1448
|
+
if (role !== RESERVED_ROLE) return true
|
|
1449
|
+
ctx.addIssue({
|
|
1450
|
+
code: 'custom',
|
|
1451
|
+
path: ['profiles', name, 'roles', role],
|
|
1452
|
+
message: `profile ${displayName(name)} cannot override the reserved default role; name each role it changes`,
|
|
1453
|
+
})
|
|
1454
|
+
return false
|
|
1342
1455
|
})
|
|
1456
|
+
if (config.roles !== undefined)
|
|
1457
|
+
checkRoleAccounts(
|
|
1458
|
+
profileRoles(config.roles, profile.roles),
|
|
1459
|
+
keys,
|
|
1460
|
+
(role) => ['profiles', name, 'roles', role],
|
|
1461
|
+
(role) => `profile ${displayName(name)} role ${JSON.stringify(role)}`,
|
|
1462
|
+
)
|
|
1343
1463
|
}
|
|
1344
1464
|
|
|
1345
1465
|
for (const kind of ['verify', 'finalize'] as const) {
|
|
@@ -1557,6 +1677,28 @@ export const configSchema = normalizedConfigSchema.superRefine((config, ctx) =>
|
|
|
1557
1677
|
ctx.addIssue({ code: 'custom', path: ['tickets', 'readyAssignee'], message: form.message })
|
|
1558
1678
|
}
|
|
1559
1679
|
}
|
|
1680
|
+
// createAssignee is the `assignees` capability, checked the same way.
|
|
1681
|
+
const createAssignee = tickets.createAssignee
|
|
1682
|
+
if (createAssignee !== undefined) {
|
|
1683
|
+
if (tickets.source === 'file' || tickets.source === 'hosted' || tickets.source === 'linear') {
|
|
1684
|
+
ctx.addIssue({
|
|
1685
|
+
code: 'custom',
|
|
1686
|
+
path: ['tickets', 'createAssignee'],
|
|
1687
|
+
message: createAssigneeUnsupported(tickets.source),
|
|
1688
|
+
})
|
|
1689
|
+
} else if (
|
|
1690
|
+
tickets.source === 'github' &&
|
|
1691
|
+
createAssignee.trim().length > 0 &&
|
|
1692
|
+
createAssignee === createAssignee.trim() &&
|
|
1693
|
+
!GITHUB_CREATE_ASSIGNEE.accepts(createAssignee)
|
|
1694
|
+
) {
|
|
1695
|
+
ctx.addIssue({
|
|
1696
|
+
code: 'custom',
|
|
1697
|
+
path: ['tickets', 'createAssignee'],
|
|
1698
|
+
message: GITHUB_CREATE_ASSIGNEE.message,
|
|
1699
|
+
})
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1560
1702
|
// Plugin sources receive the existing ticket lifecycle/configuration fields
|
|
1561
1703
|
// unchanged; adapter-specific validation belongs to their factory.
|
|
1562
1704
|
|
|
@@ -25,7 +25,9 @@ export interface StoredEvent {
|
|
|
25
25
|
/** Change this revision whenever projection semantics change without new types. */
|
|
26
26
|
// Revision 3 retains optional billing-account descriptors in session/attempt projections.
|
|
27
27
|
// Revision 4 retains the optional effective prompt in session projections.
|
|
28
|
-
|
|
28
|
+
// Revision 5 retains the optional preparation creation key.
|
|
29
|
+
// Revision 6 retains the optional role profile on build creation and session starts.
|
|
30
|
+
export const READ_DECODER_REVISION = 6
|
|
29
31
|
export function catalogIdentity(
|
|
30
32
|
build: Record<string, string> = buildEventPolicy,
|
|
31
33
|
repository: Record<string, string> = repositoryEventPolicy,
|
|
@@ -3,9 +3,23 @@ import { forgeHealthEventPayloadSchemas } from './repository'
|
|
|
3
3
|
/** Hosted admission horizon; never applied to historical event decoding. */
|
|
4
4
|
export const MAX_FORGE_DEGRADATION_MS = 24 * 60 * 60 * 1000
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
/** Forge-health facts whose `resetAt` hosted admission bounds. */
|
|
7
|
+
export const FORGE_RESET_EVENT_TYPES = [
|
|
8
|
+
'dispatcher.forge-degraded',
|
|
9
|
+
'forge.credential-limited',
|
|
10
|
+
] as const
|
|
11
|
+
|
|
12
|
+
export function validateForgeResetHorizon(
|
|
13
|
+
type: (typeof FORGE_RESET_EVENT_TYPES)[number],
|
|
14
|
+
payload: unknown,
|
|
15
|
+
now: Date,
|
|
16
|
+
): void {
|
|
17
|
+
const parsed = forgeHealthEventPayloadSchemas[type].parse(payload)
|
|
8
18
|
const deadline = Date.parse(parsed.resetAt)
|
|
9
19
|
if (!Number.isFinite(deadline) || deadline > now.getTime() + MAX_FORGE_DEGRADATION_MS)
|
|
10
20
|
throw new Error('forge resetAt must be a finite ISO deadline within 24 hours of server time')
|
|
11
21
|
}
|
|
22
|
+
|
|
23
|
+
export function validateForgeDegradation(payload: unknown, now: Date): void {
|
|
24
|
+
validateForgeResetHorizon('dispatcher.forge-degraded', payload, now)
|
|
25
|
+
}
|
|
@@ -347,6 +347,10 @@ export const eventPayloadSchemas = {
|
|
|
347
347
|
)
|
|
348
348
|
.superRefine(refineUniqueIssues)
|
|
349
349
|
.optional(),
|
|
350
|
+
/** The `[profiles.<name>]` the ticket's labels selected, frozen at claim;
|
|
351
|
+
* later relabelling never changes it. Omitted for builds without a
|
|
352
|
+
* profile and in historical logs. */
|
|
353
|
+
profile: z.string().min(1).optional(),
|
|
350
354
|
}),
|
|
351
355
|
'node.opening': z.strictObject({
|
|
352
356
|
branch: z.string().min(1),
|
|
@@ -995,6 +999,10 @@ export const eventPayloadSchemas = {
|
|
|
995
999
|
* continue, the interruption notice for a native resume. Absent on
|
|
996
1000
|
* historical events and when the runtime cannot report it. */
|
|
997
1001
|
prompt: z.string().min(1).optional(),
|
|
1002
|
+
/** The build's frozen profile and whether this session's configuration
|
|
1003
|
+
* still defined it. Present only for builds created with a profile; a
|
|
1004
|
+
* `configured: false` session resolved through the repository roles. */
|
|
1005
|
+
profile: z.strictObject({ name: z.string().min(1), configured: z.boolean() }).optional(),
|
|
998
1006
|
}),
|
|
999
1007
|
'session.suspended': z.strictObject({
|
|
1000
1008
|
session: z.string().min(1),
|
|
@@ -243,6 +243,7 @@ export const repositoryEventPolicy = {
|
|
|
243
243
|
'dispatcher.ticket-source-dependency-limited': 'decisive',
|
|
244
244
|
'dispatcher.forge-degraded': 'decisive',
|
|
245
245
|
'dispatcher.forge-recovered': 'decisive',
|
|
246
|
+
'forge.credential-limited': 'advisory',
|
|
246
247
|
'dispatcher.kernel-git-unavailable': 'advisory',
|
|
247
248
|
'dispatcher.kernel-git-recovered': 'advisory',
|
|
248
249
|
'dispatcher.ticket-source-degraded': 'decisive',
|
|
@@ -9,6 +9,7 @@ import { hardReadinessKeys } from '../ports/forge/readiness'
|
|
|
9
9
|
* builds or new phases in the fixed build grammar.
|
|
10
10
|
*/
|
|
11
11
|
import { z } from 'zod'
|
|
12
|
+
import { CREATION_KEY } from '../kernel/build-creation'
|
|
12
13
|
import {
|
|
13
14
|
artifactRefSchema,
|
|
14
15
|
findingSchema,
|
|
@@ -774,6 +775,17 @@ export const forgeHealthEventPayloadSchemas = {
|
|
|
774
775
|
forge: z.string().min(1),
|
|
775
776
|
reason: z.string().trim().min(1).optional(),
|
|
776
777
|
}),
|
|
778
|
+
/** A rate limit that does not belong to the dispatcher's credential: an
|
|
779
|
+
* unauthenticated request, or a limit seen by a build runner or phase
|
|
780
|
+
* session. Advisory attention; it never pauses repository forge work. */
|
|
781
|
+
'forge.credential-limited': z.strictObject({
|
|
782
|
+
forge: z.string().min(1),
|
|
783
|
+
process: z.string().min(1).max(200),
|
|
784
|
+
credential: z.enum(['unauthenticated', 'process']),
|
|
785
|
+
missingCredential: z.string().min(1).max(1000).optional(),
|
|
786
|
+
message: z.string().min(1).max(2000),
|
|
787
|
+
resetAt: z.iso.datetime(),
|
|
788
|
+
}),
|
|
777
789
|
} as const
|
|
778
790
|
|
|
779
791
|
/** The dispatcher could not execute Git for kernel-side node work. One event
|
|
@@ -823,6 +835,9 @@ export const ticketPreparationEventPayloadSchemas = {
|
|
|
823
835
|
'ticket-preparation.creation-selected': z.strictObject({
|
|
824
836
|
...preparationIdentity,
|
|
825
837
|
slug: z.string().min(1),
|
|
838
|
+
// Additive: present only when the store attested keyed creation, so
|
|
839
|
+
// recovery can point-read the canonical slug this key derives.
|
|
840
|
+
creationKey: z.string().regex(CREATION_KEY).optional(),
|
|
826
841
|
}),
|
|
827
842
|
'ticket-preparation.failed': z.strictObject({
|
|
828
843
|
...preparationIdentity,
|
|
@@ -904,6 +919,7 @@ export const REPOSITORY_ATTENTION_EVENTS = [
|
|
|
904
919
|
'harvest.failed',
|
|
905
920
|
'dispatcher.forge-degraded',
|
|
906
921
|
'dispatcher.forge-recovered',
|
|
922
|
+
'forge.credential-limited',
|
|
907
923
|
'dispatcher.kernel-git-unavailable',
|
|
908
924
|
'dispatcher.kernel-git-recovered',
|
|
909
925
|
'dispatcher.ticket-source-degraded',
|
|
@@ -1030,6 +1046,7 @@ const allowedActorKinds: Record<RepositoryEventType, readonly ActorKind[]> = {
|
|
|
1030
1046
|
'dispatcher.ticket-source-dependency-limited': ['dispatcher'],
|
|
1031
1047
|
'dispatcher.forge-degraded': ['dispatcher', 'kernel'],
|
|
1032
1048
|
'dispatcher.forge-recovered': ['dispatcher', 'kernel', 'human'],
|
|
1049
|
+
'forge.credential-limited': ['dispatcher', 'kernel'],
|
|
1033
1050
|
'dispatcher.kernel-git-unavailable': ['dispatcher'],
|
|
1034
1051
|
'dispatcher.kernel-git-recovered': ['dispatcher'],
|
|
1035
1052
|
'dispatcher.ticket-source-degraded': ['dispatcher'],
|