@telora/daemon 0.21.134 → 0.21.144

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 (268) hide show
  1. package/build-info.json +2 -2
  2. package/dist/audit/audit-hooks.d.ts +15 -6
  3. package/dist/audit/audit-hooks.d.ts.map +1 -1
  4. package/dist/audit/audit-hooks.js +56 -28
  5. package/dist/audit/audit-hooks.js.map +1 -1
  6. package/dist/ci/ci-escalation.js +1 -1
  7. package/dist/ci/ci-escalation.js.map +1 -1
  8. package/dist/ci/ci-sensor-loop.d.ts +24 -0
  9. package/dist/ci/ci-sensor-loop.d.ts.map +1 -1
  10. package/dist/ci/ci-sensor-loop.js +35 -9
  11. package/dist/ci/ci-sensor-loop.js.map +1 -1
  12. package/dist/cli/connect/config-write.d.ts +87 -0
  13. package/dist/cli/connect/config-write.d.ts.map +1 -0
  14. package/dist/cli/connect/config-write.js +255 -0
  15. package/dist/cli/connect/config-write.js.map +1 -0
  16. package/dist/cli/connect/registration.d.ts +76 -0
  17. package/dist/cli/connect/registration.d.ts.map +1 -0
  18. package/dist/cli/connect/registration.js +207 -0
  19. package/dist/cli/connect/registration.js.map +1 -0
  20. package/dist/cli/connect.d.ts +3 -141
  21. package/dist/cli/connect.d.ts.map +1 -1
  22. package/dist/cli/connect.js +9 -441
  23. package/dist/cli/connect.js.map +1 -1
  24. package/dist/completion/coverage-stabilized.d.ts +1 -1
  25. package/dist/completion/coverage-stabilized.d.ts.map +1 -1
  26. package/dist/completion/coverage-stabilized.js +1 -1
  27. package/dist/completion/coverage-stabilized.js.map +1 -1
  28. package/dist/completion/escalation-provenance.d.ts +2 -1
  29. package/dist/completion/escalation-provenance.d.ts.map +1 -1
  30. package/dist/completion/escalation-provenance.js +2 -1
  31. package/dist/completion/escalation-provenance.js.map +1 -1
  32. package/dist/completion/escalations.js +1 -1
  33. package/dist/completion/escalations.js.map +1 -1
  34. package/dist/completion/event-escalations.d.ts +1 -1
  35. package/dist/completion/event-escalations.d.ts.map +1 -1
  36. package/dist/completion/event-escalations.js +1 -1
  37. package/dist/completion/event-escalations.js.map +1 -1
  38. package/dist/completion/event.d.ts +1 -1
  39. package/dist/completion/event.d.ts.map +1 -1
  40. package/dist/completion/event.js +2 -2
  41. package/dist/completion/event.js.map +1 -1
  42. package/dist/completion/machine-remediable-demotion.d.ts +1 -1
  43. package/dist/completion/machine-remediable-demotion.d.ts.map +1 -1
  44. package/dist/completion/machine-remediable-demotion.js +2 -1
  45. package/dist/completion/machine-remediable-demotion.js.map +1 -1
  46. package/dist/completion/read-only-pristine.d.ts +1 -1
  47. package/dist/completion/read-only-pristine.d.ts.map +1 -1
  48. package/dist/completion/read-only-pristine.js +1 -1
  49. package/dist/completion/read-only-pristine.js.map +1 -1
  50. package/dist/completion/review-exit-escalations.d.ts +1 -1
  51. package/dist/completion/review-exit-escalations.d.ts.map +1 -1
  52. package/dist/completion/review-exit-phase.d.ts +5 -2
  53. package/dist/completion/review-exit-phase.d.ts.map +1 -1
  54. package/dist/completion/review-exit-phase.js +5 -2
  55. package/dist/completion/review-exit-phase.js.map +1 -1
  56. package/dist/completion/state-cascade.js +1 -1
  57. package/dist/completion/state-cascade.js.map +1 -1
  58. package/dist/completion/status-advance-phase.d.ts.map +1 -1
  59. package/dist/completion/status-advance-phase.js +2 -1
  60. package/dist/completion/status-advance-phase.js.map +1 -1
  61. package/dist/completion/team-lifecycle.d.ts.map +1 -1
  62. package/dist/completion/team-lifecycle.js +2 -1
  63. package/dist/completion/team-lifecycle.js.map +1 -1
  64. package/dist/delivery/delivery-advance-block.d.ts +1 -1
  65. package/dist/delivery/delivery-advance-block.d.ts.map +1 -1
  66. package/dist/delivery/delivery-advance-block.js +1 -1
  67. package/dist/delivery/delivery-advance-block.js.map +1 -1
  68. package/dist/delivery/delivery-lifecycle.js +1 -1
  69. package/dist/delivery/delivery-lifecycle.js.map +1 -1
  70. package/dist/delivery/delivery-merge-ops.js +1 -1
  71. package/dist/delivery/delivery-merge-ops.js.map +1 -1
  72. package/dist/delivery/delivery-reconciler-shadow.d.ts +1 -1
  73. package/dist/delivery/delivery-reconciler-shadow.d.ts.map +1 -1
  74. package/dist/delivery/delivery-reconciler-shadow.js +1 -1
  75. package/dist/delivery/delivery-reconciler-shadow.js.map +1 -1
  76. package/dist/delivery/operator-hold.d.ts +1 -1
  77. package/dist/delivery/operator-hold.d.ts.map +1 -1
  78. package/dist/delivery/paused-revival.d.ts.map +1 -1
  79. package/dist/delivery/paused-revival.js +2 -1
  80. package/dist/delivery/paused-revival.js.map +1 -1
  81. package/dist/directive/directive-dispatch.d.ts +1 -1
  82. package/dist/directive/directive-dispatch.d.ts.map +1 -1
  83. package/dist/directive/directive-dispatch.js +1 -1
  84. package/dist/directive/directive-dispatch.js.map +1 -1
  85. package/dist/directive/directive-executor.js +1 -1
  86. package/dist/directive/directive-executor.js.map +1 -1
  87. package/dist/drift/staleness-sensor.js +1 -1
  88. package/dist/drift/staleness-sensor.js.map +1 -1
  89. package/dist/focus/focus-engine.js +3 -2
  90. package/dist/focus/focus-engine.js.map +1 -1
  91. package/dist/focus/focus-lifecycle.d.ts.map +1 -1
  92. package/dist/focus/focus-lifecycle.js +2 -1
  93. package/dist/focus/focus-lifecycle.js.map +1 -1
  94. package/dist/focus/focus-respawn-guard.d.ts +1 -1
  95. package/dist/focus/focus-respawn-guard.d.ts.map +1 -1
  96. package/dist/focus/focus-respawn-guard.js +1 -1
  97. package/dist/focus/focus-respawn-guard.js.map +1 -1
  98. package/dist/focus/listener-auto-advance.d.ts +4 -45
  99. package/dist/focus/listener-auto-advance.d.ts.map +1 -1
  100. package/dist/focus/listener-auto-advance.js +5 -238
  101. package/dist/focus/listener-auto-advance.js.map +1 -1
  102. package/dist/focus/listener-spawn.d.ts +62 -0
  103. package/dist/focus/listener-spawn.d.ts.map +1 -0
  104. package/dist/focus/listener-spawn.js +418 -0
  105. package/dist/focus/listener-spawn.js.map +1 -0
  106. package/dist/focus/listener-state.d.ts +57 -0
  107. package/dist/focus/listener-state.d.ts.map +1 -0
  108. package/dist/focus/listener-state.js +63 -0
  109. package/dist/focus/listener-state.js.map +1 -0
  110. package/dist/focus/listener.d.ts +0 -58
  111. package/dist/focus/listener.d.ts.map +1 -1
  112. package/dist/focus/listener.js +25 -453
  113. package/dist/focus/listener.js.map +1 -1
  114. package/dist/focus/verify-open-issues.d.ts +62 -0
  115. package/dist/focus/verify-open-issues.d.ts.map +1 -0
  116. package/dist/focus/verify-open-issues.js +265 -0
  117. package/dist/focus/verify-open-issues.js.map +1 -0
  118. package/dist/focus-stage-lifecycle/index.d.ts +1 -1
  119. package/dist/focus-stage-lifecycle/index.d.ts.map +1 -1
  120. package/dist/focus-stage-lifecycle/index.js +1 -1
  121. package/dist/focus-stage-lifecycle/index.js.map +1 -1
  122. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts +1 -1
  123. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -1
  124. package/dist/focus-stage-lifecycle/wedge-watchdog.js +1 -1
  125. package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -1
  126. package/dist/git/index.d.ts +2 -0
  127. package/dist/git/index.d.ts.map +1 -1
  128. package/dist/git/index.js +2 -0
  129. package/dist/git/index.js.map +1 -1
  130. package/dist/git/merge-strategies.d.ts +80 -0
  131. package/dist/git/merge-strategies.d.ts.map +1 -0
  132. package/dist/git/merge-strategies.js +218 -0
  133. package/dist/git/merge-strategies.js.map +1 -0
  134. package/dist/git/merge-to-main.d.ts +76 -0
  135. package/dist/git/merge-to-main.d.ts.map +1 -0
  136. package/dist/git/merge-to-main.js +256 -0
  137. package/dist/git/merge-to-main.js.map +1 -0
  138. package/dist/git/merge.d.ts +27 -81
  139. package/dist/git/merge.d.ts.map +1 -1
  140. package/dist/git/merge.js +4 -448
  141. package/dist/git/merge.js.map +1 -1
  142. package/dist/git/state-detector.js +1 -1
  143. package/dist/git/state-detector.js.map +1 -1
  144. package/dist/loops/engine.js +1 -1
  145. package/dist/loops/engine.js.map +1 -1
  146. package/dist/merge/focus-merge.d.ts +1 -1
  147. package/dist/merge/focus-merge.d.ts.map +1 -1
  148. package/dist/merge/focus-merge.js +1 -1
  149. package/dist/merge/focus-merge.js.map +1 -1
  150. package/dist/merge/merge-back-loop.d.ts +1 -1
  151. package/dist/merge/merge-back-loop.d.ts.map +1 -1
  152. package/dist/merge/merge-back-loop.js +2 -2
  153. package/dist/merge/merge-back-loop.js.map +1 -1
  154. package/dist/merge/merge-detector.js +1 -1
  155. package/dist/merge/merge-detector.js.map +1 -1
  156. package/dist/nexus/return.js +1 -1
  157. package/dist/nexus/return.js.map +1 -1
  158. package/dist/prd/controller-shared.d.ts +223 -0
  159. package/dist/prd/controller-shared.d.ts.map +1 -0
  160. package/dist/prd/controller-shared.js +77 -0
  161. package/dist/prd/controller-shared.js.map +1 -0
  162. package/dist/prd/controller.d.ts +5 -256
  163. package/dist/prd/controller.d.ts.map +1 -1
  164. package/dist/prd/controller.js +9 -166
  165. package/dist/prd/controller.js.map +1 -1
  166. package/dist/prd/done-sweep.d.ts +55 -0
  167. package/dist/prd/done-sweep.d.ts.map +1 -0
  168. package/dist/prd/done-sweep.js +112 -0
  169. package/dist/prd/done-sweep.js.map +1 -0
  170. package/dist/prompt-sections/execution-sections.d.ts +1 -1
  171. package/dist/prompt-sections/execution-sections.d.ts.map +1 -1
  172. package/dist/prompt-sections/execution-sections.js +12 -2
  173. package/dist/prompt-sections/execution-sections.js.map +1 -1
  174. package/dist/prompt-sections/shared.d.ts +1 -1
  175. package/dist/prompt-sections/shared.d.ts.map +1 -1
  176. package/dist/queries/agent-resolvable-promotion.d.ts +1 -1
  177. package/dist/queries/agent-resolvable-promotion.d.ts.map +1 -1
  178. package/dist/queries/agent-resolvable-promotion.js +2 -1
  179. package/dist/queries/agent-resolvable-promotion.js.map +1 -1
  180. package/dist/queries/deliveries.d.ts +0 -195
  181. package/dist/queries/deliveries.d.ts.map +1 -1
  182. package/dist/queries/deliveries.js +1 -83
  183. package/dist/queries/deliveries.js.map +1 -1
  184. package/dist/queries/escalation-consumption.d.ts +120 -0
  185. package/dist/queries/escalation-consumption.d.ts.map +1 -0
  186. package/dist/queries/escalation-consumption.js +143 -0
  187. package/dist/queries/escalation-consumption.js.map +1 -0
  188. package/dist/queries/escalation-dispositions.d.ts +19 -0
  189. package/dist/queries/escalation-dispositions.d.ts.map +1 -0
  190. package/dist/queries/escalation-dispositions.js +18 -0
  191. package/dist/queries/escalation-dispositions.js.map +1 -0
  192. package/dist/queries/escalation-suppression.d.ts +1 -1
  193. package/dist/queries/escalation-suppression.d.ts.map +1 -1
  194. package/dist/queries/escalation-suppression.js +1 -1
  195. package/dist/queries/escalation-suppression.js.map +1 -1
  196. package/dist/queries/escalations.d.ts +343 -0
  197. package/dist/queries/escalations.d.ts.map +1 -0
  198. package/dist/queries/escalations.js +493 -0
  199. package/dist/queries/escalations.js.map +1 -0
  200. package/dist/queries/focus-discovery.d.ts +204 -0
  201. package/dist/queries/focus-discovery.d.ts.map +1 -0
  202. package/dist/queries/focus-discovery.js +92 -0
  203. package/dist/queries/focus-discovery.js.map +1 -0
  204. package/dist/queries/index.d.ts +4 -2
  205. package/dist/queries/index.d.ts.map +1 -1
  206. package/dist/queries/index.js +4 -2
  207. package/dist/queries/index.js.map +1 -1
  208. package/dist/queries/issues.d.ts +8 -436
  209. package/dist/queries/issues.d.ts.map +1 -1
  210. package/dist/queries/issues.js +7 -615
  211. package/dist/queries/issues.js.map +1 -1
  212. package/dist/resolvers/agent-escalations.d.ts +20 -0
  213. package/dist/resolvers/agent-escalations.d.ts.map +1 -1
  214. package/dist/resolvers/agent-escalations.js +40 -10
  215. package/dist/resolvers/agent-escalations.js.map +1 -1
  216. package/dist/resolvers/index.d.ts +2 -2
  217. package/dist/resolvers/index.d.ts.map +1 -1
  218. package/dist/resolvers/index.js +1 -1
  219. package/dist/resolvers/index.js.map +1 -1
  220. package/dist/resolvers/shared/git-diff.d.ts +99 -18
  221. package/dist/resolvers/shared/git-diff.d.ts.map +1 -1
  222. package/dist/resolvers/shared/git-diff.js +98 -27
  223. package/dist/resolvers/shared/git-diff.js.map +1 -1
  224. package/dist/shell/control-state.d.ts +1 -1
  225. package/dist/shell/control-state.d.ts.map +1 -1
  226. package/dist/shell/control-state.js +1 -1
  227. package/dist/shell/control-state.js.map +1 -1
  228. package/dist/shell/crash-recovery.d.ts +1 -1
  229. package/dist/shell/crash-recovery.d.ts.map +1 -1
  230. package/dist/shell/crash-recovery.js +2 -2
  231. package/dist/shell/crash-recovery.js.map +1 -1
  232. package/dist/shell/install-probe-tick.d.ts +1 -1
  233. package/dist/shell/install-probe-tick.d.ts.map +1 -1
  234. package/dist/shell/install-probe-tick.js +1 -1
  235. package/dist/shell/install-probe-tick.js.map +1 -1
  236. package/dist/shell/unified-shell.js +1 -1
  237. package/dist/shell/unified-shell.js.map +1 -1
  238. package/dist/spawn/model-routing.d.ts +1 -1
  239. package/dist/spawn/model-routing.d.ts.map +1 -1
  240. package/dist/spawn/model-routing.js +1 -1
  241. package/dist/spawn/model-routing.js.map +1 -1
  242. package/dist/spawn/prompt-assembly.d.ts +1 -1
  243. package/dist/spawn/prompt-assembly.d.ts.map +1 -1
  244. package/dist/spawn/prompt-assembly.js +1 -1
  245. package/dist/spawn/prompt-assembly.js.map +1 -1
  246. package/dist/spawn/spawn-decision.js +1 -1
  247. package/dist/spawn/spawn-decision.js.map +1 -1
  248. package/dist/spawn/worktree-session.d.ts +1 -1
  249. package/dist/spawn/worktree-session.d.ts.map +1 -1
  250. package/dist/spawn/worktree-session.js +1 -1
  251. package/dist/spawn/worktree-session.js.map +1 -1
  252. package/dist/templates/claude-md.d.ts +1 -1
  253. package/dist/templates/claude-md.d.ts.map +1 -1
  254. package/dist/templates/claude-md.js +12 -0
  255. package/dist/templates/claude-md.js.map +1 -1
  256. package/dist/verify/verification-default-on.d.ts +1 -1
  257. package/dist/verify/verification-default-on.d.ts.map +1 -1
  258. package/dist/verify/verification-deps.d.ts +1 -1
  259. package/dist/verify/verification-deps.d.ts.map +1 -1
  260. package/dist/verify/verification-engine.d.ts.map +1 -1
  261. package/dist/verify/verification-engine.js +20 -12
  262. package/dist/verify/verification-engine.js.map +1 -1
  263. package/dist/worktree/provision.js +1 -1
  264. package/dist/worktree/provision.js.map +1 -1
  265. package/dist/worktree/scratch-guard.d.ts.map +1 -1
  266. package/dist/worktree/scratch-guard.js +23 -2
  267. package/dist/worktree/scratch-guard.js.map +1 -1
  268. package/package.json +1 -1
