@kici-dev/orchestrator 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/dist/__test-helpers__/fake-scaler-state-store.d.ts +24 -0
  2. package/dist/__test-helpers__/mock-db-query.d.ts +130 -0
  3. package/dist/__test-helpers__/mock-db.d.ts +27 -0
  4. package/dist/agent/agent-version.d.ts +34 -0
  5. package/dist/agent/dispatcher.d.ts +151 -13
  6. package/dist/agent/host-roster.d.ts +37 -5
  7. package/dist/agent/registry.d.ts +2 -0
  8. package/dist/app.d.ts +56 -7
  9. package/dist/approvals/apply-decision.d.ts +67 -19
  10. package/dist/approvals/held-run-release-wiring.d.ts +45 -0
  11. package/dist/approvals/independent-wiring.d.ts +55 -0
  12. package/dist/approvals/resume-router.d.ts +9 -0
  13. package/dist/approvals/triggerer-subject.d.ts +37 -0
  14. package/dist/cache/dep-cache.d.ts +54 -10
  15. package/dist/cache/global-eval-round-cache.d.ts +95 -0
  16. package/dist/cache/index.d.ts +3 -0
  17. package/dist/cache/pending-global-evals.d.ts +42 -0
  18. package/dist/cache/pending-inits.d.ts +10 -0
  19. package/dist/cli/api-client.d.ts +18 -0
  20. package/dist/cli/commands/cluster-settings.d.ts +52 -3
  21. package/dist/cli/commands/diagnose.d.ts +6 -0
  22. package/dist/cli/commands/held-run.d.ts +58 -0
  23. package/dist/cli/commands/runs.d.ts +1 -0
  24. package/dist/cli/commands/trust-policy.d.ts +117 -12
  25. package/dist/cli/kici-admin.d.ts +10 -0
  26. package/dist/cli.js +2770 -938
  27. package/dist/cluster/cluster-identity.d.ts +3 -3
  28. package/dist/cluster/cluster-settings-reader.d.ts +59 -1
  29. package/dist/cluster/coordinator.d.ts +44 -0
  30. package/dist/cluster/index.d.ts +4 -0
  31. package/dist/cluster/peer-handler.d.ts +19 -0
  32. package/dist/cluster/peer-registry.d.ts +17 -0
  33. package/dist/cluster/plan-headroom-store.d.ts +26 -0
  34. package/dist/cluster/worker-eviction.d.ts +69 -0
  35. package/dist/cold-store/load-event-log-range.d.ts +10 -3
  36. package/dist/cold-store/load-secret-audit-log-range.d.ts +4 -3
  37. package/dist/cold-store/tables/secret-audit-log.d.ts +4 -3
  38. package/dist/config.d.ts +48 -21
  39. package/dist/content-requirements-cache.d.ts +55 -0
  40. package/dist/contexts/held-runs.d.ts +123 -16
  41. package/dist/contexts/protection/aggregate.d.ts +3 -2
  42. package/dist/contexts/protection/branch-gate.d.ts +15 -0
  43. package/dist/contexts/protection/concurrency-gate.d.ts +8 -2
  44. package/dist/contexts/protection/pipeline.d.ts +18 -0
  45. package/dist/contexts/release-queued-holds.d.ts +35 -0
  46. package/dist/dashboard/attestation-filters.d.ts +8 -0
  47. package/dist/dashboard/handler.d.ts +6 -24
  48. package/dist/db/migrations/109_cluster_settings_cache_knobs.d.ts +4 -0
  49. package/dist/db/migrations/110_cluster_settings_global_eval_knobs.d.ts +4 -0
  50. package/dist/db/migrations/111_cluster_settings_global_eval_wait.d.ts +4 -0
  51. package/dist/db/migrations/112_execution_runs_workflow_repo.d.ts +4 -0
  52. package/dist/db/migrations/113_execution_runs_workflow_repo_index.d.ts +30 -0
  53. package/dist/db/migrations/114_ingest_queue_claim.d.ts +4 -0
  54. package/dist/db/migrations/115_global_workflows_cluster_switch.d.ts +9 -0
  55. package/dist/db/migrations/116_org_plan_headroom.d.ts +4 -0
  56. package/dist/db/migrations/117_invoke_gate_proxy_jobs.d.ts +4 -0
  57. package/dist/db/migrations/118_invoke_gate_scheduling.d.ts +4 -0
  58. package/dist/db/migrations/119_scaler_ha_ownership.d.ts +4 -0
  59. package/dist/db/migrations/120_cluster_settings_scaler_reaper.d.ts +4 -0
  60. package/dist/db/migrations/121_org_settings_allow_untrusted_dockerfile_builds.d.ts +19 -0
  61. package/dist/db/migrations/122_host_roster_scaler_managed.d.ts +25 -0
  62. package/dist/db/migrations/123_workflow_registrations_default_branch.d.ts +24 -0
  63. package/dist/db/migrations/124_cluster_settings_provision_backoff.d.ts +4 -0
  64. package/dist/db/migrations/125_org_trust_directory.d.ts +30 -0
  65. package/dist/db/migrations/126_held_runs_posted_pending_check.d.ts +28 -0
  66. package/dist/db/migrations/127_org_trust_policy_approval_expiry_seconds.d.ts +26 -0
  67. package/dist/db/migrations/128_execution_runs_global_eval_round.d.ts +23 -0
  68. package/dist/db/migrations/129_execution_runs_dispatch_routing_key.d.ts +24 -0
  69. package/dist/db/migrations/130_scaler_provision_outcomes.d.ts +32 -0
  70. package/dist/db/types.d.ts +428 -12
  71. package/dist/entry-helpers.d.ts +28 -0
  72. package/dist/events/event-emitter.d.ts +22 -0
  73. package/dist/events/event-router.d.ts +87 -1
  74. package/dist/events/types.d.ts +2 -23
  75. package/dist/git/credential-broker.d.ts +94 -0
  76. package/dist/git/inherited-secret.d.ts +24 -0
  77. package/dist/git/installation-token.d.ts +38 -0
  78. package/dist/git/job-context.d.ts +13 -0
  79. package/dist/index.js +324 -84
  80. package/dist/metrics/agent-metrics-aggregator.d.ts +4 -4
  81. package/dist/metrics/prometheus.d.ts +170 -3
  82. package/dist/oidc/oidc-mint-registration.d.ts +7 -3
  83. package/dist/orchestrator-core.d.ts +91 -24
  84. package/dist/pipeline/content-filter.d.ts +71 -0
  85. package/dist/pipeline/direct-ingress-deps.d.ts +100 -0
  86. package/dist/pipeline/dispatch-matched-workflow.d.ts +521 -11
  87. package/dist/pipeline/global-eval-round.d.ts +307 -0
  88. package/dist/pipeline/internal-event-pipeline.d.ts +140 -0
  89. package/dist/pipeline/invoke-gate.d.ts +164 -0
  90. package/dist/pipeline/job-contexts.d.ts +16 -17
  91. package/dist/pipeline/needs-scheduler.d.ts +13 -0
  92. package/dist/pipeline/process-webhook.d.ts +126 -31
  93. package/dist/pipeline/processor.d.ts +282 -23
  94. package/dist/pipeline/rerun.d.ts +21 -0
  95. package/dist/pipeline/resume-workflow.d.ts +40 -7
  96. package/dist/pipeline/route-or-dispatch-jobs.d.ts +15 -0
  97. package/dist/pipeline/security-hold-check.d.ts +217 -0
  98. package/dist/pipeline/test-pipeline.d.ts +12 -0
  99. package/dist/pipeline/undispatched-hold-checks.d.ts +23 -0
  100. package/dist/pipeline/webhook-payload-store.d.ts +20 -0
  101. package/dist/policy/dashboard-write-policy-listener.d.ts +62 -0
  102. package/dist/policy/dashboard-write-policy.d.ts +14 -0
  103. package/dist/provenance/backfill-run.d.ts +10 -1
  104. package/dist/provider-registry.d.ts +47 -4
  105. package/dist/providers/github/check-status-poster.d.ts +33 -3
  106. package/dist/providers/github/commit-message.d.ts +20 -0
  107. package/dist/providers/github/file-contents.d.ts +40 -0
  108. package/dist/providers/github/index.d.ts +2 -2
  109. package/dist/providers/github/normalizer.d.ts +3 -2
  110. package/dist/providers/local/normalizer.d.ts +3 -5
  111. package/dist/providers/universal-git/config.d.ts +2 -0
  112. package/dist/providers/universal-git/index.d.ts +11 -2
  113. package/dist/providers/universal-git/normalizer.d.ts +10 -0
  114. package/dist/queue/cleanup.d.ts +7 -1
  115. package/dist/queue/job-queue.d.ts +112 -7
  116. package/dist/queue/terminalize-unroutable.d.ts +13 -0
  117. package/dist/registration/extractor.d.ts +3 -3
  118. package/dist/registration/registration-index.d.ts +7 -0
  119. package/dist/registration/registration-run-match.d.ts +47 -0
  120. package/dist/registration/registration-store.d.ts +22 -0
  121. package/dist/reporting/check-run-reporter.d.ts +146 -2
  122. package/dist/reporting/check-run-summary.d.ts +25 -1
  123. package/dist/reporting/execution-tracker.d.ts +324 -9
  124. package/dist/reporting/log-chunk-sink.d.ts +8 -5
  125. package/dist/reporting/run-aggregator.d.ts +4 -14
  126. package/dist/reporting/step-display-order.d.ts +43 -0
  127. package/dist/routes/admin-held-runs.d.ts +142 -0
  128. package/dist/routes/admin-org-settings.d.ts +5 -0
  129. package/dist/routes/admin-trust-policy.d.ts +34 -6
  130. package/dist/routes/admin.d.ts +15 -0
  131. package/dist/scaler/backend-factory.d.ts +55 -0
  132. package/dist/scaler/bare-metal-backend.d.ts +43 -5
  133. package/dist/scaler/claim-store.d.ts +119 -0
  134. package/dist/scaler/config.d.ts +4 -0
  135. package/dist/scaler/container-backend.d.ts +18 -4
  136. package/dist/scaler/container-routing.d.ts +23 -0
  137. package/dist/scaler/container-spawn.d.ts +28 -0
  138. package/dist/scaler/event-backend.d.ts +124 -0
  139. package/dist/scaler/event-provision-reaper.d.ts +350 -0
  140. package/dist/scaler/failure-tracker.d.ts +1 -1
  141. package/dist/scaler/firecracker-backend.d.ts +33 -6
  142. package/dist/scaler/index.d.ts +11 -1
  143. package/dist/scaler/label-matcher.d.ts +4 -3
  144. package/dist/scaler/manager.d.ts +905 -76
  145. package/dist/scaler/resolve-container-auth.d.ts +45 -0
  146. package/dist/scaler/scaler-events.d.ts +11 -0
  147. package/dist/scaler/scaler-state-store.d.ts +294 -10
  148. package/dist/scaler/types.d.ts +131 -13
  149. package/dist/scaler/warm-pool.d.ts +132 -29
  150. package/dist/security/comment-handler.d.ts +50 -11
  151. package/dist/security/global-workflow-policy.d.ts +52 -12
  152. package/dist/security/identity-link.d.ts +60 -0
  153. package/dist/security/lock-source.d.ts +11 -13
  154. package/dist/security/reduced-privilege-note.d.ts +59 -0
  155. package/dist/security/trust-directory-store.d.ts +233 -0
  156. package/dist/security/trust-policy-gate.d.ts +94 -59
  157. package/dist/security/trust-policy-store.d.ts +3 -0
  158. package/dist/security/trust-resolver.d.ts +14 -98
  159. package/dist/server.d.ts +11 -1
  160. package/dist/server.js +56329 -42234
  161. package/dist/stale-detector/gate-deadline-detector.d.ts +52 -0
  162. package/dist/stale-detector/stale-run-detector.d.ts +61 -3
  163. package/dist/standalone.js +37619 -23570
  164. package/dist/webhook/ingest-accept.d.ts +70 -0
  165. package/dist/webhook/ingest-overflow-buffer.d.ts +35 -4
  166. package/dist/webhook/ingest-overflow-replayer.d.ts +50 -6
  167. package/dist/worker/in-memory-job-queue.d.ts +1 -1
  168. package/dist/ws/agent-handler.d.ts +31 -4
  169. package/dist/ws/dashboard-context-handler.d.ts +28 -4
  170. package/dist/ws/dashboard-global-workflows-handler.d.ts +36 -9
  171. package/dist/ws/execution-status-frame.d.ts +32 -0
  172. package/dist/ws/failure-messages.d.ts +2 -0
  173. package/dist/ws/git-credential-relay.d.ts +39 -0
  174. package/dist/ws/oidc-token-relay.d.ts +6 -11
  175. package/dist/ws/platform-client.d.ts +68 -9
  176. package/dist/ws/test-relay-handlers.d.ts +35 -10
  177. package/installer-image-digests.json +3 -3
  178. package/package.json +24 -19
  179. package/sbom.spdx.json +868 -821
  180. package/dist/approvals/team-membership-lookup.d.ts +0 -13
  181. package/dist/pipeline/inline-eval.d.ts +0 -44
  182. package/dist/providers/github/contributor-resolver.d.ts +0 -30
  183. package/dist/security/contributor-cache.d.ts +0 -83
