@telora/daemon 0.22.144 → 0.22.160

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 (252) hide show
  1. package/build-info.json +8 -3
  2. package/dist/audit/audit-phase.d.ts +34 -1
  3. package/dist/audit/audit-phase.d.ts.map +1 -1
  4. package/dist/audit/audit-phase.js +77 -9
  5. package/dist/audit/audit-phase.js.map +1 -1
  6. package/dist/backends/codex/codex-mcp-proxy.d.ts +4 -6
  7. package/dist/backends/codex/codex-mcp-proxy.d.ts.map +1 -1
  8. package/dist/backends/codex/codex-mcp-proxy.js.map +1 -1
  9. package/dist/backends/codex/mcp-preflight.d.ts +2 -2
  10. package/dist/backends/codex/mcp-preflight.d.ts.map +1 -1
  11. package/dist/backends/codex/mcp-preflight.js.map +1 -1
  12. package/dist/completion/completion-phase-registry.d.ts +1 -0
  13. package/dist/completion/completion-phase-registry.d.ts.map +1 -1
  14. package/dist/completion/completion-phase-registry.js +7 -5
  15. package/dist/completion/completion-phase-registry.js.map +1 -1
  16. package/dist/completion/escalation-provenance.d.ts.map +1 -1
  17. package/dist/completion/escalation-provenance.js +5 -2
  18. package/dist/completion/escalation-provenance.js.map +1 -1
  19. package/dist/completion/exit-classification.d.ts +1 -1
  20. package/dist/completion/exit-classification.d.ts.map +1 -1
  21. package/dist/completion/exit-classification.js +7 -1
  22. package/dist/completion/exit-classification.js.map +1 -1
  23. package/dist/completion/review-cycle-cap.d.ts +81 -35
  24. package/dist/completion/review-cycle-cap.d.ts.map +1 -1
  25. package/dist/completion/review-cycle-cap.js +60 -132
  26. package/dist/completion/review-cycle-cap.js.map +1 -1
  27. package/dist/completion/review-exit-deps.d.ts +3 -1
  28. package/dist/completion/review-exit-deps.d.ts.map +1 -1
  29. package/dist/completion/review-exit-deps.js +3 -1
  30. package/dist/completion/review-exit-deps.js.map +1 -1
  31. package/dist/completion/review-exit-phase.d.ts.map +1 -1
  32. package/dist/completion/review-exit-phase.js +5 -4
  33. package/dist/completion/review-exit-phase.js.map +1 -1
  34. package/dist/completion/state-cascade.d.ts.map +1 -1
  35. package/dist/completion/state-cascade.js +3 -7
  36. package/dist/completion/state-cascade.js.map +1 -1
  37. package/dist/delivery/delivery-review-coverage.d.ts +16 -0
  38. package/dist/delivery/delivery-review-coverage.d.ts.map +1 -1
  39. package/dist/delivery/delivery-review-coverage.js +16 -0
  40. package/dist/delivery/delivery-review-coverage.js.map +1 -1
  41. package/dist/focus/focus-engine.d.ts +16 -0
  42. package/dist/focus/focus-engine.d.ts.map +1 -1
  43. package/dist/focus/focus-engine.js +37 -17
  44. package/dist/focus/focus-engine.js.map +1 -1
  45. package/dist/focus/focus-executor.d.ts.map +1 -1
  46. package/dist/focus/focus-executor.js +7 -0
  47. package/dist/focus/focus-executor.js.map +1 -1
  48. package/dist/focus/focus-spawn-decision.d.ts +5 -3
  49. package/dist/focus/focus-spawn-decision.d.ts.map +1 -1
  50. package/dist/focus/focus-spawn-decision.js.map +1 -1
  51. package/dist/focus/listener-spawn.d.ts.map +1 -1
  52. package/dist/focus/listener-spawn.js +4 -3
  53. package/dist/focus/listener-spawn.js.map +1 -1
  54. package/dist/focus/listener.d.ts +15 -0
  55. package/dist/focus/listener.d.ts.map +1 -1
  56. package/dist/focus/listener.js +58 -9
  57. package/dist/focus/listener.js.map +1 -1
  58. package/dist/focus/review-cycle-cap-hold.d.ts +15 -94
  59. package/dist/focus/review-cycle-cap-hold.d.ts.map +1 -1
  60. package/dist/focus/review-cycle-cap-hold.js +54 -112
  61. package/dist/focus/review-cycle-cap-hold.js.map +1 -1
  62. package/dist/focus/session-health.d.ts +22 -1
  63. package/dist/focus/session-health.d.ts.map +1 -1
  64. package/dist/focus/session-health.js +28 -3
  65. package/dist/focus/session-health.js.map +1 -1
  66. package/dist/focus/session-process-reap.d.ts +3 -1
  67. package/dist/focus/session-process-reap.d.ts.map +1 -1
  68. package/dist/focus/session-process-reap.js +20 -0
  69. package/dist/focus/session-process-reap.js.map +1 -1
  70. package/dist/focus-stage-lifecycle/index.d.ts.map +1 -1
  71. package/dist/focus-stage-lifecycle/index.js +1 -0
  72. package/dist/focus-stage-lifecycle/index.js.map +1 -1
  73. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts +10 -0
  74. package/dist/focus-stage-lifecycle/wedge-watchdog.d.ts.map +1 -1
  75. package/dist/focus-stage-lifecycle/wedge-watchdog.js +27 -3
  76. package/dist/focus-stage-lifecycle/wedge-watchdog.js.map +1 -1
  77. package/dist/git/focus-integration-sync.d.ts +42 -3
  78. package/dist/git/focus-integration-sync.d.ts.map +1 -1
  79. package/dist/git/focus-integration-sync.js +38 -2
  80. package/dist/git/focus-integration-sync.js.map +1 -1
  81. package/dist/merge/abandoned-merge-recovery.d.ts.map +1 -1
  82. package/dist/merge/abandoned-merge-recovery.js +10 -0
  83. package/dist/merge/abandoned-merge-recovery.js.map +1 -1
  84. package/dist/merge/merge-back-loop.d.ts +1 -0
  85. package/dist/merge/merge-back-loop.d.ts.map +1 -1
  86. package/dist/merge/merge-back-loop.js +3 -3
  87. package/dist/merge/merge-back-loop.js.map +1 -1
  88. package/dist/prompt/team-prompt-base.d.ts +2 -1
  89. package/dist/prompt/team-prompt-base.d.ts.map +1 -1
  90. package/dist/prompt/team-prompt-base.js +5 -19
  91. package/dist/prompt/team-prompt-base.js.map +1 -1
  92. package/dist/prompt-sections/integration-reconcile-section.d.ts +45 -0
  93. package/dist/prompt-sections/integration-reconcile-section.d.ts.map +1 -0
  94. package/dist/prompt-sections/integration-reconcile-section.js +69 -0
  95. package/dist/prompt-sections/integration-reconcile-section.js.map +1 -0
  96. package/dist/prompt-sections/persona-sections.d.ts +0 -20
  97. package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
  98. package/dist/prompt-sections/persona-sections.js +4 -49
  99. package/dist/prompt-sections/persona-sections.js.map +1 -1
  100. package/dist/prompt-sections/testing-standard.d.ts +51 -0
  101. package/dist/prompt-sections/testing-standard.d.ts.map +1 -0
  102. package/dist/prompt-sections/testing-standard.js +132 -0
  103. package/dist/prompt-sections/testing-standard.js.map +1 -0
  104. package/dist/queries/agent-resolvable-promotion.d.ts.map +1 -1
  105. package/dist/queries/agent-resolvable-promotion.js +7 -5
  106. package/dist/queries/agent-resolvable-promotion.js.map +1 -1
  107. package/dist/queries/ended-arm.d.ts +47 -0
  108. package/dist/queries/ended-arm.d.ts.map +1 -0
  109. package/dist/queries/ended-arm.js +35 -0
  110. package/dist/queries/ended-arm.js.map +1 -0
  111. package/dist/queries/escalation-consumption.d.ts.map +1 -1
  112. package/dist/queries/escalation-consumption.js +0 -1
  113. package/dist/queries/escalation-consumption.js.map +1 -1
  114. package/dist/queries/focus-discovery.d.ts +14 -0
  115. package/dist/queries/focus-discovery.d.ts.map +1 -1
  116. package/dist/queries/focus-discovery.js +1 -0
  117. package/dist/queries/focus-discovery.js.map +1 -1
  118. package/dist/queries/focus-integration-conflict.d.ts +78 -0
  119. package/dist/queries/focus-integration-conflict.d.ts.map +1 -0
  120. package/dist/queries/focus-integration-conflict.js +136 -0
  121. package/dist/queries/focus-integration-conflict.js.map +1 -0
  122. package/dist/queries/focuses.d.ts +6 -3
  123. package/dist/queries/focuses.d.ts.map +1 -1
  124. package/dist/queries/focuses.js +13 -5
  125. package/dist/queries/focuses.js.map +1 -1
  126. package/dist/queries/incident-correlation.d.ts +1 -2
  127. package/dist/queries/incident-correlation.d.ts.map +1 -1
  128. package/dist/queries/incident-correlation.js +1 -3
  129. package/dist/queries/incident-correlation.js.map +1 -1
  130. package/dist/queries/local-models.js +1 -1
  131. package/dist/queries/local-models.js.map +1 -1
  132. package/dist/queries/schemas-local-model.d.ts +47 -0
  133. package/dist/queries/schemas-local-model.d.ts.map +1 -0
  134. package/dist/queries/schemas-local-model.js +57 -0
  135. package/dist/queries/schemas-local-model.js.map +1 -0
  136. package/dist/queries/schemas.d.ts +10 -32
  137. package/dist/queries/schemas.d.ts.map +1 -1
  138. package/dist/queries/schemas.js +10 -41
  139. package/dist/queries/schemas.js.map +1 -1
  140. package/dist/queries/sessions.d.ts +120 -12
  141. package/dist/queries/sessions.d.ts.map +1 -1
  142. package/dist/queries/sessions.js +104 -11
  143. package/dist/queries/sessions.js.map +1 -1
  144. package/dist/queries/shared.d.ts +1 -0
  145. package/dist/queries/shared.d.ts.map +1 -1
  146. package/dist/queries/shared.js +1 -1
  147. package/dist/queries/shared.js.map +1 -1
  148. package/dist/queries/system-session.d.ts.map +1 -1
  149. package/dist/queries/system-session.js +3 -1
  150. package/dist/queries/system-session.js.map +1 -1
  151. package/dist/resolvers/assembly-engine.d.ts +71 -1
  152. package/dist/resolvers/assembly-engine.d.ts.map +1 -1
  153. package/dist/resolvers/assembly-engine.js +82 -43
  154. package/dist/resolvers/assembly-engine.js.map +1 -1
  155. package/dist/resolvers/branch-work-arming.d.ts +133 -0
  156. package/dist/resolvers/branch-work-arming.d.ts.map +1 -0
  157. package/dist/resolvers/branch-work-arming.js +67 -0
  158. package/dist/resolvers/branch-work-arming.js.map +1 -0
  159. package/dist/resolvers/focus-review-coverage.d.ts.map +1 -1
  160. package/dist/resolvers/focus-review-coverage.js +31 -2
  161. package/dist/resolvers/focus-review-coverage.js.map +1 -1
  162. package/dist/resolvers/wiki-topic.d.ts +6 -5
  163. package/dist/resolvers/wiki-topic.d.ts.map +1 -1
  164. package/dist/resolvers/wiki-topic.js +43 -27
  165. package/dist/resolvers/wiki-topic.js.map +1 -1
  166. package/dist/session/session-lineage.d.ts.map +1 -1
  167. package/dist/session/session-lineage.js +1 -0
  168. package/dist/session/session-lineage.js.map +1 -1
  169. package/dist/shell/crash-recovery.d.ts +4 -2
  170. package/dist/shell/crash-recovery.d.ts.map +1 -1
  171. package/dist/shell/crash-recovery.js +15 -14
  172. package/dist/shell/crash-recovery.js.map +1 -1
  173. package/dist/shell/daemon-instance.d.ts +176 -0
  174. package/dist/shell/daemon-instance.d.ts.map +1 -0
  175. package/dist/shell/daemon-instance.js +281 -0
  176. package/dist/shell/daemon-instance.js.map +1 -0
  177. package/dist/shell/graceful-shutdown.d.ts +12 -1
  178. package/dist/shell/graceful-shutdown.d.ts.map +1 -1
  179. package/dist/shell/graceful-shutdown.js +7 -4
  180. package/dist/shell/graceful-shutdown.js.map +1 -1
  181. package/dist/shell/shutdown-ownership.d.ts +34 -0
  182. package/dist/shell/shutdown-ownership.d.ts.map +1 -0
  183. package/dist/shell/shutdown-ownership.js +51 -0
  184. package/dist/shell/shutdown-ownership.js.map +1 -0
  185. package/dist/shell/unified-shell.d.ts.map +1 -1
  186. package/dist/shell/unified-shell.js +12 -5
  187. package/dist/shell/unified-shell.js.map +1 -1
  188. package/dist/shell/worker-pidfile.d.ts +127 -11
  189. package/dist/shell/worker-pidfile.d.ts.map +1 -1
  190. package/dist/shell/worker-pidfile.js +349 -58
  191. package/dist/shell/worker-pidfile.js.map +1 -1
  192. package/dist/spawn/lead-launch.d.ts +17 -1
  193. package/dist/spawn/lead-launch.d.ts.map +1 -1
  194. package/dist/spawn/lead-launch.js +56 -7
  195. package/dist/spawn/lead-launch.js.map +1 -1
  196. package/dist/spawn/lead-process-ownership.d.ts +5 -4
  197. package/dist/spawn/lead-process-ownership.d.ts.map +1 -1
  198. package/dist/spawn/lead-process-ownership.js +7 -4
  199. package/dist/spawn/lead-process-ownership.js.map +1 -1
  200. package/dist/spawn/lifecycle.d.ts +0 -12
  201. package/dist/spawn/lifecycle.d.ts.map +1 -1
  202. package/dist/spawn/lifecycle.js +76 -19
  203. package/dist/spawn/lifecycle.js.map +1 -1
  204. package/dist/spawn/liveness.d.ts.map +1 -1
  205. package/dist/spawn/liveness.js +3 -1
  206. package/dist/spawn/liveness.js.map +1 -1
  207. package/dist/spawn/one-shot-process-ownership.d.ts +46 -2
  208. package/dist/spawn/one-shot-process-ownership.d.ts.map +1 -1
  209. package/dist/spawn/one-shot-process-ownership.js +78 -3
  210. package/dist/spawn/one-shot-process-ownership.js.map +1 -1
  211. package/dist/spawn/process-group-kill.d.ts.map +1 -1
  212. package/dist/spawn/process-group-kill.js +3 -1
  213. package/dist/spawn/process-group-kill.js.map +1 -1
  214. package/dist/spawn/process-spawn.d.ts +5 -15
  215. package/dist/spawn/process-spawn.d.ts.map +1 -1
  216. package/dist/spawn/process-spawn.js +2 -1
  217. package/dist/spawn/process-spawn.js.map +1 -1
  218. package/dist/spawn/prompt-assembly.d.ts +27 -2
  219. package/dist/spawn/prompt-assembly.d.ts.map +1 -1
  220. package/dist/spawn/prompt-assembly.js +65 -43
  221. package/dist/spawn/prompt-assembly.js.map +1 -1
  222. package/dist/spawn/worktree-session.d.ts +46 -2
  223. package/dist/spawn/worktree-session.d.ts.map +1 -1
  224. package/dist/spawn/worktree-session.js +57 -4
  225. package/dist/spawn/worktree-session.js.map +1 -1
  226. package/dist/testing/fixtures/conflicting-repo.d.ts +30 -0
  227. package/dist/testing/fixtures/conflicting-repo.d.ts.map +1 -0
  228. package/dist/testing/fixtures/conflicting-repo.js +89 -0
  229. package/dist/testing/fixtures/conflicting-repo.js.map +1 -0
  230. package/dist/testing/fixtures/index.d.ts.map +1 -1
  231. package/dist/testing/fixtures/index.js +2 -1
  232. package/dist/testing/fixtures/index.js.map +1 -1
  233. package/dist/testing/fixtures/pending-spawn-world.js +2 -2
  234. package/dist/testing/fixtures/pending-spawn-world.js.map +1 -1
  235. package/dist/types/exit-category.d.ts +59 -0
  236. package/dist/types/exit-category.d.ts.map +1 -0
  237. package/dist/types/exit-category.js +133 -0
  238. package/dist/types/exit-category.js.map +1 -0
  239. package/dist/types/index.js +1 -1
  240. package/dist/types/session.d.ts +5 -1
  241. package/dist/types/session.d.ts.map +1 -1
  242. package/dist/types/session.js +1 -1
  243. package/dist/types/session.js.map +1 -1
  244. package/dist/verify/stall-detector-config.d.ts +5 -1
  245. package/dist/verify/stall-detector-config.d.ts.map +1 -1
  246. package/dist/verify/stall-detector-config.js +5 -1
  247. package/dist/verify/stall-detector-config.js.map +1 -1
  248. package/dist/worktree/state.d.ts +75 -1
  249. package/dist/worktree/state.d.ts.map +1 -1
  250. package/dist/worktree/state.js +89 -17
  251. package/dist/worktree/state.js.map +1 -1
  252. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"exit-classification.d.ts","sourceRoot":"","sources":["../../src/completion/exit-classification.ts"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtF;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAEjF;AAID,4DAA4D;AAC5D,MAAM,WAAW,sBAAsB;IACrC,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,UAAU,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,qBAAqB,EAAE,OAAO,CAAC;IAC/B;;;;;;;;;;;;OAYG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;;;;;OAOG;IACH,WAAW,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;CACjD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,cAAc,CAAC;IAC1B,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;CAClD,GAAG,sBAAsB,CAezB;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,sBAAsB,CAAC,aAAa,CAAC,EAClD,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,GAC/C,YAAY,GAAG,IAAI,CAgBrB"}
1
+ {"version":3,"file":"exit-classification.d.ts","sourceRoot":"","sources":["../../src/completion/exit-classification.ts"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtF;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAEjF;AAID,4DAA4D;AAC5D,MAAM,WAAW,sBAAsB;IACrC,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,UAAU,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,qBAAqB,EAAE,OAAO,CAAC;IAC/B;;;;;;;;;;;;OAYG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;;;;;OAOG;IACH,WAAW,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;CACjD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,cAAc,CAAC;IAC1B,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;CAClD,GAAG,sBAAsB,CAezB;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,sBAAsB,CAAC,aAAa,CAAC,EAClD,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,GAC/C,YAAY,CAsBd"}
@@ -56,7 +56,13 @@ export function classifyTeamExit(params) {
56
56
  export function deriveExitCategory(disposition, shutdownReason) {
57
57
  switch (disposition) {
58
58
  case 'completed':
59
- return shutdownReason === 'work_complete' ? 'work_complete' : null;
59
+ // A clean exit whose PASS continues is 'segment_complete', not null. It
60
+ // used to be null, which is how a close with no category stayed
61
+ // expressible at all -- and a categoryless row is decided on the
62
+ // dashboard by matching prose in exit_reason. It is deliberately NOT a
63
+ // member of PASS_ENDING_EXIT_CATEGORIES, so it still makes no readiness
64
+ // claim: the behaviour is unchanged, the reason for it is now declared.
65
+ return shutdownReason === 'work_complete' ? 'work_complete' : 'segment_complete';
60
66
  case 'stopped':
61
67
  switch (shutdownReason) {
62
68
  case 'no_actionable_work': return 'no_actionable_work';
@@ -1 +1 @@
1
- {"version":3,"file":"exit-classification.js","sourceRoot":"","sources":["../../src/completion/exit-classification.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,+EAA+E;AAC/E,oEAAoE;AACpE,sFAAsF;AACtF,8EAA8E;AAC9E,uEAAuE;AACvE,gBAAgB;AAahB;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,IAAmB,EAAE,MAAqB;IACtE,OAAO,MAAM,KAAK,SAAS,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC;AACrD,CAAC;AAgDD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAKhC;IACC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7D,MAAM,qBAAqB,GACzB,MAAM,CAAC,SAAS,KAAK,eAAe;QACpC,UAAU;QACV,MAAM,CAAC,cAAc,KAAK,eAAe,CAAC;IAC5C,MAAM,SAAS,GAAG,QAAQ,KAAK,CAAC,IAAI,qBAAqB,CAAC;IAC1D,8EAA8E;IAC9E,6EAA6E;IAC7E,2EAA2E;IAC3E,MAAM,cAAc,GAAG,MAAM,CAAC,SAAS,KAAK,eAAe,IAAI,UAAU,CAAC;IAC1E,MAAM,WAAW,GACf,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;IAClE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,qBAAqB,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC;AACjG,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAChC,WAAkD,EAClD,cAAgD;IAEhD,QAAQ,WAAW,EAAE,CAAC;QACpB,KAAK,WAAW;YACd,OAAO,cAAc,KAAK,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC;QACrE,KAAK,SAAS;YACZ,QAAQ,cAAc,EAAE,CAAC;gBACvB,KAAK,oBAAoB,CAAC,CAAC,OAAO,oBAAoB,CAAC;gBACvD,KAAK,aAAa,CAAC,CAAC,OAAO,aAAa,CAAC;gBACzC,KAAK,cAAc,CAAC,CAAC,OAAO,cAAc,CAAC;gBAC3C,KAAK,SAAS,CAAC,CAAC,OAAO,SAAS,CAAC;gBACjC,KAAK,UAAU,CAAC,CAAC,OAAO,UAAU,CAAC;gBACnC,OAAO,CAAC,CAAC,OAAO,SAAS,CAAC;YAC5B,CAAC;QACH,KAAK,QAAQ;YACX,OAAO,OAAO,CAAC;IACnB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"exit-classification.js","sourceRoot":"","sources":["../../src/completion/exit-classification.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,+EAA+E;AAC/E,oEAAoE;AACpE,sFAAsF;AACtF,8EAA8E;AAC9E,uEAAuE;AACvE,gBAAgB;AAahB;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,IAAmB,EAAE,MAAqB;IACtE,OAAO,MAAM,KAAK,SAAS,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC;AACrD,CAAC;AAgDD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAKhC;IACC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,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,UAAU,CAAC;gBACnC,OAAO,CAAC,CAAC,OAAO,SAAS,CAAC;YAC5B,CAAC;QACH,KAAK,QAAQ;YACX,OAAO,OAAO,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -1,12 +1,62 @@
1
- import { getFocusIssues, getFocusReviewFiledIssueIds, type clearReviewRequestedAt } from '../queries/focuses.js';
2
- import { type ReviewExitEscalationContext, type ReviewExitEscalationDeps, type ReviewFiledFindingSummary } from './review-exit-escalations.js';
1
+ /**
2
+ * The review-cycle BUDGET: count the review cycles a focus spends without
3
+ * converging, and at TELORA_REVIEW_CYCLE_CAP END THE ARMED RUN.
4
+ *
5
+ * WHAT ENDING THE RUN MEANS. The daemon releases the focus's assigned agent
6
+ * role -- the ONE state in which no team may run (spawn/null-role-spawn.ts
7
+ * focusMayRunTeam) -- and records WHY, durably, on the focus:
8
+ * arm_ended_reason = 'review_budget_spent', with the cycle count, the cap, the
9
+ * open blocking review-filed findings, and (added at the edge, which owns the
10
+ * shape they live in) the acceptance criteria the last verdict-bearing review
11
+ * called not_met. Nothing closes those issues: they stay open work. Only a NEW
12
+ * ARM grants further cycles, and the arm edge resets the count to 0 in the
13
+ * database (migration 20260920140801), so every arm writer grants a fresh
14
+ * budget without any of them knowing about this module.
15
+ *
16
+ * WHY NOT AN OBSERVATION. The previous crossing filed ONE
17
+ * review_cycle_cap_exceeded observation and HELD the spawn gates on it. The
18
+ * promotion sweep handed that observation to a routing decider, and on
19
+ * 2026-09-19/20 the decider granted three foci eight more cycles each within
20
+ * minutes of crossing; one ran 25 team spawns and ~$242 of coding spend with
21
+ * nothing merged, stopping only when the operator killed the daemon. A stop
22
+ * answered from inside the loop it is meant to stop is not a stop. The budget
23
+ * is a BACKSTOP, not the convergence mechanism, so it now ends the run and
24
+ * hands the decision back to a human at the only lever that grants cycles: the
25
+ * arm.
26
+ *
27
+ * What the count measures (recordReviewCycleAndMaybeEndArm, on every routed exit
28
+ * of a REVIEW session -- a routed coding exit, e.g. the open-work self-heal, is
29
+ * not a review cycle and leaves the count, the window and the arm alone):
30
+ * - a CONVERGED cycle -- a delivery reached done, nothing re-opened to
31
+ * verify_failed, and no open blocking review-filed finding is left on the
32
+ * focus -- resets it to 0. The budget measures consecutive unconverged
33
+ * cycles, not lifetime cycles, so a focus shipping many deliveries one clean
34
+ * review at a time never nears it.
35
+ * - any other routed cycle increments it. Below the budget nothing else
36
+ * happens, so cycling below it is unchanged.
37
+ * - at the budget: the count is written FIRST (so a failed un-arm still stops
38
+ * by count -- focus/review-cycle-cap-hold.ts), then the arm is released with
39
+ * its reason, then the review window is closed. The count is NOT reset: it
40
+ * is the fail-closed backstop for an un-arm write that did not land, and the
41
+ * arm edge is what clears it.
42
+ *
43
+ * A DAEMON SHUTDOWN SPENDS NOTHING. A review team killed by a shutdown exits
44
+ * with no inspection evidence, which routes exactly like a bounce -- so without
45
+ * this guard a restart cycle would burn budget a review never spent. The whole
46
+ * record is skipped while the daemon is shutting down: no climb, no reset, no
47
+ * un-arm.
48
+ *
49
+ * @module completion/review-cycle-cap
50
+ */
51
+ import { setReviewCycleCount, releaseFocusArm, type clearReviewRequestedAt } from '../queries/focuses.js';
52
+ import type { ReviewFiledFindingSummary } from './review-exit-escalations.js';
3
53
  /** The routed review exit's facts the cycle count is decided from. */
4
54
  export interface ReviewCycleOutcome {
5
55
  /**
6
56
  * The EXITING session's type. Only a review-session exit is a review cycle: a
7
57
  * coding exit that routes verify work (the open-work self-heal) can neither fail
8
58
  * nor converge a review's verdict, so it leaves the count untouched (no climb, no
9
- * reset), files nothing and closes no window. Absent counts, as the hand-off
59
+ * reset), closes no window and ends no arm. Absent counts, as the hand-off
10
60
  * breaker's absent sessionType does (recordHandoffAndMaybeTerminate): a caller
11
61
  * that cannot name its lineage must not be able to switch off the billing stop.
12
62
  */
@@ -22,41 +72,37 @@ export interface ReviewCycleOutcome {
22
72
  }
23
73
  /** Pure: whether a routed review exit converged -- it resets the count instead of climbing it. */
24
74
  export declare function reviewCycleConverged(outcome: Pick<ReviewCycleOutcome, 'convergedAny' | 'anyReopenedToVerifyFailed' | 'openBlockingFindings'>): boolean;
25
- /** Deps of the crossing: the escalation deps plus the window writer it closes. */
26
- export interface ReviewCycleCapDeps extends ReviewExitEscalationDeps {
27
- clearReviewRequestedAt: typeof clearReviewRequestedAt;
28
- }
29
75
  /**
30
- * Record one routed review cycle: reset on convergence, climb otherwise, and hold
31
- * the focus at the cap. Best-effort -- never aborts the routing that already ran.
32
- * A deps object without the count writer or the cap skips the whole cap.
76
+ * Deps of the budget. Every writer is injectable so the crossing can be driven
77
+ * in a test without a network; `isShuttingDown` too, because a shutdown must be
78
+ * assertable rather than reproducible.
33
79
  */
34
- export declare function recordReviewCycleAndMaybeHold(deps: ReviewCycleCapDeps, ctx: ReviewExitEscalationContext, priorCycleCount: number, outcome: ReviewCycleOutcome): Promise<void>;
35
- /**
36
- * File the review_cycle_cap_exceeded observation (at most one open per focus).
37
- * Returns whether one is now open (filed, or already open). NO_HUMAN_ACT: what the
38
- * unconverged findings need -- route, re-scope, descope -- is planning work an
39
- * agent performs; the hold is keyed on this observation's kind, not on an act.
40
- */
41
- export declare function fileReviewCycleCapObservation(deps: ReviewExitEscalationDeps, ctx: ReviewExitEscalationContext, args: {
42
- cycleCount: number;
43
- cap: number;
44
- openBlockingFindings: readonly ReviewFiledFindingSummary[];
45
- }): Promise<boolean>;
46
- /** Deps of the failed-filing re-file (real defaults; tests inject). */
47
- export interface ReviewCycleCapReconcileDeps extends ReviewExitEscalationDeps {
48
- getFocusIssues: typeof getFocusIssues;
49
- getFocusReviewFiledIssueIds: typeof getFocusReviewFiledIssueIds;
80
+ export interface ReviewCycleCapDeps {
81
+ setReviewCycleCount?: typeof setReviewCycleCount;
82
+ resolveReviewCycleCap?: () => number;
83
+ clearReviewRequestedAt: typeof clearReviewRequestedAt;
84
+ /**
85
+ * The un-arm writer (queries/focuses.ts releaseFocusArm), which carries the
86
+ * ended-arm record in the SAME edge call as the release. OPTIONAL in the type
87
+ * so a partial test deps object type-checks, but a deps object that omits it
88
+ * cannot stop the run -- so the crossing REFUSES to pretend: it logs that the
89
+ * arm was not ended and leaves the count at the budget, which holds every
90
+ * spawn gate by itself. defaultReviewExitDeps always supplies it (pinned by
91
+ * review-cycle-churn-meter.test.ts).
92
+ */
93
+ releaseFocusArm?: typeof releaseFocusArm;
94
+ isShuttingDown?: () => boolean;
50
95
  }
51
- /**
52
- * The failed-filing half, run by the cascade each poll: a focus whose count
53
- * stands at or past the cap is held by count; file (or find) its observation and
54
- * reset the count, so the routing decider has the observation to take and its
55
- * resolution lifts the hold. A no-op below the cap (no read). Best-effort.
56
- */
57
- export declare function reconcileReviewCycleCapFiling(ctx: {
58
- organizationId: string;
96
+ /** The focus this exit belongs to. */
97
+ export interface ReviewCycleCapContext {
59
98
  focusId: string;
60
99
  focusName: string;
61
- }, reviewCycleCount: number, deps?: ReviewCycleCapReconcileDeps): Promise<void>;
100
+ }
101
+ /**
102
+ * Record one routed review cycle: reset on convergence, climb otherwise, and at
103
+ * the budget end the armed run. Best-effort -- never aborts the routing that
104
+ * already ran. A deps object without the count writer or the budget value skips
105
+ * the whole budget.
106
+ */
107
+ export declare function recordReviewCycleAndMaybeEndArm(deps: ReviewCycleCapDeps, ctx: ReviewCycleCapContext, priorCycleCount: number, outcome: ReviewCycleOutcome): Promise<void>;
62
108
  //# sourceMappingURL=review-cycle-cap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"review-cycle-cap.d.ts","sourceRoot":"","sources":["../../src/completion/review-cycle-cap.ts"],"names":[],"mappings":"AA8CA,OAAO,EAAuB,cAAc,EAAE,2BAA2B,EAAE,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAItI,OAAO,EAEL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC/B,MAAM,8BAA8B,CAAC;AAMtC,sEAAsE;AACtE,MAAM,WAAW,kBAAkB;IACjC;;;;;;;OAOG;IACH,WAAW,CAAC,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,wBAAsB,+BAA+B,CACnD,IAAI,EAAE,kBAAkB,EACxB,GAAG,EAAE,qBAAqB,EAC1B,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAyDf"}
@@ -1,53 +1,8 @@
1
1
  // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
- // Pinned by: packages/daemon/src/completion/review-cycle-cap-regression.test.ts,
3
- // packages/daemon/src/completion/review-cycle-churn-meter.test.ts
2
+ // Pinned by: packages/daemon/src/completion/review-cycle-churn-meter.test.ts
4
3
  // PINNED-BY-END
5
- /**
6
- * The review-cycle cap: count the review cycles a focus spends without
7
- * converging, and at TELORA_REVIEW_CYCLE_CAP stop the loop.
8
- *
9
- * Replaces the churn METER that used to live in review-exit-escalations.ts. That
10
- * meter filed one review_cycle_cap_exceeded observation and let the loop keep
11
- * spawning; the hand-off breaker it deferred to never advances on a cycle that
12
- * files a new finding, so a non-converging loop billed passes until an operator
13
- * disarmed it (2026-09-15). Now the crossing holds every spawn gate
14
- * (focus/review-cycle-cap-hold.ts).
15
- *
16
- * What the count measures (recordReviewCycleAndMaybeHold, on every routed exit of
17
- * a REVIEW session -- a routed coding exit, e.g. the open-work self-heal, is not a
18
- * review cycle and leaves the count, the window and the filings alone):
19
- * - a CONVERGED cycle -- a delivery reached done, nothing re-opened to
20
- * verify_failed, and no open blocking review-filed finding is left on the
21
- * focus -- resets it to 0. The cap measures consecutive unconverged cycles,
22
- * not lifetime cycles, so a focus shipping many deliveries one clean review at
23
- * a time never nears it.
24
- * - any other routed cycle increments it. Below the cap nothing else happens:
25
- * the count's only reader is the hold, so cycling below the cap is unchanged.
26
- * - at the cap: the count is written first (a failed filing still holds by
27
- * count), the review window is closed, and ONE observation is filed
28
- * enumerating the open blocking review-filed findings. Nothing closes those
29
- * issues: they stay open work, and the observation carries them to the agent
30
- * routing decision (the promotion sweep hands a held focus's observations to
31
- * the routing decider). Once the observation is filed the count resets to 0,
32
- * so resolving it -- or, once a routing decider made it human-facing,
33
- * resolving that filing (focus/review-cycle-cap-hold.ts reads the lineage
34
- * carrier) -- lifts the hold, and a fresh cap of cycles is needed to re-cross:
35
- * the review_handoff_exhausted precedent.
36
- *
37
- * reconcileReviewCycleCapFiling is the failed-filing half: a focus whose count
38
- * stands at or past the cap with no observation filed would otherwise be held
39
- * with nothing for the routing decider to take. The cascade re-files each poll
40
- * until the filing lands.
41
- *
42
- * @module completion/review-cycle-cap
43
- */
44
- import { createEscalation, hasOpenFocusEscalation } from '../queries/escalations.js';
45
- import { setReviewCycleCount, getFocusIssues, getFocusReviewFiledIssueIds } from '../queries/focuses.js';
46
- import { resolveReviewCycleCap } from '../verify/stall-detector-config.js';
47
- import { NO_HUMAN_ACT } from '../queries/filing-observation.js';
48
- import { REVIEW_CYCLE_CAP_EXCEEDED_KIND } from '../focus/review-cycle-cap-hold.js';
49
- import { fileDedupedFocusEscalation, } from './review-exit-escalations.js';
50
- import { filterBlockingReviewFiledComplete } from './review-defect-detector.js';
4
+ import { ARM_ENDED_REVIEW_BUDGET_SPENT } from '../queries/ended-arm.js';
5
+ import { isDaemonShuttingDown } from '../shell/shutdown-state.js';
51
6
  import { createLogger } from '../shell/log.js';
52
7
  const log = createLogger({ module: 'focus-executor' });
53
8
  /** Pure: whether a routed review exit converged -- it resets the count instead of climbing it. */
@@ -66,13 +21,47 @@ async function writeCycleCount(setCount, ctx, count) {
66
21
  }
67
22
  }
68
23
  /**
69
- * Record one routed review cycle: reset on convergence, climb otherwise, and hold
70
- * the focus at the cap. Best-effort -- never aborts the routing that already ran.
71
- * A deps object without the count writer or the cap skips the whole cap.
24
+ * End the armed run: release the role and record WHY, atomically, in one edge
25
+ * call. Returns whether the write landed -- a failure leaves the count standing
26
+ * at the budget, which is what holds the spawn gates until the write succeeds on
27
+ * a later crossing or an operator acts.
72
28
  */
73
- export async function recordReviewCycleAndMaybeHold(deps, ctx, priorCycleCount, outcome) {
29
+ async function endArmForSpentBudget(release, ctx, args) {
30
+ try {
31
+ await release(ctx.focusId, {
32
+ reason: ARM_ENDED_REVIEW_BUDGET_SPENT,
33
+ detail: {
34
+ reviewCycleCount: args.cycleCount,
35
+ cap: args.cap,
36
+ openBlockingFindings: args.openBlockingFindings.map((f) => ({
37
+ id: f.id, key: f.key, title: f.title, deliveryId: f.deliveryId ?? null,
38
+ })),
39
+ },
40
+ });
41
+ return true;
42
+ }
43
+ catch (err) {
44
+ log.warn(`[focus-executor] releaseFocusArm (review budget) failed for "${ctx.focusName}": ${err.message}`);
45
+ return false;
46
+ }
47
+ }
48
+ /**
49
+ * Record one routed review cycle: reset on convergence, climb otherwise, and at
50
+ * the budget end the armed run. Best-effort -- never aborts the routing that
51
+ * already ran. A deps object without the count writer or the budget value skips
52
+ * the whole budget.
53
+ */
54
+ export async function recordReviewCycleAndMaybeEndArm(deps, ctx, priorCycleCount, outcome) {
74
55
  if (!deps.setReviewCycleCount || !deps.resolveReviewCycleCap)
75
56
  return;
57
+ // A shutdown is not a review cycle. The teams it kills exit as clean reviews
58
+ // with no inspection evidence, which routes like a bounce -- counting those
59
+ // would let a restart spend a budget no review ever spent.
60
+ if ((deps.isShuttingDown ?? isDaemonShuttingDown)()) {
61
+ log.info(`[focus-executor] "${ctx.focusName}" review exit observed during daemon shutdown -- ` +
62
+ `review-cycle count left at ${priorCycleCount} (a shutdown spends no budget).`);
63
+ return;
64
+ }
76
65
  // MEASURE, don't assume: only a review-session exit moves the count (ReviewCycleOutcome.sessionType).
77
66
  if (outcome.sessionType && outcome.sessionType !== 'review') {
78
67
  log.info(`[focus-executor] "${ctx.focusName}" ${outcome.sessionType} session exit routed -- not a review pass; ` +
@@ -86,95 +75,34 @@ export async function recordReviewCycleAndMaybeHold(deps, ctx, priorCycleCount,
86
75
  }
87
76
  const cycleCount = priorCycleCount + 1;
88
77
  const cap = deps.resolveReviewCycleCap();
89
- // Durable first: if the filing below fails, count >= cap is what holds.
78
+ // Durable first: if the un-arm below fails, count >= cap is what stops the run.
90
79
  await writeCycleCount(deps.setReviewCycleCount, ctx, cycleCount);
91
80
  if (cycleCount < cap)
92
81
  return;
93
- // Close the window (as the hand-off breaker does) unless a delivery awaits its
94
- // gate verdict -- that replay converges without a spawn and needs the window.
82
+ // The arm goes FIRST, before the window. Closing the review window fires
83
+ // clear_focus_team_on_review_window_close(), which nulls the role WITHOUT a
84
+ // reason -- so a focus disarmed by that trigger would read as a lifecycle
85
+ // clear. Releasing the arm here means the trigger finds the role already null
86
+ // and the recorded reason stands.
87
+ const armEnded = deps.releaseFocusArm
88
+ ? await endArmForSpentBudget(deps.releaseFocusArm, ctx, { cycleCount, cap, openBlockingFindings: outcome.openBlockingFindings })
89
+ : false;
90
+ // Close the window unless a delivery awaits its gate verdict -- that replay
91
+ // converges without a spawn and needs the window.
95
92
  if (!outcome.verdictHeldAny) {
96
93
  try {
97
94
  await deps.clearReviewRequestedAt(ctx.focusId);
98
95
  }
99
96
  catch (err) {
100
- log.warn(`[focus-executor] clearReviewRequestedAt (review-cycle cap) failed for "${ctx.focusName}": ${err.message}`);
97
+ log.warn(`[focus-executor] clearReviewRequestedAt (review budget) failed for "${ctx.focusName}": ${err.message}`);
101
98
  }
102
99
  }
103
- const filed = await fileReviewCycleCapObservation(deps, ctx, { cycleCount, cap, openBlockingFindings: outcome.openBlockingFindings });
104
- if (filed)
105
- await writeCycleCount(deps.setReviewCycleCount, ctx, 0);
106
- log.warn(`[focus-executor] "${ctx.focusName}" reached its review-cycle cap without converging (${cycleCount} >= cap ${cap}): ` +
107
- `spawns held, review window ${outcome.verdictHeldAny ? 'left open for a pending gate verdict' : 'closed'}, ` +
108
- (filed ? 'observation filed and count reset to 0.' : 'observation NOT filed -- the count holds and the cascade re-files it.'));
109
- }
110
- /**
111
- * File the review_cycle_cap_exceeded observation (at most one open per focus).
112
- * Returns whether one is now open (filed, or already open). NO_HUMAN_ACT: what the
113
- * unconverged findings need -- route, re-scope, descope -- is planning work an
114
- * agent performs; the hold is keyed on this observation's kind, not on an act.
115
- */
116
- export async function fileReviewCycleCapObservation(deps, ctx, args) {
117
- const findings = args.openBlockingFindings;
118
- const findingsBlock = findings.length > 0
119
- ? `\n\nMEASURED: ${findings.length} open blocking review-filed finding(s) remain on this focus, still open ` +
120
- `(the daemon closed none):\n` +
121
- findings.map(f => ` - ${f.key} (${f.id}): ${f.title}${f.deliveryId ? ` (delivery ${f.deliveryId})` : ''}`).join('\n')
122
- : `\n\nMEASURED: 0 open blocking review-filed findings on this focus at the capped exit -- the cycles ` +
123
- `failed to converge for another reason (e.g. uninspected reviews or deliveries re-opening).`;
124
- return fileDedupedFocusEscalation(deps, ctx, {
125
- escalationKind: REVIEW_CYCLE_CAP_EXCEEDED_KIND,
126
- label: 'review-cycle-cap',
127
- description: `Focus "${ctx.focusName}" completed ${args.cycleCount} review cycle(s) without converging ` +
128
- `(cap ${args.cap}, TELORA_REVIEW_CYCLE_CAP). The daemon has STOPPED its review loop: the review ` +
129
- `window is closed and no coding or review pass spawns while this observation is open.` +
130
- findingsBlock +
131
- `\n\nDecide what the unconverged findings need -- route or re-scope them onto a delivery, descope ` +
132
- `them, or re-scope the focus -- then resolve this observation. Resolving it lifts the hold and the ` +
133
- `focus gets a fresh ${args.cap} review cycles; a focus that converges retires it automatically. ` +
134
- `If what they need is an act only a human can perform, a filing made human-facing from this ` +
135
- `observation (sourceEscalationId naming it) keeps the hold standing until THAT filing is resolved.`,
136
- humanAct: NO_HUMAN_ACT,
137
- metadata: {
138
- review_cycle_count: args.cycleCount,
139
- cap: args.cap,
140
- routed_via: 'review_cycle_cap_hold',
141
- holds_spawns: true,
142
- open_blocking_review_filed_count: findings.length,
143
- open_blocking_review_filed_findings: findings.map(f => ({ key: f.key, id: f.id, delivery_id: f.deliveryId })),
144
- terminates_when: 'focus_converged',
145
- },
146
- });
147
- }
148
- const defaultReconcileDeps = {
149
- createEscalation,
150
- hasOpenFocusEscalation,
151
- setReviewCycleCount,
152
- resolveReviewCycleCap,
153
- getFocusIssues,
154
- getFocusReviewFiledIssueIds,
155
- };
156
- /**
157
- * The failed-filing half, run by the cascade each poll: a focus whose count
158
- * stands at or past the cap is held by count; file (or find) its observation and
159
- * reset the count, so the routing decider has the observation to take and its
160
- * resolution lifts the hold. A no-op below the cap (no read). Best-effort.
161
- */
162
- export async function reconcileReviewCycleCapFiling(ctx, reviewCycleCount, deps = defaultReconcileDeps) {
163
- const cap = (deps.resolveReviewCycleCap ?? resolveReviewCycleCap)();
164
- if (reviewCycleCount < cap || !deps.setReviewCycleCount)
165
- return;
166
- let openBlockingFindings = [];
167
- try {
168
- const [issues, reviewFiledIds] = await Promise.all([deps.getFocusIssues(ctx.focusId), deps.getFocusReviewFiledIssueIds(ctx.focusId)]);
169
- openBlockingFindings = filterBlockingReviewFiledComplete(issues, new Set(reviewFiledIds), null)
170
- .map(i => ({ id: i.id, key: i.key, title: i.title, deliveryId: i.deliveryId ?? null, description: i.description ?? null }));
171
- }
172
- catch (err) {
173
- log.warn(`[focus-executor] review-cycle cap re-file could not read findings for "${ctx.focusName}": ${err.message}`);
174
- }
175
- const filed = await fileReviewCycleCapObservation(deps, { ...ctx, sessionId: '' }, { cycleCount: reviewCycleCount, cap, openBlockingFindings });
176
- if (filed && await writeCycleCount(deps.setReviewCycleCount, ctx, 0)) {
177
- log.info(`[focus-executor] "${ctx.focusName}" review-cycle cap observation re-filed (count ${reviewCycleCount} >= cap ${cap}); count reset to 0.`);
178
- }
100
+ log.warn(`[focus-executor] "${ctx.focusName}" spent its review-cycle budget without converging (${cycleCount} >= cap ${cap}): ` +
101
+ (armEnded
102
+ ? `the armed run has ENDED -- the focus is un-armed with arm_ended_reason='review_budget_spent' ` +
103
+ `(${outcome.openBlockingFindings.length} open blocking review-filed finding(s), none closed). Only a new arm grants further cycles.`
104
+ : `the arm was NOT ended (${deps.releaseFocusArm ? 'the release write failed' : 'no release writer was supplied'}) -- ` +
105
+ `the count stands at the budget, which holds every spawn gate until a release lands or the focus is re-armed.`) +
106
+ ` Review window ${outcome.verdictHeldAny ? 'left open for a pending gate verdict' : 'closed'}.`);
179
107
  }
180
108
  //# sourceMappingURL=review-cycle-cap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"review-cycle-cap.js","sourceRoot":"","sources":["../../src/completion/review-cycle-cap.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,iFAAiF;AACjF,oEAAoE;AACpE,gBAAgB;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,2BAA2B,EAA+B,MAAM,uBAAuB,CAAC;AACtI,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AACnF,OAAO,EACL,0BAA0B,GAI3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAuBvD,kGAAkG;AAClG,MAAM,UAAU,oBAAoB,CAAC,OAAwG;IAC3I,OAAO,OAAO,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,yBAAyB,IAAI,OAAO,CAAC,oBAAoB,CAAC,MAAM,KAAK,CAAC,CAAC;AACjH,CAAC;AAOD,0DAA0D;AAC1D,KAAK,UAAU,eAAe,CAC5B,QAAoC,EACpC,GAA2C,EAC3C,KAAa;IAEb,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACnC,OAAO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AC,0BAA0B,CAAC,CAAC,CAAC,gCAAgC,OAAO;gBACrH,8GAA8G,CAAC;QACnH,kBAAkB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC,QAAQ,GAAG,CAChG,CAAC;AACJ,CAAC"}
@@ -15,7 +15,7 @@ import { type ReviewWindowCommit } from '../resolvers/shared/review-window-commi
15
15
  import { getActiveFocuses } from '../queries/focus-discovery.js';
16
16
  import { hasPendingSpawnDirective } from '../directive/directive-queue.js';
17
17
  import { emitLoopTrigger } from '../loops/index.js';
18
- import { getFocusDeliveries, getFocusIssues, clearReviewRequestedAt, setReviewCycleCount, setReviewHandoffCount, getFocusReviewReportForSession, getFocusReviewFiledIssueIds } from '../queries/focuses.js';
18
+ import { getFocusDeliveries, getFocusIssues, clearReviewRequestedAt, releaseFocusArm, setReviewCycleCount, setReviewHandoffCount, getFocusReviewReportForSession, getFocusReviewFiledIssueIds } from '../queries/focuses.js';
19
19
  import { resolveReviewCycleCap, resolveReviewHandoffCap } from '../verify/stall-detector-config.js';
20
20
  import { getDeliveryIssues, rehomeIssueToDelivery } from '../queries/issues.js';
21
21
  import { createEscalation, hasOpenFocusEscalation, hasOpenEscalationForDelivery } from '../queries/escalations.js';
@@ -57,6 +57,8 @@ export interface ReviewExitDeps {
57
57
  setReviewedThroughSha: (focusId: string, sha: string) => Promise<void>;
58
58
  setReviewCycleCount?: typeof setReviewCycleCount;
59
59
  resolveReviewCycleCap?: typeof resolveReviewCycleCap;
60
+ releaseFocusArm?: typeof releaseFocusArm;
61
+ isShuttingDown?: () => boolean;
60
62
  setReviewHandoffCount?: typeof setReviewHandoffCount;
61
63
  resolveReviewHandoffCap?: typeof resolveReviewHandoffCap;
62
64
  resolveHandoffExhaustedHold?: (focusId: string, notes: string) => Promise<number>;
@@ -1 +1 @@
1
- {"version":3,"file":"review-exit-deps.d.ts","sourceRoot":"","sources":["../../src/completion/review-exit-deps.ts"],"names":[],"mappings":"AAKA;;;;;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AAqB,EAAE,cA+CnC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  // PINNED-BY-BEGIN (generated by gen:pinned-by -- do not hand-edit; checked by lint:pinned-by)
2
2
  // Pinned by: packages/daemon/src/completion/review-coverage-seam.test.ts,
3
+ // packages/daemon/src/completion/review-cycle-churn-meter.test.ts,
3
4
  // packages/daemon/src/integration/failed-verdict-review-exit-respawn-regression.test.ts
4
5
  // PINNED-BY-END
5
6
  /**
@@ -20,7 +21,7 @@ import { blameLineCommits, listReviewWindowCommits } from '../resolvers/shared/r
20
21
  import { getActiveFocuses } from '../queries/focus-discovery.js';
21
22
  import { clearPendingReviewDirective, hasPendingSpawnDirective } from '../directive/directive-queue.js';
22
23
  import { emitLoopTrigger } from '../loops/index.js';
23
- import { getFocusDeliveries, getFocusIssues, clearReviewRequestedAt, setReviewCycleCount, setReviewHandoffCount, getFocusReviewReportForSession, getFocusReviewFiledIssueIds, } from '../queries/focuses.js';
24
+ import { getFocusDeliveries, getFocusIssues, clearReviewRequestedAt, releaseFocusArm, setReviewCycleCount, setReviewHandoffCount, getFocusReviewReportForSession, getFocusReviewFiledIssueIds, } from '../queries/focuses.js';
24
25
  import { resolveReviewCycleCap, resolveReviewHandoffCap } from '../verify/stall-detector-config.js';
25
26
  import { getDeliveryIssues, rehomeIssueToDelivery } from '../queries/issues.js';
26
27
  import { createEscalation, hasOpenFocusEscalation, hasOpenEscalationForDelivery, resolveOpenFocusEscalationsOfKind, resolveConvergedFocusEscalations } from '../queries/escalations.js';
@@ -51,6 +52,7 @@ export const defaultReviewExitDeps = {
51
52
  setReviewedThroughSha: stampReviewCoverage,
52
53
  setReviewCycleCount,
53
54
  resolveReviewCycleCap,
55
+ releaseFocusArm,
54
56
  setReviewHandoffCount,
55
57
  resolveReviewHandoffCap,
56
58
  resolveHandoffExhaustedHold: (focusId, notes) => resolveOpenFocusEscalationsOfKind(focusId, 'review_handoff_exhausted', 'agent_session', notes),
@@ -1 +1 @@
1
- {"version":3,"file":"review-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,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;;;;OAYG;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAMD,OAAO,EACL,iCAAiC,EACjC,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AAEnC,gGAAgG;AAChG,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAMnE;AAyBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,gBAAgB,EACxB,IAAI,GAAE,cAAsC,GAC3C,OAAO,CAAC,IAAI,CAAC,CA+lBf"}
@@ -19,7 +19,7 @@ import { resolveOperatorHold, writeOperatorHoldGateState, describeOperatorHold }
19
19
  import { resolveExternalHold, makeDeferredRequestClosureEvaluator, describeExternalHold } from '../delivery/external-hold.js';
20
20
  import { surfaceStaleReferenceLessExternalHold } from '../delivery/external-hold-surface.js';
21
21
  import { resolveShortfallHold, writeShortfallGateState, describeShortfallHold, } from './review-exit-shortfall.js';
22
- import { recordReviewCycleAndMaybeHold } from './review-cycle-cap.js';
22
+ import { recordReviewCycleAndMaybeEndArm } from './review-cycle-cap.js';
23
23
  import { fileCoverageIncompleteEscalation, fileGapsWithoutIssueEscalation, fileMissingReportNotice, recordHandoffAndMaybeTerminate, } from './review-exit-escalations.js';
24
24
  import { forceFullPassReviewFocuses, recordBelowCoverageDrift, resetCoverageDriftState } from './coverage-drift-state.js';
25
25
  import { resolveReviewCycleProgress, emitReviewCompleted, logLeftInVerifyWithoutSignal } from './review-exit-progress.js';
@@ -499,9 +499,10 @@ export async function runReviewExitHandler(params, deps = defaultReviewExitDeps)
499
499
  sessionType,
500
500
  openBlockingFindings,
501
501
  });
502
- // Review-cycle cap (review-cycle-cap.ts): a converged review cycle resets the count; an unconverged one climbs it,
503
- // and at the cap closes the window and holds every spawn gate. A coding exit touches none of it. Best-effort.
504
- await recordReviewCycleAndMaybeHold(deps, escalationCtx, current.review_cycle_count ?? 0, { convergedAny, anyReopenedToVerifyFailed, verdictHeldAny, openBlockingFindings, sessionType });
502
+ // Review-cycle BUDGET (review-cycle-cap.ts): a converged review cycle resets the count; an unconverged one
503
+ // climbs it, and at the budget the armed run ENDS -- the focus is un-armed with a recorded reason, so only a
504
+ // new arm grants further cycles. A coding exit touches none of it. Best-effort.
505
+ await recordReviewCycleAndMaybeEndArm(deps, escalationCtx, current.review_cycle_count ?? 0, { convergedAny, anyReopenedToVerifyFailed, verdictHeldAny, openBlockingFindings, sessionType });
505
506
  emitReviewCompleted(deps, escalationCtx, {
506
507
  gapsWithoutIssue, reportExists, hasBlockingIssueEvidence, sessionType, succeeded, reviewInspected,
507
508
  });