@@ -1,26 +1,14 @@
1
1
  /**
2
- * Issue and escalation queries.
2
+ * Issue CRUD queries.
3
+ *
4
+ * The escalation-query family (creation, open-escalation dedup reads,
5
+ * resolution) moved to queries/escalations.ts + queries/escalation-consumption.ts
6
+ * (file-size limit). Importers reference those modules directly -- this module
7
+ * deliberately does NOT re-export them, per the daemon's
8
+ * import-from-the-defining-module (no-facade) discipline.
3
9
  */
4
10
  import { callApi, callApiValidated } from './shared.js';
5
11
  import { DeliveryIssuesResponseSchema, DeliverySessionCountResponseSchema, IssueCreateResponseSchema, } from './schemas.js';
6
- import { resolveProvenance } from '../completion/escalation-provenance.js';
7
- /**
8
- * Daemon-local literal, TYPE-PINNED to the daemon-core disposition vocabulary.
9
- *
10
- * This module must NOT take a runtime (value) import of `@telora/daemon-core`.
11
- * Under the node:test module-mock loader, a bare `@telora/*` value specifier is
12
- * resolved RELATIVE TO THIS FILE (.../src/queries/@telora/daemon-core) and dies
13
- * with ERR_MODULE_NOT_FOUND -- so every test that registers a mock.module and
14
- * transitively loads this file fails to even start. That is the same quirk that
15
- * keeps src/log.ts daemon-local.
16
- *
17
- * The `Extract<...>` annotation keeps this honest: it stops compiling if the
18
- * value is dropped or renamed in daemon-core, so this is a pinned mirror of the
19
- * vocabulary rather than a redeclaration that can silently drift.
20
- */
21
- const DISPOSITION_AGENT_RESOLVABLE = 'agent_resolvable';
22
- import { createLogger } from '../shell/log.js';
23
- const log = createLogger({ module: 'escalations' });
24
12
  /**
25
13
  * Fetch all issues for a delivery (used by completion guards).
26
14
  */
