@kici-dev/orchestrator 0.16.0 → 0.18.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 (592) hide show
  1. package/dist/agent/agent-version.d.ts +12 -21
  2. package/dist/agent/dispatcher.d.ts +283 -437
  3. package/dist/agent/host-roster-reaper.d.ts +8 -10
  4. package/dist/agent/host-roster.d.ts +77 -100
  5. package/dist/agent/ownership-refusal.d.ts +3 -5
  6. package/dist/agent/ownership-tracker.d.ts +42 -76
  7. package/dist/agent/registry.d.ts +121 -233
  8. package/dist/agent/token-store.d.ts +34 -77
  9. package/dist/agent-packaging/availability.d.ts +6 -9
  10. package/dist/agent-packaging/download.d.ts +6 -9
  11. package/dist/agent-packaging/install-closure.d.ts +9 -12
  12. package/dist/agent-packaging/node-binary.d.ts +6 -10
  13. package/dist/agent-packaging/node-runtime-members.d.ts +3 -5
  14. package/dist/agent-packaging/refresh.d.ts +12 -16
  15. package/dist/agent-packaging/store.d.ts +5 -6
  16. package/dist/agent-packaging/upload.d.ts +3 -4
  17. package/dist/app.d.ts +0 -3
  18. package/dist/approvals/apply-decision.d.ts +39 -45
  19. package/dist/approvals/approval-resolver.d.ts +11 -23
  20. package/dist/approvals/held-run-release-wiring.d.ts +14 -21
  21. package/dist/approvals/independent-wiring.d.ts +13 -20
  22. package/dist/approvals/resume-router.d.ts +1 -1
  23. package/dist/approvals/step-approval-bridge.d.ts +11 -21
  24. package/dist/approvals/triggerer-subject.d.ts +8 -10
  25. package/dist/artifacts/artifact-store.d.ts +55 -95
  26. package/dist/artifacts/failure-messages.d.ts +15 -20
  27. package/dist/audit/access-log.d.ts +27 -45
  28. package/dist/audit/sampling-rate-limiter.d.ts +11 -23
  29. package/dist/cache/agent-job-failed-error.d.ts +2 -3
  30. package/dist/cache/build-coordinator.d.ts +5 -28
  31. package/dist/cache/cache-upload-settle.d.ts +11 -11
  32. package/dist/cache/dep-cache.d.ts +32 -60
  33. package/dist/cache/dispatch-cache-ref-tracker.d.ts +15 -23
  34. package/dist/cache/global-eval-round-cache.d.ts +33 -41
  35. package/dist/cache/pending-builds.d.ts +2 -6
  36. package/dist/cache/pending-dynamics.d.ts +2 -7
  37. package/dist/cache/pending-global-evals.d.ts +9 -12
  38. package/dist/cache/pending-inits.d.ts +11 -22
  39. package/dist/cache/pending-precursor-db-watcher.d.ts +24 -32
  40. package/dist/cache/pending-tracker.d.ts +17 -45
  41. package/dist/cache/precursor-result.d.ts +17 -30
  42. package/dist/cache/source-cache.d.ts +36 -65
  43. package/dist/cache/user-cache.d.ts +21 -25
  44. package/dist/cancel/cancel-held-run.d.ts +13 -16
  45. package/dist/cancel/cancel-route-answer.d.ts +1 -2
  46. package/dist/cancel/cancel-run.d.ts +26 -50
  47. package/dist/cancel/dashboard-cancel-handler.d.ts +2 -2
  48. package/dist/cancel/peer-job-cancel.d.ts +11 -14
  49. package/dist/cancel/sweep-stuck-cancelling.d.ts +9 -13
  50. package/dist/cli/api-client.d.ts +33 -76
  51. package/dist/cli/commands/access-log.d.ts +4 -24
  52. package/dist/cli/commands/agent-package.d.ts +7 -15
  53. package/dist/cli/commands/agent-service/agent-env.d.ts +3 -6
  54. package/dist/cli/commands/agent-service/index.d.ts +4 -10
  55. package/dist/cli/commands/agent-service/install.d.ts +4 -11
  56. package/dist/cli/commands/agent-service/status.d.ts +4 -9
  57. package/dist/cli/commands/agent-service/upgrade.d.ts +4 -16
  58. package/dist/cli/commands/agent.d.ts +12 -25
  59. package/dist/cli/commands/api-key.d.ts +7 -7
  60. package/dist/cli/commands/attestations-list.d.ts +7 -17
  61. package/dist/cli/commands/attestations-retry.d.ts +5 -11
  62. package/dist/cli/commands/attestations-reverify.d.ts +4 -5
  63. package/dist/cli/commands/attestations.d.ts +3 -8
  64. package/dist/cli/commands/audit.d.ts +1 -5
  65. package/dist/cli/commands/backend.d.ts +2 -11
  66. package/dist/cli/commands/check-run.d.ts +7 -18
  67. package/dist/cli/commands/cluster-name.d.ts +5 -12
  68. package/dist/cli/commands/cluster-settings.d.ts +28 -53
  69. package/dist/cli/commands/cold-store.d.ts +7 -15
  70. package/dist/cli/commands/config.d.ts +9 -20
  71. package/dist/cli/commands/context.d.ts +8 -20
  72. package/dist/cli/commands/dashboard-encryption-key.d.ts +9 -14
  73. package/dist/cli/commands/db-backup.d.ts +17 -32
  74. package/dist/cli/commands/db.d.ts +3 -4
  75. package/dist/cli/commands/debug-bundle.d.ts +3 -10
  76. package/dist/cli/commands/diagnose.d.ts +3 -14
  77. package/dist/cli/commands/event-dlq.d.ts +4 -12
  78. package/dist/cli/commands/event-log.d.ts +2 -20
  79. package/dist/cli/commands/execution.d.ts +3 -9
  80. package/dist/cli/commands/firecracker/index.d.ts +3 -6
  81. package/dist/cli/commands/held-run.d.ts +23 -37
  82. package/dist/cli/commands/host.d.ts +4 -11
  83. package/dist/cli/commands/inspect-bundle.d.ts +3 -11
  84. package/dist/cli/commands/local-hook.d.ts +2 -10
  85. package/dist/cli/commands/local-trigger.d.ts +2 -2
  86. package/dist/cli/commands/orchestrator-service/drain.d.ts +3 -6
  87. package/dist/cli/commands/orchestrator-service/index.d.ts +6 -14
  88. package/dist/cli/commands/orchestrator-service/install-env.d.ts +25 -49
  89. package/dist/cli/commands/orchestrator-service/install.d.ts +2 -5
  90. package/dist/cli/commands/orchestrator-service/status.d.ts +10 -22
  91. package/dist/cli/commands/orchestrator-service/upgrade.d.ts +6 -15
  92. package/dist/cli/commands/org-settings.d.ts +5 -11
  93. package/dist/cli/commands/peer.d.ts +5 -10
  94. package/dist/cli/commands/queue.d.ts +3 -9
  95. package/dist/cli/commands/registration.d.ts +4 -8
  96. package/dist/cli/commands/remote-source.d.ts +6 -12
  97. package/dist/cli/commands/rotate.d.ts +1 -5
  98. package/dist/cli/commands/runs.d.ts +1 -30
  99. package/dist/cli/commands/scaler.d.ts +5 -12
  100. package/dist/cli/commands/secret.d.ts +1 -9
  101. package/dist/cli/commands/service-health.d.ts +5 -10
  102. package/dist/cli/commands/shared/admin-cli-access-log.d.ts +10 -19
  103. package/dist/cli/commands/shared/bare-metal-binary-check.d.ts +86 -0
  104. package/dist/cli/commands/shared/cli-action.d.ts +1 -4
  105. package/dist/cli/commands/shared/confirm.d.ts +5 -10
  106. package/dist/cli/commands/shared/db.d.ts +1 -12
  107. package/dist/cli/commands/shared/env-file-mode.d.ts +6 -9
  108. package/dist/cli/commands/shared/secret-input.d.ts +7 -21
  109. package/dist/cli/commands/shared/service-verbs.d.ts +6 -12
  110. package/dist/cli/commands/shared/unbound-context-warning.d.ts +2 -4
  111. package/dist/cli/commands/shared/upgrade-hooks.d.ts +7 -16
  112. package/dist/cli/commands/shared/upgrade-safety.d.ts +20 -31
  113. package/dist/cli/commands/shared/versioned-upgrade.d.ts +83 -161
  114. package/dist/cli/commands/signing-key.d.ts +4 -9
  115. package/dist/cli/commands/source-manifest.d.ts +11 -14
  116. package/dist/cli/commands/source.d.ts +7 -32
  117. package/dist/cli/commands/token.d.ts +4 -15
  118. package/dist/cli/commands/trust-policy.d.ts +35 -88
  119. package/dist/cli/commands/variable.d.ts +3 -5
  120. package/dist/cli/commands/workflow.d.ts +3 -24
  121. package/dist/cli/join.d.ts +3 -6
  122. package/dist/cli/kici-admin.d.ts +11 -29
  123. package/dist/cli/lazy-deps/cache.d.ts +1 -14
  124. package/dist/cli/lazy-deps/downloader.d.ts +4 -27
  125. package/dist/cli/lazy-deps/registry.d.ts +5 -25
  126. package/dist/cli/local-github-ingress-url.d.ts +5 -7
  127. package/dist/cli/loopback-callback.d.ts +6 -7
  128. package/dist/cli/open-browser.d.ts +4 -8
  129. package/dist/cli/root-option-routing.d.ts +17 -29
  130. package/dist/cli/service/backup-timer.d.ts +16 -39
  131. package/dist/cli/service/compose-path.d.ts +3 -7
  132. package/dist/cli/service/compose.d.ts +12 -30
  133. package/dist/cli/service/deploy-env.d.ts +6 -18
  134. package/dist/cli/service/entrypoint.d.ts +14 -25
  135. package/dist/cli/service/env-assignment.d.ts +6 -17
  136. package/dist/cli/service/image-digests.d.ts +6 -15
  137. package/dist/cli/service/index.d.ts +2 -18
  138. package/dist/cli/service/instance/index-file.d.ts +9 -16
  139. package/dist/cli/service/instance/manifest.d.ts +33 -59
  140. package/dist/cli/service/instance/resolve.d.ts +32 -68
  141. package/dist/cli/service/instance/types.d.ts +12 -29
  142. package/dist/cli/service/launchd.d.ts +29 -60
  143. package/dist/cli/service/platform-detect.d.ts +13 -68
  144. package/dist/cli/service/privilege.d.ts +12 -25
  145. package/dist/cli/service/shutdown-grace.d.ts +11 -20
  146. package/dist/cli/service/systemd.d.ts +7 -20
  147. package/dist/cli/service/types.d.ts +63 -114
  148. package/dist/cli/service/windows-acl.d.ts +14 -21
  149. package/dist/cli/service/windows-env-file.d.ts +10 -28
  150. package/dist/cli/service/windows.d.ts +15 -31
  151. package/dist/cli/webhook-url-notes.d.ts +4 -6
  152. package/dist/cli/wizard/agent-wizard.d.ts +3 -14
  153. package/dist/cli/wizard/orchestrator-wizard.d.ts +12 -37
  154. package/dist/cli/wizard/prompts.d.ts +6 -16
  155. package/dist/cli.js +4553 -6556
  156. package/dist/cluster/cluster-identity.d.ts +20 -32
  157. package/dist/cluster/cluster-settings-reader.d.ts +50 -77
  158. package/dist/cluster/coordinator-credential.d.ts +4 -5
  159. package/dist/cluster/coordinator.d.ts +76 -148
  160. package/dist/cluster/health-api.d.ts +2 -10
  161. package/dist/cluster/index.d.ts +1 -6
  162. package/dist/cluster/instance-heartbeat.d.ts +26 -42
  163. package/dist/cluster/join-client.d.ts +4 -7
  164. package/dist/cluster/join-handler.d.ts +3 -7
  165. package/dist/cluster/join-token.d.ts +13 -27
  166. package/dist/cluster/leader-gated-scheduler.d.ts +8 -17
  167. package/dist/cluster/orphan-recovery.d.ts +13 -35
  168. package/dist/cluster/peer-auth-coordinator.d.ts +2 -8
  169. package/dist/cluster/peer-client.d.ts +46 -76
  170. package/dist/cluster/peer-credentials.d.ts +24 -70
  171. package/dist/cluster/peer-crypto.d.ts +5 -26
  172. package/dist/cluster/peer-forget.d.ts +3 -3
  173. package/dist/cluster/peer-handler.d.ts +47 -71
  174. package/dist/cluster/peer-registry.d.ts +37 -106
  175. package/dist/cluster/plan-headroom-store.d.ts +4 -6
  176. package/dist/cluster/raft-state.d.ts +4 -13
  177. package/dist/cluster/raft.d.ts +18 -53
  178. package/dist/cluster/reconcile-identity.d.ts +8 -11
  179. package/dist/cluster/rerouted-job-guard.d.ts +7 -11
  180. package/dist/cluster/verified-issuer.d.ts +2 -3
  181. package/dist/cluster/worker-cluster-settings.d.ts +7 -10
  182. package/dist/cluster/worker-eviction.d.ts +16 -26
  183. package/dist/cold-store/load-access-log-range.d.ts +15 -31
  184. package/dist/cold-store/load-event-log-range.d.ts +13 -27
  185. package/dist/cold-store/load-secret-audit-log-range.d.ts +8 -12
  186. package/dist/cold-store/orchestrator-cold-store.d.ts +8 -28
  187. package/dist/cold-store/tables/access-log.d.ts +12 -14
  188. package/dist/cold-store/tables/event-log.d.ts +4 -8
  189. package/dist/cold-store/tables/execution-runs.d.ts +6 -11
  190. package/dist/cold-store/tables/secret-audit-log.d.ts +5 -12
  191. package/dist/concurrency/dispatch-next-queued.d.ts +13 -25
  192. package/dist/concurrency/queue-manager.d.ts +22 -54
  193. package/dist/concurrency/waiters.d.ts +15 -31
  194. package/dist/config/encryption.d.ts +0 -2
  195. package/dist/config/loader.d.ts +0 -1
  196. package/dist/config/reload.d.ts +0 -6
  197. package/dist/config/resolver.d.ts +0 -4
  198. package/dist/config/shared-store.d.ts +0 -2
  199. package/dist/config/types.d.ts +0 -3
  200. package/dist/content-requirements-cache.d.ts +0 -1
  201. package/dist/contexts/context-store.d.ts +0 -2
  202. package/dist/contexts/held-runs.d.ts +0 -2
  203. package/dist/contexts/variable-store.d.ts +0 -2
  204. package/dist/dashboard/attestation-filters.d.ts +13 -18
  205. package/dist/dashboard/handler.d.ts +143 -307
  206. package/dist/db/client.d.ts +2 -6
  207. package/dist/db/deferred-index-build.d.ts +8 -10
  208. package/dist/db/deferred-indexes.d.ts +15 -22
  209. package/dist/db/migration-provider.d.ts +2 -4
  210. package/dist/db/migration-test-harness.d.ts +26 -44
  211. package/dist/db/migrations/001_initial.d.ts +1 -4
  212. package/dist/db/migrations/002_config_versions_key_version.d.ts +5 -8
  213. package/dist/db/migrations/003_access_log.d.ts +10 -15
  214. package/dist/db/migrations/004_rename_bundle_to_source.d.ts +7 -9
  215. package/dist/db/migrations/005_cold_store_chunk_counter.d.ts +4 -10
  216. package/dist/db/migrations/006_runs_jobs_steps_archived_at.d.ts +9 -29
  217. package/dist/db/migrations/007_audit_logs_archived_at.d.ts +11 -30
  218. package/dist/db/migrations/008_event_log_archived_at.d.ts +14 -29
  219. package/dist/db/migrations/009_access_log_trigram.d.ts +4 -8
  220. package/dist/db/migrations/010_cold_store_chunks.d.ts +16 -26
  221. package/dist/db/migrations/011_drop_source_secrets_notify.d.ts +6 -14
  222. package/dist/db/migrations/012_peer_credentials_active_uniq.d.ts +9 -14
  223. package/dist/db/migrations/013_execution_log_bytes.d.ts +5 -13
  224. package/dist/db/migrations/014_kici_events_lease_retry.d.ts +14 -27
  225. package/dist/db/migrations/015_org_settings_customer_scoped.d.ts +12 -17
  226. package/dist/db/migrations/016_org_settings_allow_http_npm.d.ts +4 -6
  227. package/dist/db/migrations/019_generic_sources_change_notify.d.ts +13 -17
  228. package/dist/db/migrations/020_org_settings_dashboard_write_policy.d.ts +5 -8
  229. package/dist/db/migrations/021_check_run_tracking.d.ts +5 -17
  230. package/dist/db/migrations/022_scaler_manager_state.d.ts +10 -20
  231. package/dist/db/migrations/023_dispatch_queue_recovery_deadline.d.ts +7 -18
  232. package/dist/db/migrations/024_dispatch_queue_provisioning_error.d.ts +5 -11
  233. package/dist/db/migrations/025_init_failure.d.ts +5 -9
  234. package/dist/db/migrations/027_workflow_timeout.d.ts +5 -13
  235. package/dist/db/migrations/029_dispatch_queue_attempts.d.ts +4 -10
  236. package/dist/db/migrations/030_held_runs_env_set_null.d.ts +5 -6
  237. package/dist/db/migrations/031_dispatch_queue_ack_deadline.d.ts +6 -12
  238. package/dist/db/migrations/033_org_settings_approval.d.ts +7 -10
  239. package/dist/db/migrations/034_held_runs_generalize.d.ts +10 -18
  240. package/dist/db/migrations/035_pending_workflow_contexts.d.ts +4 -5
  241. package/dist/db/migrations/037_generic_sources_provider_type_local.d.ts +5 -6
  242. package/dist/db/migrations/038_remote_sources.d.ts +5 -7
  243. package/dist/db/migrations/045_host_properties.d.ts +5 -9
  244. package/dist/db/migrations/046_join_token_consumed_by_instance.d.ts +5 -10
  245. package/dist/db/migrations/048_host_reboot_pending.d.ts +6 -12
  246. package/dist/db/migrations/049_held_runs_payload.d.ts +3 -8
  247. package/dist/db/migrations/050_sources_slug.d.ts +4 -5
  248. package/dist/db/migrations/051_binding_host_pattern.d.ts +7 -10
  249. package/dist/db/migrations/052_host_reach_metadata.d.ts +8 -11
  250. package/dist/db/migrations/053_agent_token_single_use.d.ts +6 -10
  251. package/dist/db/migrations/054_local_working_tree.d.ts +4 -6
  252. package/dist/db/migrations/055_agent_token_mandatory_labels.d.ts +6 -11
  253. package/dist/db/migrations/056_execution_jobs_environments.d.ts +4 -11
  254. package/dist/db/migrations/064_execution_jobs_skipped_environments.d.ts +6 -9
  255. package/dist/db/migrations/065_pending_attestations.d.ts +9 -12
  256. package/dist/db/migrations/066_pending_attestations_rejected.d.ts +4 -7
  257. package/dist/db/migrations/068_request_idempotency.d.ts +7 -9
  258. package/dist/db/migrations/069_reroute_tunables.d.ts +6 -14
  259. package/dist/db/migrations/071_batch_accumulation.d.ts +8 -16
  260. package/dist/db/migrations/072_dispatch_queue_run_id_index.d.ts +3 -9
  261. package/dist/db/migrations/074_normalize_zero_concurrency_limit.d.ts +4 -7
  262. package/dist/db/migrations/076_artifacts.d.ts +7 -8
  263. package/dist/db/migrations/078_org_settings_backup_staleness.d.ts +3 -6
  264. package/dist/db/migrations/079_org_settings_scaler_spawn_timeout.d.ts +4 -8
  265. package/dist/db/migrations/080_cluster_settings.d.ts +6 -10
  266. package/dist/db/migrations/081_org_settings_queue_timeout.d.ts +7 -11
  267. package/dist/db/migrations/082_host_s3_reachable.d.ts +5 -10
  268. package/dist/db/migrations/083_org_settings_artifact_caps.d.ts +6 -8
  269. package/dist/db/migrations/084_orchestrator_signing_keys.d.ts +8 -13
  270. package/dist/db/migrations/085_cluster_settings_reroute_flap_grace_ms.d.ts +4 -5
  271. package/dist/db/migrations/086_cluster_settings_max_fanout_hosts.d.ts +3 -3
  272. package/dist/db/migrations/087_cluster_settings_event_router_rate_limit.d.ts +5 -3
  273. package/dist/db/migrations/088_cluster_settings_cache_max_tarball_bytes.d.ts +3 -3
  274. package/dist/db/migrations/089_cluster_settings_cache_ttl_days.d.ts +3 -5
  275. package/dist/db/migrations/090_cluster_settings_concurrency_wait_timeout_ms.d.ts +3 -6
  276. package/dist/db/migrations/091_cluster_settings_agent_token_ttl_ms.d.ts +3 -6
  277. package/dist/db/migrations/092_cluster_settings_version.d.ts +5 -9
  278. package/dist/db/migrations/094_dashboard_encryption_keys.d.ts +9 -14
  279. package/dist/db/migrations/095_dashboard_write_policy_tristate.d.ts +2 -6
  280. package/dist/db/migrations/099_cluster_settings_dashboard_verified_issuer.d.ts +8 -11
  281. package/dist/db/migrations/101_contexts_hold_expiry_drop_default.d.ts +9 -15
  282. package/dist/db/migrations/102_dispatch_queue_agent_id.d.ts +6 -11
  283. package/dist/db/migrations/103_cluster_settings_ownership_db_check_timeout_ms.d.ts +6 -12
  284. package/dist/db/migrations/104_check_run_terminal_sent.d.ts +8 -14
  285. package/dist/db/migrations/105_org_trust_policy.d.ts +5 -7
  286. package/dist/db/migrations/106_cluster_settings_check_run_tracking_ttl_days.d.ts +4 -12
  287. package/dist/db/migrations/107_check_run_tracking_updated_at_index.d.ts +8 -14
  288. package/dist/db/migrations/113_execution_runs_workflow_repo_index.d.ts +10 -19
  289. package/dist/db/migrations/115_global_workflows_cluster_switch.d.ts +2 -3
  290. package/dist/db/migrations/121_org_settings_allow_untrusted_dockerfile_builds.d.ts +7 -8
  291. package/dist/db/migrations/122_host_roster_scaler_managed.d.ts +9 -16
  292. package/dist/db/migrations/123_workflow_registrations_default_branch.d.ts +8 -16
  293. package/dist/db/migrations/125_org_trust_directory.d.ts +13 -21
  294. package/dist/db/migrations/126_held_runs_posted_pending_check.d.ts +10 -16
  295. package/dist/db/migrations/127_org_trust_policy_approval_expiry_seconds.d.ts +8 -16
  296. package/dist/db/migrations/128_execution_runs_global_eval_round.d.ts +6 -11
  297. package/dist/db/migrations/129_execution_runs_dispatch_routing_key.d.ts +8 -11
  298. package/dist/db/migrations/130_scaler_provision_outcomes.d.ts +13 -20
  299. package/dist/db/migrations/131_execution_jobs_git_credentials.d.ts +12 -22
  300. package/dist/db/migrations/132_execution_runs_trigger_event.d.ts +6 -16
  301. package/dist/db/migrations/133_dispatch_queue_source_tar_digest.d.ts +6 -9
  302. package/dist/db/migrations/140_dispatch_queue_canonical_labels.d.ts +22 -40
  303. package/dist/db/migrations/143_execution_jobs_precursor_result.d.ts +9 -18
  304. package/dist/db/migrations/144_execution_runs_registration_window.d.ts +12 -20
  305. package/dist/db/migrations/147_sealed_job_secrets.d.ts +5 -9
  306. package/dist/db/migrations/148_cluster_settings_sealed_secrets_retry_backoff_ms.d.ts +7 -13
  307. package/dist/db/migrations/150_execution_runs_status_epoch.d.ts +6 -11
  308. package/dist/db/migrations/152_org_settings_cache_upload_settle_timeout.d.ts +5 -8
  309. package/dist/db/migrations/157_host_roster_identity_source.d.ts +9 -13
  310. package/dist/db/migrations/159_org_id_widen_to_source_width.d.ts +5 -0
  311. package/dist/db/migrator.d.ts +17 -25
  312. package/dist/db/notify-listener.d.ts +8 -11
  313. package/dist/db/repos/dashboard-encryption-keys-repo.d.ts +9 -10
  314. package/dist/db/synthetic-job-ids.d.ts +6 -8
  315. package/dist/db/types.d.ts +531 -1058
  316. package/dist/deployment/deployment-identity.d.ts +42 -60
  317. package/dist/diagnostics/bundle-reader.d.ts +3 -15
  318. package/dist/diagnostics/bundle-writer.d.ts +5 -12
  319. package/dist/diagnostics/checks/agents.d.ts +1 -7
  320. package/dist/diagnostics/checks/backup.d.ts +7 -10
  321. package/dist/diagnostics/checks/certs.d.ts +1 -6
  322. package/dist/diagnostics/checks/config.d.ts +2 -5
  323. package/dist/diagnostics/checks/db.d.ts +1 -1
  324. package/dist/diagnostics/checks/disk.d.ts +1 -6
  325. package/dist/diagnostics/checks/firecracker-network.d.ts +3 -3
  326. package/dist/diagnostics/checks/index.d.ts +0 -6
  327. package/dist/diagnostics/checks/retention.d.ts +3 -6
  328. package/dist/diagnostics/checks/scaler.d.ts +3 -7
  329. package/dist/diagnostics/checks/ws.d.ts +1 -6
  330. package/dist/diagnostics/fleet-collector.d.ts +11 -14
  331. package/dist/diagnostics/fleet-constants.d.ts +1 -3
  332. package/dist/diagnostics/fleet-selection.d.ts +3 -7
  333. package/dist/diagnostics/fleet-topology.d.ts +2 -6
  334. package/dist/diagnostics/fleet-wiring.d.ts +6 -12
  335. package/dist/diagnostics/index.d.ts +0 -5
  336. package/dist/diagnostics/runner.d.ts +4 -8
  337. package/dist/diagnostics/types.d.ts +10 -21
  338. package/dist/drain/drain-controller.d.ts +16 -22
  339. package/dist/entry-helpers.d.ts +0 -2
  340. package/dist/events/circuit-breaker.d.ts +0 -3
  341. package/dist/events/event-router.d.ts +1 -2
  342. package/dist/events/event-store.d.ts +0 -9
  343. package/dist/events/trust-store.d.ts +0 -3
  344. package/dist/events/types.d.ts +0 -9
  345. package/dist/firecracker/host-network.d.ts +24 -30
  346. package/dist/firecracker/net-interfaces.d.ts +4 -7
  347. package/dist/helpers/rate-limiter.d.ts +0 -1
  348. package/dist/index.js +251 -486
  349. package/dist/metrics/agent-metrics-aggregator.d.ts +24 -67
  350. package/dist/metrics/metrics-reporter.d.ts +4 -13
  351. package/dist/metrics/prometheus.d.ts +47 -81
  352. package/dist/orchestrator-core.d.ts +3 -7
  353. package/dist/pipeline/content-filter.d.ts +20 -30
  354. package/dist/pipeline/cross-source-tally.d.ts +7 -8
  355. package/dist/pipeline/decorating-secret-resolver.d.ts +4 -8
  356. package/dist/pipeline/degraded-reason.d.ts +3 -4
  357. package/dist/pipeline/direct-ingress-deps.d.ts +15 -24
  358. package/dist/pipeline/dispatch-matched-workflow.d.ts +289 -525
  359. package/dist/pipeline/flatten-lock-steps.d.ts +4 -6
  360. package/dist/pipeline/global-dispatch-identity.d.ts +5 -10
  361. package/dist/pipeline/global-eval-round.d.ts +65 -151
  362. package/dist/pipeline/global-round-hold.d.ts +5 -7
  363. package/dist/pipeline/held-context-data.d.ts +5 -8
  364. package/dist/pipeline/held-round-registrations.d.ts +8 -11
  365. package/dist/pipeline/install-gate.d.ts +15 -25
  366. package/dist/pipeline/install-secrets-resolver.d.ts +24 -34
  367. package/dist/pipeline/internal-event-pipeline.d.ts +45 -62
  368. package/dist/pipeline/invoke-gate.d.ts +27 -40
  369. package/dist/pipeline/job-contexts.d.ts +19 -36
  370. package/dist/pipeline/manual-schedule.d.ts +7 -13
  371. package/dist/pipeline/needs-scheduler.d.ts +29 -46
  372. package/dist/pipeline/pending-workflow-context.d.ts +14 -28
  373. package/dist/pipeline/process-webhook.d.ts +88 -123
  374. package/dist/pipeline/processor.d.ts +209 -355
  375. package/dist/pipeline/remote-source-store.d.ts +5 -8
  376. package/dist/pipeline/request-idempotency.d.ts +10 -13
  377. package/dist/pipeline/rerun-global.d.ts +6 -7
  378. package/dist/pipeline/rerun-inputs.d.ts +23 -37
  379. package/dist/pipeline/rerun.d.ts +34 -57
  380. package/dist/pipeline/resolve-sandbox-grant.d.ts +5 -10
  381. package/dist/pipeline/resume-workflow.d.ts +28 -34
  382. package/dist/pipeline/route-or-dispatch-jobs.d.ts +19 -30
  383. package/dist/pipeline/run-event-context.d.ts +16 -21
  384. package/dist/pipeline/sandbox-allowlist-reader.d.ts +7 -11
  385. package/dist/pipeline/security-hold-check.d.ts +56 -80
  386. package/dist/pipeline/test-pipeline.d.ts +21 -46
  387. package/dist/pipeline/unbound-job-context.d.ts +6 -9
  388. package/dist/pipeline/undispatched-hold-checks.d.ts +4 -6
  389. package/dist/pipeline/wave-scheduler.d.ts +15 -22
  390. package/dist/pipeline/webhook-payload-store.d.ts +3 -10
  391. package/dist/pipeline/workflow-lock-at-sha.d.ts +14 -20
  392. package/dist/policy/dashboard-write-policy.d.ts +1 -1
  393. package/dist/provider-registry.d.ts +0 -19
  394. package/dist/providers/generic/index.d.ts +0 -2
  395. package/dist/providers/generic/normalizer.d.ts +0 -1
  396. package/dist/providers/generic/verification.d.ts +0 -8
  397. package/dist/providers/github/auth.d.ts +0 -1
  398. package/dist/providers/github/changed-files.d.ts +2 -1
  399. package/dist/providers/github/file-contents.d.ts +0 -4
  400. package/dist/providers/github/lock-file.d.ts +0 -4
  401. package/dist/providers/github/normalizer.d.ts +1 -9
  402. package/dist/providers/local/index.d.ts +1 -2
  403. package/dist/providers/local/lock-file-fetcher.d.ts +0 -4
  404. package/dist/providers/local/normalizer.d.ts +0 -10
  405. package/dist/providers/local/repo-url-builder.d.ts +0 -2
  406. package/dist/providers/universal-git/clone-token.d.ts +0 -2
  407. package/dist/providers/universal-git/lock-file.d.ts +0 -2
  408. package/dist/providers/universal-git/normalizer.d.ts +0 -2
  409. package/dist/queue/bootstrap.d.ts +3 -15
  410. package/dist/queue/cleanup.d.ts +29 -50
  411. package/dist/queue/depth-refresher.d.ts +21 -39
  412. package/dist/queue/job-queue.d.ts +112 -163
  413. package/dist/queue/retention.d.ts +23 -36
  414. package/dist/queue/scheduled-job.d.ts +17 -39
  415. package/dist/queue/terminalize-unroutable.d.ts +21 -18
  416. package/dist/queue/unroutable-probe.d.ts +15 -22
  417. package/dist/registration/extractor.d.ts +0 -6
  418. package/dist/registration/registration-index.d.ts +0 -6
  419. package/dist/registration/registration-store.d.ts +0 -9
  420. package/dist/reporting/agent-failure-category.d.ts +3 -5
  421. package/dist/reporting/check-run-reporter.d.ts +142 -316
  422. package/dist/reporting/check-run-summary.d.ts +16 -35
  423. package/dist/reporting/check-run-tracking-store.d.ts +54 -107
  424. package/dist/reporting/execution-tracker.d.ts +356 -526
  425. package/dist/reporting/fs-log-storage.d.ts +31 -33
  426. package/dist/reporting/job-check-run-completion.d.ts +14 -22
  427. package/dist/reporting/log-chunk-sink.d.ts +11 -16
  428. package/dist/reporting/log-pull-handler.d.ts +4 -13
  429. package/dist/reporting/log-retention.d.ts +3 -4
  430. package/dist/reporting/log-storage.d.ts +24 -52
  431. package/dist/reporting/log-writer.d.ts +28 -56
  432. package/dist/reporting/peer-log-normalize.d.ts +4 -8
  433. package/dist/reporting/run-aggregator.d.ts +6 -11
  434. package/dist/reporting/run-summary-fields.d.ts +5 -8
  435. package/dist/reporting/s3-log-storage.d.ts +31 -50
  436. package/dist/reporting/step-display-order.d.ts +11 -21
  437. package/dist/reporting/step-log-buffer.d.ts +7 -28
  438. package/dist/reporting/step-log-reader.d.ts +11 -19
  439. package/dist/routes/admin-access-log.d.ts +4 -6
  440. package/dist/routes/admin-auth.d.ts +19 -38
  441. package/dist/routes/admin-backends.d.ts +3 -14
  442. package/dist/routes/admin-cluster-name.d.ts +13 -21
  443. package/dist/routes/admin-cluster-settings.d.ts +6 -9
  444. package/dist/routes/admin-config.d.ts +7 -19
  445. package/dist/routes/admin-contexts.d.ts +6 -13
  446. package/dist/routes/admin-db.d.ts +5 -10
  447. package/dist/routes/admin-event-dlq.d.ts +3 -5
  448. package/dist/routes/admin-event-inspect.d.ts +3 -4
  449. package/dist/routes/admin-event-log.d.ts +3 -7
  450. package/dist/routes/admin-events.d.ts +16 -30
  451. package/dist/routes/admin-held-runs.d.ts +52 -76
  452. package/dist/routes/admin-maintenance.d.ts +3 -6
  453. package/dist/routes/admin-orchestrator-drain.d.ts +0 -2
  454. package/dist/routes/admin-org-settings.d.ts +8 -14
  455. package/dist/routes/admin-peer-forget.d.ts +0 -1
  456. package/dist/routes/admin-queue-execution.d.ts +3 -3
  457. package/dist/routes/admin-registrations.d.ts +3 -12
  458. package/dist/routes/admin-runs.d.ts +16 -29
  459. package/dist/routes/admin-scaler-orphans.d.ts +4 -4
  460. package/dist/routes/admin-scaler-reload.d.ts +5 -8
  461. package/dist/routes/admin-scheduled-jobs.d.ts +3 -4
  462. package/dist/routes/admin-sources.d.ts +20 -29
  463. package/dist/routes/admin-trust-policy.d.ts +31 -48
  464. package/dist/routes/admin.d.ts +67 -94
  465. package/dist/routes/caller-identity.d.ts +45 -0
  466. package/dist/routes/capabilities.d.ts +8 -13
  467. package/dist/routes/diagnostics.d.ts +2 -10
  468. package/dist/routes/fleet.d.ts +1 -2
  469. package/dist/routes/github-webhook.d.ts +2 -5
  470. package/dist/routes/health.d.ts +6 -19
  471. package/dist/routes/provenance-oidc.d.ts +3 -3
  472. package/dist/routes/test-direct.d.ts +46 -0
  473. package/dist/routes/uploads.d.ts +14 -19
  474. package/dist/routes/webhooks.d.ts +2 -24
  475. package/dist/scaler/agent-binary-location.d.ts +77 -0
  476. package/dist/scaler/agent-fit.d.ts +2 -2
  477. package/dist/scaler/backend-factory.d.ts +10 -18
  478. package/dist/scaler/bare-metal-backend.d.ts +28 -45
  479. package/dist/scaler/claim-store.d.ts +20 -43
  480. package/dist/scaler/config.d.ts +10 -37
  481. package/dist/scaler/container-backend.d.ts +22 -35
  482. package/dist/scaler/container-hostconfig.d.ts +10 -16
  483. package/dist/scaler/container-routing.d.ts +10 -13
  484. package/dist/scaler/disk-guard.d.ts +2 -3
  485. package/dist/scaler/event-backend.d.ts +33 -58
  486. package/dist/scaler/event-provision-reaper.d.ts +61 -84
  487. package/dist/scaler/failure-tracker.d.ts +6 -13
  488. package/dist/scaler/file-tail.d.ts +6 -19
  489. package/dist/scaler/firecracker-api.d.ts +19 -63
  490. package/dist/scaler/firecracker-backend.d.ts +142 -258
  491. package/dist/scaler/host-access.d.ts +7 -10
  492. package/dist/scaler/index.d.ts +3 -6
  493. package/dist/scaler/ip-allocator.d.ts +30 -82
  494. package/dist/scaler/label-matcher.d.ts +14 -35
  495. package/dist/scaler/log-forwarder.d.ts +6 -25
  496. package/dist/scaler/machine-ledger.d.ts +39 -86
  497. package/dist/scaler/manager.d.ts +517 -787
  498. package/dist/scaler/pending-scale-sweeper.d.ts +8 -11
  499. package/dist/scaler/reap-orphans.d.ts +8 -12
  500. package/dist/scaler/resolve-container-auth.d.ts +12 -21
  501. package/dist/scaler/scaler-events.d.ts +2 -5
  502. package/dist/scaler/scaler-state-store.d.ts +127 -189
  503. package/dist/scaler/spawn-errors.d.ts +1 -4
  504. package/dist/scaler/startup-orphan-sweep.d.ts +3 -4
  505. package/dist/scaler/startup-tools-check.d.ts +21 -0
  506. package/dist/scaler/types.d.ts +142 -255
  507. package/dist/scaler/vm-job-bindings.d.ts +5 -9
  508. package/dist/scaler/warm-pool.d.ts +46 -93
  509. package/dist/secrets/audit-logger.d.ts +0 -3
  510. package/dist/secrets/backend-health.d.ts +0 -9
  511. package/dist/secrets/backend-registry.d.ts +0 -9
  512. package/dist/secrets/cleanup.d.ts +0 -1
  513. package/dist/secrets/config.d.ts +0 -3
  514. package/dist/secrets/ephemeral-keys.d.ts +0 -3
  515. package/dist/secrets/pg-secret-store.d.ts +0 -3
  516. package/dist/secrets/rbac.d.ts +5 -7
  517. package/dist/secrets/routing-key-scope.d.ts +1 -0
  518. package/dist/secrets/secret-output-store.d.ts +0 -6
  519. package/dist/secrets/secret-resolver.d.ts +2 -6
  520. package/dist/secrets/token-manager.d.ts +1 -4
  521. package/dist/secrets/vault-secret-store.d.ts +0 -13
  522. package/dist/security/comment-handler.d.ts +0 -2
  523. package/dist/security/workflow-diff.d.ts +1 -1
  524. package/dist/server.js +49004 -53782
  525. package/dist/sources/source-manager.d.ts +0 -3
  526. package/dist/sources/source-store.d.ts +0 -9
  527. package/dist/sources/source-validator.d.ts +0 -3
  528. package/dist/stale-detector/all-terminal-runs.d.ts +8 -11
  529. package/dist/stale-detector/gate-deadline-detector.d.ts +14 -19
  530. package/dist/stale-detector/reboot-deadline-sweep.d.ts +7 -11
  531. package/dist/stale-detector/stale-dispatch-candidates.d.ts +13 -20
  532. package/dist/stale-detector/stale-run-detector.d.ts +74 -121
  533. package/dist/stale-detector/workflow-deadline-detector.d.ts +15 -43
  534. package/dist/standalone.js +9342 -13077
  535. package/dist/storage/blob-routes.d.ts +10 -19
  536. package/dist/storage/filesystem.d.ts +19 -29
  537. package/dist/storage/index.d.ts +2 -10
  538. package/dist/storage/key-discriminator.d.ts +8 -10
  539. package/dist/storage/loopback-guard.d.ts +27 -45
  540. package/dist/storage/s3.d.ts +26 -53
  541. package/dist/storage/sign-url.d.ts +7 -22
  542. package/dist/storage/types.d.ts +46 -72
  543. package/dist/webhook/event-log.d.ts +0 -2
  544. package/dist/webhook/generic-sources.d.ts +0 -21
  545. package/dist/webhook/ingest-admission.d.ts +0 -1
  546. package/dist/webhook/relay-buffer.d.ts +2 -2
  547. package/dist/webhook/verify-inbound.d.ts +0 -1
  548. package/dist/worker/in-memory-execution-tracker.d.ts +9 -31
  549. package/dist/worker/in-memory-job-queue.d.ts +32 -72
  550. package/dist/worker/peer-outbox.d.ts +5 -8
  551. package/dist/worker/reroute-dispatch.d.ts +4 -6
  552. package/dist/worker/static-agent-token-store.d.ts +6 -27
  553. package/dist/worker/worker-outbox-relay.d.ts +2 -2
  554. package/dist/worker/worker-status.d.ts +3 -20
  555. package/dist/ws/agent-api-registry.d.ts +8 -27
  556. package/dist/ws/agent-handler.d.ts +63 -110
  557. package/dist/ws/agent-heartbeat.d.ts +5 -12
  558. package/dist/ws/bringup-api.d.ts +31 -38
  559. package/dist/ws/dashboard-backends-handler.d.ts +12 -22
  560. package/dist/ws/dashboard-context-handler.d.ts +37 -80
  561. package/dist/ws/dashboard-diagnostics-handler.d.ts +8 -25
  562. package/dist/ws/dashboard-dispatch-guard.d.ts +3 -4
  563. package/dist/ws/dashboard-fleet-handler.d.ts +9 -13
  564. package/dist/ws/dashboard-fleet-write-handler.d.ts +7 -21
  565. package/dist/ws/dashboard-global-workflows-handler.d.ts +22 -44
  566. package/dist/ws/dashboard-registrations-handler.d.ts +10 -27
  567. package/dist/ws/dashboard-run-state-handler.d.ts +10 -13
  568. package/dist/ws/event-buffer.d.ts +3 -6
  569. package/dist/ws/execution-status-frame.d.ts +7 -10
  570. package/dist/ws/failure-messages.d.ts +9 -14
  571. package/dist/ws/fleet-agent-collector.d.ts +6 -12
  572. package/dist/ws/fleet-runs-on-all.d.ts +1 -6
  573. package/dist/ws/git-credential-relay.d.ts +12 -20
  574. package/dist/ws/inventory-api.d.ts +4 -5
  575. package/dist/ws/observer-registry.d.ts +14 -59
  576. package/dist/ws/ownership-gate.d.ts +1 -1
  577. package/dist/ws/platform-client.d.ts +21 -30
  578. package/dist/ws/replay-chunker.d.ts +7 -10
  579. package/dist/ws/server-options.d.ts +5 -9
  580. package/dist/ws/test-relay-handlers.d.ts +46 -63
  581. package/installer-image-digests.json +3 -3
  582. package/package.json +6 -5
  583. package/sbom.spdx.json +53 -53
  584. package/dist/__test-helpers__/fake-scaler-state-store.d.ts +0 -24
  585. package/dist/__test-helpers__/mock-db-query.d.ts +0 -129
  586. package/dist/__test-helpers__/mock-db.d.ts +0 -134
  587. package/dist/__test-helpers__/mock-ws.d.ts +0 -13
  588. package/dist/__test-helpers__/peer-mutual-auth.d.ts +0 -42
  589. package/dist/__test-helpers__/scratch-db.d.ts +0 -16
  590. package/dist/__test-helpers__/test-db.d.ts +0 -34
  591. package/dist/pipeline/dispatch-matched-workflow.test-helpers.d.ts +0 -121
  592. package/dist/scaler/container-spawn.d.ts +0 -28
