@nanobpm/nano-workforce 0.99.0 → 0.100.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/app/agentCompletion.test.ts +92 -6
  3. package/app/agentCompletion.ts +86 -58
  4. package/app/convergeGate.test.ts +8 -4
  5. package/app/convergenceEscalationGuard.test.ts +106 -0
  6. package/app/feature.ts +15 -166
  7. package/app/featureGateway.test.ts +6 -57
  8. package/app/persist-escalation.test.ts +32 -0
  9. package/app/pollUserTasks.test.ts +39 -13
  10. package/app/roundProgress.test.ts +7 -4
  11. package/app/service.ts +60 -132
  12. package/app/stage.test.ts +7 -53
  13. package/app/stage.ts +5 -37
  14. package/app/userTasks.test.ts +1 -1
  15. package/app/userTasks.ts +3 -3
  16. package/db/migrations/049_drop_feature_escalation_surface.sql +25 -0
  17. package/e2e/feature-run.e2e.ts +52 -41
  18. package/e2e/retire-escalation-subsystem.e2e.ts +26 -0
  19. package/openapi.yaml +7 -108
  20. package/operations/agentCompleteEscalation.ts +2 -2
  21. package/operations/completeUserTask.test.ts +25 -6
  22. package/operations/completeUserTask.ts +12 -10
  23. package/package.json +2 -2
  24. package/pages/feature.page.json +1 -37
  25. package/pages/overview.page.json +1 -39
  26. package/pages/tasks.page.json +78 -93
  27. package/resources/forms/feature-escalation.form +3 -0
  28. package/resources/processes/convergence-loop.bpmn +114 -118
  29. package/workers/persist-escalation/worker.ts +7 -4
  30. package/workers/record-blocked-ack/worker.test.ts +1 -4
  31. package/workers/record-blocked-ack/worker.ts +0 -5
  32. package/workers/record-feature/worker.ts +0 -6
  33. package/workers/record-feature-escalation/worker.test.ts +14 -27
  34. package/workers/record-feature-escalation/worker.ts +16 -22
  35. package/app/featureBlocked.test.ts +0 -182
  36. package/app/featureEscalation.test.ts +0 -235
  37. package/operations/acknowledgeBlocked.test.ts +0 -111
  38. package/operations/acknowledgeBlocked.ts +0 -62
  39. package/operations/answerFeatureEscalation.ts +0 -68
@@ -161,7 +161,7 @@
161
161
  </zeebe:ioMapping>
162
162
  </bpmn:extensionElements>
163
163
  <bpmn:incoming>f_noProgress</bpmn:incoming>
164
- <bpmn:outgoing>f_noprogressWait</bpmn:outgoing>
164
+ <bpmn:outgoing>f_noprogressGate</bpmn:outgoing>
165
165
  </bpmn:serviceTask>
166
166
  <bpmn:eventBasedGateway id="gw-review-wait" name="review ready or timeout?">
167
167
  <bpmn:incoming>f_progressOk</bpmn:incoming>
@@ -199,7 +199,7 @@
199
199
  </zeebe:ioMapping>
200
200
  </bpmn:extensionElements>
201
201
  <bpmn:incoming>f_reviewStalled</bpmn:incoming>
202
- <bpmn:outgoing>f_stalledWait</bpmn:outgoing>
202
+ <bpmn:outgoing>f_stalledGate</bpmn:outgoing>
203
203
  </bpmn:serviceTask>
204
204
  <bpmn:serviceTask id="persist-escalation" name="Record escalation">
205
205
  <bpmn:extensionElements>
@@ -214,6 +214,10 @@
214
214
  </bpmn:serviceTask>
215
215
  <bpmn:exclusiveGateway id="gw-escalated" name="escalation opened?" default="f_escReenter">
216
216
  <bpmn:incoming>f_escGate</bpmn:incoming>
217
+ <bpmn:incoming>f_noprogressGate</bpmn:incoming>
218
+ <bpmn:incoming>f_stalledGate</bpmn:incoming>
219
+ <bpmn:incoming>f_blockedGate</bpmn:incoming>
220
+ <bpmn:incoming>f_maxGate</bpmn:incoming>
217
221
  <bpmn:outgoing>f_escWait</bpmn:outgoing>
218
222
  <bpmn:outgoing>f_escReenter</bpmn:outgoing>
219
223
  </bpmn:exclusiveGateway>
@@ -230,7 +234,7 @@
230
234
  </zeebe:ioMapping>
231
235
  </bpmn:extensionElements>
232
236
  <bpmn:incoming>f_guardMax</bpmn:incoming>
233
- <bpmn:outgoing>f_maxWait</bpmn:outgoing>
237
+ <bpmn:outgoing>f_maxGate</bpmn:outgoing>
234
238
  </bpmn:serviceTask>
235
239
  <bpmn:userTask id="wait-answer" name="Answer escalation">
236
240
  <bpmn:extensionElements>
@@ -242,10 +246,6 @@
242
246
  </zeebe:ioMapping>
243
247
  </bpmn:extensionElements>
244
248
  <bpmn:incoming>f_escWait</bpmn:incoming>
245
- <bpmn:incoming>f_maxWait</bpmn:incoming>
246
- <bpmn:incoming>f_stalledWait</bpmn:incoming>
247
- <bpmn:incoming>f_noprogressWait</bpmn:incoming>
248
- <bpmn:incoming>f_blockedWait</bpmn:incoming>
249
249
  <bpmn:outgoing>f_answerRecord</bpmn:outgoing>
