@telora/daemon 0.21.98 → 0.21.134

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 (226) hide show
  1. package/build-info.json +6 -3
  2. package/dist/audit/audit-hooks.d.ts +106 -0
  3. package/dist/audit/audit-hooks.d.ts.map +1 -1
  4. package/dist/audit/audit-hooks.js +149 -17
  5. package/dist/audit/audit-hooks.js.map +1 -1
  6. package/dist/ci/ci-sensor-loop.d.ts +6 -0
  7. package/dist/ci/ci-sensor-loop.d.ts.map +1 -1
  8. package/dist/ci/ci-sensor-loop.js +50 -3
  9. package/dist/ci/ci-sensor-loop.js.map +1 -1
  10. package/dist/completion/coverage-drift-state.d.ts +29 -2
  11. package/dist/completion/coverage-drift-state.d.ts.map +1 -1
  12. package/dist/completion/coverage-drift-state.js +42 -2
  13. package/dist/completion/coverage-drift-state.js.map +1 -1
  14. package/dist/completion/coverage-stabilized.d.ts +58 -0
  15. package/dist/completion/coverage-stabilized.d.ts.map +1 -0
  16. package/dist/completion/coverage-stabilized.js +84 -0
  17. package/dist/completion/coverage-stabilized.js.map +1 -0
  18. package/dist/completion/delivery-advancement-guard.d.ts +21 -0
  19. package/dist/completion/delivery-advancement-guard.d.ts.map +1 -1
  20. package/dist/completion/delivery-advancement-guard.js +31 -3
  21. package/dist/completion/delivery-advancement-guard.js.map +1 -1
  22. package/dist/completion/event-escalations.d.ts +15 -0
  23. package/dist/completion/event-escalations.d.ts.map +1 -1
  24. package/dist/completion/event-escalations.js +42 -4
  25. package/dist/completion/event-escalations.js.map +1 -1
  26. package/dist/completion/event-phases.d.ts.map +1 -1
  27. package/dist/completion/event-phases.js +5 -2
  28. package/dist/completion/event-phases.js.map +1 -1
  29. package/dist/completion/machine-remediable-demotion.d.ts +74 -0
  30. package/dist/completion/machine-remediable-demotion.d.ts.map +1 -0
  31. package/dist/completion/machine-remediable-demotion.js +147 -0
  32. package/dist/completion/machine-remediable-demotion.js.map +1 -0
  33. package/dist/completion/review-exit-phase.d.ts.map +1 -1
  34. package/dist/completion/review-exit-phase.js +10 -6
  35. package/dist/completion/review-exit-phase.js.map +1 -1
  36. package/dist/completion/settle-injection-sweep.d.ts +55 -0
  37. package/dist/completion/settle-injection-sweep.d.ts.map +1 -0
  38. package/dist/completion/settle-injection-sweep.js +88 -0
  39. package/dist/completion/settle-injection-sweep.js.map +1 -0
  40. package/dist/completion/state-cascade.d.ts.map +1 -1
  41. package/dist/completion/state-cascade.js +41 -0
  42. package/dist/completion/state-cascade.js.map +1 -1
  43. package/dist/completion/status-advance-phase.d.ts.map +1 -1
  44. package/dist/completion/status-advance-phase.js +18 -1
  45. package/dist/completion/status-advance-phase.js.map +1 -1
  46. package/dist/completion/team-lifecycle.d.ts +42 -0
  47. package/dist/completion/team-lifecycle.d.ts.map +1 -1
  48. package/dist/completion/team-lifecycle.js +71 -0
  49. package/dist/completion/team-lifecycle.js.map +1 -1
  50. package/dist/delivery/delivery-lifecycle.d.ts +19 -33
  51. package/dist/delivery/delivery-lifecycle.d.ts.map +1 -1
  52. package/dist/delivery/delivery-lifecycle.js +19 -147
  53. package/dist/delivery/delivery-lifecycle.js.map +1 -1
  54. package/dist/delivery/delivery-merge-ops.d.ts +46 -0
  55. package/dist/delivery/delivery-merge-ops.d.ts.map +1 -0
  56. package/dist/delivery/delivery-merge-ops.js +154 -0
  57. package/dist/delivery/delivery-merge-ops.js.map +1 -0
  58. package/dist/delivery/delivery-reconciler-apply.d.ts +28 -0
  59. package/dist/delivery/delivery-reconciler-apply.d.ts.map +1 -1
  60. package/dist/delivery/delivery-reconciler-apply.js +30 -0
  61. package/dist/delivery/delivery-reconciler-apply.js.map +1 -1
  62. package/dist/delivery/delivery-reconciler.d.ts +7 -2
  63. package/dist/delivery/delivery-reconciler.d.ts.map +1 -1
  64. package/dist/delivery/delivery-reconciler.js +34 -5
  65. package/dist/delivery/delivery-reconciler.js.map +1 -1
  66. package/dist/delivery/external-hold-surface.d.ts +32 -0
  67. package/dist/delivery/external-hold-surface.d.ts.map +1 -0
  68. package/dist/delivery/external-hold-surface.js +67 -0
  69. package/dist/delivery/external-hold-surface.js.map +1 -0
  70. package/dist/delivery/external-hold.d.ts +21 -0
  71. package/dist/delivery/external-hold.d.ts.map +1 -1
  72. package/dist/delivery/external-hold.js +40 -5
  73. package/dist/delivery/external-hold.js.map +1 -1
  74. package/dist/delivery/paused-revival.d.ts +140 -0
  75. package/dist/delivery/paused-revival.d.ts.map +1 -0
  76. package/dist/delivery/paused-revival.js +229 -0
  77. package/dist/delivery/paused-revival.js.map +1 -0
  78. package/dist/delivery/wait-reachability.d.ts.map +1 -1
  79. package/dist/delivery/wait-reachability.js +11 -0
  80. package/dist/delivery/wait-reachability.js.map +1 -1
  81. package/dist/directive/close-loop-dispatcher.d.ts +16 -263
  82. package/dist/directive/close-loop-dispatcher.d.ts.map +1 -1
  83. package/dist/directive/close-loop-dispatcher.js +21 -259
  84. package/dist/directive/close-loop-dispatcher.js.map +1 -1
  85. package/dist/directive/directive-dispatch.d.ts +19 -0
  86. package/dist/directive/directive-dispatch.d.ts.map +1 -1
  87. package/dist/directive/directive-dispatch.js +18 -0
  88. package/dist/directive/directive-dispatch.js.map +1 -1
  89. package/dist/directive/directive-executor.d.ts +1 -3
  90. package/dist/directive/directive-executor.d.ts.map +1 -1
  91. package/dist/directive/directive-executor.js +23 -21
  92. package/dist/directive/directive-executor.js.map +1 -1
  93. package/dist/directive/phase-sync.d.ts +28 -15
  94. package/dist/directive/phase-sync.d.ts.map +1 -1
  95. package/dist/directive/phase-sync.js +28 -36
  96. package/dist/directive/phase-sync.js.map +1 -1
  97. package/dist/directive/resolver-dispatch.d.ts +19 -92
  98. package/dist/directive/resolver-dispatch.d.ts.map +1 -1
  99. package/dist/directive/resolver-dispatch.js +19 -65
  100. package/dist/directive/resolver-dispatch.js.map +1 -1
  101. package/dist/focus/focus-engine.d.ts.map +1 -1
  102. package/dist/focus/focus-engine.js +26 -0
  103. package/dist/focus/focus-engine.js.map +1 -1
  104. package/dist/focus/focus-executor.d.ts.map +1 -1
  105. package/dist/focus/focus-executor.js +290 -256
  106. package/dist/focus/focus-executor.js.map +1 -1
  107. package/dist/focus/focus-loop-registry.d.ts.map +1 -1
  108. package/dist/focus/focus-loop-registry.js +43 -1
  109. package/dist/focus/focus-loop-registry.js.map +1 -1
  110. package/dist/focus/focus-respawn-guard.d.ts.map +1 -1
  111. package/dist/focus/focus-respawn-guard.js +11 -2
  112. package/dist/focus/focus-respawn-guard.js.map +1 -1
  113. package/dist/focus/focus-team-state.d.ts +11 -0
  114. package/dist/focus/focus-team-state.d.ts.map +1 -1
  115. package/dist/focus/focus-team-state.js +17 -0
  116. package/dist/focus/focus-team-state.js.map +1 -1
  117. package/dist/focus/listener-auto-advance.d.ts +13 -1
  118. package/dist/focus/listener-auto-advance.d.ts.map +1 -1
  119. package/dist/focus/listener-auto-advance.js +103 -22
  120. package/dist/focus/listener-auto-advance.js.map +1 -1
  121. package/dist/focus/listener.d.ts.map +1 -1
  122. package/dist/focus/listener.js +125 -75
  123. package/dist/focus/listener.js.map +1 -1
  124. package/dist/focus/tick-deadline.d.ts +55 -0
  125. package/dist/focus/tick-deadline.d.ts.map +1 -0
  126. package/dist/focus/tick-deadline.js +91 -0
  127. package/dist/focus/tick-deadline.js.map +1 -0
  128. package/dist/focus-stage-lifecycle/index.d.ts +18 -25
  129. package/dist/focus-stage-lifecycle/index.d.ts.map +1 -1
  130. package/dist/focus-stage-lifecycle/index.js +26 -38
  131. package/dist/focus-stage-lifecycle/index.js.map +1 -1
  132. package/dist/focus-stage-lifecycle/wedge-cause-arbiter.d.ts +52 -0
  133. package/dist/focus-stage-lifecycle/wedge-cause-arbiter.d.ts.map +1 -0
  134. package/dist/focus-stage-lifecycle/wedge-cause-arbiter.js +94 -0
  135. package/dist/focus-stage-lifecycle/wedge-cause-arbiter.js.map +1 -0
  136. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts +18 -1
  137. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -1
  138. package/dist/focus-stage-lifecycle/wedge-watchdog.js +57 -7
  139. package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -1
  140. package/dist/guard/condition-evaluators.d.ts +9 -0
  141. package/dist/guard/condition-evaluators.d.ts.map +1 -1
  142. package/dist/guard/condition-evaluators.js +15 -0
  143. package/dist/guard/condition-evaluators.js.map +1 -1
  144. package/dist/guard/guard-evaluator.d.ts +17 -1
  145. package/dist/guard/guard-evaluator.d.ts.map +1 -1
  146. package/dist/guard/guard-evaluator.js +61 -2
  147. package/dist/guard/guard-evaluator.js.map +1 -1
  148. package/dist/guard/trigger-executor.d.ts +30 -18
  149. package/dist/guard/trigger-executor.d.ts.map +1 -1
  150. package/dist/guard/trigger-executor.js +55 -31
  151. package/dist/guard/trigger-executor.js.map +1 -1
  152. package/dist/prompt/team-prompt-base.d.ts +1 -1
  153. package/dist/prompt/team-prompt-base.d.ts.map +1 -1
  154. package/dist/prompt/team-prompt-base.js +1 -1
  155. package/dist/prompt/team-prompt-base.js.map +1 -1
  156. package/dist/prompt-sections/persona-sections.d.ts +0 -32
  157. package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
  158. package/dist/prompt-sections/persona-sections.js +19 -88
  159. package/dist/prompt-sections/persona-sections.js.map +1 -1
  160. package/dist/queries/deliveries.d.ts +23 -0
  161. package/dist/queries/deliveries.d.ts.map +1 -1
  162. package/dist/queries/deliveries.js +6 -0
  163. package/dist/queries/deliveries.js.map +1 -1
  164. package/dist/queries/focuses.d.ts +36 -0
  165. package/dist/queries/focuses.d.ts.map +1 -1
  166. package/dist/queries/focuses.js +45 -0
  167. package/dist/queries/focuses.js.map +1 -1
  168. package/dist/queries/guards.d.ts +10 -0
  169. package/dist/queries/guards.d.ts.map +1 -1
  170. package/dist/queries/guards.js +14 -1
  171. package/dist/queries/guards.js.map +1 -1
  172. package/dist/queries/issues.d.ts +65 -1
  173. package/dist/queries/issues.d.ts.map +1 -1
  174. package/dist/queries/issues.js +135 -2
  175. package/dist/queries/issues.js.map +1 -1
  176. package/dist/queries/schemas.d.ts +51 -0
  177. package/dist/queries/schemas.d.ts.map +1 -1
  178. package/dist/queries/schemas.js +34 -0
  179. package/dist/queries/schemas.js.map +1 -1
  180. package/dist/queries/verification.d.ts +5 -6
  181. package/dist/queries/verification.d.ts.map +1 -1
  182. package/dist/queries/verification.js +5 -6
  183. package/dist/queries/verification.js.map +1 -1
  184. package/dist/resolvers/loop-persona.d.ts +1 -11
  185. package/dist/resolvers/loop-persona.d.ts.map +1 -1
  186. package/dist/resolvers/loop-persona.js +2 -16
  187. package/dist/resolvers/loop-persona.js.map +1 -1
  188. package/dist/shell/unified-shell-provisioning.d.ts +40 -0
  189. package/dist/shell/unified-shell-provisioning.d.ts.map +1 -1
  190. package/dist/shell/unified-shell-provisioning.js +72 -0
  191. package/dist/shell/unified-shell-provisioning.js.map +1 -1
  192. package/dist/shell/unified-shell.d.ts.map +1 -1
  193. package/dist/shell/unified-shell.js +18 -1
  194. package/dist/shell/unified-shell.js.map +1 -1
  195. package/dist/spawn/helpers.d.ts.map +1 -1
  196. package/dist/spawn/helpers.js +6 -1
  197. package/dist/spawn/helpers.js.map +1 -1
  198. package/dist/spawn/process-spawn.d.ts.map +1 -1
  199. package/dist/spawn/process-spawn.js +7 -0
  200. package/dist/spawn/process-spawn.js.map +1 -1
  201. package/dist/spawn/spawn-cooldown.d.ts +41 -7
  202. package/dist/spawn/spawn-cooldown.d.ts.map +1 -1
  203. package/dist/spawn/spawn-cooldown.js +47 -0
  204. package/dist/spawn/spawn-cooldown.js.map +1 -1
  205. package/dist/spawn/spawn-decision.d.ts.map +1 -1
  206. package/dist/spawn/spawn-decision.js +33 -1
  207. package/dist/spawn/spawn-decision.js.map +1 -1
  208. package/dist/verify/stall-detectors.d.ts +20 -8
  209. package/dist/verify/stall-detectors.d.ts.map +1 -1
  210. package/dist/verify/stall-detectors.js +27 -46
  211. package/dist/verify/stall-detectors.js.map +1 -1
  212. package/dist/workflow/gate-failure-policy.d.ts +48 -0
  213. package/dist/workflow/gate-failure-policy.d.ts.map +1 -0
  214. package/dist/workflow/gate-failure-policy.js +57 -0
  215. package/dist/workflow/gate-failure-policy.js.map +1 -0
  216. package/dist/workflow/pipeline-config.d.ts +2 -2
  217. package/dist/workflow/pipeline-config.js +2 -2
  218. package/package.json +1 -1
  219. package/dist/directive/close-loop-stage.d.ts +0 -50
  220. package/dist/directive/close-loop-stage.d.ts.map +0 -1
  221. package/dist/directive/close-loop-stage.js +0 -210
  222. package/dist/directive/close-loop-stage.js.map +0 -1
  223. package/dist/focus-stage-lifecycle/review-convergence.d.ts +0 -133
  224. package/dist/focus-stage-lifecycle/review-convergence.d.ts.map +0 -1
  225. package/dist/focus-stage-lifecycle/review-convergence.js +0 -237
  226. package/dist/focus-stage-lifecycle/review-convergence.js.map +0 -1
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Evidence-driven demotion of a stall filing back to the machine lane (TEL-3 of
3
+ * "A stall is diagnosed before it is handed to a human").
4
+ *
5
+ * The agent_resolvable PROMOTION sweep (queries/agent-resolvable-promotion.ts)
6
+ * moves ownership ONE way -- machine -> human on open-age. Nothing moved it back:
7
+ * a filing that a human took but that is actually machine-remediable could only
8
+ * ratchet toward the human. This is the inverse: an OPEN needs_intent team_failure
9
+ * whose recorded evidence shows a machine-remediable cause is returned to the
10
+ * machine (disposition agent_resolvable), where the agent-resolvable transport
11
+ * rides it into the next spawn.
12
+ *
13
+ * Evidence = the SAME classifier TEL-1 filed it with (statedCauseNeedsIntent).
14
+ * A team_failure-kind row disposed needs_intent is filed that way ONLY when a
15
+ * human-decision cause matched, so a row here whose recorded statedCause is NOT a
16
+ * human decision (a pre-TEL-1 default, or a misroute) is demotable; a row whose
17
+ * cause IS a genuine build-changing decision is left with the human. Gate-stuck
18
+ * filings are kind daemon_gate_stuck (needs_operator), never team_failure, so they
19
+ * are excluded by construction -- an operator-owned hold is never demoted.
20
+ *
21
+ * Deploy-safe like the promotion: escalation_update cannot rewrite disposition
22
+ * without an edge deploy, so a demotion RESOLVES the source needs_intent row and
23
+ * REFILES the same content as an agent_resolvable escalation (idempotent on a
24
+ * cause key derived from the source id). Best-effort per row; never throws.
25
+ */
26
+ import { type DemotableTeamFailureItem } from '../queries/issues.js';
27
+ import { type FileEscalationIdempotentParams, type FileEscalationIdempotentResult } from '../queries/escalation-suppression.js';
28
+ /** escalation_kind preserved on a demoted (formerly needs_intent) team_failure. */
29
+ export declare const MACHINE_REMEDIABLE_DEMOTED_KIND = "team_failure";
30
+ /** The cause key that makes a demotion refile idempotent (one per source filing). */
31
+ export declare function machineRemediableDemotionCauseKey(originalEscalationId: string): string;
32
+ /**
33
+ * Pure: split open needs_intent team_failures into the ones a HUMAN still owns
34
+ * (their recorded cause names a build-changing decision) and the ones to DEMOTE
35
+ * (no human-decision cause -> machine-remediable). Exported for direct testing.
36
+ */
37
+ export declare function partitionDemotable(items: readonly DemotableTeamFailureItem[]): {
38
+ keep: DemotableTeamFailureItem[];
39
+ demote: DemotableTeamFailureItem[];
40
+ };
41
+ /**
42
+ * Pure: build the agent_resolvable refile params for a needs_intent filing whose
43
+ * evidence shows a machine-remediable cause. Preserves the original description +
44
+ * kind so the incoming team sees the full context; anchored to the focus when one
45
+ * is present.
46
+ */
47
+ export declare function buildDemotionRefileParams(item: DemotableTeamFailureItem, ctx: {
48
+ organizationId: string;
49
+ focusId?: string;
50
+ productId?: string;
51
+ }): FileEscalationIdempotentParams;
52
+ /** Counts a single demotion sweep returns (for tick logging). */
53
+ export interface MachineRemediableDemotionCounts {
54
+ scanned: number;
55
+ demoted: number;
56
+ }
57
+ /** Injected IO for the demotion sweep (real defaults; tests inject stubs). */
58
+ export interface MachineRemediableDemotionDeps {
59
+ listOpenDemotable: () => Promise<DemotableTeamFailureItem[]>;
60
+ markResolved: (id: string, notes?: string) => Promise<void>;
61
+ file: (params: FileEscalationIdempotentParams) => Promise<FileEscalationIdempotentResult>;
62
+ }
63
+ /**
64
+ * Sweep the org's OPEN needs_intent team_failures and return ownership to the
65
+ * machine for every one whose recorded evidence is machine-remediable: refile the
66
+ * same content as agent_resolvable, then resolve the source needs_intent row.
67
+ * Idempotent (shared cause key + source resolve) and best-effort per filing -- a
68
+ * failure is logged and the source left open for the next sweep, never thrown, so
69
+ * one bad row never aborts the sweep. Spawn-independent by design: a needs_intent
70
+ * team_failure BLOCKS the respawn (TEL-2 keeps human-owned holds blocking), so the
71
+ * demotion cannot ride a spawn -- it must run from this org loop.
72
+ */
73
+ export declare function sweepMachineRemediableDemotions(deps?: Partial<MachineRemediableDemotionDeps>): Promise<MachineRemediableDemotionCounts>;
74
+ //# sourceMappingURL=machine-remediable-demotion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine-remediable-demotion.d.ts","sourceRoot":"","sources":["../../src/completion/machine-remediable-demotion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACpC,MAAM,sCAAsC,CAAC;AAO9C,mFAAmF;AACnF,eAAO,MAAM,+BAA+B,iBAAiB,CAAC;AAE9D,qFAAqF;AACrF,wBAAgB,iCAAiC,CAAC,oBAAoB,EAAE,MAAM,GAAG,MAAM,CAEtF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,wBAAwB,EAAE,GACzC;IAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC;IAAC,MAAM,EAAE,wBAAwB,EAAE,CAAA;CAAE,CAW1E;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,wBAAwB,EAC9B,GAAG,EAAE;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACpE,8BAA8B,CAiChC;AAED,iEAAiE;AACjE,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,8EAA8E;AAC9E,MAAM,WAAW,6BAA6B;IAC5C,iBAAiB,EAAE,MAAM,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;IAC7D,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,IAAI,EAAE,CAAC,MAAM,EAAE,8BAA8B,KAAK,OAAO,CAAC,8BAA8B,CAAC,CAAC;CAC3F;AAUD;;;;;;;;;GASG;AACH,wBAAsB,+BAA+B,CACnD,IAAI,GAAE,OAAO,CAAC,6BAA6B,CAAM,GAChD,OAAO,CAAC,+BAA+B,CAAC,CA4C1C"}
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Evidence-driven demotion of a stall filing back to the machine lane (TEL-3 of
3
+ * "A stall is diagnosed before it is handed to a human").
4
+ *
5
+ * The agent_resolvable PROMOTION sweep (queries/agent-resolvable-promotion.ts)
6
+ * moves ownership ONE way -- machine -> human on open-age. Nothing moved it back:
7
+ * a filing that a human took but that is actually machine-remediable could only
8
+ * ratchet toward the human. This is the inverse: an OPEN needs_intent team_failure
9
+ * whose recorded evidence shows a machine-remediable cause is returned to the
10
+ * machine (disposition agent_resolvable), where the agent-resolvable transport
11
+ * rides it into the next spawn.
12
+ *
13
+ * Evidence = the SAME classifier TEL-1 filed it with (statedCauseNeedsIntent).
14
+ * A team_failure-kind row disposed needs_intent is filed that way ONLY when a
15
+ * human-decision cause matched, so a row here whose recorded statedCause is NOT a
16
+ * human decision (a pre-TEL-1 default, or a misroute) is demotable; a row whose
17
+ * cause IS a genuine build-changing decision is left with the human. Gate-stuck
18
+ * filings are kind daemon_gate_stuck (needs_operator), never team_failure, so they
19
+ * are excluded by construction -- an operator-owned hold is never demoted.
20
+ *
21
+ * Deploy-safe like the promotion: escalation_update cannot rewrite disposition
22
+ * without an edge deploy, so a demotion RESOLVES the source needs_intent row and
23
+ * REFILES the same content as an agent_resolvable escalation (idempotent on a
24
+ * cause key derived from the source id). Best-effort per row; never throws.
25
+ */
26
+ import { ESCALATION_REASONS, ESCALATION_DISPOSITIONS } from '@telora/daemon-core';
27
+ import { markEscalationResolved as defaultMarkEscalationResolved, listOpenDemotableTeamFailureForOrg as defaultListOpenDemotable, } from '../queries/issues.js';
28
+ import { fileEscalationIdempotent as defaultFileEscalationIdempotent, } from '../queries/escalation-suppression.js';
29
+ import { computeCauseKey } from '../queries/cause-key.js';
30
+ import { statedCauseNeedsIntent } from './event-escalations.js';
31
+ import { createLogger } from '../shell/log.js';
32
+ const log = createLogger({ module: 'escalations' });
33
+ /** escalation_kind preserved on a demoted (formerly needs_intent) team_failure. */
34
+ export const MACHINE_REMEDIABLE_DEMOTED_KIND = 'team_failure';
35
+ /** The cause key that makes a demotion refile idempotent (one per source filing). */
36
+ export function machineRemediableDemotionCauseKey(originalEscalationId) {
37
+ return computeCauseKey('team_failure_demoted', { escalationId: originalEscalationId });
38
+ }
39
+ /**
40
+ * Pure: split open needs_intent team_failures into the ones a HUMAN still owns
41
+ * (their recorded cause names a build-changing decision) and the ones to DEMOTE
42
+ * (no human-decision cause -> machine-remediable). Exported for direct testing.
43
+ */
44
+ export function partitionDemotable(items) {
45
+ const keep = [];
46
+ const demote = [];
47
+ for (const item of items) {
48
+ if (statedCauseNeedsIntent(item.statedCause)) {
49
+ keep.push(item); // a genuine human decision -- leave it with the human
50
+ }
51
+ else {
52
+ demote.push(item); // no human-decision evidence -- return to the machine
53
+ }
54
+ }
55
+ return { keep, demote };
56
+ }
57
+ /**
58
+ * Pure: build the agent_resolvable refile params for a needs_intent filing whose
59
+ * evidence shows a machine-remediable cause. Preserves the original description +
60
+ * kind so the incoming team sees the full context; anchored to the focus when one
61
+ * is present.
62
+ */
63
+ export function buildDemotionRefileParams(item, ctx) {
64
+ return {
65
+ causeKey: machineRemediableDemotionCauseKey(item.id),
66
+ organizationId: ctx.organizationId,
67
+ issueId: null,
68
+ reasonType: ESCALATION_REASONS.BLOCKED_BY_EXTERNAL,
69
+ // Evidence shows the cause is machine-remediable -> return it to the machine
70
+ // lane. The agent-resolvable transport rides it into the next coding spawn,
71
+ // and the promotion sweep re-escalates it to a human only if it survives.
72
+ disposition: ESCALATION_DISPOSITIONS.AGENT_RESOLVABLE,
73
+ anchor: ctx.focusId ? { focusId: ctx.focusId } : {},
74
+ ...(ctx.productId ? { productId: ctx.productId } : {}),
75
+ escalationKind: MACHINE_REMEDIABLE_DEMOTED_KIND,
76
+ description: `A no-progress stall filed to the intent owner has been RETURNED to the ` +
77
+ `machine: its recorded cause names no build-changing decision, so it is ` +
78
+ `machine-remediable and rides into the focus's next coding spawn.\n\n` +
79
+ `**Demoted from:** needs_intent (team_failure)\n` +
80
+ `**Original filing:** ${item.id}\n\n` +
81
+ `${item.description}`,
82
+ whatWasTried: `The stall was re-classified from its own recorded stated cause; no human ` +
83
+ `decision is required, so ownership returned to the machine (needs_intent -> ` +
84
+ `agent_resolvable).`,
85
+ helpNeeded: `None from a human yet -- the incoming coding team will attempt this. It is ` +
86
+ `re-escalated to an operator only if it survives the agent-resolvable window.`,
87
+ metadata: {
88
+ cause: MACHINE_REMEDIABLE_DEMOTED_KIND,
89
+ demotedFrom: 'needs_intent',
90
+ originalEscalationId: item.id,
91
+ },
92
+ };
93
+ }
94
+ function defaultDeps() {
95
+ return {
96
+ listOpenDemotable: defaultListOpenDemotable,
97
+ markResolved: defaultMarkEscalationResolved,
98
+ file: defaultFileEscalationIdempotent,
99
+ };
100
+ }
101
+ /**
102
+ * Sweep the org's OPEN needs_intent team_failures and return ownership to the
103
+ * machine for every one whose recorded evidence is machine-remediable: refile the
104
+ * same content as agent_resolvable, then resolve the source needs_intent row.
105
+ * Idempotent (shared cause key + source resolve) and best-effort per filing -- a
106
+ * failure is logged and the source left open for the next sweep, never thrown, so
107
+ * one bad row never aborts the sweep. Spawn-independent by design: a needs_intent
108
+ * team_failure BLOCKS the respawn (TEL-2 keeps human-owned holds blocking), so the
109
+ * demotion cannot ride a spawn -- it must run from this org loop.
110
+ */
111
+ export async function sweepMachineRemediableDemotions(deps = {}) {
112
+ const d = { ...defaultDeps(), ...deps };
113
+ const open = await d.listOpenDemotable();
114
+ const { demote } = partitionDemotable(open);
115
+ let demoted = 0;
116
+ for (const item of demote) {
117
+ if (!item.organizationId) {
118
+ log.warn(`[escalations] needs_intent team_failure ${item.id} is machine-remediable but ` +
119
+ `lacks an org anchor; cannot refile (skipping)`);
120
+ continue;
121
+ }
122
+ const ctx = {
123
+ organizationId: item.organizationId,
124
+ ...(item.focusId ? { focusId: item.focusId } : {}),
125
+ ...(item.productId ? { productId: item.productId } : {}),
126
+ };
127
+ try {
128
+ const result = await d.file(buildDemotionRefileParams(item, ctx));
129
+ // Only retire the source once the agent_resolvable refile is in place (filed
130
+ // OR already suppressed by a prior demotion) -- never resolve without a
131
+ // landing spot, which would drop the signal entirely.
132
+ if (result.filed || result.suppressed) {
133
+ await d.markResolved(item.id, `Returned to the machine: the recorded cause is machine-remediable, so ` +
134
+ `ownership was demoted needs_intent -> agent_resolvable.`);
135
+ demoted++;
136
+ log.info(`[escalations] Demoted needs_intent team_failure ${item.id} to agent_resolvable ` +
137
+ `(focus ${item.focusId ?? '<none>'})`);
138
+ }
139
+ }
140
+ catch (err) {
141
+ log.warn(`[escalations] Failed to demote needs_intent team_failure ${item.id}: ${err.message}`);
142
+ // Left open; the next sweep retries.
143
+ }
144
+ }
145
+ return { scanned: open.length, demoted };
146
+ }
147
+ //# sourceMappingURL=machine-remediable-demotion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine-remediable-demotion.js","sourceRoot":"","sources":["../../src/completion/machine-remediable-demotion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EA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AO,CAAC,IAAI,CAAC,CAigBf"}
@@ -21,10 +21,11 @@ import { resolveReviewCycleCap, resolveReviewHandoffCap } from '../verify/stall-
21
21
  import { createEscalation, hasOpenFocusEscalation, findOpenOperatorHoldForDelivery, getDeliveryIssues } from '../queries/issues.js';