@@ -1,12 +1,11 @@
1
1
  /**
2
2
  * Execution state tracker with write-through DB persistence.
3
3
  *
4
- * Aggregates job/step status updates from agents and persists execution
5
- * history to PostgreSQL. Maintains in-memory state for fast lookups
6
- * (job name resolution, run completion detection) with write-through
7
- * to the execution_runs/execution_jobs/execution_steps tables.
4
+ * Aggregates agent job/step status updates in memory (job name resolution, run
5
+ * completion detection) and writes through to the
6
+ * execution_runs/execution_jobs/execution_steps tables.
8
7
  *
9
- * Overall run status follows locked decision:
8
+ * Overall run status:
10
9
  * - success ONLY if ALL jobs succeed
11
10
  * - failed if ANY job fails
12
11
  * - cancelled if ANY job is cancelled (and none failed)
@@ -153,18 +152,17 @@ export interface ExecutionTrackerDeps {
153
152
  * Drop the in-process state a run leaves behind — its pending job contexts
154
153
  * and its still-open eval gates.
155
154
  *
156
- * Separate from {@link ExecutionTrackerDeps.onExecutionComplete} because that
157
- * callback is NOT the terminalization chokepoint it reads as. It fires on the
158
- * three paths that finish a run whose jobs ran (`completeRun`, and both
159
- * stale-detector arms) and on none of the paths that terminalize a run whose
160
- * jobs never did — `failRun` (the expired-approval sweep and every
161
- * pre-dispatch abort) and `cancelHeldRun` (an install gate rejected). Those
162
- * are exactly the runs most likely to be holding a pending job context, since
163
- * a context is only stored for a job that was gated rather than dispatched.
155
+ * Separate from {@link ExecutionTrackerDeps.onExecutionComplete}, which is NOT
156
+ * a terminalization chokepoint: it fires on the paths that finish a run whose
157
+ * jobs ran (`completeRun`, and both stale-detector arms) and on none that
158
+ * terminalize a run whose jobs never did — `failRun` (the expired-approval
159
+ * sweep and every pre-dispatch abort) and `cancelHeldRun` (an install gate
160
+ * rejected). Those runs are the likeliest to hold a pending job context, since
161
+ * a context is stored only for a job that was gated rather than dispatched.
164
162
  *
165
- * Synchronous by contract: the in-memory half of the cleanup must not be
166
- * deferred behind an await the caller does not hold, and the DB half is
167
- * fire-and-forget inside the callback.
163
+ * Synchronous by contract: the in-memory half must not be deferred behind an
164
+ * await the caller does not hold; the DB half is fire-and-forget inside the
165
+ * callback.
168
166
  */