@@ -31,6 +31,19 @@ export interface SchedulerResult {
31
31
  action: 'dispatch' | 'skip';
32
32
  reason?: string;
33
33
  }
34
+ /**
35
+ * Check if ALL upstreams of a job are satisfied.
36
+ * Returns { satisfied: true, action: 'dispatch' } when every upstream is
37
+ * terminal and its status is a member of the edge's run_on set. Returns
38
+ * { satisfied: true, action: 'skip', reason } when an upstream is terminal but
39
+ * its status is not in the edge's run_on set. Returns { satisfied: false } when
40
+ * any upstream is not yet terminal.
41
+ */
42
+ export declare function checkAllUpstreamsSatisfied(db: Kysely<Database>, runId: string, jobName: string): Promise<{
43
+ satisfied: boolean;
44
+ action?: 'dispatch' | 'skip';
45
+ reason?: string;
46
+ }>;
34
47
  /**
35
48
  * Insert dependency edges at run start for static-to-static needs.
36
49
  *
@@ -21,44 +21,101 @@ import type { LockFile as FullLockFile, SimulatedEvent } from '@kici-dev/engine'
21
21
  import type { OrchestratorMode } from '@kici-dev/engine';
22
22
  import type { WebhookInfo } from '../webhook/handler.js';
23
23
  import type { ProviderBundle } from '../provider-registry.js';
24
- import type { TrustResolution } from '../security/trust-resolver.js';
24
+ import { type TrustResolution } from '../security/trust-resolver.js';
25
25
  import { type TrustPolicyOutcome } from '../security/trust-policy-gate.js';
26
26
  import { type WorkflowModification } from '../security/workflow-diff.js';
27
+ import type { IdentityLink, PermissionLevel } from '../security/identity-link.js';
27
28
  import { type ProcessingDeps } from './processor.js';
28
29
  /**
29
30
  * Outcome of a single inbound-webhook ingestion. `duplicate` lets a direct-
30
31
  * ingress route return `{ duplicate: true }` to GitHub's Recent Deliveries
31
32
  * panel; `skipped` covers unknown provider / unknown event / no-repo paths;
32
33
  * `processed` means the pipeline matched and dispatched (or recorded a run).
34
+ *
35
+ * `queued` means the delivery is durably stored and its pipeline will run after
36
+ * the response — the direct-ingress accept path's success outcome. It maps to
37
+ * the same 202 `processed` always did, because from the sender's side both mean
38
+ * "accepted, nothing more to do"; the distinction exists so the accept path can
39
+ * be asserted on directly rather than through the HTTP status.
33
40
  */