22
22
  import { resolveOperatorHold, writeOperatorHoldGateState, describeOperatorHold } from '../delivery/operator-hold.js';
23
23
  import { resolveExternalHold, makeDeferredRequestClosureEvaluator, describeExternalHold } from '../delivery/external-hold.js';
24
+ import { surfaceStaleReferenceLessExternalHold } from '../delivery/external-hold-surface.js';
24
25
  import { listOpenShortfallProposalIds } from '../queries/reality-tree.js';
25
26
  import { resolveShortfallHold, writeShortfallGateState, describeShortfallHold, } from './review-exit-shortfall.js';
26
27
  import { recordReviewCycleAndMaybeEscalate, fileCoverageIncompleteEscalation, fileGapsWithoutIssueEscalation, fileMissingReportNotice, recordHandoffAndMaybeTerminate, } from './review-exit-escalations.js';
27
- import { belowCoverageDriftCounts, forceFullPassReviewFocuses } from './coverage-drift-state.js';
28
+ import { forceFullPassReviewFocuses, recordBelowCoverageDrift, resetCoverageDriftState } from './coverage-drift-state.js';
28
29
  import { reviewFiledIssueExists, blockingReviewFiledIssueExists, filterDeferrableReviewNotes, } from './review-defect-detector.js';
29
30
  import { createLogger } from '../shell/log.js';