169
167
  onRunTerminalCleanup?: (runId: string) => void;
170
168
  /** Optional callback to forward step status to Platform. */
@@ -250,12 +248,11 @@ export interface ExecutionTrackerDeps {
250
248
  /** Optional job queue for cascading run failures to dispatch_queue entries. */
251
249
  jobQueue?: JobQueue;
252
250
  /**
253
- * Resolves a routing key to its owning org (customer_id), used to populate
254
- * `execution_runs.customer_id` at insert time so the concurrency-gate running
255
- * count is scoped per tenant. Injected (bound to `(rk) => resolveOrgId(db, rk)`
256
- * at construction) to keep the tracker free of a pipeline import cycle. When
257
- * absent — or when a run has no routing key — the row falls back to the
258
- * `'__default__'` column default (the no-source fallback org).
251
+ * Resolves a routing key to its owning org, stamped on
252
+ * `execution_runs.customer_id` at insert so the concurrency-gate running count
253
+ * is scoped per tenant. Injected (bound to `(rk) => resolveOrgId(db, rk)`) to
254
+ * avoid a pipeline import cycle. Absent, or for a run with no routing key, the
255
+ * row falls back to the `'__default__'` column default (the no-source org).
259
256
  */
260
257
  resolveOrgId?: (routingKey: string) => Promise<string>;
261
258
  /**
@@ -278,11 +275,9 @@ export interface ExecutionTrackerDeps {
278
275
  /**
279
276
  * The per-job fields the tracker persists to an execution_jobs row.
280
277
  *
281
- * Exported and shared by every registration entry point (`onExecutionStarted`,
282
- * `addJobsToRun`) rather than restated inline at each one: three structural
283
- * copies had already drifted apart on which optional fields they carried, so a
284
- * new column had to be added in three places or silently go unwritten from one
285
- * of them.
278
+ * Shared by every registration entry point (`onExecutionStarted`,
279
+ * `addJobsToRun`) rather than restated inline: inline copies drift on which
280
+ * optional fields they carry, so a new column silently goes unwritten from one.
286
281
  */
287
282
  export interface TrackedJobRow {
288
283
  jobId: string;
@@ -358,15 +353,11 @@ export declare class ExecutionTracker {
358
353
  /** Tracks which runs are test runs for observer broadcasting. */
359
354
  private readonly testRunIds;
360
355
  /**
361
- * Per-(run, job) raw log byte accumulator.
356
+ * Per-(run, job) raw log bytes: runId -> jobId -> bytes.
362
357
  *
363
- * Populated from the agent-reported `logBytesStreamed` field on terminal
364
- * `step.status` messages and folded into `execution_jobs.log_bytes` when
365
- * the job reaches terminal state. The per-run total is then computed by
366
- * summing the per-job entries and written into `execution_runs.log_bytes`
367
- * at run completion. Deleted on run prune to avoid Map growth.
368
- *
369
- * Map shape: runId -> jobId -> bytes.
358
+ * Fed by `logBytesStreamed` on terminal `step.status` messages, written to
359
+ * `execution_jobs.log_bytes` at job terminal state and summed into
360
+ * `execution_runs.log_bytes` at run completion. Deleted on run prune.
370
361
  */
371
362
  private readonly jobLogBytes;
372
363
  /** Callback fired when a job's needs are satisfied and it's ready for dispatch. */
@@ -384,10 +375,8 @@ export declare class ExecutionTracker {
384
375
  */
385
376
  setOnJobReadyCallback(cb: (runId: string, jobName: string) => Promise<void>): void;
386
377
  /**
387
- * Record a new execution run with its initial jobs.
388
- *
389
- * Inserts execution_runs and execution_jobs rows in the DB and
390
- * sets up in-memory tracking state.
378
+ * Record a new execution run with its initial jobs: inserts the
379
+ * execution_runs and execution_jobs rows and sets up in-memory state.
391
380
  */
392
381
  onExecutionStarted(runId: string, workflowName: string, provider: string, repoIdentifier: string, ref: string, sha: string, deliveryId: string | null, providerContext: Record<string, unknown>, triggerDecision: Record<string, unknown> | null, jobs: TrackedJobRow[], routingKey?: string,
393
382
  /** Secret context names dispatched with jobs (for context-disable job lookup). */
@@ -467,21 +456,18 @@ export declare class ExecutionTracker {
467
456
  * Cancel job rows just registered under a run that has already stopped.
468
457
  *
469
458
  * A job registers after its dispatch, so a cancel landing in between leaves
470
- * the run terminal while the job's row is written `pending`. The queue
471
- * refuses that job's dispatch (`JobQueue.insertDispatched`), so no agent
472
- * will ever report on it: its row is cancelled here, as the cancel cancels
473
- * the queued jobs it can see.
459
+ * the run terminal and the job row `pending`. The queue refuses that dispatch
460
+ * (`JobQueue.insertDispatched`), so no agent will report on it; the row is
461
+ * cancelled here, as the cancel cancels the queued jobs it can see.
474
462
  */
475
463
  private cancelJobsOfStoppedRun;
476
464
  /**
477
- * Find the synthetic needs-pending job ID for a given job name in a run.
478
- * Used by dispatchReadyJob to locate the placeholder entry before replacing it.
465
+ * Find the synthetic needs-pending job ID that dispatchReadyJob replaces.
479
466
  *
480
- * Cluster correctness: the synthetic row is inserted by the peer that
481
- * ingested the webhook. In an HA cluster `dispatchReadyJob` can fire on a
482
- * different peer whose in-memory map has no entry for this run. Fall back
483
- * to the DB so the leftover synthetic row gets cleaned up regardless of
484
- * which peer owns the downstream dispatch.
467
+ * Cluster correctness: the peer that ingested the webhook inserts the
468
+ * synthetic row, but `dispatchReadyJob` can fire on a peer whose in-memory map
469
+ * has no entry for this run. The DB fallback cleans up the synthetic row
470
+ * whichever peer owns the downstream dispatch.
485
471
  */
486
472
  findSyntheticJobId(runId: string, jobName: string): Promise<string | undefined>;
487
473
  /**
@@ -502,28 +488,23 @@ export declare class ExecutionTracker {
502
488
  * Whether a rerouted job has visibly started, read from the shared
503
489
  * `execution_jobs` row rather than from a relayed progress frame.
504
490
  *
505
- * The coordinator's spawn-window backstop learns about progress from
506
- * `job.progress`, which only a WORKER peer sends — a worker has no database,
507
- * so relaying is its only channel. A peer COORDINATOR writes the job's status
508
- * straight into this table instead, so silence on the wire says nothing about
509
- * whether the job is running, and the backstop would cancel a healthy job.
491
+ * The spawn-window backstop learns progress from `job.progress`, which only a
492
+ * WORKER peer (no database) sends. A peer COORDINATOR writes the status
493
+ * straight into this table, so wire silence says nothing and the backstop
494
+ * would cancel a healthy job.
510
495
  *
511
- * False when no row exists yet (the peer has not started the job) and when the
512
- * row is still `pending`; the `started_at` half covers a status that has
513
- * already moved on to a terminal value.
496
+ * False when no row exists yet or the row is still `pending`; the
497
+ * `started_at` half covers a status already moved on to a terminal value.
514
498
  */
515
499
  hasJobStarted(runId: string, jobId: string): Promise<boolean>;
516
500
  /**
517
- * Whether a job has reached a terminal state in the shared `execution_jobs`
518
- * row.
501
+ * Whether the shared `execution_jobs` row records a terminal state.
519
502
  *
520
- * The companion read to {@link hasJobStarted}: a peer COORDINATOR runs a
521
- * rerouted job against this same table and relays no terminal `job.progress`,
522
- * so the row is the only signal the routing coordinator gets that the job is
523
- * over and its reroute tracking can be released.
503
+ * Companion to {@link hasJobStarted}: a peer COORDINATOR relays no terminal
504
+ * `job.progress`, so the row is the routing coordinator's only signal that the
505
+ * job is over and its reroute tracking can be released.
524
506
  *
525
- * False when no row exists yet — an absent row is a job that has not started,
526
- * never a finished one.
507
+ * False when no row exists — an absent row is a job not yet started.
527
508
  */
528
509
  isJobTerminal(runId: string, jobId: string): Promise<boolean>;
529
510
  /**
@@ -543,14 +524,13 @@ export declare class ExecutionTracker {
543
524
  * (`onJobStatus`, `addJobsToRun`) so a status reply cannot interleave with the
544
525
  * synthetic→real job swap and wedge the run in `running`.
545
526
  *
546
- * The lock is **reentrant**: three paths re-enter a locked method within the
547
- * same async context for the same runId — onJobStatus → scheduler hook →
527
+ * The lock is **reentrant**: these paths re-enter a locked method in the same
528
+ * async context for the same runId — onJobStatus → scheduler hook →
548
529
  * dispatchReadyJob → addJobsToRun; onJobStatus → enforceSchedulerInvariant →
549
- * onJobStatus; runSchedulerHook → onJobStatus (skip). A non-reentrant mutex
550
- * would deadlock on these, so a context that already holds the runId's lock
551
- * (tracked via `heldRunLocks`) runs `fn` inline. A genuinely concurrent caller
552
- * for the same runId (a separate WS message) is a different async context and
553
- * correctly waits. All reentrant paths are same-runId, so there is no
530
+ * onJobStatus; runSchedulerHook → onJobStatus (skip). A context already
531
+ * holding the runId's lock (`heldRunLocks`) runs `fn` inline instead of
532
+ * deadlocking; a concurrent caller (a separate WS message) is a different async
533
+ * context and waits. Reentrant paths are all same-runId, so there is no
554
534
  * cross-run lock-ordering deadlock.
555
535
  */
556
536
  private withRunLock;
@@ -558,14 +538,8 @@ export declare class ExecutionTracker {
558
538
  /** Synthetic job ID to replace (e.g. needs-pending-deploy-{uuid}). */
559
539
  replaceSyntheticId?: string): Promise<void>;
560
540
  private addJobsToRunImpl;
561
- /**
562
- * Mark a run as a test run for observer broadcasting.
563
- * Called by the test pipeline after creating the execution run.
564
- */
541
+ /** Mark a run as a test run for observer broadcasting (called by the test pipeline). */
565
542
  markTestRun(runId: string): void;
566
- /**
567
- * Check if a run is a test run.
568
- */
569
543
  isTestRun(runId: string): boolean;
570
544
  /**
571
545
  * Update job status within a run.
@@ -579,30 +553,26 @@ export declare class ExecutionTracker {
579
553
  /**
580
554
  * Whether this coordinator may finalize the run now.
581
555
  *
582
- * The in-memory job map is only this coordinator's view: a run rehydrated
583
- * from the database holds just the jobs its own agents reported, and even
584
- * the run's owner holds a sibling-claimed job at the status it last heard.
585
- * So once the map reads complete, the shared `execution_jobs` rows are
586
- * folded in ({@link syncRunJobsFromRows}) and the check is repeated over the
587
- * whole set — a job another coordinator is still running keeps the run
588
- * open, and the status computed afterwards covers every job, not a subset.
556
+ * The in-memory map is only this coordinator's view: a rehydrated run holds
557
+ * just the jobs its own agents reported, and even the owner holds a
558
+ * sibling-claimed job at its last-heard status. So once the map reads
559
+ * complete, the shared `execution_jobs` rows are folded in
560
+ * ({@link syncRunJobsFromRows}) and the check repeats over every job — a job a
561
+ * sibling still runs keeps the run open.
589
562
  *
590
563
  * Then the registration window: while a LIVE sibling still has jobs to
591
- * register (a build-window owner whose real jobs are dispatched only once
592
- * the build finishes), the rows say nothing yet, so finalization is deferred
593
- * to whichever coordinator sees the last job finish — or to that owner's
594
- * own release, which re-runs this check. A dead holder reads as no window,
595
- * and a run it left behind is finished by the stale detector's
596
- * all-terminal sweep.
564
+ * register (a build-window owner dispatches its real jobs after the build),
565
+ * finalization defers to whichever coordinator sees the last job finish, or
566
+ * to that owner's release, which re-runs this check. A dead holder reads as no
567
+ * window; the stale detector's all-terminal sweep finishes its run.
597
568
  */
598
569
  private readyToFinalize;
599
570
  /**
600
- * Fold the run's persisted `execution_jobs` rows into its in-memory map:
601
- * a row this coordinator never registered is added at the row's status, and
602
- * a job it holds as non-terminal is lifted to the terminal status the row
603
- * carries. Memory is never downgraded — the row for the job being reported
604
- * was upserted before any completion check runs, so a terminal entry in
605
- * memory is always at least as current as its row.
571
+ * Fold the run's `execution_jobs` rows into its in-memory map: an unknown row
572
+ * is added at its status, and a non-terminal job is lifted to the row's
573
+ * terminal status. Memory is never downgraded — the reported job's row is
574
+ * upserted before any completion check, so a terminal memory entry is at
575
+ * least as current as its row.
606
576
  */
607
577
  private syncRunJobsFromRows;
608
578
  /**
@@ -613,56 +583,51 @@ export declare class ExecutionTracker {
613
583
  private registrationWindowHeldByLiveSibling;
614
584
  /**
615
585
  * Phase 1a: recover run state from the DB when in-memory tracking is empty.
616
- * Returns the rehydrated RunState or null if the run is unknown to the DB
617
- * (in which case the caller skips this status update entirely).
586
+ * Null when the run is unknown to the DB; the caller then skips the update.
618
587
  */
619
588
  private recoverRunFromDb;
620
589
  /**
621
590
  * Reopen a run rehydrated from a prematurely `failed` row (e.g. "No agents
622
591
  * available to dispatch jobs", but a queued job is now running): reset the
623
592
  * row to `running`, clear the failure it recorded, and raise its status
624
- * generation. The run completion logic then sets the correct final status.
593
+ * generation; run completion then sets the final status.
625
594
  *
626
- * Called only once the job report that rehydrated the run has been applied to
627
- * its job row. A replay of a frame the row already records must not reopen a
628
- * finished run: it would roll the run up a second time. A run that failed on
629
- * a build failure is never reopened — that failure is intentionally terminal.
595
+ * Called only after the rehydrating job report is applied to its job row: a
596
+ * replay of a frame the row already records must not reopen (and roll up
597
+ * again) a finished run. A build failure is intentionally terminal and is
598
+ * never reopened.
630
599
  */
631
600
  private reopenRecoveredRun;
632
601
  /**
633
602
  * Read the run row's status generation into the in-memory run after this
634
603
  * coordinator's reopen matched nothing.
635
604
  *
636
- * The reopen loses when another coordinator already reopened the run, or when
637
- * this view is a generation behind the row. Either way the row's generation
638
- * is the current one: a coordinator that kept its own older value would send
639
- * every later frame of the run at a generation the Platform keeps as older, so
640
- * none of them would apply.
605
+ * The reopen loses when another coordinator reopened the run first, or when
606
+ * this view is a generation behind. Either way the row's generation is
607
+ * current: keeping an older value would send every later frame at a
608
+ * generation the Platform treats as older, so none would apply.
641
609
  */
642
610
  private adoptStoredStatusEpoch;
643
611
  /**
644
- * Phase 1b: recover job state from the dispatch_queue and add it to the
645
- * run's in-memory map. Returns the freshly-inserted job entry.
612
+ * Phase 1b: recover job state from the dispatch_queue into the run's
613
+ * in-memory map.
646
614
  */
647
615
  private recoverJobFromDispatchQueue;
648
616
  /**
649
617
  * Phase 2: build the upsert payload for execution_jobs and execute it.
650
618
  *
651
- * The conflict update is guarded so it cannot rewrite a row that already
652
- * reached a terminal state. `applied` reports the guard's verdict; the log
653
- * byte total is the per-job value when the job reached a terminal state (used
654
- * downstream by the run-completion phase to populate run.log_bytes).
619
+ * The conflict update cannot rewrite a terminal row; `applied` reports the
620
+ * guard's verdict. The log byte total is set on a terminal state and feeds
621
+ * run.log_bytes at run completion.
655
622
  */
656
623
  private persistJobStatusUpdate;
657
624
  /**
658
- * Phase 3a: transition run from pending -> running when the first job
659
- * starts executing.
625
+ * Phase 3a: pending -> running when the first job starts.
660
626
  */
661
627
  private maybeTransitionRunToRunning;
662
628
  /**
663
- * Phase 3b: when an agent reports 'cancelling', transition the run-level
664
- * status too. 'cancelling' means "graceful cancel in progress, hooks
665
- * running" — the run should reflect this intermediate state.
629
+ * Phase 3b: an agent's 'cancelling' (graceful cancel in progress, hooks
630
+ * running) moves the run to 'cancelling' too.
666
631
  */
667
632
  private maybeTransitionRunToCancelling;
668
633
  /**
@@ -675,32 +640,27 @@ export declare class ExecutionTracker {
675
640
  */
676
641
  private fireJobStatusChangeCallback;
677
642
  /**
678
- * Phase 6: reconcile orphaned steps. If a job reaches terminal state but
679
- * some steps are still 'running' (because a step.complete IPC message was
680
- * lost), mark them as the job's terminal state. Without this safety net,
681
- * the dashboard shows "running" with an ever-growing duration for the lost
682
- * step.
643
+ * Phase 6: reconcile orphaned steps. Steps still 'running' when their job
644
+ * is terminal (a lost step.complete IPC message) take the job's terminal
645
+ * state; otherwise the dashboard shows the step running forever.
683
646
  */
684
647
  private reconcileOrphanedSteps;
685
648
  /**
686
- * Phase 7: drift report handling.
687
- * When an agent reports droppedJobs, transition those sibling jobs to
688
- * drift_dropped. drift_dropped is a terminal state, so the scheduler hook
689
- * (Phase 8) will propagate failures to any downstreams.
649
+ * Phase 7: drift report handling. Jobs an agent reports as droppedJobs move
650
+ * to the terminal drift_dropped, so the scheduler hook (Phase 8) propagates
651
+ * failure to their downstreams.
690
652
  */
691
653
  private handleDriftDroppedJobs;
692
654
  /**
693
- * Phase 8: needs-aware scheduler hook.
694
- * When a job reaches terminal state, evaluate its downstreams for dispatch.
695
- * The DAG is acyclic (validated at compile time L1 and eval time L2),
696
- * so recursive skip propagation terminates naturally.
655
+ * Phase 8: needs-aware scheduler hook: evaluate a terminal job's downstreams
656
+ * for dispatch. The DAG is acyclic (validated at compile time L1 and eval
657
+ * time L2), so recursive skip propagation terminates.
697
658
  */
698
659
  private runSchedulerHook;
699
660
  /**
700
661
  * Rolling-wave hook: fires beside the needs-scheduler when a fan-out child of
701
- * a bounded wave (`maxParallel` set) reaches terminal. Reads the completed
702
- * child's row to recover the base + wave policy, asks {@link evaluateWave}
703
- * what to do, then performs it:
662
+ * a bounded wave (`maxParallel` set) reaches terminal, and performs what
663
+ * {@link evaluateWave} decides:
704
664
  *
705
665
  * - `release`: clear the next held sibling's `wave_gated` flag and fire the
706
666
  * onJobReady callback (the existing ready→dispatch path).
@@ -710,17 +670,15 @@ export declare class ExecutionTracker {
710
670
  private runWaveSchedulerHook;
711
671
  /**
712
672
  * When a proxy job of an invoke gate reaches terminal, aggregate the gate once
713
- * every sibling proxy is terminal: the gate is set `failed` if any proxy
714
- * failed, else `success`. Setting the gate terminal drives its own downstream
715
- * `needs` release via the scheduler hook. A no-op for any non-proxy job.
673
+ * every sibling proxy is terminal: `failed` if any proxy failed, else
674
+ * `success`. The terminal gate releases its downstream `needs` through the
675
+ * scheduler hook. A no-op for any non-proxy job.
716
676
  */
717
677
  private runInvokeGateAggregationHook;
718
678
  /**
719
- * Phase 9: stuck-jobs invariant check (Layer 3).
720
- * Before declaring a run complete, verify no stuck jobs exist. If any are
721
- * found, fail them via recursive onJobStatus calls and signal the caller to
722
- * stop (returns true) — the recursive calls will re-enter and re-check
723
- * completion with fresh state.
679
+ * Phase 9: stuck-jobs invariant check (Layer 3), before declaring a run
680
+ * complete. Stuck jobs are failed via recursive onJobStatus calls, which
681
+ * re-check completion with fresh state; true tells the caller to stop.
724
682
  */
725
683
  private enforceSchedulerInvariantOrFail;
726
684
  /**
@@ -730,9 +688,8 @@ export declare class ExecutionTracker {
730
688
  */
731
689
  private finalizeRunCompletion;
732
690
  /**
733
- * Map a terminal run status to the terminal job status a proxy should carry.
734
- * A failure class collapses to `failed`; a cancel to `cancelled`; everything
735
- * else (success) to `success`.
691
+ * The terminal job status a proxy carries for a terminal run status:
692
+ * `success` and `cancelled` map through; every other status is `failed`.
736
693
  */
737
694
  private mapRunStatusToProxyStatus;
738
695
  /**
@@ -743,9 +700,8 @@ export declare class ExecutionTracker {
743
700
  */
744
701
  private readNonSecretRunOutputs;
745
702
  /**
746
- * Normalize an `outputs` JSONB cell to a plain object. The Postgres driver may
747
- * return it already parsed (object) or as a JSON string; both are accepted. A
748
- * null / empty / malformed cell yields `null`.
703
+ * Normalize an `outputs` JSONB cell (already-parsed object or JSON string)
704
+ * to a plain object; `null` for a null / empty / malformed cell.
749
705
  */
750
706
  private parseOutputsCell;
751
707
  /**
@@ -756,52 +712,42 @@ export declare class ExecutionTracker {
756
712
  */
757
713
  private mirrorSummonedRunOntoProxy;
758
714
  /**
759
- * Set a proxy job's timeline span to the summoned run's own started_at /
760
- * completed_at so its dashboard bar reflects the run it mirrors. A run rejected
761
- * before executing any step has no start; fall back to its completion (and, for
762
- * a run with no completion recorded, to the mirror timestamp) so the proxy
763
- * still renders a point-width bar rather than a status-only placeholder.
715
+ * Set a proxy job's timeline span to the summoned run's started_at /
716
+ * completed_at. A run rejected before any step has no start, so it falls back
717
+ * to its completion (or, with none recorded, the mirror timestamp) and still
718
+ * renders a point-width bar.
764
719
  */
765
720
  private mirrorSummonedRunSpanOntoProxy;
766
721
  /**
767
- * Reconcile a just-tagged summoned run against its proxy: if the run is already
768
- * terminal, drive the mirror now. Closes the tag race — a run that finalizes
769
- * before `summoned_by_run_id` lands (a synchronous all-jobs-rejected completion,
770
- * or an HA peer finalizing it first) reads a null tag in `mirrorSummonedRunOntoProxy`
771
- * and skips, so nothing else terminalizes its proxy and the gate hangs until
772
- * its timeout. The invoke gate calls this after tagging each spawned run; the
773
- * `onJobStatus` idempotency guard makes a double-fire with the normal finalize
774
- * a no-op.
722
+ * Drive the proxy mirror now when a just-tagged summoned run is already
723
+ * terminal. Closes the tag race: a run that finalizes before
724
+ * `summoned_by_run_id` lands (a synchronous all-jobs-rejected completion, or
725
+ * an HA peer finalizing first) reads a null tag and skips, so the gate hangs
726
+ * until its timeout. The invoke gate calls this after tagging each spawned
727
+ * run; the `onJobStatus` idempotency guard makes a double-fire a no-op.
775
728
  */
776
729
  reconcileSummonedRunIfTerminal(spawnedRunId: string): Promise<void>;
777
730
  /**
778
- * Mark a run as failed when its build fails (timeout or error).
779
- *
780
- * Called by the processor when a build job was tracked early via
781
- * onExecutionStarted but the build subsequently fails. Without this,
782
- * the execution_runs row would stay in a non-terminal state.
731
+ * Mark a run failed when its build fails (timeout or error) after the
732
+ * processor tracked it early via onExecutionStarted; otherwise the row stays
733
+ * non-terminal.
783
734
  */
784
735
  onBuildFailed(runId: string, initFailure?: InitFailure): Promise<void>;
785
736
  /**
786
- * Create a failed execution run when the build timed out before onExecutionStarted
787
- * had a chance to insert the row (buildJobTrackedEarly was false).
788
- *
789
- * Inserts a minimal execution_runs row with status='failed' directly so the
790
- * dashboard (and any run query) can observe the failure instead of a missing run.
737
+ * Insert a minimal `failed` execution_runs row when the build timed out
738
+ * before onExecutionStarted inserted one (buildJobTrackedEarly was false), so
739
+ * the dashboard and run queries see the failure instead of a missing run.
791
740
  *
792
- * The fifth pre-dispatch recording site, and the third that writes the row and
793
- * returns. Its row is terminal with no resume path, so no invoke gate ever
794
- * reads its `chain_depth` — the stamp is here for the same reason as on
741
+ * A pre-dispatch recording site that writes the row and returns. The row is
742
+ * terminal, so no invoke gate reads its `chain_depth`; it is stamped as in
795
743
  * {@link ExecutionTracker.recordInitFailureRun}: this row is the run's ONLY
796
- * record, and one that says `0` claims to have started the chain it actually
797
- * died inside.
744
+ * record, and a `0` claims it started the chain it died inside.
798
745
  */
799
746
  onBuildFailedBeforeTracking(runId: string, workflowName: string, provider: string, repoIdentifier: string, ref: string, sha: string, deliveryId: string | null, providerContext: Record<string, unknown>, routingKey: string, triggerEvent?: string, commitMessage?: string, failureReason?: string, initFailure?: InitFailure,
800
747
  /**
801
- * Internal-trigger provenance, as one object rather than two more
802
- * positional args on an already 13-wide signature. Shape matches
803
- * `preDispatchRunProvenance` in `dispatch-matched-workflow.ts`, which is
804
- * the only caller.
748
+ * Internal-trigger provenance, one object rather than more positional
749
+ * args. Shape matches `preDispatchRunProvenance` in
750
+ * `dispatch-matched-workflow.ts`, the only caller.
805
751
  */
806
752
  provenance?: {
807
753
  chainDepth?: number;
@@ -809,21 +755,19 @@ export declare class ExecutionTracker {
809
755
  rerunLineage?: RerunLineage;
810
756
  }): Promise<void>;
811
757
  /**
812
- * Write a `failed` execution_runs row directly for an init failure, and drop
813
- * any in-memory run so the recorded failure is the run's final word. Also
814
- * writes the structured init_failure signal and fires onExecutionStatusChange
815
- * so Platform's projection picks it up via the normal forward path.
758
+ * Write a `failed` execution_runs row (with the structured init_failure) for
759
+ * an init failure, and stamp any in-memory run complete so the recorded failure
760
+ * is the run's final word. Forwarded via onExecutionStatusChange to the Platform
761
+ * projection.
816
762
  *
817
- * An existing row for this runId is overwritten while it is still live —
818
- * dispatch may already have registered the run before init failed — and left
819
- * alone once it is terminal, so a run that genuinely finished is never
820
- * rewritten as failed. When the guard leaves the row alone, the failure
821
- * metric and the Platform forward are suppressed with it: this orchestrator
822
- * did not record the init failure, so it must not report one.
763
+ * An existing row is overwritten while live (dispatch may have registered the
764
+ * run before init failed) and left alone once terminal, so a finished run is
765
+ * never rewritten as failed. When the guard leaves it alone, the failure
766
+ * metric and Platform forward are suppressed too: this orchestrator did not
767
+ * record the init failure, so it must not report one.
823
768
  *
824
- * Closes the silent pre-run-failure gap — without this helper, secret /
825
- * install-secret / all-jobs-rejected early-exits in dispatch-matched-workflow
826
- * leave no trace on the dashboard.
769
+ * Without this, the secret / install-secret / all-jobs-rejected early exits in
770
+ * dispatch-matched-workflow leave no trace on the dashboard.
827
771
  */
828
772
  recordInitFailureRun(args: {
829
773
  runId: string;
@@ -840,25 +784,21 @@ export declare class ExecutionTracker {
840
784
  commitMessage?: string;
841
785
  /**
842
786
  * The repository that DEFINES the workflow this run was about to execute.
843
- * REQUIRED: every run has one, and a caller that does not state it must not
844
- * compile. Left optional, a global dispatch path added later would record a
845
- * null marker — and a null marker does not mean "unknown", it means "the
846
- * workflow lives in this run's own repository", which the whole
847
- * defining-repository predicate then reads as fact.
787
+ * REQUIRED so a caller that omits it does not compile: a null marker means
788
+ * "the workflow lives in this run's own repository", not "unknown", and the
789
+ * defining-repository predicate reads it as fact.
848
790
  *
849
- * Narrowed to the differing case here, exactly as `onExecutionStarted`
850
- * does, so passing `repoIdentifier` (the per-repository case) is correct
851
- * and records nothing.
791
+ * Narrowed to the differing case as in `onExecutionStarted`, so passing
792
+ * `repoIdentifier` (the per-repository case) records nothing.
852
793
  */
853
794
  workflowRepoIdentifier: string;
854
795
  /**
855
796
  * Inherited invoke-chain depth for a run summoned by an invoke gate.
856
797
  *
857
- * An init failure is terminal, so unlike the hold on
858
- * {@link ExecutionTracker.recordRunHeld} this run never fires a gate of its
859
- * own and nothing reads the column back to bound recursion. It is recorded
860
- * because this row is the run's ONLY record: one that says `0` claims to
861
- * have started the chain it actually died inside.
798
+ * Unlike a hold ({@link ExecutionTracker.recordRunHeld}), an init failure is
799
+ * terminal and never fires a gate, so nothing reads it to bound recursion.
800
+ * It is recorded because this row is the run's ONLY record, and a `0`
801
+ * claims it started the chain it died inside.
862
802
  */
863
803
  chainDepth?: number;
864
804
  /**
@@ -866,12 +806,10 @@ export declare class ExecutionTracker {
866
806
  * the run's `trigger_decision` marker
867
807
  * (`EventRouter.isFailureLifecycleRun`).
868
808
  *
869
- * Consistency rather than a live reader: this path emits no
870
- * `__workflow_complete`, so no accumulator reads the marker back today. It
871
- * is recorded so the row does not disagree with the one
872
- * {@link ExecutionTracker.recordRunHeld} writes for the same dispatch, and
873
- * so adding an emit here later cannot silently re-open the self-retrigger
874
- * loop.
809
+ * For consistency, not a live reader: this path emits no
810
+ * `__workflow_complete`. The row then agrees with the one
811
+ * {@link ExecutionTracker.recordRunHeld} writes for the same dispatch, and a
812
+ * later emit here cannot silently re-open the self-retrigger loop.
875
813
  */
876
814
  dispatchedByFailureLifecycle?: boolean;
877
815
  /** Re-run lineage, when this run re-runs another. */
@@ -881,20 +819,16 @@ export declare class ExecutionTracker {
881
819
  * Write one `failed` execution_runs row for a global eval round that never
882
820
  * produced verdicts.
883
821
  *
884
- * The round decides which organization-wide workflows apply to an event, so a
885
- * round that fails suppresses every workflow it was deciding on. Without a row
886
- * that outcome is invisible: no run was ever created for those workflows, so
887
- * there is nothing on the dashboard to explain why they did not appear.
822
+ * A failed round suppresses every organization-wide workflow it was deciding
823
+ * on; without this row nothing on the dashboard explains their absence.
888
824
  *
889
- * **One row for the whole round, not one per workflow.** The round exists to
890
- * collapse N candidate workflows into a single pre-run job; fanning its
891
- * failure back out into N rows would undo exactly that. The reason names every
892
- * affected workflow instead.
825
+ * **One row for the whole round, not one per workflow:** the round collapses
826
+ * N candidate workflows into one pre-run job, and N rows would undo that. The
827
+ * reason names every affected workflow instead.
893
828
  *
894
- * Its `runId` is the round job's own — the last attempt's — so the row, the
895
- * `dispatch_queue` row, and the attempt's logs all carry one id. No conflict
896
- * guard is needed beyond `doNothing`: the id was minted for this round and
897
- * belongs to no other run.
829
+ * `runId` is the round job's (last attempt's) own, so the row, the
830
+ * `dispatch_queue` row and the attempt's logs share one id. `doNothing` is
831
+ * guard enough: the id was minted for this round and belongs to no other run.
898
832
  */
899
833
  recordGlobalEvalRoundFailureRun(args: {
900
834
  runId: string;
@@ -910,30 +844,26 @@ export declare class ExecutionTracker {
910
844
  * The source `providerContext` was taken from, when a cross-provider
911
845
  * lock-file fallback made it a different source from `routingKey`.
912
846
  *
913
- * Recorded because the two are a PAIR: a re-run of this round re-drives the
914
- * organization-wide pass and must hand it the same bundle those credentials
915
- * belong to. Pairing the stored context with the inbound routing key instead
916
- * gives one source's credentials to another source's API client.
847
+ * The two are a PAIR: a re-run re-drives the organization-wide pass with the
848
+ * bundle those credentials belong to. Pairing the stored context with the
849
+ * inbound routing key gives one source's credentials to another's API client.
917
850
  */
918
851
  dispatchRoutingKey?: string;
919
852
  failureReason: string;
920
853
  triggerEvent?: string;
921
854
  /**
922
- * The repository whose global workflows the round was deciding. A round is
923
- * definitionally the cross-repository case, so this is normally a different
924
- * repository from `repoIdentifier` — recorded, like everywhere else, only
925
- * when the two actually differ.
855
+ * The repository whose global workflows the round was deciding — normally
856
+ * not `repoIdentifier`, and recorded only when the two differ.
926
857
  */
927
858
  workflowRepoIdentifier: string;
928
859
  }): Promise<void>;
929
860
  /**
930
861
  * Record a run paused at the workflow install gate (a `registries:` /
931
- * `installEnv:` protection rule returned hold / wait / queue). Writes an
932
- * `execution_runs` row in the `held` state — alive and resumable — so the
933
- * dashboard run list surfaces the paused workflow. No jobs are tracked: the
934
- * workflow-scoped held_runs row + pending workflow context (written by the
935
- * caller) keep the run from being counted complete, and any in-memory run is
936
- * dropped so jobs registered before the gate cannot roll it up.
862
+ * `installEnv:` protection rule returned hold / wait / queue) as a resumable
863
+ * `held` `execution_runs` row the dashboard run list shows. No jobs are
864
+ * tracked: the caller's held_runs row and pending workflow context keep the
865
+ * run from counting as complete, and any in-memory run is dropped so jobs
866
+ * registered before the gate cannot roll it up.
937
867
  *
938
868
  * An existing row for this runId is flipped to `held` while it is still live
939
869
  * and left alone once it is terminal — a finished run is never re-held.
@@ -953,35 +883,26 @@ export declare class ExecutionTracker {
953
883
  triggerEvent?: string;
954
884
  commitMessage?: string;
955
885
  /**
956
- * Pull-request number for PR-triggered holds; null/omitted for non-PR runs.
957
- * Stamped so PR-scoped `/kici approve|reject` (which joins `execution_runs`
958
- * on `pr_number`) can attribute the held run to its PR — a NULL leaves a
959
- * security hold fail-closed unreachable by the comment path.
886
+ * Pull-request number for PR-triggered holds. PR-scoped
887
+ * `/kici approve|reject` joins `execution_runs` on `pr_number`; a NULL
888
+ * leaves a security hold fail-closed unreachable by the comment path.
960
889
  */
961
890
  prNumber?: number | null;
962
891
  /**
963
- * The repository that DEFINES the held workflow. REQUIRED for the same
964
- * reason as on {@link ExecutionTracker.recordInitFailureRun}: a hold is a
965
- * live, resumable run, so a null marker here would misattribute it for the
966
- * whole time it sits in the queue and for the run it resumes into.
892
+ * The repository that DEFINES the held workflow. REQUIRED as on
893
+ * {@link ExecutionTracker.recordInitFailureRun}: a null marker would
894
+ * misattribute the hold while it waits and the run it resumes into.
967
895
  */
968
896
  workflowRepoIdentifier: string;
969
- /**
970
- * Commit of the workflow repository the held run dispatches, recorded only
971
- * when the workflow is defined in another repository.
972
- */
897
+ /** Workflow repository commit, recorded only for a cross-repository workflow. */
973
898
  workflowSha?: string | null;
974
- /**
975
- * The workflow repository's registered branch, recorded only when the
976
- * workflow is defined in another repository.
977
- */
899
+ /** Workflow repository registered branch, recorded only for a cross-repository workflow. */
978
900
  workflowBranch?: string | null;
979
901
  /**
980
- * Inherited invoke-chain depth for a run summoned by an invoke gate.
981
- * REQUIRED to be threaded by any caller that has one: a hold is resumable,
982
- * so the resumed run can fire its own invoke gate, and the chain-depth
983
- * circuit breaker reads this column back. Absent ⇒ the column's `0`
984
- * default, which means "this run starts a chain".
902
+ * Inherited invoke-chain depth for a run summoned by an invoke gate. Any
903
+ * caller that has one MUST thread it: the resumed run can fire its own
904
+ * invoke gate, and the chain-depth circuit breaker reads this column back.
905
+ * Absent ⇒ the `0` default, meaning "this run starts a chain".
985
906
  */
986
907
  chainDepth?: number;
987
908
  /**
@@ -993,51 +914,46 @@ export declare class ExecutionTracker {
993
914
  /** Re-run lineage, when this run re-runs another. */
994
915
  rerunLineage?: RerunLineage;
995
916
  /**
996
- * True when the held run is a pre-run global evaluation round rather than a
997
- * workflow: the structural marker the release and re-run paths branch on,
998
- * written here because a held round is recorded through this method.
917
+ * True for a held pre-run global evaluation round: the marker the release
918
+ * and re-run paths branch on.
999
919
  */
1000
920
  isGlobalEvalRound?: boolean;
1001
921
  /**
1002
- * For a held evaluation round: the workflows the round covers, recorded so
1003
- * its release can refuse when one of them lost its registration while the
1004
- * round waited. Stored in the row's `trigger_decision` blob.
922
+ * For a held evaluation round: the workflows it covers (in the
923
+ * `trigger_decision` blob), so its release can refuse when one lost its
924
+ * registration while the round waited.
1005
925
  */
1006
926
  heldRoundWorkflows?: readonly string[];
1007
927
  /**
1008
- * The source `providerContext` was taken from, when it is not
1009
- * `routingKey`. Recorded for a held evaluation round, whose release re-drives
1010
- * the organization-wide pass with that same pair — see
1011
- * {@link ExecutionTracker.recordGlobalEvalRoundFailureRun}.
928
+ * The source `providerContext` was taken from, when not `routingKey`; a held
929
+ * round's release re-drives the organization-wide pass with that pair (see
930
+ * {@link ExecutionTracker.recordGlobalEvalRoundFailureRun}).
1012
931
  */
1013
932
  dispatchRoutingKey?: string;
1014
933
  }): Promise<void>;
1015
934
  /**
1016
- * Claim a held global evaluation round for its release: move it from `held`
1017
- * to `pending`. Returns false when the row is not a held round — another
1018
- * release already claimed it — so a re-fired release signal dispatches the
1019
- * round at most once.
935
+ * Claim a held global evaluation round for release (`held` → `pending`).
936
+ * False when another release already claimed it, so a re-fired release
937
+ * signal dispatches the round at most once.
1020
938
  *
1021
- * `pending`, as a resumed per-repository run (`resumeHeldRun`), and not
1022
- * `running`: orphan recovery fails a `running` row older than its stale
1023
- * threshold that has no job rows, and a round row keeps the `started_at` of
1024
- * its hold and never has job rows. No sweeper selects a `pending` row with no
1025
- * job rows and no workflow timeout.
939
+ * `pending` (as `resumeHeldRun`), not `running`: orphan recovery fails a
940
+ * jobless `running` row older than its stale threshold, and a round row keeps
941
+ * its hold's `started_at` and never has job rows. No sweeper selects a
942
+ * jobless `pending` row with no workflow timeout.
1026
943
  */
1027
944
  claimHeldGlobalEvalRound(runId: string): Promise<boolean>;
1028
945
  /**
1029
946
  * Terminalize a held global evaluation round whose hold was released.
1030
947
  *
1031
- * The released round runs as a job of its own and creates no run row when it
1032
- * decides, so nothing else ever moves this row out of `held`. `success`
1033
- * records that the round reached a verdict for its workflow repository;
1034
- * `failed` that it did not, with the reason. Guarded on `pending`, the
1035
- * state {@link ExecutionTracker.claimHeldGlobalEvalRound} moved the row to,
1036
- * so only the release that claimed it settles it.
948
+ * The released round runs as its own job and creates no run row, so nothing
949
+ * else settles this row. `success` means it reached a verdict for its
950
+ * workflow repository; `failed` that it did not, with the reason. Guarded on
951
+ * `pending` (set by {@link ExecutionTracker.claimHeldGlobalEvalRound}), so
952
+ * only the claiming release settles it.
1037
953
  *
1038
- * A settled round is not an execution: no `executions_total` sample is
1039
- * counted for a success, and the forwarded frame carries `isGlobalEvalRound`
1040
- * so the Platform raises no run notification or outbound webhook for it.
954
+ * A settled round is not an execution: a success counts no
955
+ * `executions_total` sample, and the frame carries `isGlobalEvalRound` so the
956
+ * Platform raises no run notification or outbound webhook.
1041
957
  */
1042
958
  completeReleasedGlobalEvalRound(runId: string, outcome: {
1043
959
  status: typeof ExecutionRunStatus.enum.success;
@@ -1046,8 +962,8 @@ export declare class ExecutionTracker {
1046
962
  reason: string;
1047
963
  }): Promise<void>;
1048
964
  /**
1049
- * Flip a `held` run back to `pending` so the resumed dispatch can proceed
1050
- * into job dispatch. Returns true when a held row was found and updated.
965
+ * Flip a `held` run back to `pending` for the resumed dispatch. True when a
966
+ * held row was updated.
1051
967
  */
1052
968
  resumeHeldRun(runId: string): Promise<boolean>;
1053
969
  /**
@@ -1058,93 +974,73 @@ export declare class ExecutionTracker {
1058
974
  /**
1059
975
  * Cancel a run that has no job rows: a run cancelled before it dispatched
1060
976
  * any job, a pre-run evaluation round, or a `pending` row a crash left
1061
- * behind. No job will ever report a terminal status for it, so the cancel
1062
- * itself writes the terminal row and forwards it, as `cancelHeldRun` does.
977
+ * behind. No job will report a terminal status, so the cancel writes and
978
+ * forwards the terminal row itself, as `cancelHeldRun` does.
1063
979
  *
1064
- * Guarded on the row being non-terminal, not `held`, and having no job rows,
1065
- * so a run a job registered on in the meantime is left to the job-driven
1066
- * completion and a held run to the hold-rejection path.
1067
- * The cancellation reason already stamped on the row wins over `reason`.
980
+ * Guarded on non-terminal, not `held`, and no job rows: a run that gained a
981
+ * job meanwhile is left to job-driven completion, a held run to the
982
+ * hold-rejection path. A reason already on the row wins over `reason`.
1068
983
  * Returns whether a row was cancelled.
1069
984
  */
1070
985
  cancelJoblessRun(runId: string, reason: string): Promise<boolean>;
1071
986
  /**
1072
- * Mark a run as failed immediately with a reason message.
1073
- *
1074
- * Used when no agents are available to dispatch any jobs (e.g. cron-triggered
1075
- * runs on a cluster leader without matching local agents and no reachable peers).
1076
- * Instead of leaving the run in 'running' for OrphanRecovery to catch after 5 min,
1077
- * this fails it right away.
987
+ * Fail a run immediately, e.g. when no agents can take any job (cron-triggered
988
+ * runs on a cluster leader without matching local agents and no reachable
989
+ * peers), rather than leave it 'running' for OrphanRecovery to catch after
990
+ * 5 min.
1078
991
  */
1079
992
  failRun(runId: string, reason: string, initFailure?: InitFailure): Promise<void>;
1080
993
  /**
1081
- * Update step status within a job.
994
+ * Upsert a step's execution_steps row (started_at on 'running';
995
+ * completed_at, duration_ms, exit_code on terminal), with its log_path, and
996
+ * forward it to the Platform.
1082
997
  *
1083
- * Upserts execution_steps row with timing information. On 'running',
1084
- * sets started_at. On terminal state, sets completed_at, duration_ms,
1085
- * exit_code. Also constructs log_path and forwards to Platform.
1086
- *
1087
- * @param logBytesStreamed Raw byte total reported by the agent's
1088
- * LogStreamer at terminal step time. Accumulated into a per-(run, job)
1089
- * counter that lands in `execution_jobs.log_bytes` and
1090
- * `execution_runs.log_bytes` when the job and run reach terminal state,
1091
- * feeding the operator-side `kici_org_log_bytes` capacity-planning gauge
1092
- * on the Platform.
998
+ * @param logBytesStreamed Raw byte total from the agent's LogStreamer at
999
+ * terminal step time; summed into `execution_jobs.log_bytes` and
1000
+ * `execution_runs.log_bytes`, feeding the Platform's operator-side
1001
+ * `kici_org_log_bytes` capacity-planning gauge.
1093
1002
  */
1094
1003
  onStepStatus(runId: string, jobId: string, stepIndex: number, stepName: string, state: string, timestamp: number, data?: Record<string, unknown>, logBytesStreamed?: number): Promise<void>;
1095
- /**
1096
- * Check if all tracked jobs in a run have reached terminal state.
1097
- */
1004
+ /** Whether every tracked job of the run is terminal. */
1098
1005
  isRunComplete(runId: string): boolean;
1099
1006
  /**
1100
1007
  * Take a token holding a run open while some of its jobs are still to be
1101
- * registered. Returns true when a token was taken, false for an unknown or
1102
- * already-completed run (nothing to hold).
1008
+ * registered. False for an unknown or already-completed run.
1009
+ *
1010
+ * The registration windows: a run whose source-pack `__build__` job goes
1011
+ * first is registered with that job ALONE, its real jobs dispatched after the
1012
+ * build; a run without a build is registered with NO jobs before its dispatch
1013
+ * loop; a deferred init job and a deferred dynamic entry register from a
1014
+ * fire-and-forget task that outlives the dispatch call. Without a token, the
1015
+ * already-registered jobs going terminal satisfy {@link isRunComplete}, so a
1016
+ * terminal status is written, the provider check posted and the status
1017
+ * forwarded — before a single real job has run.
1103
1018
  *
1104
- * Four registration windows need this. A run whose source-pack `__build__`
1105
- * job is dispatched first is registered with that job ALONE, and its real
1106
- * jobs are only dispatched once the build finishes; a run without a build is
1107
- * registered with NO jobs before its dispatch loop, so its jobs land once
1108
- * every dispatch has returned. A deferred init job and a deferred dynamic
1109
- * entry each register their jobs from a fire-and-forget task that outlives
1110
- * the dispatch call. In every case, without a token the already
1111
- * -registered jobs reaching a terminal state satisfies {@link isRunComplete},
1112
- * so the run is finalized early: a terminal run status is written, the
1113
- * provider check is posted, and the status is forwarded to the Platform — all
1114
- * before a single real job has run.
1019
+ * The hold is a counter read only by {@link isRunComplete}, deliberately NOT
1020
+ * a synthetic job-map entry: every outward projection enumerates the job map
1021
+ * (the Platform `state.replay` snapshot and its `execution_jobs` mirror, the
1022
+ * job count, workflow-complete job results, the active-run summary), so a
1023
+ * marker there would be a phantom pending job and an off-by-one count. The
1024
+ * counter writes no `execution_jobs` row either.
1115
1025
  *
1116
- * The hold is a counter on the in-memory run, read only by
1117
- * {@link isRunComplete} — deliberately NOT a synthetic entry in the run's job
1118
- * map. The job map is what every outward projection enumerates (the Platform
1119
- * `state.replay` snapshot and its `execution_jobs` mirror, the reported job
1120
- * count, the workflow-complete job results, the active-run summary), so a
1121
- * marker parked there would surface as a phantom pending job on the dashboard
1122
- * and an off-by-one job count for the length of the window. A counter holds
1123
- * the completion check open without being visible to any of them, and it
1124
- * writes no `execution_jobs` row, so it never surfaces as a phantom job.
1125
1026
  * A token whose holder never settles keeps the run open until the stale
1126
- * detector reaps it — the same backstop that covers a job that never
1127
- * reports. That backstop only reaches a run that has at least one job: every
1128
- * sub-scan of the stale detector starts from `execution_jobs` or
1129
- * `dispatch_queue`. So a holder that registers NO jobs must terminalize the
1130
- * run itself rather than rely on the sweep — which is what
1027
+ * detector reaps it, which reaches only a run with at least one job (every
1028
+ * sub-scan starts from `execution_jobs` or `dispatch_queue`). So a holder that
1029
+ * registers NO jobs must terminalize the run itself, as
1131
1030
  * `dispatchMatchedWorkflow` does when its dispatch loop throws.
1132
1031
  *
1133
1032
  * Each token must be paired with exactly one {@link releasePendingJobsHold}.
1134
1033
  */
1135
1034
  holdRunForPendingJobs(runId: string): boolean;
1136
1035
  /**
1137
- * Record this coordinator as the run's registration-window holder in
1138
- * `execution_runs.registration_window_instance_id` — the token's durable
1139
- * form, which a sibling coordinator finalizing the run consults.
1036
+ * Record this coordinator in `execution_runs.registration_window_instance_id`
1037
+ * — the token's durable form, which a sibling finalizing the run consults.
1140
1038
  *
1141
- * Chained rather than awaited: the caller is synchronous by contract (the
1142
- * token must be counted before the next `await` can drop a sibling token),
1143
- * so the write rides a per-run chain that the clear on the last release
1144
- * awaits. `registrationWindowSettled` exposes the chain to a caller that
1145
- * must know the window is durable before it starts waiting on a job a
1146
- * sibling may finish. A coordinator with no instance id holds no durable
1147
- * window.
1039
+ * Chained, not awaited: the caller is synchronous by contract (the token must
1040
+ * be counted before the next `await` can drop a sibling token), and the clear
1041
+ * on the last release awaits the chain. `registrationWindowSettled` exposes
1042
+ * it to a caller that needs the window durable before waiting on a job a
1043
+ * sibling may finish. No instance id, no durable window.
1148
1044
  */
1149
1045
  private openRegistrationWindow;
1150
1046
  /**
@@ -1159,108 +1055,78 @@ export declare class ExecutionTracker {
1159
1055
  * Drop one token taken by {@link holdRunForPendingJobs}, and finalize the run
1160
1056
  * if dropping the LAST one left every remaining job terminal.
1161
1057
  *
1162
- * The re-evaluation matters for the same reason it does in `addJobsToRun`:
1163
- * once the last token is gone nothing else drives a completion check (no
1164
- * further `job.status` messages are coming for already-finished jobs), so a
1165
- * run whose jobs all finished while a token was held would otherwise hang in
1166
- * `running` forever. Only the last release may finalize — while any other
1167
- * token is outstanding more jobs are still on their way.
1058
+ * As in `addJobsToRun`, nothing else drives a completion check once the last
1059
+ * token is gone, so a run whose jobs all finished meanwhile would hang in
1060
+ * `running` forever. Only the last release may finalize: while another token
1061
+ * is outstanding, more jobs are on their way.
1168
1062
  *
1169
- * Idempotent — a no-op when no token is outstanding. The count clamps at
1170
- * zero so a stray extra release cannot drive it negative, which would
1171
- * permanently un-hold the run and stop a genuinely outstanding token from
1172
- * holding it open.
1063
+ * Idempotent: a no-op with no token outstanding. The count clamps at zero, so
1064
+ * a stray extra release cannot go negative and stop a genuinely outstanding
1065
+ * token from holding the run open.
1173
1066
  */
1174
1067
  releasePendingJobsHold(runId: string): Promise<void>;
1175
- /**
1176
- * Get the current overall status of a run.
1177
- */
1178
1068
  getRunStatus(runId: string): Extract<ExecutionRunStatus, 'running' | 'success' | 'failed' | 'cancelled'>;
1179
- /**
1180
- * Look up a job name from in-memory state.
1181
- * Used by LogWriter to construct log paths.
1182
- */
1069
+ /** In-memory job name lookup, used by LogWriter for log paths. */
1183
1070
  getJobName(runId: string, jobId: string): string | undefined;
1184
1071
  /**
1185
- * Resolve the job name that names a step-log storage path, with a durable
1186
- * fallback. The step-log path is `executions/{runId}/job-{jobName}/…` and it
1187
- * is written from two sites — the chunk writer (`log-chunk-sink`) and the
1188
- * `execution_steps.log_path` upsert in `onStepStatus`. A purely in-memory
1189
- * lookup (`getJobName`) returns `undefined` during the brief window between
1190
- * dispatch and `addJobsToRun` populating `run.jobs`, so an early chunk would
1191
- * land under `job-{jobId}` while the reader later keys on `job-{realName}` —
1192
- * silently losing those lines. Both write sites go through this resolver so
1193
- * they cannot disagree: in-memory first, then the authoritative
1194
- * `dispatch_queue.job_name` (the same source `recoverJobFromDispatchQueue`
1195
- * trusts), and only `jobId` when the job is genuinely unknown.
1072
+ * Resolve the job name in a step-log storage path
1073
+ * (`executions/{runId}/job-{jobName}/…`), with a durable fallback. Both
1074
+ * writers — the chunk writer (`log-chunk-sink`) and the
1075
+ * `execution_steps.log_path` upsert in `onStepStatus` — use this, so they
1076
+ * cannot disagree. `getJobName` is `undefined` between dispatch and
1077
+ * `addJobsToRun`, which would put an early chunk under `job-{jobId}` while the
1078
+ * reader keys on `job-{realName}`, silently losing lines. Order: in-memory,
1079
+ * then `dispatch_queue.job_name` (as `recoverJobFromDispatchQueue` trusts),
1080
+ * then `jobId` for a genuinely unknown job.
1196
1081
  */
1197
1082
  resolveJobName(runId: string, jobId: string): Promise<string>;
1198
1083
  /**
1199
- * Seed the in-memory job name for a job the coordinator did not itself
1200
- * dispatch — a worker-rerouted job. Such a job is tracked in the cluster
1201
- * coordinator's own map, never enters this tracker's `run.jobs` via
1202
- * `addJobsToRun`, and has no coordinator-owned `dispatch_queue` row (the
1203
- * worker owns it under a fresh id), so `resolveJobName` would fall back to
1204
- * the bare `jobId` for its early log chunks while the reader keys on the real
1205
- * name — the same split-brain that loses lines. Seeding the name here, at
1206
- * reroute time, makes `resolveJobName`'s fast path correct from the first
1207
- * relayed chunk, independent of when the worker's `dispatch_queue` row becomes
1208
- * visible. In-memory only: the `execution_jobs` row is still created lazily by
1209
- * the worker's first status update. Guarded against clobbering an existing
1210
- * entry so a later terminal status is never overwritten.
1084
+ * Seed the in-memory job name of a worker-rerouted job at reroute time. It
1085
+ * never enters `run.jobs` via `addJobsToRun` and has no coordinator-owned
1086
+ * `dispatch_queue` row (the worker owns it under a fresh id), so
1087
+ * `resolveJobName` would fall back to the bare `jobId` for early log chunks
1088
+ * while the reader keys on the real name, losing lines. In-memory only: the
1089
+ * worker's first status update creates the `execution_jobs` row. An existing
1090
+ * entry is never clobbered, so a later terminal status survives.
1211
1091
  */
1212
1092
  registerJobName(runId: string, jobId: string, jobName: string): void;
1213
1093
  /**
1214
- * Find the runId of the in-memory run that owns a given dispatched jobId.
1215
- *
1216
- * The agent's `event.emit` message is job-scoped (it carries only the
1217
- * emitting jobId), but run context is keyed by runId. This maps job → run so
1218
- * `getExecutionContext(runId)` resolves for an agent-emitted custom event.
1219
- * In-memory only (matches `getExecutionContext`'s semantics); emit happens
1220
- * mid-execution, so the owning run is always live in `this.runs`.
1094
+ * The in-memory run owning a dispatched jobId, so `getExecutionContext`
1095
+ * resolves for a job-scoped agent `event.emit`. In-memory only, like
1096
+ * `getExecutionContext`: emit happens mid-execution, so the run is live.
1221
1097
  */
1222
1098
  getRunIdForJob(jobId: string): string | undefined;
1223
1099
  /**
1224
- * Get execution context for a run from in-memory state.
1225
- * Used by commit status reporting to access provider/repo/sha info.
1100
+ * In-memory execution context of a run, for commit status reporting.
1226
1101
  */
1227
1102
  getExecutionContext(runId: string): ExecutionContext | undefined;
1228
1103
  /**
1229
1104
  * Stamp the run's resolved trust tier and lock-file branch onto the in-memory
1230
1105
  * state, after `onExecutionStarted` recorded the row.
1231
1106
  *
1232
- * Separate from the start call because trust resolves on its own path and is
1233
- * written to `execution_runs` by its own update. The dispatch site that
1234
- * writes those two columns calls this with the same values, but the two
1235
- * writes are independent and either can be lost: the DB update is
1236
- * fire-and-forget with its own `.catch()`, and this call is wrapped in a
1237
- * `try`/`catch` there. Both are deliberate — the note is worth less than the
1238
- * run — so the in-memory copy and the row CAN disagree, and neither is
1239
- * authoritative for the other. `recoverRunFromDb` reconciles by reading the
1240
- * row, so the durable value is the one that survives.
1107
+ * Trust resolves on its own path with its own `execution_runs` update. The
1108
+ * dispatch site calls this with the same values, but either write can be
1109
+ * lost (the DB update is fire-and-forget with its own `.catch()`, and this
1110
+ * call sits in a `try`/`catch`) — deliberately, as the note is worth less
1111
+ * than the run. So memory and the row CAN disagree; `recoverRunFromDb` reads
1112
+ * the row, so the durable value survives.
1241
1113
  *
1242
- * A run this tracker does not know is a no-op: a missing run means the status
1243
- * updates that would read the fields are not coming either.
1114
+ * An unknown run is a no-op: the status updates that would read the fields
1115
+ * are not coming either.
1244
1116
  *
1245
- * Keep this synchronous. Each caller wraps it in `try`/`catch`, which catches
1246
- * a throw but not a rejected promise, so an async body would put the failure
1247
- * back outside the guard.
1117
+ * Keep this synchronous: callers' `try`/`catch` catches a throw, not a
1118
+ * rejected promise.
1248
1119
  */
1249
1120
  setRunTrustContext(runId: string, trustTier: string, lockFileSource?: string): void;
1250
1121
  /**
1251
- * Update the heartbeat timestamp for a running job.
1252
- *
1253
- * Uses optimistic WHERE status='running' so completed jobs are not updated.
1254
- * Called when the agent sends a job.heartbeat message.
1122
+ * Stamp a running job's heartbeat on an agent job.heartbeat; the
1123
+ * status='running' predicate leaves completed jobs alone.
1255
1124
  */
1256
1125
  updateJobHeartbeat(runId: string, jobId: string): Promise<void>;
1257
- /**
1258
- * Get the count of active (non-completed) runs in memory.
1259
- */
1126
+ /** Count of non-completed runs in memory. */
1260
1127
  getActiveRunCount(): number;
1261
1128
  /**
1262
- * Get a summary of all active runs for the cluster health API.
1263
- * Returns run ID, workflow name, status, and job routing counts.
1129
+ * Summary of active runs (with job counts) for the cluster health API.
1264
1130
  */
1265
1131
  getActiveRuns(): Array<{
1266
1132
  runId: string;
@@ -1274,9 +1140,9 @@ export declare class ExecutionTracker {
1274
1140
  };
1275
1141
  }>;
1276
1142
  /**
1277
- * Get replay data for all in-memory runs (both active and recently completed).
1278
- * Used to send a state.replay message to Platform on reconnection so the Platform
1279
- * can reconcile its execution_runs and execution_jobs projection tables.
1143
+ * Replay data for every in-memory run (active and recently completed), sent
1144
+ * as state.replay on reconnection so the Platform reconciles its
1145
+ * execution_runs and execution_jobs projections.
1280
1146
  */
1281
1147
  getReplayData(): Array<{
1282
1148
  runId: string;
@@ -1312,38 +1178,31 @@ export declare class ExecutionTracker {
1312
1178
  /**
1313
1179
  * Replay data merged with terminal runs read from the orchestrator's local DB.
1314
1180
  *
1315
- * `getReplayData()` only sees runs still in memory. After an orchestrator
1316
- * crash/restart, in-memory state is empty until new webhooks arrive — but
1317
- * any run that completed before the crash still lives in `execution_runs`
1318
- * on disk. Without re-emitting those, Platform's mirror table (and the
1319
- * `kici_org_executions_count` operator-aggregate gauge) silently undercounts.
1181
+ * After a crash/restart memory is empty, but runs completed before it are
1182
+ * still in `execution_runs`; without re-emitting them the Platform mirror
1183
+ * (and the `kici_org_executions_count` operator-aggregate gauge) silently
1184
+ * undercounts.
1320
1185
  *
1321
- * This wrapper fills that gap: it returns the in-memory replay items first,
1322
- * then unions in any terminal-state runs from the local DB completed within
1323
- * `windowHours` (default 24h) that aren't already covered. Order is preserved
1324
- * for in-memory entries (callers may rely on that for active-run metadata);
1325
- * DB-backed entries are appended in `completed_at ASC` order.
1186
+ * Returns the in-memory items first, in order (callers may rely on it for
1187
+ * active-run metadata), then appends uncovered terminal DB runs completed
1188
+ * within `windowHours` (default 24h), in `completed_at ASC` order.
1326
1189
  *
1327
- * Idempotent: Platform's `state.replay` handler upserts on `run_id`, so
1328
- * re-emitting an already-mirrored run is a no-op for billing and dashboard
1329
- * state alike.
1190
+ * Idempotent: the Platform's `state.replay` handler upserts on `run_id`, so
1191
+ * re-emitting a mirrored run is a no-op for billing and dashboard state.
1330
1192
  */
1331
1193
  getReplayDataWithDb(windowHours?: number): Promise<ReturnType<ExecutionTracker['getReplayData']>>;
1332
1194
  /**
1333
- * Update a job's in-memory status without touching the DB.
1334
- * Used by StaleRunDetector which does direct DB updates and only needs
1335
- * the in-memory state kept in sync for run completion detection.
1195
+ * Update a job's in-memory status only, for StaleRunDetector, which writes
1196
+ * the DB itself and needs memory in sync for completion detection.
1336
1197
  */
1337
1198
  updateInMemoryJob(runId: string, jobId: string, status: string): void;
1338
1199
  /**
1339
- * Forward a terminal job status to Platform via the onJobStatusChange callback.
1340
- * Used by StaleRunDetector and OrphanRecovery which update the DB directly
1341
- * but need to notify Platform so its execution_jobs projection stays in sync.
1200
+ * Forward a terminal job status to the Platform's execution_jobs projection,
1201
+ * for StaleRunDetector and OrphanRecovery, which write the DB directly.
1342
1202
  */
1343
1203
  forwardJobTerminalStatus(runId: string, jobId: string, jobName: string, status: string, errorMessage?: string): void;
1344
1204
  /**
1345
- * Emit a run.event message via the onRunEventEmit callback.
1346
- * Public wrapper for use by StaleRunDetector and OrphanRecovery.
1205
+ * Public run.event emitter for StaleRunDetector and OrphanRecovery.
1347
1206
  */
1348
1207
  emitInfraEvent(runId: string, eventType: string, opts?: {
1349
1208
  jobId?: string;
@@ -1351,95 +1210,71 @@ export declare class ExecutionTracker {
1351
1210
  durationMs?: number;
1352
1211
  }): void;
1353
1212
  /**
1354
- * Cancel all non-terminal steps for a job.
1355
- *
1356
- * When a job is terminated by infrastructure (stale detection, orphan recovery,
1357
- * recovery timeout), any in-progress steps remain with status='running' in the DB.
1358
- * This method marks them as 'cancelled' so the dashboard doesn't show stale
1359
- * running indicators for steps that are no longer executing.
1213
+ * Cancel a job's non-terminal steps after infrastructure terminated it (stale
1214
+ * detection, orphan recovery, recovery timeout), so the dashboard shows no
1215
+ * stale running steps.
1360
1216
  */
1361
1217
  cancelStepsForJob(runId: string, jobId: string, reason: string): Promise<void>;
1362
1218
  /**
1363
- * Check if all jobs for a run are terminal, and if so, complete the run.
1364
- * Works with in-memory state (normal operation) or falls back to DB query
1365
- * (crash recovery / pruned runs). Called by StaleRunDetector after marking
1366
- * stale jobs.
1219
+ * Complete the run when every job is terminal, from memory or else from the
1220
+ * DB (crash recovery / pruned runs). Called by StaleRunDetector after
1221
+ * marking stale jobs.
1367
1222
  */
1368
1223
  completeRunIfAllJobsTerminal(runId: string): Promise<void>;
1369
1224
  /**
1370
- * Path A helper: complete a run using in-memory state. Called by the
1371
- * stale detector when memRun is still tracked locally — writes the
1372
- * execution_runs terminal row, fires Platform-forwarding +
1373
- * workflow-complete callbacks, and schedules in-memory pruning.
1225
+ * Path A helper: complete a locally tracked run from memory — terminal row,
1226
+ * Platform-forwarding and workflow-complete callbacks, pruning.
1374
1227
  *
1375
- * The terminal write is clobber-guarded. If the guard rejects it (the run
1376
- * already finished through the normal path), only the pruning happens: the
1377
- * recomputed status is not this orchestrator's record of the run, so neither
1378
- * the callbacks nor the completion metrics may claim it.
1228
+ * The terminal write is clobber-guarded. On rejection (the run finished on
1229
+ * the normal path) only pruning happens: the recomputed status is not this
1230
+ * orchestrator's record, so no callback or metric may claim it.
1379
1231
  */
1380
1232
  private completeRunFromMemoryState;
1381
1233
  /**
1382
1234
  * Drop the in-memory state of every run another writer already finished.
1383
1235
  *
1384
- * A coordinator finalizes a run — and schedules its own prune — only when it
1385
- * sees the run's last job finish. In a cluster the last job's frames may go
1386
- * to a sibling, which finalizes the run and prunes ITS state; this
1387
- * coordinator's copy has no later trigger and, without this sweep, stays in
1388
- * memory for the life of the process, one `RunState` per cross-coordinator
1389
- * run. The stale detector calls this on every tick. One query over the
1390
- * non-finished runs held here; a run whose row is terminal is released the
1391
- * way the finalizing path releases its own, minus the completion events and
1392
- * the row write, which the finalizer already did.
1236
+ * A coordinator prunes a run only when it sees the last job finish. In a
1237
+ * cluster a sibling may see it instead, leaving this copy in memory for the
1238
+ * process lifetime (one `RunState` per cross-coordinator run). The stale
1239
+ * detector calls this every tick; a run whose row is terminal is released
1240
+ * like the finalizer's own, minus the completion events and row write.
1393
1241
  *
1394
- * A run this coordinator legitimately still holds — its row non-terminal,
1395
- * with or without an open registration window — is not touched.
1242
+ * A run whose row is non-terminal (with or without an open registration
1243
+ * window) is not touched.
1396
1244
  */
1397
1245
  pruneRunsFinishedElsewhere(): Promise<number>;
1398
1246
  /**
1399
- * Treat a run whose row another writer finished as finished here too:
1400
- * mark it complete so no completion path re-enters it, shed the per-run
1401
- * state the terminal callback sheds, and schedule the prune. Emits no
1402
- * completion event and writes no row. Returns false when the run is not
1403
- * held here or is already finishing.
1247
+ * Finish here a run another writer finished: mark it complete so no
1248
+ * completion path re-enters it, shed its terminal-callback state, schedule
1249
+ * the prune. No event, no row write. False when not held or already
1250
+ * finishing.
1404
1251
  */
1405
1252
  private releaseRunFinishedElsewhere;
1406
1253
  /**
1407
1254
  * Drop a finished run's in-memory state after a grace period, so a late
1408
1255
  * status/heartbeat arriving just after completion still finds its run.
1409
1256
  *
1410
- * This is the single owner of run-lifetime state teardown, so every
1411
- * run-lifetime map is cleared here — including `testRunIds`: a run finished by
1412
- * the stale detector rather than the normal completion path would otherwise
1413
- * leave its observer-broadcast marker behind for the process's lifetime.
1414
- * (`runLockTails` is deliberately not touched: it is keyed by runId but scoped
1415
- * to a lock's holders, and `withRunLock` drops its own entry on release.)
1257
+ * The single owner of run-lifetime teardown, so every run-lifetime map is
1258
+ * cleared here — `testRunIds` too, or a stale-detector-finished run leaks its
1259
+ * observer marker. (`runLockTails` is deliberately skipped: scoped to a
1260
+ * lock's holders, `withRunLock` drops its own entry on release.)
1416
1261
  */
1417
1262
  private scheduleRunPrune;
1418
1263
  /**
1419
- * Path B helper: complete a run using DB rows only (crash recovery /
1420
- * pruned runs). Loads jobs + run row from execution_jobs/execution_runs,
1421
- * checks the all-terminal predicate + run-state guard, then writes the
1422
- * terminal row and fires Platform-forwarding callbacks.
1264
+ * Path B helper: complete a run from DB rows only (crash recovery / pruned
1265
+ * runs) — all-terminal predicate, run-state guard, terminal row,
1266
+ * Platform-forwarding callbacks.
1423
1267
  *
1424
- * The run-state read and the terminal write are separate statements, so the
1425
- * write carries its own clobber guard. If that guard rejects it — a
1426
- * concurrent normal completion landed in between — the callbacks and the
1427
- * completion metrics are suppressed with it.
1268
+ * The run-state read and the write are separate statements, so the write has
1269
+ * its own clobber guard; when a concurrent normal completion lands between
1270
+ * them, callbacks and metrics are suppressed too.
1428
1271
  */
1429
1272
  private completeRunFromDbFallback;
1430
- /**
1431
- * Emit a run.event message to Platform via the onRunEventEmit callback.
1432
- * Called at orchestrator lifecycle points for infrastructure event tracking.
1433
- */
1273
+ /** Emit a run.event to the Platform at an orchestrator lifecycle point. */
1434
1274
  private emitRunEvent;
1435
1275
  /**
1436
- * Emit a scaler lifecycle event for a job.
1437
- * Stores the event in the event_log table via the existing run.event pipeline
1438
- * and writes a log line to the provisioning JSONL file.
1439
- *
1440
- * @param runId - The run this event belongs to
1441
- * @param jobId - The job this event belongs to
1442
- * @param event - The scaler event with type, detail, and timestamp
1276
+ * Emit a job's scaler lifecycle event: stored in event_log via the run.event
1277
+ * pipeline and written to the provisioning JSONL file.
1443
1278
  */
1444
1279
  emitScalerEvent(runId: string, jobId: string, event: {
1445
1280
  agentId: string;
@@ -1448,34 +1283,29 @@ export declare class ExecutionTracker {
1448
1283
  timestampMs: number;
1449
1284
  }): void;
1450
1285
  /**
1451
- * Append a line to a per-job orchestration log file via LogStorage.
1452
- * Log format is JSONL for structured parsing on the frontend.
1453
- * Path convention: executions/{runId}/jobs/{jobId}/orchestration.jsonl
1286
+ * Append a JSONL line to a job's orchestration log
1287
+ * (executions/{runId}/jobs/{jobId}/orchestration.jsonl).
1454
1288
  */
1455
1289
  private writeOrchLog;
1456
1290
  /**
1457
- * Build a human-readable description for a completed run.
1458
- * Lists failed job names for non-success outcomes.
1291
+ * Human-readable description of a non-success run (its failed job names).
1459
1292
  */
1460
1293
  private buildRunDescription;
1461
1294
  /**
1462
- * Compute the overall run status from job statuses.
1463
- *
1464
- * Per locked decision:
1295
+ * Overall run status from job statuses:
1465
1296
  * - success ONLY if ALL jobs pass (skipped jobs count as success)
1466
1297
  * - failed if ANY job ended in a failure status (see `STATUS_FAILURE_CLASS`)
1467
1298
  * - cancelled if ANY job cancelled (and none failed)
1468
1299
  */
1469
1300
  private computeRunStatus;
1470
1301
  /**
1471
- * Derive the failure class from a terminal run's job statuses. Null for
1302
+ * Derive the failure class from a terminal run's job statuses; null for
1472
1303
  * success (and any non-terminal status). `timed_out_stale` / `drift_dropped`
1473
- * / `unroutable` jobs — a job that never dispatched, whose `runsOn` matched no
1474
- * agent, whose agent went silent, or that was dropped by a topology reroute —
1475
- * are infra-class and collapse to `timed_out`; any other `failed` run is a
1476
- * `step_failure` (a job actually ran and failed). `never_started` (init
1477
- * failure) and `dead_orchestrator` (Platform-detected) are stamped by their
1478
- * own paths, not here.
1304
+ * / `unroutable` jobs (never dispatched, `runsOn` matched no agent, agent went
1305
+ * silent, or dropped by a topology reroute) are infra-class and collapse to
1306
+ * `timed_out`; any other `failed` run is a `step_failure`. `never_started`
1307
+ * (init failure) and `dead_orchestrator` (Platform-detected) are stamped by
1308
+ * their own paths.
1479
1309
  */
1480
1310
  private computeFailureClass;
1481
1311
  }