250
250
  </bpmn:userTask>
251
251
  <bpmn:serviceTask id="record-answer" name="Record answer">
@@ -302,7 +302,7 @@
302
302
  </zeebe:ioMapping>
303
303
  </bpmn:extensionElements>
304
304
  <bpmn:incoming>f_convergeBlocked</bpmn:incoming>
305
- <bpmn:outgoing>f_blockedWait</bpmn:outgoing>
305
+ <bpmn:outgoing>f_blockedGate</bpmn:outgoing>
306
306
  </bpmn:serviceTask>
307
307
  <bpmn:endEvent id="End" name="Converged">
308
308
  <bpmn:incoming>f_finalize</bpmn:incoming>
@@ -317,7 +317,7 @@
317
317
  <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=convergeBlocked = true</bpmn:conditionExpression>
318
318
  </bpmn:sequenceFlow>
319
319
  <bpmn:sequenceFlow id="f_convergeOk" name="addressed / default" sourceRef="gw-converge-gate" targetRef="persist-converged" />
320
- <bpmn:sequenceFlow id="f_blockedWait" sourceRef="persist-escalation-blockedcomments" targetRef="wait-answer" />
320
+ <bpmn:sequenceFlow id="f_blockedGate" sourceRef="persist-escalation-blockedcomments" targetRef="gw-escalated" />
321
321
  <bpmn:sequenceFlow id="f_addressed" name="addressed / default" sourceRef="gw-status" targetRef="gw-guard" />
322
322
  <bpmn:sequenceFlow id="f_waiting" name="waiting" sourceRef="gw-status" targetRef="gw-guard">
323
323
  <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=status = "waiting"</bpmn:conditionExpression>
@@ -335,18 +335,18 @@
335
335
  <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=progressed = false</bpmn:conditionExpression>
336
336
  </bpmn:sequenceFlow>
337
337
  <bpmn:sequenceFlow id="f_progressOk" name="progress / default" sourceRef="gw-progress" targetRef="gw-review-wait" />
338
- <bpmn:sequenceFlow id="f_noprogressWait" sourceRef="persist-escalation-noprogress" targetRef="wait-answer" />
338
+ <bpmn:sequenceFlow id="f_noprogressGate" sourceRef="persist-escalation-noprogress" targetRef="gw-escalated" />
339
339
  <bpmn:sequenceFlow id="f_toReviewWait" sourceRef="gw-review-wait" targetRef="wait-review" />
340
340
  <bpmn:sequenceFlow id="f_toReviewTimeout" sourceRef="gw-review-wait" targetRef="wait-review-timeout" />
341
341
  <bpmn:sequenceFlow id="f_reviewLoop" sourceRef="wait-review" targetRef="review-round" />
342
342
  <bpmn:sequenceFlow id="f_reviewStalled" sourceRef="wait-review-timeout" targetRef="persist-review-stalled" />
343
- <bpmn:sequenceFlow id="f_stalledWait" sourceRef="persist-review-stalled" targetRef="wait-answer" />
343
+ <bpmn:sequenceFlow id="f_stalledGate" sourceRef="persist-review-stalled" targetRef="gw-escalated" />
344
344
  <bpmn:sequenceFlow id="f_escGate" sourceRef="persist-escalation" targetRef="gw-escalated" />
345
345
  <bpmn:sequenceFlow id="f_escWait" sourceRef="gw-escalated" targetRef="wait-answer">
346
346
  <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=escalated = true</bpmn:conditionExpression>
347
347
  </bpmn:sequenceFlow>
348
348
  <bpmn:sequenceFlow id="f_escReenter" name="no escalation opened" sourceRef="gw-escalated" targetRef="gw-guard" />
349
- <bpmn:sequenceFlow id="f_maxWait" sourceRef="persist-escalation-maxrounds" targetRef="wait-answer" />
349
+ <bpmn:sequenceFlow id="f_maxGate" sourceRef="persist-escalation-maxrounds" targetRef="gw-escalated" />
350
350
  <bpmn:sequenceFlow id="f_answerRecord" sourceRef="wait-answer" targetRef="record-answer" />
351
351
  <bpmn:sequenceFlow id="f_answerLoop" sourceRef="record-answer" targetRef="review-round" />
352
352
  <bpmn:sequenceFlow id="f_finalize" sourceRef="persist-converged" targetRef="End" />
@@ -369,84 +369,84 @@
369
369
  </bpmndi:BPMNLabel>
370
370
  </bpmndi:BPMNShape>
371
371
  <bpmndi:BPMNShape id="BPMNShape_gw-guard" bpmnElement="gw-guard" isMarkerVisible="true">
372
- <dc:Bounds x="941" y="415" width="50" height="50" />
372
+ <dc:Bounds x="591" y="415" width="50" height="50" />
373
373
  <bpmndi:BPMNLabel>
374
- <dc:Bounds x="924" y="470" width="85" height="14" />
374
+ <dc:Bounds x="574" y="470" width="85" height="14" />
375
375
  </bpmndi:BPMNLabel>
376
376
  </bpmndi:BPMNShape>
377
377
  <bpmndi:BPMNShape id="BPMNShape_persist-round" bpmnElement="persist-round">
378
- <dc:Bounds x="1116" y="400" width="100" height="80" />
378
+ <dc:Bounds x="766" y="400" width="100" height="80" />
379
379
  </bpmndi:BPMNShape>
380
380
  <bpmndi:BPMNShape id="BPMNShape_check-progress" bpmnElement="check-progress">