34
41
  export declare const WebhookIngestOutcome: z.ZodEnum<{
35
42
  duplicate: "duplicate";
36
43
  processed: "processed";
44
+ queued: "queued";
37
45
  shed: "shed";
38
46
  skipped: "skipped";
39
47
  }>;
40
48
  export type WebhookIngestOutcome = z.infer<typeof WebhookIngestOutcome>;
49
+ /**
50
+ * Resolve the directory a `/kici approve` comment is authorized against.
51
+ *
52
+ * Two sources, and which one applies is decided by the caller that assembled
53
+ * these deps rather than by the orchestrator's mode:
54
+ *
55
+ * - `server.ts` holds the Platform-pushed directory in memory and refreshes it
56
+ * on every `trust_policy.update`, so it always supplies both fields. An
57
+ * in-memory directory therefore wins outright — reading the row instead
58
+ * would answer from a cache the push has already superseded.
59
+ * - Every other assembly supplies neither. That includes the direct-ingress
60
+ * pipeline in `app.ts`, which is the only path an independent orchestrator
61
+ * has, and where the operator's own `kici-admin trust-policy directory-set`
62
+ * registrations live only in the row. Reading it per command is also what
63
+ * makes a registration take effect immediately rather than at the next
64
+ * restart.
65
+ *
66
+ * A failed read degrades to an empty directory: the commenter is not resolved
67
+ * and the command is refused, which is the same fail-closed answer an absent
68
+ * directory already gives.
69
+ */
70
+ export declare function resolveApprovalDirectory(deps: ProcessingDeps, orgId: string): Promise<{
71
+ identityLinks: IdentityLink[];
72
+ orgMemberPermissions: Map<string, PermissionLevel>;
73
+ }>;
41
74
  interface TrustOutcome {
42
75
  trustResolution: TrustResolution | undefined;
43
76
  /** Default 'base' for PR events; trust resolution may override to 'head'. */
44
77
  lockFileSource: 'head' | 'base';
45
78
  }