30
31
  const log = createLogger({ module: 'focus-executor' });
@@ -273,6 +274,10 @@ export async function runReviewExitHandler(params, deps = defaultReviewExitDeps)
273
274
  // not by a human resolve. Same fail-closed shape as the operator-hold gate.
274
275
  if (target === DELIVERY_STATUS.DONE) {
275
276
  const externalHold = await resolveExternalHold({ updateDeliveryStatus: deps.updateDeliveryStatus }, d.id, d.gateState, makeDeferredRequestClosureEvaluator(productId));
277
+ // Surface (or clear) a stale reference-less hold as operator-visible state
278
+ // (TEL-5, delivery 2): a reference-less hold cannot self-clear, so once it
279
+ // is age-bounded stale it must not be a silent permanent hold.
280
+ surfaceStaleReferenceLessExternalHold(d.id, d.name, externalHold.staleReferenceLess ?? false, externalHold.hold);
276
281
  if (externalHold.held) {
277
282
  externalHeldAny = true;
278
283
  log.info(`[focus-executor] Delivery "${d.name}" NOT moved to done -- ${describeExternalHold(externalHold)}. ` +
@@ -412,9 +417,9 @@ export async function runReviewExitHandler(params, deps = defaultReviewExitDeps)
412
417
  }
413
418
  // A routed completion means the drift streak (if any) is broken: either
414
419
  // coverage was complete (auto-approve) or defects routed the delivery. Clear
415
- // the per-focus below-coverage counter so a future drift starts fresh.
416
- belowCoverageDriftCounts.delete(focusId);
417
- forceFullPassReviewFocuses.delete(focusId);
420
+ // the per-focus below-coverage counter so a future drift starts fresh (this
421
+ // also writes the cleared budget through durably).
422
+ resetCoverageDriftState(focusId);
418
423
  // A routed exit is progress: the routes-nothing hand-off streak is broken, so
419
424
  // reset the durable hand-off counter to 0 (only when it stands above 0, to
420
425
  // avoid a needless write on every routed exit). Best-effort -- never aborts
@@ -515,8 +520,7 @@ export async function runReviewExitHandler(params, deps = defaultReviewExitDeps)
515
520
  log.warn(`setReviewedThroughSha (drift) failed for "${focusName}": ${err.message}`);
516
521
  }
517
522
  }