381
- <dc:Bounds x="1316" y="400" width="100" height="80" />
381
+ <dc:Bounds x="966" y="400" width="100" height="80" />
382
382
  </bpmndi:BPMNShape>
383
383
  <bpmndi:BPMNShape id="BPMNShape_gw-progress" bpmnElement="gw-progress" isMarkerVisible="true">
384
- <dc:Bounds x="1516" y="415" width="50" height="50" />
384
+ <dc:Bounds x="1166" y="415" width="50" height="50" />
385
385
  <bpmndi:BPMNLabel>
386
- <dc:Bounds x="1511" y="382" width="60" height="28" />
386
+ <dc:Bounds x="1161" y="382" width="60" height="28" />
387
387
  </bpmndi:BPMNLabel>
388
388
  </bpmndi:BPMNShape>
389
389
  <bpmndi:BPMNShape id="BPMNShape_persist-escalation-noprogress" bpmnElement="persist-escalation-noprogress">
390
- <dc:Bounds x="1666" y="720" width="100" height="80" />
390
+ <dc:Bounds x="1316" y="720" width="100" height="80" />
391
391
  </bpmndi:BPMNShape>
392
392
  <bpmndi:BPMNShape id="BPMNShape_gw-review-wait" bpmnElement="gw-review-wait" isMarkerVisible="true">
393
- <dc:Bounds x="1691" y="415" width="50" height="50" />
393
+ <dc:Bounds x="1341" y="415" width="50" height="50" />
394
394
  <bpmndi:BPMNLabel>
395
- <dc:Bounds x="1672" y="382" width="88" height="28" />
395
+ <dc:Bounds x="1322" y="382" width="88" height="28" />
396
396
  </bpmndi:BPMNLabel>
397
397
  </bpmndi:BPMNShape>
398
398
  <bpmndi:BPMNShape id="BPMNShape_wait-review" bpmnElement="wait-review">
399
- <dc:Bounds x="1866" y="422" width="36" height="36" />
399
+ <dc:Bounds x="1516" y="422" width="36" height="36" />
400
400
  <bpmndi:BPMNLabel>
401
- <dc:Bounds x="1840" y="389" width="88" height="28" />
401
+ <dc:Bounds x="1490" y="389" width="88" height="28" />
402
402
  </bpmndi:BPMNLabel>
403
403
  </bpmndi:BPMNShape>
404
404
  <bpmndi:BPMNShape id="BPMNShape_wait-review-timeout" bpmnElement="wait-review-timeout">
405
- <dc:Bounds x="1866" y="582" width="36" height="36" />
405
+ <dc:Bounds x="1516" y="582" width="36" height="36" />
406
406
  <bpmndi:BPMNLabel>
407
- <dc:Bounds x="1856" y="623" width="56" height="42" />
407
+ <dc:Bounds x="1506" y="623" width="56" height="42" />
408
408
  </bpmndi:BPMNLabel>
409
409
  </bpmndi:BPMNShape>
410
410
  <bpmndi:BPMNShape id="BPMNShape_persist-review-stalled" bpmnElement="persist-review-stalled">
411
- <dc:Bounds x="2002" y="560" width="100" height="80" />
411
+ <dc:Bounds x="1652" y="560" width="100" height="80" />
412
412
  </bpmndi:BPMNShape>
413
413
  <bpmndi:BPMNShape id="BPMNShape_persist-escalation" bpmnElement="persist-escalation">
414
- <dc:Bounds x="566" y="560" width="100" height="80" />
414
+ <dc:Bounds x="566" y="1040" width="100" height="80" />
415
415
  </bpmndi:BPMNShape>
416
416
  <bpmndi:BPMNShape id="BPMNShape_gw-escalated" bpmnElement="gw-escalated" isMarkerVisible="true">
417
- <dc:Bounds x="766" y="575" width="50" height="50" />
417
+ <dc:Bounds x="1852" y="255" width="50" height="50" />
418
418
  <bpmndi:BPMNLabel>
419
- <dc:Bounds x="821" y="586" width="74" height="28" />
419
+ <dc:Bounds x="1760" y="290" width="74" height="28" />
420
420
  </bpmndi:BPMNLabel>
421
421
  </bpmndi:BPMNShape>
422
422
  <bpmndi:BPMNShape id="BPMNShape_persist-escalation-maxrounds" bpmnElement="persist-escalation-maxrounds">
423
- <dc:Bounds x="1116" y="880" width="100" height="80" />
423
+ <dc:Bounds x="766" y="880" width="100" height="80" />
424
424
  </bpmndi:BPMNShape>
425
425
  <bpmndi:BPMNShape id="BPMNShape_wait-answer" bpmnElement="wait-answer">
426
- <dc:Bounds x="2202" y="240" width="100" height="80" />
426
+ <dc:Bounds x="2002" y="240" width="100" height="80" />
427
427
  </bpmndi:BPMNShape>
428
428
  <bpmndi:BPMNShape id="BPMNShape_record-answer" bpmnElement="record-answer">
429
- <dc:Bounds x="2402" y="240" width="100" height="80" />
429
+ <dc:Bounds x="2202" y="240" width="100" height="80" />
430
430
  </bpmndi:BPMNShape>
431
431
  <bpmndi:BPMNShape id="BPMNShape_persist-converged" bpmnElement="persist-converged">
432
- <dc:Bounds x="916" y="80" width="100" height="80" />
432
+ <dc:Bounds x="966" y="80" width="100" height="80" />
433
433
  </bpmndi:BPMNShape>