79
+ /** Whether an inbound event name is one of the pull-request events. */
80
+ export declare function isPullRequestEvent(eventName: string): boolean;
46
81
  export declare function resolveTrustForPR(args: {
47
82
  info: WebhookInfo;
48
- deps: ProcessingDeps;
49
83
  bundle: ProviderBundle;
50
84
  event: SimulatedEvent;
85
+ /** Raw webhook payload — read only to decide whether a push targets the default branch. */
51
86
  payload: Record<string, unknown>;
52
- resolvedOrgId: string;
53
- repoIdentifier: string;
54
- credentials: Record<string, unknown>;
55
87
  }): Promise<TrustOutcome>;
88
+ /** What one organization-wide dispatch pass produced. */
89
+ interface GlobalDispatchOutcome {
90
+ matchedCount: number;
91
+ matchedRunIds: string[];
92
+ /** One summary per global decision this pass reached, dispatched or excluded. */
93
+ decisionSummaries: Record<string, unknown>[];
94
+ /**
95
+ * The workflow repository of every evaluation round this pass could not
96
+ * decide. Empty means every round the pass ran reached a verdict.
97
+ */
98
+ roundFailureWorkflowRepos: string[];
99
+ /**
100
+ * Every workflow repository this pass actually evaluated: it examined that
101
+ * repository's registrations and reached a real outcome for each of them —
102
+ * dispatched, filtered out, or excluded by a verdict.
103
+ *
104
+ * The pass's POSITIVE signal, and the one a re-run gates its success check
105
+ * on. An empty `roundFailureWorkflowRepos` cannot carry that meaning: a pass
106
+ * with no registration index, no pending-eval tracker, or an event the trust
107
+ * policy held evaluates nothing and reports no failure either, so reading its
108
+ * silence as a clean verdict is the false assurance the round exists to
109
+ * remove.
110
+ */
111
+ decidedWorkflowRepos: string[];
112
+ }
56
113
  interface SecurityState {
57
114
  workflowModifications: WorkflowModification[];
58
115
  /**
59
- * True when this PR changes `.kici/` workflow definitions. A *signal*, not a
60
- * decision the trust-policy gate turns it into an outcome, which the
61
- * dispatch gate then enforces as a held run or a rejected run.
116
+ * True when this PR changes `.kici/` workflow definitions. Reported, not
117
+ * enforced: the org trust policy is the fork switch, and it reads the fork
118
+ * signal and the tier never this one.
62
119
  */
63
120
  hasWorkflowModifications: boolean;
64
121
  }