518
- const streak = (belowCoverageDriftCounts.get(focusId) ?? 0) + 1;
519
- belowCoverageDriftCounts.set(focusId, streak);
523
+ const streak = recordBelowCoverageDrift(focusId);
520
524
  if (streak >= 2) {
521
525
  // Drift persisted after the full-pass respawn -- an operator must look.
522
526
  await fileCoverageIncompleteEscalation(deps, escalationCtx, {
@@ -1 +1 @@
1
- {"version":3,"file":"review-exit-phase.js","sourceRoot":"","sources":["../../src/completion/review-exit-phase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5G,OAAO,EAA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aAAa,CAAC,CAAC;IAC5D,CAAC;IAED,8EAA8E;IAC9E,2EAA2E;IAC3E,2EAA2E;IAC3E,2EAA2E;IAC3E,oDAAoD;IACpD,IAAI,SAAS,IAAI,CAAC,YAAY,IAAI,wBAAwB,EAAE,CAAC;QAC3D,MAAM,uBAAuB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Focus-scope anchored-injection retirement on the lifecycle that ACTUALLY runs
3
+ * (the derived winding_down settle), TEL-5 of "One focus lifecycle, terminating
4
+ * at winding_down".
5
+ *
6
+ * The anchored-injection sweep used to live ONLY inside the machine-completion
7
+ * family (directive/close-loop-dispatcher.ts advanceFocusToDoneWithSweep), which
8
+ * fires only when the product_focuses.stage column reaches 'close_loop'. A focus
9
+ * that settles (all deliveries terminal -> derived phase winding_down) WITHOUT
10
+ * the stage column reaching close_loop -- e.g. review disabled, or a delivery
11
+ * exiting via review rather than the per-delivery verify gate -- never had its
12
+ * anchored injections retired, so the focus completed with a stale reality tree
13
+ * whose FRT overlays stayed frozen.
14
+ *
15
+ * This runs the SAME sweep (planInjectionSweep + executeSweep +
16
+ * buildWritebackVerify, reused verbatim -- the FRT writeback is unrecoverable if
17
+ * reimplemented) when the DERIVED phase reaches winding_down, and writes NO focus
18
+ * stage: completion stays human-owned (the machine never writes focus.stage =
19
+ * 'done'). Idempotent + best-effort: planInjectionSweep skips injections already
20
+ * 'verified', so a re-run once the tree is settled is an empty-plan no-op; every
21
+ * I/O failure holds (retries next settle) rather than throwing.
22
+ */
23
+ import type { FocusDeliveryInfo } from '../types/index.js';
24
+ /** The per-injection snapshot the sweep reads (status + owning tree id). */
25
+ interface InjectionNodeSnapshot {
26
+ id: string;
27
+ injectionStatus: string | null;
28
+ realityTreeId?: string | null;
29
+ }
30
+ /** I/O seam so the sweep unit-tests with plain stubs (no mock.module). */
31
+ export interface SettleSweepDeps {
32
+ /** Current injection-status snapshot for the focus (reality_tree_focus_injections). */
33
+ fetchInjectionSnapshot: (focusId: string) => Promise<InjectionNodeSnapshot[]>;
34
+ /** The per-injection FRT writeback verify, keyed by owning tree id. */
35
+ buildVerify: (treeIdByInjection: ReadonlyMap<string, string>) => (injectionId: string, evidence: string) => Promise<void>;
36
+ }
37
+ export interface SettleSweepOutcome {
38
+ planSize: number;
39
+ verified: number;
40
+ failedAt?: {
41
+ injectionId: string;
42
+ error: Error;
43
+ };
44
+ }
45
+ /**
46
+ * Retire the focus's anchored injections whose anchoring delivery closed
47
+ * successfully but whose injection is not yet 'verified', at the winding_down
48
+ * settle. Writes no focus stage. Returns the sweep tally; never throws.
49
+ */
50
+ export declare function sweepAnchoredInjectionsOnSettle(focus: {
51
+ focus_id: string;
52
+ focus_name: string;
53
+ }, deliveries: FocusDeliveryInfo[], deps?: SettleSweepDeps): Promise<SettleSweepOutcome>;
54
+ export {};
55
+ //# sourceMappingURL=settle-injection-sweep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settle-injection-sweep.d.ts","sourceRoot":"","sources":["../../src/completion/settle-injection-sweep.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAa3D,4EAA4E;AAC5E,UAAU,qBAAqB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC9B,uFAAuF;IACvF,sBAAsB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAC9E,uEAAuE;IACvE,WAAW,EAAE,CACX,iBAAiB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,KAC3C,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAYD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC;CAClD;AAED;;;;GAIG;AACH,wBAAsB,+BAA+B,CACnD,KAAK,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EAC/C,UAAU,EAAE,iBAAiB,EAAE,EAC/B,IAAI,GAAE,eAA6B,GAClC,OAAO,CAAC,kBAAkB,CAAC,CAwD7B"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Focus-scope anchored-injection retirement on the lifecycle that ACTUALLY runs
3
+ * (the derived winding_down settle), TEL-5 of "One focus lifecycle, terminating
4
+ * at winding_down".
5
+ *
6
+ * The anchored-injection sweep used to live ONLY inside the machine-completion
7
+ * family (directive/close-loop-dispatcher.ts advanceFocusToDoneWithSweep), which
8
+ * fires only when the product_focuses.stage column reaches 'close_loop'. A focus
9
+ * that settles (all deliveries terminal -> derived phase winding_down) WITHOUT
10
+ * the stage column reaching close_loop -- e.g. review disabled, or a delivery
11
+ * exiting via review rather than the per-delivery verify gate -- never had its
12
+ * anchored injections retired, so the focus completed with a stale reality tree
13
+ * whose FRT overlays stayed frozen.
14
+ *
15
+ * This runs the SAME sweep (planInjectionSweep + executeSweep +
16
+ * buildWritebackVerify, reused verbatim -- the FRT writeback is unrecoverable if
17
+ * reimplemented) when the DERIVED phase reaches winding_down, and writes NO focus
18
+ * stage: completion stays human-owned (the machine never writes focus.stage =
19
+ * 'done'). Idempotent + best-effort: planInjectionSweep skips injections already
20
+ * 'verified', so a re-run once the tree is settled is an empty-plan no-op; every
21
+ * I/O failure holds (retries next settle) rather than throwing.
22
+ */
23
+ import { getAnchoringDeliveries, planInjectionSweep, executeSweep, } from '../directive/close-loop-dispatcher.js';
24
+ import { buildWritebackVerify } from '../queries/verification.js';
25
+ import { callApi } from '../queries/shared.js';
26
+ import { createLogger } from '../shell/log.js';
27
+ const log = createLogger({ module: 'settle-injection-sweep' });
28
+ const defaultDeps = {
29
+ fetchInjectionSnapshot: async (focusId) => {
30
+ const result = await callApi('reality_tree_focus_injections', { focusId });
31
+ return (result.items ?? []).map((i) => i.injection);
32
+ },
33
+ buildVerify: (treeIdByInjection) => buildWritebackVerify(treeIdByInjection),
34
+ };
35
+ /**
36
+ * Retire the focus's anchored injections whose anchoring delivery closed
37
+ * successfully but whose injection is not yet 'verified', at the winding_down
38
+ * settle. Writes no focus stage. Returns the sweep tally; never throws.
39
+ */
40
+ export async function sweepAnchoredInjectionsOnSettle(focus, deliveries, deps = defaultDeps) {
41
+ const anchored = getAnchoringDeliveries(deliveries);
42
+ if (anchored.length === 0)
43
+ return { planSize: 0, verified: 0 };
44
+ let snapshot;
45
+ try {
46
+ snapshot = await deps.fetchInjectionSnapshot(focus.focus_id);
47
+ }
48
+ catch (err) {
49
+ log.warn(`[settle-sweep] failed to fetch injections for focus ${focus.focus_id.slice(0, 8)}: ` +
50
+ `${err.message} -- holding; next settle retries`);
51
+ return { planSize: 0, verified: 0 };
52
+ }
53
+ const statusById = new Map();
54
+ const treeIdByInjection = new Map();
55
+ for (const item of snapshot) {
56
+ statusById.set(item.id, item.injectionStatus);
57
+ const treeId = item.realityTreeId;
58
+ if (typeof treeId === 'string' && treeId.length > 0) {
59
+ treeIdByInjection.set(item.id, treeId);
60
+ }
61
+ }
62
+ const plan = planInjectionSweep(anchored, statusById);
63
+ if (plan.length === 0)
64
+ return { planSize: 0, verified: 0 }; // all already verified -- no-op
65
+ let outcome;
66
+ try {
67
+ outcome = await executeSweep(plan, deps.buildVerify(treeIdByInjection));
68
+ }
69
+ catch (err) {
70
+ log.warn(`[settle-sweep] sweep threw for focus ${focus.focus_id.slice(0, 8)}: ${err.message}`);
71
+ return { planSize: plan.length, verified: 0 };
72
+ }
73
+ if (outcome.verified.length > 0) {
74
+ log.info(`[settle-sweep] Focus "${focus.focus_name}" reached winding_down -- retired ` +
75
+ `${outcome.verified.length}/${plan.length} anchored injection(s) at focus scope ` +
76
+ `(no stage write; completion stays human-owned)`);
77
+ }
78
+ if (!outcome.ok && outcome.failedAt) {
79
+ log.warn(`[settle-sweep] Focus "${focus.focus_name}" sweep stopped at injection ` +
80
+ `${outcome.failedAt.injectionId.slice(0, 8)}: ${outcome.failedAt.error.message} -- ` +
81
+ `${outcome.verified.length}/${plan.length} retired; next settle retries the rest`);
82
+ }
83
+ const result = { planSize: plan.length, verified: outcome.verified.length };
84
+ if (outcome.failedAt)
85
+ result.failedAt = outcome.failedAt;
86
+ return result;
87
+ }
88
+ //# sourceMappingURL=settle-injection-sweep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settle-injection-sweep.js","sourceRoot":"","sources":["../../src/completion/settle-injection-sweep.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,YAAY,GACb,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,wBAAwB,EAAE,CAAC,CAAC;AAmB/D,MAAM,WAAW,GAAoB;IACnC,sBAAsB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAGxC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAO,+BAA+B,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACjF,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CA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AAI,EACrC,iBAAiB,EAAE,MAAM,GAAG,IAAI,EAChC,UAAU,EAAE,iBAAiB,EAAE,EAC/B,IAAI,GAAE,WAAyB,GAC9B,OAAO,CAAC,IAAI,CAAC,CA2Cf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,mBAAmB,EAC1B,iBAAiB,EAAE,MAAM,GAAG,IAAI,EAChC,IAAI,GAAE,WAAyB,GAC9B,OAAO,CAAC,IAAI,CAAC,CA8Bf;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA6F1E"}
@@ -31,10 +31,12 @@ import { DELIVERY_STATUS } from '@telora/daemon-core';
31
31
  import { getActiveFocuses } from '../queries/deliveries.js';
32
32
  import { getFocusDeliveries as _getFocusDeliveries, setReviewRequestedAt as _setReviewRequestedAt, clearReviewRequestedAt as _clearReviewRequestedAt, } from '../queries/focuses.js';
33
33
  import { configForProduct } from '../shell/config.js';
34
+ import { sweepAnchoredInjectionsOnSettle } from './settle-injection-sweep.js';
34
35
  import { emitLoopTrigger } from '../loops/index.js';
35
36
  import { deriveFocusPhase } from '../focus/focus-phase.js';
36
37
  import { isReviewEnabled } from '../workflow/pipeline-config.js';
37
38
  import { checkVerifyFailedCapForFocus, checkReviewWindowStaleForFocus, checkIdleTeamStallForFocus, } from '../verify/stall-detectors.js';
39
+ import { reconcileCoverageIncompleteHold } from './coverage-stabilized.js';
38
40
  import { createLogger } from '../shell/log.js';
39
41
  const log = createLogger({ module: 'state-cascade' });
40
42
  const defaultDeps = {
@@ -53,6 +55,16 @@ const defaultDeps = {
53
55
  * re-iteration (status change, new merge commit) still re-triggers review.
54
56
  */
55
57
  const lastReviewSignature = new Map();
58
+ /**
59
+ * Focuses whose anchored-injection settle sweep has already fully succeeded this
60
+ * run, so a winding_down focus is not re-fetched every poll (keeping a terminal
61
+ * focus quiet). Cleared when a focus leaves winding_down (a new delivery may add
62
+ * a fresh anchored injection to retire on the next settle), and NOT set on a
63
+ * partial/failed sweep so the remainder retries next poll. In-memory only: a
64
+ * re-exec re-runs the sweep once, which is an idempotent empty-plan no-op once
65
+ * the tree is settled -- not a bound/halt, so it needs no durable column.
66
+ */
67
+ const settledSweptFocuses = new Set();
56
68
  /**
57
69
  * Compute a stable signature of the focus's delivery aggregate. Changes when a
58
70
  * delivery's status, last-update time, merge commit, or git state moves --
@@ -70,6 +82,7 @@ function computeReviewSignature(deliveries) {
70
82
  */
71
83
  export function __resetReviewSignaturesForTesting() {
72
84
  lastReviewSignature.clear();
85
+ settledSweptFocuses.clear();
73
86
  }
74
87
  /**
75
88
  * When a focus reaches the verifying phase and auto-review is enabled
@@ -192,6 +205,23 @@ export async function runCascadeChecks(config) {
192
205
  });
193
206
  await checkAutoReview(focus.focus_id, phase, focus.pipeline_config, focus.review_requested_at, deliveries);
194
207
  await clearStaleReviewRequest(focus.focus_id, phase, focus.review_requested_at);
208
+ // Retire anchored injections at focus scope on the lifecycle that
209
+ // ACTUALLY runs -- the derived winding_down settle (TEL-5). This
210
+ // replaces the machine-completion family's sweep, which only fired when
211
+ // the stage column reached close_loop. Runs once per settle-entry (the
212
+ // guard keeps a terminal focus quiet); a partial/failed sweep is left
213
+ // unmarked so the remainder retries next poll. It writes NO focus stage
214
+ // -- completion stays human-owned.
215
+ if (phase === 'winding_down') {
216
+ if (!settledSweptFocuses.has(focus.focus_id)) {
217
+ const sweep = await sweepAnchoredInjectionsOnSettle({ focus_id: focus.focus_id, focus_name: focus.focus_name }, deliveries);
218
+ if (!sweep.failedAt)
219
+ settledSweptFocuses.add(focus.focus_id);
220
+ }
221
+ }
222
+ else {
223
+ settledSweptFocuses.delete(focus.focus_id);
224
+ }
195
225
  // Targeted daemon-owned stall detectors RIDE this same review-handling
196
226
  // seam: they reuse the deliveries + review phase + review_requested_at
197
227
  // already loaded above instead of fanning out a second per-poll
@@ -216,6 +246,17 @@ export async function runCascadeChecks(config) {
216
246
  // escalation. Rides the same seam; reads the per-team last-activity
217
247
  // clock rather than any loaded delivery/review state.
218
248
  checkIdleTeamStallForFocus(stallCtx);
249
+ // (4) review_coverage_incomplete close-half (delivery 7 Task 2): resolve
250
+ // the machine-filed review spawn block once the focus branch has
251
+ // stabilized at the tip recorded at filing -- the spawn-independent
252
+ // clearing condition (applyRespawnGuard blocks the review that would
253
+ // otherwise observe it). No human act.
254
+ await reconcileCoverageIncompleteHold({
255
+ focusId: focus.focus_id,
256
+ focusName: focus.focus_name,
257
+ branchName: focus.branch_name,
258
+ repoPath: pc.repoPath,
259
+ });
219
260
  }
220
261
  catch (err) {
221
262
  log.warn(`[state-cascade] Cascade pass failed for focus ${focus.focus_id}:`, err.message);