434
434
  <bpmndi:BPMNShape id="BPMNShape_check-converge" bpmnElement="check-converge">
435
435
  <dc:Bounds x="566" y="80" width="100" height="80" />
436
436
  </bpmndi:BPMNShape>
437
437
  <bpmndi:BPMNShape id="BPMNShape_gw-converge-gate" bpmnElement="gw-converge-gate" isMarkerVisible="true">
438
- <dc:Bounds x="766" y="95" width="50" height="50" />
438
+ <dc:Bounds x="791" y="95" width="50" height="50" />
439
439
  <bpmndi:BPMNLabel>
440
- <dc:Bounds x="754" y="62" width="74" height="28" />
440
+ <dc:Bounds x="779" y="62" width="74" height="28" />
441
441
  </bpmndi:BPMNLabel>
442
442
  </bpmndi:BPMNShape>
443
443
  <bpmndi:BPMNShape id="BPMNShape_persist-escalation-blockedcomments" bpmnElement="persist-escalation-blockedcomments">
444
- <dc:Bounds x="916" y="240" width="100" height="80" />
444
+ <dc:Bounds x="966" y="240" width="100" height="80" />
445
445
  </bpmndi:BPMNShape>
446
446
  <bpmndi:BPMNShape id="BPMNShape_End" bpmnElement="End">
447
- <dc:Bounds x="1148" y="102" width="36" height="36" />
447
+ <dc:Bounds x="1173" y="102" width="36" height="36" />
448
448
  <bpmndi:BPMNLabel>
449
- <dc:Bounds x="1132" y="143" width="69" height="14" />
449
+ <dc:Bounds x="1157" y="143" width="69" height="14" />
450
450
  </bpmndi:BPMNLabel>
451
451
  </bpmndi:BPMNShape>
452
452
  <bpmndi:BPMNEdge id="BPMNEdge_f_start" bpmnElement="f_start">
@@ -466,71 +466,73 @@
466
466
  </bpmndi:BPMNEdge>
467
467
  <bpmndi:BPMNEdge id="BPMNEdge_f_toConvergeGate" bpmnElement="f_toConvergeGate">
468
468
  <di:waypoint x="666" y="120" />
469
- <di:waypoint x="766" y="120" />
469
+ <di:waypoint x="791" y="120" />
470
470
  </bpmndi:BPMNEdge>
471
471
  <bpmndi:BPMNEdge id="BPMNEdge_f_convergeOk" bpmnElement="f_convergeOk">
472
- <di:waypoint x="816" y="120" />
473
- <di:waypoint x="916" y="120" />
472
+ <di:waypoint x="841" y="120" />
473
+ <di:waypoint x="966" y="120" />
474
474
  <bpmndi:BPMNLabel>
475
- <dc:Bounds x="827" y="125" width="78" height="28" />
475
+ <dc:Bounds x="865" y="87" width="78" height="28" />
476
476
  </bpmndi:BPMNLabel>
477
477
  </bpmndi:BPMNEdge>
478
478
  <bpmndi:BPMNEdge id="BPMNEdge_f_finalize" bpmnElement="f_finalize">
479
- <di:waypoint x="1016" y="120" />
480
- <di:waypoint x="1148" y="120" />
479
+ <di:waypoint x="1066" y="120" />
480
+ <di:waypoint x="1173" y="120" />
481
481
  </bpmndi:BPMNEdge>
482
482
  <bpmndi:BPMNEdge id="BPMNEdge_f_guardOk" bpmnElement="f_guardOk">
483
- <di:waypoint x="991" y="440" />
484
- <di:waypoint x="1116" y="440" />
483
+ <di:waypoint x="641" y="440" />
484
+ <di:waypoint x="766" y="440" />
485
485
  <bpmndi:BPMNLabel>
486
- <dc:Bounds x="1014" y="418" width="60" height="14" />
486
+ <dc:Bounds x="664" y="418" width="60" height="14" />
487
487
  </bpmndi:BPMNLabel>
488
488
  </bpmndi:BPMNEdge>
489
489
  <bpmndi:BPMNEdge id="BPMNEdge_f_roundWait" bpmnElement="f_roundWait">
490
- <di:waypoint x="1216" y="440" />
491
- <di:waypoint x="1316" y="440" />
490
+ <di:waypoint x="866" y="440" />
491
+ <di:waypoint x="966" y="440" />
492
492
  </bpmndi:BPMNEdge>
493
493
  <bpmndi:BPMNEdge id="BPMNEdge_f_checkGate" bpmnElement="f_checkGate">
494
- <di:waypoint x="1416" y="440" />
495
- <di:waypoint x="1516" y="440" />
494
+ <di:waypoint x="1066" y="440" />
495
+ <di:waypoint x="1166" y="440" />
496
496
  </bpmndi:BPMNEdge>
497
497
  <bpmndi:BPMNEdge id="BPMNEdge_f_progressOk" bpmnElement="f_progressOk">
498
- <di:waypoint x="1566" y="440" />
499
- <di:waypoint x="1691" y="440" />
498
+ <di:waypoint x="1216" y="440" />
499
+ <di:waypoint x="1341" y="440" />
500
500
  <bpmndi:BPMNLabel>
501
- <dc:Bounds x="1591" y="407" width="71" height="28" />
501
+ <dc:Bounds x="1241" y="407" width="71" height="28" />
502
502
  </bpmndi:BPMNLabel>
503
503
  </bpmndi:BPMNEdge>