@@ -67,10 +124,11 @@ interface SecurityState {
67
124
  * modifications by diffing base vs. head and post a neutral informational check
68
125
  * (on its own dedicated check name).
69
126
  *
70
- * Detection only. Whether a modification gates the run is the org trust policy's
71
- * call, evaluated in `evaluateSecurityPolicy` and enforced by the dispatch gate
72
- * which creates the real `held_runs` row and posts the pending
73
- * "Held for approval" check, so `/kici approve` / reject / expiry can resolve it.
127
+ * Detection and legibility only: the check tells a reviewer that this PR edits
128
+ * the workflows it would run under. It feeds no policy decision — a PR that
129
+ * edits `.kici/` from the base repo is written by a contributor who could
130
+ * already push to it, and one from a fork is governed by the fork switch
131
+ * whether or not it touches `.kici/`.
74
132
  */
75
133
  export declare function applyWorkflowModificationsAndSecurityHold(args: {
76
134
  info: WebhookInfo;
@@ -88,11 +146,17 @@ export declare function applyWorkflowModificationsAndSecurityHold(args: {
88
146
  /**
89
147
  * Evaluate the org trust policy for a PR event.
90
148
  *
91
- * Scoped to providers with a contributor model the same condition trust
92
- * resolution uses. A source without a `ContributorResolver` (generic, local,
93
- * universal-git) is trusted by construction, so it passes regardless of policy;
94
- * in particular, universal-git computes an `isForkPR` signal that must NOT gate
95
- * those sources.
149
+ * Scoped to providers with a fork model (`bundle.hasForkModel`): a source
150
+ * without one passes regardless of policy. That is not a trust claim about such
151
+ * a source — a PR from a fork-less provider resolves no tier at all. It is that
152
+ * the policy's one condition cannot be established for it: universal-git does
153
+ * compute an `isForkPR`, but from payload keys many forges omit, and it reads
154
+ * `false` when they are absent. Gating on a signal that fails toward trust
155
+ * would be worse than not gating.
156
+ *
157
+ * The policy read has two distinct failure shapes, and they get distinct
158
+ * answers: no stored row is the unconfigured default (`FAIL_CLOSED_POLICY`),
159
+ * while a read that THREW gets `READ_FAILURE_POLICY` — see there for why.
96
160
  */
97
161
  export declare function evaluateSecurityPolicy(args: {
98
162
  deps: ProcessingDeps;
@@ -102,23 +166,54 @@ export declare function evaluateSecurityPolicy(args: {
102
166
  mode: OrchestratorMode;
103
167
  trustResolution: TrustResolution | undefined;
104
168
  isForkPR: boolean;
105
- hasWorkflowModifications: boolean;
106
169
  }): Promise<TrustPolicyOutcome>;
107
170
  /**
108
- * Process a webhook through the complete pipeline.
171
+ * Phase J After per-repo workflows are dispatched, query the global index
172
+ * for workflows authored in OTHER repos that target this event type via
173
+ * cross-repo `repos` patterns. Same-org scope picks up both same-source and
174
+ * cross-source globals (cross-provider global workflows).
175
+ */
176
+ export declare function dispatchGlobalWorkflowsForOtherRepos(args: {
177
+ info: WebhookInfo;
178
+ deps: ProcessingDeps;
179
+ eventWithFiles: SimulatedEvent;
180
+ resolvedOrgId: string;
181
+ repoIdentifier: string;
182
+ ref: string;
183
+ dispatchBundle: ProviderBundle;
184
+ dispatchCredentials: Record<string, unknown>;
185
+ /** The inbound event's own bundle, used to post the globals-skipped check. */
186
+ bundle: ProviderBundle;
187
+ credentials: Record<string, unknown>;
188
+ securityDecision: TrustPolicyOutcome;
189
+ /**
190
+ * The source `dispatchCredentials` belongs to, when a cross-provider lock-file
191
+ * fallback made it a different source from `info.routingKey`. Persisted on a
192
+ * failed round's run row so its re-run can rebuild the same dispatch pair
193
+ * instead of handing this source's credentials to the inbound source's client.
194
+ */
195
+ dispatchRoutingKey?: string;
196
+ /**
197
+ * Restrict the pass to global workflows authored in this repository. Set by
198
+ * the re-run of a failed evaluation round, which re-decides that round alone.
199
+ */
200
+ onlyWorkflowRepo?: string;
201
+ }): Promise<GlobalDispatchOutcome>;
202
+ /**
203
+ * Process a webhook through the complete pipeline, recording a `failed` event-log
204
+ * row for a delivery the pipeline could not finish.
205
+ *
206
+ * The row is the only per-delivery record of such a failure. Nothing the pipeline
207
+ * decides after acknowledgement can reach the sender — `acceptWebhookDelivery`
208
+ * answers 202 and runs this detached — and the dashboard's webhook-activity view
209
+ * counts `event_log.status = 'failed'` for exactly this. Without the write that
210
+ * count is structurally always zero, and a post-acknowledgement failure appears
211
+ * in the orchestrator's own logs and nowhere a customer can see.
109
212
  *
110
- * Flow:
111
- * 1. Dedup + provider lookup -> contributor cache invalidation -> normalize
112
- * 2. Cross-source dispatch (generic webhook fan-out, optional)
113
- * 3. Extract repo + credentials, handle /kici approval comments
114
- * 4. Trust resolution for PR events
115
- * 5. Lock file fetch (with multi-provider fallback)
116
- * - No lock file: dispatch global workflows for this event (same org) and return
117
- * 6. Workflow modification detection + security hold check status
118
- * 7. Default-branch registration
119
- * 8. Match triggers + dispatch matched same-source workflows
120
- * 9. Match + dispatch global workflows for OTHER repos
121
- * 10. Forward Platform trace + record event log
213
+ * Best-effort and non-masking: the write is wrapped, and the original error is
214
+ * rethrown either way. The delivery still reverts to `buffered` for the drain
215
+ * pass to retry, so a redelivery that succeeds writes its own `processed` row
216
+ * beside this one — the two are distinct rows, not a mutation.
122
217
  */
123
218
  export declare function processWebhook(info: WebhookInfo, deps: ProcessingDeps): Promise<WebhookIngestOutcome>;
124
219
  export {};