@@ -53,602 +41,6 @@ export async function updateIssueStatus(issueId, status) {
53
41
  throw err;
54
42
  }
55
43
  }
56
- export async function createEscalation(params, deps = {}) {
57
- const call = deps.callApi ?? callApi;
58
- const resolveProvenanceFn = deps.resolveProvenance ?? resolveProvenance;
59
- const derived = params.anchor ? await resolveProvenanceFn(params.anchor) : {};
60
- const productId = params.productId ?? derived.productId;
61
- const focusId = params.focusId ?? derived.focusId;
62
- const deliveryId = params.deliveryId ?? derived.deliveryId;
63
- const res = await call('escalation_create', {
64
- issueId: params.issueId,
65
- fields: {
66
- reasonType: params.reasonType,
67
- description: params.description,
68
- whatWasTried: params.whatWasTried,
69
- helpNeeded: params.helpNeeded,
70
- ...(params.escalationKind ? { escalationKind: params.escalationKind } : {}),
71
- ...(params.metadata ? { metadata: params.metadata } : {}),
72
- ...(productId ? { productId } : {}),
73
- ...(focusId ? { focusId } : {}),
74
- ...(deliveryId ? { deliveryId } : {}),
75
- ...(params.targetProductId ? { targetProductId: params.targetProductId } : {}),
76
- ...(params.disposition ? { disposition: params.disposition } : {}),
77
- },
78
- });
79
- return { escalationId: res.escalation?.id ?? null };
80
- }
81
- /**
82
- * List open (not-yet-resolved) escalations for the organization.
83
- *
84
- * Returns rows with status in `('pending', 'in_review')` -- both are
85
- * "open" from a dedup perspective. An operator may move a stuck-branch
86
- * escalation to `in_review` while triaging; the merge-back loop must
87
- * still treat it as suppressing duplicates so it does not file a second
88
- * `pending` row for the same branch.
89
- *
90
- * Used by the merge-back loop to detect when a branch already has an
91
- * unresolved merge-conflict escalation, and to find existing stuck-branch
92
- * escalations for dedup / auto-resolution.
93
- */
94
- export async function listPendingEscalations(deps = {}) {
95
- const call = deps.callApi ?? callApi;
96
- const result = await call('escalation_list', { fields: { statuses: ['pending', 'in_review'] } });
97
- return result.escalations.map((e) => ({
98
- id: e.id,
99
- reasonType: e.reasonType,
100
- description: e.description,
101
- whatWasTried: e.whatWasTried ?? null,
102
- helpNeeded: e.helpNeeded ?? null,
103
- escalationKind: e.escalationKind ?? null,
104
- metadata: e.metadata ?? null,
105
- }));
106
- }
107
- /**
108
- * Returns true when an open (status pending or in_review) team_failure
109
- * escalation exists for the given focus.
110
- *
111
- * Used by the focus-executor spawn precondition to prevent respawning a
112
- * team that has already given up on a focus. The escalation row is the
113
- * signal "this focus is not currently workable"; until a human resolves
114
- * it, the daemon should not spend cycles re-deriving the same conclusion.
115
- *
116
- * Dedup matches on the first-class `focus_id` column (stamped via the
117
- * anchor since Delivery B of the Escalation Signal Richness focus). A
118
- * metadata.focusId fallback covers any rows that predate the migration's
119
- * backfill and landed in the deployment window before the daemon restarted.
120
- */
121
- export async function hasOpenTeamFailureEscalation(focusId, deps = {}, opts = {}) {
122
- const call = deps.callApi ?? callApi;
123
- const result = await call('escalation_list', {
124
- fields: {
125
- statuses: ['pending', 'in_review'],
126
- escalationKind: 'team_failure',
127
- focusId,
128
- },
129
- limit: 500,
130
- });
131
- // Primary: column-filtered result. Fallback: metadata.focusId for any rows
132
- // that predate the column backfill (deployment-window back-compat only).
133
- const forThisFocus = (result.escalations ?? []).filter((e) => e.focusId === focusId ||
134
- e.metadata?.focusId === focusId);
135
- // TEL-2: the respawn guard passes excludeAgentResolvable so a MACHINE-owned
136
- // (agent_resolvable) team_failure does NOT gate the spawn -- it is a RECORD the
137
- // incoming team resolves (ridden in by the agent-resolvable transport), not a
138
- // hold. A null / needs_intent / needs_operator disposition still blocks
139
- // (conservative: pre-TEL-1 rows were human-owned). The idempotency callers pass
140
- // no opts, so they still count EVERY open team_failure (no duplicate filings).
141
- return forThisFocus.some((e) => !(opts.excludeAgentResolvable && e.disposition === DISPOSITION_AGENT_RESOLVABLE));
142
- }
143
- /**
144
- * Returns true when an open (status pending or in_review) escalation exists
145
- * for the given delivery + kind discriminator.
146
- *
147
- * Now that the advance-block class is a first-class `escalation_kind`
148
- * ('advance_blocked', added to the DB CHECK + ESCALATION_KINDS) and the
149
- * delivery is a first-class `delivery_id` column, dedup matches on the
150
- * COLUMNS in preference to the metadata bag. A metadata fallback is retained
151
- * for back-compat with rows already open at deploy time (filed before this
152
- * promotion, which carry the discriminator only in metadata.kind /
153
- * metadata.deliveryId).
154
- *
155
- * Used by the delivery advance-block path so a delivery stuck across many
156
- * polls files exactly one open escalation instead of one per tick.
157
- */
158
- export async function hasOpenEscalationForDelivery(deliveryId, escalationKind) {
159
- const result = await callApi('escalation_list', {
160
- fields: { statuses: ['pending', 'in_review'] },
161
- limit: 500,
162
- });
163
- return (result.escalations ?? []).some((e) => {
164
- // Preferred: match on the typed columns.
165
- if (e.escalationKind === escalationKind && e.deliveryId === deliveryId) {
166
- return true;
167
- }
168
- // Back-compat: rows filed before the column promotion carry the
169
- // discriminator in the metadata bag.
170
- const meta = e.metadata ?? null;
171
- return meta?.kind === escalationKind && meta?.deliveryId === deliveryId;
172
- });
173
- }
174
- import { OPEN_ESCALATION_STATUSES, OPERATOR_HOLD_DISPOSITIONS, SELF_REPORT_STALL_HOLD_KINDS, REFUSED_OPERATOR_HOLD_KINDS, findOpenOperatorHoldForDelivery, hasOpenOperatorHoldForDelivery, } from './holds.js';
175
- // The delivery hold-lookup family moved to queries/holds.ts (file-size limit).
176
- // Re-exported here so every existing importer of queries/issues.js keeps working.
177
- export { OPERATOR_HOLD_DISPOSITIONS, SELF_REPORT_STALL_HOLD_KINDS, REFUSED_OPERATOR_HOLD_KINDS, findOpenOperatorHoldForDelivery, hasOpenOperatorHoldForDelivery, };
178
- /**
179
- * escalation_kind discriminators for the two focus-merge worktree-dirty
180
- * classes. Declared as daemon-local string constants (not imported from
181
- * @telora/daemon-core's ESCALATION_KINDS) on purpose: the daemon consumes the
182
- * registry-PUBLISHED daemon-core, so it cannot reference newly-added enum
183
- * members until a build that depends on a daemon-core publish carrying them.
184
- * They ARE now in daemon-core (ESCALATION_KINDS.MERGE_CONFLICT /
185
- * .MERGE_REFUSED_DIRTY, shipped in 0.2.45) for other consumers (frontend, MCP),
186
- * but the daemon keeps the local strings so this code does not depend on the
187
- * publish ordering. The DB CHECK is the real constraint -- loosened by the
188
- * agent_escalations_kind_merge_classes migration to admit these two values --
189
- * and the daemon stamps them as plain strings.
190
- * (advance_blocked already shipped in daemon-core as ESCALATION_KINDS.ADVANCE_BLOCKED.)
191
- */
192
- export const MERGE_CONFLICT_ESCALATION_KIND = 'merge_conflict';
193
- export const MERGE_REFUSED_DIRTY_ESCALATION_KIND = 'merge_refused_dirty';
194
- /**
195
- * The worktree-dirty escalation classes: a single physical fact (one focus
196
- * worktree with uncommitted changes) can be observed by three independent
197
- * daemon paths -- the delivery advance-block guard (advance_blocked), the
198
- * focus-merge dirty-worktree refusal (merge_refused_dirty), and the
199
- * focus-merge conflict path (merge_conflict). They are siblings: when one is
200
- * already open for a focus, the others should suppress rather than pile on.
201
- */
202
- export const WORKTREE_DIRTY_ESCALATION_KINDS = [
203
- 'advance_blocked',
204
- MERGE_CONFLICT_ESCALATION_KIND,
205
- MERGE_REFUSED_DIRTY_ESCALATION_KIND,
206
- ];
207
- /**
208
- * True when `e` is an OPEN worktree-dirty-class escalation for `focusId` whose
209
- * kind is in `kindSet`. Shared by hasOpenWorktreeDirtyEscalation (dedup) and
210
- * resolveOpenWorktreeDirtyEscalations (auto-close) so both agree on what counts.
211
- *
212
- * The status re-check is defense-in-depth. The live escalation_list handler
213
- * (issue-handlers.listEscalations) already honors the `statuses` filter
214
- * server-side, so the daemon normally receives only pending/in_review rows --
215
- * but we re-check here so the invariant "a RESOLVED worktree-dirty row must
216
- * never suppress (or be re-resolved as) a legitimate new escalation" holds
217
- * regardless of how the rows were fetched (custom `kinds`, a future caller that
218
- * forgets the statuses filter, etc.).
219
- */
220
- function isOpenWorktreeDirtyMatch(e, focusId, kindSet) {
221
- if (e.status && !OPEN_ESCALATION_STATUSES.has(e.status))
222
- return false;
223
- // Preferred: match on the typed columns.
224
- if (e.focusId === focusId && e.escalationKind && kindSet.has(e.escalationKind)) {
225
- return true;
226
- }
227
- // Back-compat: rows filed before the column promotion carry the focus / kind
228
- // in the metadata bag.
229
- const meta = e.metadata ?? null;
230
- const metaKind = meta?.kind;
231
- return (meta?.focusId === focusId &&
232
- typeof metaKind === 'string' &&
233
- kindSet.has(metaKind));
234
- }
235
- /**
236
- * Returns true when an open (status pending or in_review) worktree-dirty-class
237
- * escalation exists for the given FOCUS.
238
- *
239
- * This generalizes hasOpenEscalationForDelivery from per-delivery to
240
- * focus/worktree grain. A dirty worktree is a property of one focus worktree
241
- * shared by all of the focus's deliveries, so deduping per delivery emits N
242
- * rows for one physical fact. Keying on the focus collapses them to one.
243
- *
244
- * It also collapses ACROSS escalation classes: by default the sibling set is
245
- * { advance_blocked, merge_conflict, merge_refused_dirty }, so an open
246
- * advance-block escalation suppresses a merge-refuse one (and vice versa) --
247
- * one dirty-worktree fact yields at most one open escalation regardless of how
248
- * many code paths observe it. Pass `kinds` to narrow the sibling set.
249
- *
250
- * Dedup matches on the typed `focus_id` + `escalation_kind` COLUMNS in
251
- * preference to the metadata bag, with a metadata fallback (metadata.focusId /
252
- * metadata.kind) for rows already open at deploy time. Because it queries the
253
- * DB rather than an in-memory Set, the dedup survives a daemon restart.
254
- *
255
- * The request narrows server-side by `focusId` + open `statuses` (both honored
256
- * by the live escalation_list handler) so the 500-row page is scoped to this
257
- * focus's open rows, not the org's newest 500 -- closing the gap where a busy
258
- * org could push the matching sibling off the page. The status + focus + kind
259
- * predicate is ALSO applied client-side (isOpenWorktreeDirtyMatch) as
260
- * defense-in-depth.
261
- */
262
- export async function hasOpenWorktreeDirtyEscalation(focusId, kinds = WORKTREE_DIRTY_ESCALATION_KINDS, deps = {}) {
263
- const call = deps.callApi ?? callApi;
264
- const kindSet = new Set(kinds);
265
- const result = await call('escalation_list', {
266
- fields: { statuses: ['pending', 'in_review'], focusId },
267
- limit: 500,
268
- });
269
- return (result.escalations ?? []).some((e) => isOpenWorktreeDirtyMatch(e, focusId, kindSet));
270
- }
271
- /** The escalation_kind filed by the planning-wedge watchdog. */
272
- export const WEDGED_FOCUS_ESCALATION_KIND = 'wedged_focus';
273
- /**
274
- * Returns true when an OPEN (status pending or in_review) wedged_focus
275
- * escalation already exists for the given FOCUS.
276
- *
277
- * The planning-wedge watchdog re-evaluates every poll tick, so without a dedup
278
- * it would file an identical wedged_focus row each tick the focus stays wedged
279
- * (the 172-duplicate storm class). Keying on the focus + escalation_kind COLUMNS
280
- * collapses the threshold-crossing escalation to at most one open row per focus.
281
- *
282
- * Mirrors hasOpenWorktreeDirtyEscalation: the request narrows server-side by
283
- * focusId + open statuses (both honored by the live escalation_list handler) so
284
- * a busy org cannot page the matching row off the 500-row window, and the
285
- * status + focus + kind predicate is ALSO applied client-side as defense-in-depth.
286
- * Because it queries the DB rather than an in-memory Set, the dedup SURVIVES A
287
- * DAEMON RESTART -- a restart cannot re-storm a focus that is still wedged.
288
- */
289
- export async function hasOpenWedgedFocusEscalation(focusId) {
290
- const result = await callApi('escalation_list', {
291
- fields: { statuses: ['pending', 'in_review'], focusId },
292
- limit: 500,
293
- });
294
- return (result.escalations ?? []).some((e) => {
295
- if (e.status && !OPEN_ESCALATION_STATUSES.has(e.status))
296
- return false;
297
- if (e.focusId === focusId && e.escalationKind === WEDGED_FOCUS_ESCALATION_KIND)
298
- return true;
299
- // Back-compat: a row filed before the column promotion carries focus / kind
300
- // in the metadata bag.
301
- const meta = e.metadata ?? null;
302
- return meta?.focusId === focusId && meta?.kind === WEDGED_FOCUS_ESCALATION_KIND;
303
- });
304
- }
305
- /**
306
- * Returns true when an OPEN (status pending or in_review) escalation of the
307
- * given `escalationKind` already exists for the given FOCUS. Generic per-focus
308
- * dedup, mirroring hasOpenWedgedFocusEscalation but parameterized on the kind.
309
- *
310
- * Used by the targeted stall detectors (review_window_stalled) so a focus that
311
- * stays stalled across many poll ticks files exactly one open escalation
312
- * instead of one per tick. Queries the DB (not an in-memory Set), so the dedup
313
- * survives a daemon restart. Narrows server-side by focusId + open statuses and
314
- * re-applies the status/focus/kind predicate client-side as defense-in-depth.
315
- */
316
- /**
317
- * The escalation_kind the review-exit drift-streak breaker files when a focus
318
- * branch keeps advancing DURING each review pass (review-exit-escalations.ts).
319
- * Named here so the respawn guard and the filer agree on the exact string.
320
- */
321
- export const REVIEW_COVERAGE_INCOMPLETE_ESCALATION_KIND = 'review_coverage_incomplete';
322
- /**
323
- * Returns true when an open (status pending or in_review)
324
- * review_coverage_incomplete escalation exists for the given focus.
325
- *
326
- * Used by the respawn guard so a focus whose drift-streak breaker has already
327
- * fired parks its re-review spawns instead of burning a review cycle every
328
- * spawn cooldown while the escalation sits open (the 2026-08-06 incident: the
329
- * breaker fired 4 minutes in, but nothing stopped the loop for 4.5h). Mirrors
330
- * hasOpenTeamFailureEscalation; delegates to the generic per-focus dedup query.
331
- */
332
- export async function hasOpenReviewCoverageIncompleteEscalation(focusId) {
333
- return hasOpenFocusEscalation(focusId, REVIEW_COVERAGE_INCOMPLETE_ESCALATION_KIND);
334
- }
335
- export async function hasOpenFocusEscalation(focusId, escalationKind) {
336
- const result = await callApi('escalation_list', {
337
- fields: { statuses: ['pending', 'in_review'], focusId },
338
- limit: 500,
339
- });
340
- return (result.escalations ?? []).some((e) => {
341
- if (e.status && !OPEN_ESCALATION_STATUSES.has(e.status))
342
- return false;
343
- if (e.focusId === focusId && e.escalationKind === escalationKind)
344
- return true;
345
- // Back-compat: a row filed before the column promotion carries focus / kind
346
- // in the metadata bag.
347
- const meta = e.metadata ?? null;
348
- return meta?.focusId === focusId && meta?.kind === escalationKind;
349
- });
350
- }
351
- /**
352
- * The close half for a per-FOCUS escalation kind: resolve every open (pending or
353
- * in_review) escalation of `escalationKind` for the focus, once the daemon has
354
- * observed its clearing condition. Mirrors resolveOpenWorktreeDirtyEscalations
355
- * (the delivery-scoped precedent) for the focus-scoped blocking kinds that
356
- * applyRespawnGuard reads as a spawn block (team_failure) -- so a machine-filed
357
- * spawn block clears itself the moment its own condition (genuine progress)
358
- * clears, and the armed focus resumes spawning with no human act.
359
- *
360
- * Best-effort: a resolve failure for one row is logged and skipped, never thrown,
361
- * so the caller's primary work (advancing a delivery) is not blocked. Returns the
362
- * count resolved.
363
- */
364
- /**
365
- * Read the OPEN (pending or in_review) escalations of `escalationKind` for a
366
- * focus, returning each row's id + metadata. The read sibling of
367
- * resolveOpenFocusEscalationsOfKind, for close-halves whose clearing condition
368
- * is per-row (e.g. review_coverage_incomplete clears only when the focus branch
369
- * has stabilized at the tip recorded in the row's metadata at filing).
370
- */
371
- /**
372
- * List the escalation_kind of every OPEN (pending/in_review) escalation naming a
373
- * focus -- the raw evidence the wedge-cause arbiter (TEL-3) draws on. Any-kind
374
- * (no server kind filter); the caller narrows to wedge causes. Column-first with
375
- * the metadata.focusId fallback for pre-backfill rows.
376
- */
377
- export async function listOpenFocusEscalationKinds(focusId, deps = {}) {
378
- const call = deps.callApi ?? callApi;
379
- const result = await call('escalation_list', {
380
- fields: { statuses: ['pending', 'in_review'], focusId },
381
- limit: 500,
382
- });
383
- return (result.escalations ?? [])
384
- .filter((e) => (!e.status || OPEN_ESCALATION_STATUSES.has(e.status)) &&
385
- (e.focusId === focusId ||
386
- e.metadata?.focusId === focusId))
387
- .map((e) => e.escalationKind ?? '')
388
- .filter((k) => k.length > 0);
389
- }
390
- export async function listOpenFocusEscalationsOfKind(focusId, escalationKind, deps = {}) {
391
- const call = deps.callApi ?? callApi;
392
- const result = await call('escalation_list', {
393
- fields: { statuses: ['pending', 'in_review'], escalationKind, focusId },
394
- limit: 500,
395
- });
396
- return (result.escalations ?? [])
397
- .filter((e) => {
398
- if (e.status && !OPEN_ESCALATION_STATUSES.has(e.status))
399
- return false;
400
- if (e.focusId === focusId && e.escalationKind === escalationKind)
401
- return true;
402
- const meta = e.metadata ?? null;
403
- return meta?.focusId === focusId && meta?.kind === escalationKind;
404
- })
405
- .map((e) => ({ id: e.id, metadata: e.metadata ?? null }));
406
- }
407
- export async function resolveOpenFocusEscalationsOfKind(focusId, escalationKind, resolutionNotes, deps = {}) {
408
- const call = deps.callApi ?? callApi;
409
- const result = await call('escalation_list', {
410
- fields: { statuses: ['pending', 'in_review'], escalationKind, focusId },
411
- limit: 500,
412
- });
413
- const open = (result.escalations ?? []).filter((e) => {
414
- if (e.status && !OPEN_ESCALATION_STATUSES.has(e.status))
415
- return false;
416
- if (e.focusId === focusId && e.escalationKind === escalationKind)
417
- return true;
418
- // Back-compat: a row filed before the column promotion carries focus / kind
419
- // in the metadata bag.
420
- const meta = e.metadata ?? null;
421
- return meta?.focusId === focusId && meta?.kind === escalationKind;
422
- });
423
- let resolved = 0;
424
- for (const e of open) {
425
- try {
426
- await markEscalationResolved(e.id, resolutionNotes, deps);
427
- resolved++;
428
- }
429
- catch (err) {
430
- log.warn(`[escalations] Failed to auto-resolve ${escalationKind} escalation ${e.id} for focus ${focusId}: ${err.message}`);
431
- }
432
- }
433
- return resolved;
434
- }
435
- /**
436
- * Auto-resolve the open worktree-dirty escalations for a focus once their
437
- * underlying condition has cleared (the worktree is observed clean again, or a
438
- * merge conflict has been merged through). Lists the open rows for the focus
439
- * narrowed to `kinds`, resolves each with a daemon-remediation note, and
440
- * returns the count resolved.
441
- *
442
- * This is the close half of the disposition-aware model: an agent_resolvable
443
- * condition that auto-remediates should also stop showing in the human inbox
444
- * the moment it clears, instead of lingering as a resolved-in-fact but
445
- * still-pending row. Best-effort: a resolve failure for one row is logged and
446
- * skipped, never thrown, so the caller's primary work is not blocked.
447
- *
448
- * Callers MUST pass `kinds` narrowed to the conditions the clearing event
449
- * actually resolves -- e.g. a clean worktree clears advance_blocked /
450
- * merge_refused_dirty but NOT merge_conflict (a content conflict is not a dirty
451
- * worktree), and a successful merge clears merge_conflict.
452
- */
453
- export async function resolveOpenWorktreeDirtyEscalations(focusId, kinds, resolutionNotes = 'Auto-resolved by the daemon: the worktree-dirty condition cleared.', deps = {}) {
454
- const call = deps.callApi ?? callApi;
455
- const kindSet = new Set(kinds);
456
- const result = await call('escalation_list', {
457
- fields: { statuses: ['pending', 'in_review'], focusId },
458
- limit: 500,
459
- });
460
- const open = (result.escalations ?? []).filter((e) => isOpenWorktreeDirtyMatch(e, focusId, kindSet));
461
- let resolved = 0;
462
- for (const e of open) {
463
- try {
464
- await markEscalationResolved(e.id, resolutionNotes, deps);
465
- resolved++;
466
- }
467
- catch (err) {
468
- log.warn(`[escalations] Failed to auto-resolve worktree-dirty escalation ${e.id} for focus ${focusId}: ${err.message}`);
469
- }
470
- }
471
- return resolved;
472
- }
473
- /**
474
- * Pure: keep only the OPEN, agent_resolvable rows and shape them into
475
- * AgentResolvableItems. The status re-check is defense-in-depth so a
476
- * resolved/dismissed row can never ride into a spawn even if the fetch returned
477
- * one. Exported for direct unit testing (no callApi mocking needed).
478
- */
479
- export function toAgentResolvableItems(rows) {
480
- return rows
481
- .filter((e) => (!e.status || OPEN_ESCALATION_STATUSES.has(e.status)) &&
482
- e.disposition === DISPOSITION_AGENT_RESOLVABLE)
483
- .map((e) => ({
484
- id: e.id,
485
- escalationKind: e.escalationKind ?? null,
486
- description: e.description ?? '',
487
- createdAt: e.createdAt ?? '',
488
- }));
489
- }
490
- /**
491
- * List the OPEN (pending/in_review) agent_resolvable escalations anchored to a
492
- * focus -- the filings a machine (the next spawned team) can resolve without a
493
- * human. This is how the daemon CONSUMES agent_resolvable filings: it hands them
494
- * to the focus's next execution spawn (ride-into-next-spawn) so the agent
495
- * addresses them as part of its work, and on a clean exit they auto-resolve.
496
- * agent_resolvable rows are hidden from the operator inbox (the disposition
497
- * routes to the machine, not the human); this is the machine-side counterpart read.
498
- *
499
- * escalation_list does not filter by disposition server-side, so we narrow
500
- * server-side by focusId + open statuses (scoping the 500-row page to this focus)
501
- * and filter disposition === agent_resolvable client-side. The status re-check is
502
- * defense-in-depth so a resolved/dismissed row can never ride into a spawn.
503
- */
504
- export async function listOpenAgentResolvableForFocus(focusId) {
505
- const result = await callApi('escalation_list', {
506
- fields: { statuses: ['pending', 'in_review'], focusId },
507
- limit: 500,
508
- });
509
- return toAgentResolvableItems(result.escalations ?? []);
510
- }
511
- /**
512
- * Pure: keep only the OPEN, agent_resolvable rows and shape them into
513
- * OrgAgentResolvableItems, carrying each row's org/focus/product anchor. Same
514
- * open+disposition filter as toAgentResolvableItems; the difference is the
515
- * anchor fields the org-wide promotion needs. Exported for direct unit testing.
516
- */
517
- export function toOrgAgentResolvableItems(rows) {
518
- return rows
519
- .filter((e) => (!e.status || OPEN_ESCALATION_STATUSES.has(e.status)) &&
520
- e.disposition === DISPOSITION_AGENT_RESOLVABLE)
521
- .map((e) => ({
522
- id: e.id,
523
- escalationKind: e.escalationKind ?? null,
524
- description: e.description ?? '',
525
- createdAt: e.createdAt ?? '',
526
- organizationId: e.organizationId ?? null,
527
- focusId: e.focusId ?? null,
528
- productId: e.productId ?? null,
529
- }));
530
- }
531
- /**
532
- * List the OPEN (pending/in_review) agent_resolvable escalations across the
533
- * ENTIRE org -- NOT scoped to a single focus. This is the read behind the
534
- * org-wide promotion sweep: it catches filings anchored to a focus that never
535
- * spawns a team (un-armed, or wedged by an open blocking escalation), which the
536
- * focus-scoped ride-into-spawn read (listOpenAgentResolvableForFocus) never sees
537
- * because no spawn ever queries that focus.
538
- *
539
- * escalation_list scopes to the daemon's org by auth and does not filter by
540
- * disposition server-side, so we narrow to open statuses server-side (the 500-row
541
- * page) and filter disposition === agent_resolvable client-side. Each row's
542
- * first-class focus_id / product_id / organization_id columns are carried onto
543
- * the item so the promotion can anchor its needs_operator refile to the right
544
- * focus.
545
- */
546
- export async function listOpenAgentResolvableForOrg(deps = {}) {
547
- const call = deps.callApi ?? callApi;
548
- const result = await call('escalation_list', {
549
- fields: { statuses: ['pending', 'in_review'] },
550
- limit: 500,
551
- // detail:'full' is REQUIRED: transformEscalation only emits organizationId AND
552
- // description in the full branch (the summary base carries neither). Without it
553
- // the org anchor is dropped and sweepAgentResolvablePromotions skips every item
554
- // -- the org-wide sweep scans N and promotes 0 forever. The dropped description
555
- // would also refile an empty body on any promotion that did fire.
556
- detail: 'full',
557
- });
558
- return toOrgAgentResolvableItems(result.escalations ?? []);
559
- }
560
- const DISPOSITION_NEEDS_INTENT = 'needs_intent';
561
- /**
562
- * Pure: keep only OPEN team_failure escalations disposed needs_intent, shaping
563
- * them for the demotion sweep. team_failure kind (not daemon_gate_stuck) with
564
- * needs_intent is exactly the class TEL-1 files ONLY when a human-decision cause
565
- * matched -- so a row here whose recorded cause is NOT a human decision is a
566
- * misrouted / pre-TEL-1 filing the machine can take back. Exported for testing.
567
- */
568
- export function toDemotableTeamFailureItems(rows) {
569
- return rows
570
- .filter((e) => (!e.status || OPEN_ESCALATION_STATUSES.has(e.status)) &&
571
- e.disposition === DISPOSITION_NEEDS_INTENT &&
572
- e.escalationKind === 'team_failure')
573
- .map((e) => {
574
- const cause = e.metadata?.statedCause;
575
- return {
576
- id: e.id,
577
- escalationKind: e.escalationKind ?? null,
578
- description: e.description ?? '',
579
- createdAt: e.createdAt ?? '',
580
- organizationId: e.organizationId ?? null,
581
- focusId: e.focusId ?? null,
582
- productId: e.productId ?? null,
583
- statedCause: typeof cause === 'string' ? cause : undefined,
584
- };
585
- });
586
- }
587
- /**
588
- * List the org's OPEN needs_intent team_failure escalations -- the candidates the
589
- * evidence-driven demotion (TEL-3) re-classifies. Same open-status server filter +
590
- * detail:'full' (for metadata + description + org anchor) as
591
- * listOpenAgentResolvableForOrg; disposition/kind are filtered client-side.
592
- */
593
- export async function listOpenDemotableTeamFailureForOrg(deps = {}) {
594
- const call = deps.callApi ?? callApi;
595
- const result = await call('escalation_list', {
596
- fields: { statuses: ['pending', 'in_review'] },
597
- limit: 500,
598
- detail: 'full',
599
- });
600
- return toDemotableTeamFailureItems(result.escalations ?? []);
601
- }
602
- /**
603
- * Returns true when an OPEN (status pending or in_review) PRD machine escalation
604
- * of the given `discriminator` already exists for the given PRD.
605
- *
606
- * PRD machine escalations are filed via escalations.fileEscalation with a machine
607
- * `kind` -- carried in metadata.machine_discriminator (NOT the escalation_kind
608
- * CHECK enum) -- and the prd id folded from `details` into metadata.prdId. So
609
- * dedup matches on those two metadata fields. Parameterizing the discriminator
610
- * lets every cadence-reachable PRD escalation path share ONE idempotency guard:
611
- * the steward divergence path ('prd_divergence_steward_escalation') AND the
612
- * reflex no-surviving-path fallback ('prd_divergence_no_surviving_path'), both of
613
- * which would otherwise flood identically (the 172-duplicate storm class).
614
- *
615
- * Because it queries the DB rather than a process-lifetime in-memory Set, the
616
- * dedup SURVIVES A DAEMON RESTART: the escalation storm this prevents (identical
617
- * pending rows filed every cadence tick) cannot recur after a restart, unlike the
618
- * no-arm-role Set whose intentional restart-renotify semantics stay untouched.
619
- *
620
- * The request narrows server-side by metadata->>prdId (metadataPrdId, honored by
621
- * the live escalation_list handler) so a busy org cannot page this PRD's row off
622
- * the 500-row window. The metadata predicate is ALSO applied client-side as
623
- * defense-in-depth AND so the dedup works before the edge-fn filter deploys
624
- * (edge changes propagate via the separate INFRA pipeline) -- an unknown
625
- * metadataPrdId field is simply ignored server-side until then.
626
- */
627
- export async function hasOpenPrdEscalation(prdId, discriminator) {
628
- const result = await callApi('escalation_list', {
629
- fields: { statuses: ['pending', 'in_review'], metadataPrdId: prdId },
630
- limit: 500,
631
- });
632
- return (result.escalations ?? []).some((e) => {
633
- if (e.status && !OPEN_ESCALATION_STATUSES.has(e.status))
634
- return false;
635
- const meta = e.metadata ?? null;
636
- return meta?.machine_discriminator === discriminator && meta?.prdId === prdId;
637
- });
638
- }
639
- /**
640
- * Mark an escalation as resolved with optional notes.
641
- */
642
- export async function markEscalationResolved(escalationId, resolutionNotes, deps = {}) {
643
- const call = deps.callApi ?? callApi;
644
- await call('escalation_update', {
645
- escalationId,
646
- fields: {
647
- status: 'resolved',
648
- ...(resolutionNotes ? { resolutionNotes } : {}),
649
- },
650
- });
651
- }
652
44
  /**
653
45
  * Create an issue on a delivery (for create_issue trigger action).
654
46
  */
@@ -1 +1 @@
1
- {"version":3,"file":"issues.js","sourceRoot":"","sources":["../../src/queries/issues.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OA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