504
504
  <bpmndi:BPMNEdge id="BPMNEdge_f_toReviewWait" bpmnElement="f_toReviewWait">
505
- <di:waypoint x="1741" y="440" />
506
- <di:waypoint x="1866" y="440" />
505
+ <di:waypoint x="1391" y="440" />
506
+ <di:waypoint x="1516" y="440" />
507
507
  </bpmndi:BPMNEdge>
508
508
  <bpmndi:BPMNEdge id="BPMNEdge_f_reviewLoop" bpmnElement="f_reviewLoop">
509
- <di:waypoint x="1884" y="458" />
510
- <di:waypoint x="1884" y="500" />
509
+ <di:waypoint x="1534" y="458" />
510
+ <di:waypoint x="1534" y="500" />
511
511
  <di:waypoint x="266" y="500" />
512
512
  <di:waypoint x="266" y="160" />
513
513
  </bpmndi:BPMNEdge>
514
514
  <bpmndi:BPMNEdge id="BPMNEdge_f_escReenter" bpmnElement="f_escReenter">
515
- <di:waypoint x="791" y="575" />
516
- <di:waypoint x="791" y="440" />
517
- <di:waypoint x="941" y="440" />
515
+ <di:waypoint x="1877" y="255" />
516
+ <di:waypoint x="1877" y="220" />
517
+ <di:waypoint x="616" y="220" />
518
+ <di:waypoint x="616" y="415" />
518
519
  <bpmndi:BPMNLabel>
519
- <dc:Bounds x="796" y="507" width="74" height="42" />
520
+ <dc:Bounds x="1410" y="173" width="74" height="42" />
520
521
  </bpmndi:BPMNLabel>
521
522
  </bpmndi:BPMNEdge>
522
523
  <bpmndi:BPMNEdge id="BPMNEdge_f_convergeBlocked" bpmnElement="f_convergeBlocked">
523
- <di:waypoint x="791" y="145" />
524
- <di:waypoint x="791" y="280" />
525
- <di:waypoint x="916" y="280" />
524
+ <di:waypoint x="816" y="145" />
525
+ <di:waypoint x="816" y="220" />
526
+ <di:waypoint x="1016" y="220" />
527
+ <di:waypoint x="1016" y="240" />
526
528
  <bpmndi:BPMNLabel>
527
- <dc:Bounds x="796" y="199" width="81" height="28" />
529
+ <dc:Bounds x="821" y="169" width="81" height="28" />
528
530
  </bpmndi:BPMNLabel>
529
531
  </bpmndi:BPMNEdge>
530
532
  <bpmndi:BPMNEdge id="BPMNEdge_f_addressed" bpmnElement="f_addressed">
531
533
  <di:waypoint x="441" y="145" />
532
534
  <di:waypoint x="441" y="440" />
533
- <di:waypoint x="941" y="440" />
535
+ <di:waypoint x="591" y="440" />
534
536
  <bpmndi:BPMNLabel>
535
537
  <dc:Bounds x="446" y="279" width="78" height="28" />
536
538
  </bpmndi:BPMNLabel>
@@ -538,87 +540,81 @@
538
540
  <bpmndi:BPMNEdge id="BPMNEdge_f_waiting" bpmnElement="f_waiting">
539
541
  <di:waypoint x="441" y="145" />
540
542
  <di:waypoint x="441" y="440" />
541
- <di:waypoint x="941" y="440" />
543
+ <di:waypoint x="591" y="440" />
542
544
  <bpmndi:BPMNLabel>
543
545
  <dc:Bounds x="380" y="286" width="56" height="14" />
544
546
  </bpmndi:BPMNLabel>
545
547
  </bpmndi:BPMNEdge>
546
548
  <bpmndi:BPMNEdge id="BPMNEdge_f_escalate" bpmnElement="f_escalate">
547
549
  <di:waypoint x="441" y="145" />
548
- <di:waypoint x="441" y="600" />
549
- <di:waypoint x="566" y="600" />
550
+ <di:waypoint x="441" y="1080" />
551
+ <di:waypoint x="566" y="1080" />
550
552
  <bpmndi:BPMNLabel>
551
- <dc:Bounds x="446" y="506" width="81" height="28" />
553
+ <dc:Bounds x="446" y="746" width="81" height="28" />
552
554
  </bpmndi:BPMNLabel>
553
555
  </bpmndi:BPMNEdge>
554
556
  <bpmndi:BPMNEdge id="BPMNEdge_f_guardMax" bpmnElement="f_guardMax">
555
- <di:waypoint x="991" y="440" />
556
- <di:waypoint x="1096" y="440" />
557
- <di:waypoint x="1096" y="920" />
558
- <di:waypoint x="1116" y="920" />
557
+ <di:waypoint x="641" y="440" />
558
+ <di:waypoint x="746" y="440" />
559
+ <di:waypoint x="746" y="920" />
560
+ <di:waypoint x="766" y="920" />
559
561
  <bpmndi:BPMNLabel>
560
- <dc:Bounds x="1101" y="673" width="74" height="14" />
562
+ <dc:Bounds x="751" y="673" width="74" height="14" />
561
563
  </bpmndi:BPMNLabel>
562
564
  </bpmndi:BPMNEdge>
563
565
  <bpmndi:BPMNEdge id="BPMNEdge_f_noProgress" bpmnElement="f_noProgress">
564
- <di:waypoint x="1566" y="440" />
565
- <di:waypoint x="1646" y="440" />
566
- <di:waypoint x="1646" y="760" />
567
- <di:waypoint x="1666" y="760" />
566
+ <di:waypoint x="1216" y="440" />
567
+ <di:waypoint x="1296" y="440" />
568
+ <di:waypoint x="1296" y="760" />
569
+ <di:waypoint x="1316" y="760" />
568
570
  <bpmndi:BPMNLabel>
569
- <dc:Bounds x="1563" y="593" width="78" height="14" />
571
+ <dc:Bounds x="1213" y="593" width="78" height="14" />
570
572
  </bpmndi:BPMNLabel>
571
573
  </bpmndi:BPMNEdge>
572
574
  <bpmndi:BPMNEdge id="BPMNEdge_f_toReviewTimeout" bpmnElement="f_toReviewTimeout">
573
- <di:waypoint x="1716" y="465" />
574
- <di:waypoint x="1716" y="600" />
575
- <di:waypoint x="1866" y="600" />
575
+ <di:waypoint x="1366" y="465" />
576
+ <di:waypoint x="1366" y="600" />
577
+ <di:waypoint x="1516" y="600" />
576
578
  </bpmndi:BPMNEdge>
577
- <bpmndi:BPMNEdge id="BPMNEdge_f_escWait" bpmnElement="f_escWait">
578
- <di:waypoint x="791" y="625" />
579
- <di:waypoint x="791" y="980" />
580
- <di:waypoint x="2182" y="980" />
581
- <di:waypoint x="2182" y="300" />
582
- <di:waypoint x="2202" y="300" />
579
+ <bpmndi:BPMNEdge id="BPMNEdge_f_blockedGate" bpmnElement="f_blockedGate">
580
+ <di:waypoint x="1066" y="280" />
581
+ <di:waypoint x="1852" y="280" />
583
582
  </bpmndi:BPMNEdge>
584
- <bpmndi:BPMNEdge id="BPMNEdge_f_blockedWait" bpmnElement="f_blockedWait">
585
- <di:waypoint x="1016" y="280" />
586
- <di:waypoint x="2202" y="280" />
587
- </bpmndi:BPMNEdge>
588
- <bpmndi:BPMNEdge id="BPMNEdge_f_noprogressWait" bpmnElement="f_noprogressWait">
589
- <di:waypoint x="1766" y="780" />
590
- <di:waypoint x="1786" y="780" />
591
- <di:waypoint x="1786" y="980" />
592
- <di:waypoint x="2252" y="980" />
593
- <di:waypoint x="2252" y="320" />
583
+ <bpmndi:BPMNEdge id="BPMNEdge_f_noprogressGate" bpmnElement="f_noprogressGate">
584
+ <di:waypoint x="1416" y="760" />
585
+ <di:waypoint x="1877" y="760" />
586
+ <di:waypoint x="1877" y="305" />
594
587
  </bpmndi:BPMNEdge>
595
588
  <bpmndi:BPMNEdge id="BPMNEdge_f_reviewStalled" bpmnElement="f_reviewStalled">
596
- <di:waypoint x="1902" y="600" />
597
- <di:waypoint x="2002" y="600" />
589
+ <di:waypoint x="1552" y="600" />
590
+ <di:waypoint x="1652" y="600" />
598
591
  </bpmndi:BPMNEdge>
599
- <bpmndi:BPMNEdge id="BPMNEdge_f_stalledWait" bpmnElement="f_stalledWait">
600
- <di:waypoint x="2052" y="560" />
601
- <di:waypoint x="2052" y="280" />
602
- <di:waypoint x="2202" y="280" />
592
+ <bpmndi:BPMNEdge id="BPMNEdge_f_stalledGate" bpmnElement="f_stalledGate">
593
+ <di:waypoint x="1752" y="600" />
594
+ <di:waypoint x="1877" y="600" />
595
+ <di:waypoint x="1877" y="305" />
603
596
  </bpmndi:BPMNEdge>
604
597
  <bpmndi:BPMNEdge id="BPMNEdge_f_escGate" bpmnElement="f_escGate">
605
- <di:waypoint x="666" y="600" />
606
- <di:waypoint x="766" y="600" />
598
+ <di:waypoint x="666" y="1080" />
599
+ <di:waypoint x="1877" y="1080" />
600
+ <di:waypoint x="1877" y="305" />
607
601
  </bpmndi:BPMNEdge>
608
- <bpmndi:BPMNEdge id="BPMNEdge_f_maxWait" bpmnElement="f_maxWait">
609
- <di:waypoint x="1216" y="940" />
610
- <di:waypoint x="1236" y="940" />
611
- <di:waypoint x="1236" y="980" />
612
- <di:waypoint x="2252" y="980" />
613
- <di:waypoint x="2252" y="320" />
602
+ <bpmndi:BPMNEdge id="BPMNEdge_f_escWait" bpmnElement="f_escWait">
603
+ <di:waypoint x="1902" y="280" />
604
+ <di:waypoint x="2002" y="280" />
605
+ </bpmndi:BPMNEdge>
606
+ <bpmndi:BPMNEdge id="BPMNEdge_f_maxGate" bpmnElement="f_maxGate">
607
+ <di:waypoint x="866" y="920" />
608
+ <di:waypoint x="1877" y="920" />
609
+ <di:waypoint x="1877" y="305" />
614
610
  </bpmndi:BPMNEdge>
615
611
  <bpmndi:BPMNEdge id="BPMNEdge_f_answerRecord" bpmnElement="f_answerRecord">
616
- <di:waypoint x="2302" y="280" />
617
- <di:waypoint x="2402" y="280" />
612
+ <di:waypoint x="2102" y="280" />
613
+ <di:waypoint x="2202" y="280" />
618
614
  </bpmndi:BPMNEdge>
619
615
  <bpmndi:BPMNEdge id="BPMNEdge_f_answerLoop" bpmnElement="f_answerLoop">
620
- <di:waypoint x="2452" y="320" />
621
- <di:waypoint x="2452" y="340" />
616
+ <di:waypoint x="2252" y="320" />
617
+ <di:waypoint x="2252" y="340" />
622
618
  <di:waypoint x="266" y="340" />
623
619
  <di:waypoint x="266" y="160" />
624
620
  </bpmndi:BPMNEdge>
@@ -9,10 +9,13 @@
9
9
  // durable review wait instead of routing here (see app/roundResultDefault.ts). This worker keeps
10
10
  // the same rule as defence-in-depth via the canonical taxonomy: if a blank-question job ever
11
11
  // reaches it, it opens NO escalation and reports `escalated:false` rather than FABRICATING a
12
- // question (the retired failure mode) or throwing an un-remediable incident. The convergence-loop
13
- // model branches on that `escalated` output (`gw-escalated`): a `false` return re-enters the loop
14
- // via `gw-guard` instead of flowing into the `wait-answer` catch, so a non-escalation can never
15
- // wedge a token on a durable wait that has no escalation for a human to answer.
12
+ // question (the retired failure mode) or throwing an un-remediable incident. EVERY convergence-loop
13
+ // escalation arm the agent-verdict `persist-escalation` AND the four control-flow arms
14
+ // (`persist-escalation-noprogress`, `persist-review-stalled`, `persist-escalation-blockedcomments`,
15
+ // `persist-escalation-maxrounds`) now routes its `escalated` output through the `gw-escalated`
16
+ // gateway (issue #333): a `false` return re-enters the loop via `gw-guard` instead of flowing into
17
+ // the `wait-answer` catch, so a non-escalation (e.g. a blank `convergeBlockReason`) can never wedge
18
+ // a token on a durable wait that has no escalation for a human to answer.
16
19
  import type { AppJobHandler } from "@nanobpm/urban";
17
20
  import { abandonTokenFromUrl } from "../../app/abandon.ts";
18
21
  import { classifyEscalation } from "../../app/escalationTaxonomy.ts";
@@ -32,15 +32,12 @@ function fakeApp(rows: Record<string, unknown>[]) {
32
32
  }
33
33
 
34
34
  test("record-blocked-ack: settles the parked run at terminal blocked and records the operator note", async () => {
35
- const rows = [{ feature_key: "owner/repo#7", status: "awaiting_operator", delivery_label: null, blocked_user_task_key: "ut-7" }];
35
+ const rows = [{ feature_key: "owner/repo#7", status: "awaiting_operator", delivery_label: null }];
36
36
  const app = fakeApp(rows);
37
37
  const out = await handler({ variables: { featureKey: "owner/repo#7", note: "reassigned to a human" } } as any, app);
38
38
  assertEquals(out, {});
39
39
  assertEquals(rows[0].status, "blocked");
40
40
  assertEquals(rows[0].delivery_label, "operator: reassigned to a human");
41
- // The completable-task pointer is cleared on the terminal-ward transition so the pages stop offering
42
- // the acknowledge affordance for a now-completed task (pollFeatureBlocked no longer sweeps this row).
43
- assertEquals(rows[0].blocked_user_task_key, null);
44
41
  });
45
42
 
46
43
  test("record-blocked-ack: a blank note falls back to an 'acknowledged' label", async () => {
@@ -26,11 +26,6 @@ const handler: AppJobHandler<In, Record<string, never>> = async (job, app) => {
26
26
  await featureRuns(app.data).update(featureKey, {
27
27
  status: "blocked",
28
28
  delivery_label: note ? `operator: ${note}` : "acknowledged",
29
- // The run has left the `feature-blocked` wait, so clear the denormalised completable-task pointer
30
- // the pages gate the "Acknowledge blocked" affordance on. pollFeatureBlocked only sweeps
31
- // `awaiting_operator` runs, so this terminal-ward transition must clear it itself or a stale pointer
32
- // would linger on the now-terminal row.
33
- blocked_user_task_key: null,
34
29
  updated_at: ts,
35
30
  });
36
31
  app.log.info("record-blocked-ack", { featureKey, note: note ?? null });
@@ -54,12 +54,6 @@ const handler: AppJobHandler<In, Out> = async (job, app) => {
54
54
  status: rowStatus,
55
55
  pr_key: prKey,
56
56
  outcome: summary ?? null,
57
- // The run has left the `feature-escalation` wait (answered → abandon, SLA auto-abandon, or the
58
- // agent finished without escalating), so clear the denormalised escalation pointer the pages gate
59
- // on. pollFeatureEscalations only sweeps `running`/`escalated` runs, so a terminal-ward transition
60
- // through here must clear it itself or the stale question would linger on the row.
61
- escalation_question: null,
62
- escalation_user_task_key: null,
63
57
  updated_at: ts,
64
58
  });
65
59
  app.log.info("record-feature", { featureKey, featureStatus, rowStatus, prKey });
@@ -1,9 +1,10 @@
1
1
  // Unit coverage for pr.record-feature-escalation — a feature run parked on the native
2
2
  // `feature-escalation` user task (issue #210). Runs on the `escalated` arm, before the user task
3
- // exists, and must flip the row to the non-terminal `escalated` status and persist the agent's
4
- // `question` so the nwf UI can surface it (the poller can't read task-local vars, so this is the
5
- // question's source of truth). It clears the completable-task pointer to NULL (the task does not
6
- // exist yet, so any non-null value is stale); the poller fills the real key once it is observable.
3
+ // exists, and must flip the row to the non-terminal `escalated` status and append the agent's
4
+ // `question` to the canonical `feature_escalations` audit log so the nwf UI can surface it (the poller
5
+ // can't read task-local vars, so this is the question's source of truth). Issue #332 dropped the
6
+ // denormalised `feature_runs.escalation_question` / `escalation_user_task_key` columns, so this worker
7
+ // now only flips the status and appends the audit row.
7
8
  import { test } from "node:test";
8
9
  import { assertEquals } from "#test-assert";
9
10
  import { noopLog } from "../../test/log.ts";
@@ -43,8 +44,8 @@ function fakeApp(rows: Record<string, unknown>[]): any {
43
44
  };
44
45
  }
45
46
 
46
- test("record-feature-escalation: flips the run to escalated and persists the question", async () => {
47
- const rows = [{ feature_key: "owner/repo#7", status: "running", escalation_question: null, escalation_user_task_key: null }];
47
+ test("record-feature-escalation: flips the run to escalated and appends the question to the audit log", async () => {
48
+ const rows = [{ feature_key: "owner/repo#7", status: "running" }];
48
49
  const app = fakeApp(rows);
49
50
  const out = await handler(
50
51
  { jobKey: "job-1", variables: { featureKey: "owner/repo#7", question: "Which API should I use?" } } as never,
@@ -52,11 +53,8 @@ test("record-feature-escalation: flips the run to escalated and persists the que
52
53
  );
53
54
  assertEquals(out, {});
54
55
  assertEquals(rows[0].status, "escalated");
55
- assertEquals(rows[0].escalation_question, "Which API should I use?");
56
- // The user task does not exist yet the pointer is cleared to NULL here (poller fills the real key).
57
- assertEquals(rows[0].escalation_user_task_key, null);
58
- // Dual-write (issue #305): the question is ALSO appended to the canonical `feature_escalations`
59
- // audit log so `pollUserTasks` can source it from a surviving table once the denormalised column drops.
56
+ // Issue #305/#332: the question is the sole responsibility of the canonical `feature_escalations`
57
+ // audit log so `pollUserTasks` can source it from a surviving table (the denormalised column is gone).
60
58
  assertEquals(app.stores.feature_escalations.length, 1);
61
59
  assertEquals(app.stores.feature_escalations[0].feature_key, "owner/repo#7");
62
60
  assertEquals(app.stores.feature_escalations[0].question, "Which API should I use?");
@@ -68,7 +66,7 @@ test("record-feature-escalation: a retried job (same jobKey) reuses its audit ro
68
66
  // before job completion re-runs with the SAME jobKey. The `job_key` idempotency guard must reuse the
69
67
  // existing `feature_escalations` row rather than append a duplicate (which would bloat the append-only
70
68
  // log and could skew "latest question" selection). Mirrors `record-plan-review`'s `plan_reviews` guard.
71
- const rows = [{ feature_key: "owner/repo#7", status: "running", escalation_question: null, escalation_user_task_key: null }];
69
+ const rows = [{ feature_key: "owner/repo#7", status: "running" }];
72
70
  const app = fakeApp(rows);
73
71
  const job = { jobKey: "job-retry", variables: { featureKey: "owner/repo#7", question: "Which API?" } } as never;
74
72
  await handler(job, app);
@@ -77,22 +75,11 @@ test("record-feature-escalation: a retried job (same jobKey) reuses its audit ro
77
75
  assertEquals(app.stores.feature_escalations[0].job_key, "job-retry");
78
76
  });
79
77
 
80
- test("record-feature-escalation: clears a stale completable-task pointer at escalation entry", async () => {
81
- // The task does not exist yet here, so a non-null key can only be stale (a prior escalation's key
82
- // left behind, a manual DB repair, etc). Leaving it would bind the pages' answer/abandon affordance
83
- // to the wrong task until the poller overwrites it; clear it so the row reads "key unknown here".
84
- const rows = [{ feature_key: "owner/repo#9", status: "running", escalation_question: null, escalation_user_task_key: "stale-ut" }];
85
- const app = fakeApp(rows);
86
- await handler({ jobKey: "job-9", variables: { featureKey: "owner/repo#9", question: "Q?" } } as never, app);
87
- assertEquals(rows[0].status, "escalated");
88
- assertEquals(rows[0].escalation_question, "Q?");
89
- assertEquals(rows[0].escalation_user_task_key, null);
90
- });
91
-
92
- test("record-feature-escalation: a blank/absent question is persisted as NULL (badge/affordance stay off)", async () => {
93
- const rows = [{ feature_key: "owner/repo#8", status: "running", escalation_question: null }];
78
+ test("record-feature-escalation: a blank/absent question is appended as NULL (badge/affordance stay off)", async () => {
79
+ const rows = [{ feature_key: "owner/repo#8", status: "running" }];
94
80
  const app = fakeApp(rows);
95
81
  await handler({ jobKey: "job-8", variables: { featureKey: "owner/repo#8", question: " " } } as never, app);
96
82
  assertEquals(rows[0].status, "escalated");
97
- assertEquals(rows[0].escalation_question, null);
83
+ assertEquals(app.stores.feature_escalations.length, 1);
84
+ assertEquals(app.stores.feature_escalations[0].question, null);
98
85
  });