agents-relay 2.0.156 → 2.0.158

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 (50) hide show
  1. package/dist/blockers.js +6 -27
  2. package/dist/chatgpt-platform-fallback.js +1 -1
  3. package/dist/cli-help.js +5 -6
  4. package/dist/cli-plan-clean-history.js +16 -0
  5. package/dist/cli-unblock.js +3 -14
  6. package/dist/cli-worker-task.js +11 -0
  7. package/dist/cli.js +27 -16
  8. package/dist/dashboard-actions.js +9 -19
  9. package/dist/dashboard-data.js +45 -0
  10. package/dist/dashboard-html.js +1 -1
  11. package/dist/dashboard.js +2 -52
  12. package/dist/host-invocation-store.js +2 -2
  13. package/dist/interactive-invocation.js +1 -1
  14. package/dist/interactive-resume.js +5 -5
  15. package/dist/legacy-blocked-task-migration.js +14 -0
  16. package/dist/legacy-orchestrator-repair.js +6 -6
  17. package/dist/manual-plan.js +19 -1
  18. package/dist/planner-recovery.js +1 -1
  19. package/dist/planner-runtime.js +9 -1
  20. package/dist/planner.js +18 -23
  21. package/dist/projection-outbox.js +1 -1
  22. package/dist/reconciler-review.js +4 -3
  23. package/dist/reconciler-runtime.js +15 -19
  24. package/dist/reconciler.js +3 -3
  25. package/dist/relay-store.js +2 -0
  26. package/dist/relayd-control.js +14 -7
  27. package/dist/single-job-task-control.js +1 -1
  28. package/dist/task-actions.js +28 -3
  29. package/dist/task-recovery.js +1 -1
  30. package/dist/troubleshooter.js +1 -1
  31. package/dist/types.js +12 -6
  32. package/dist/unblock.js +5 -44
  33. package/dist/workflow/authoritative-unblock-v2.js +6 -7
  34. package/dist/workflow/contracts.js +3 -0
  35. package/dist/workflow/definitions-v2.js +3 -2
  36. package/dist/workflow/lifecycle.js +5 -5
  37. package/dist/workflow/orchestrator-rescue.js +13 -12
  38. package/dist/workflow/runtime.js +13 -2
  39. package/dist/workflow/task-resolution.js +52 -15
  40. package/dist/workflow/troubleshooter-v2.js +5 -3
  41. package/package.json +3 -3
  42. package/skills/agents-relay/agents/planner.agent.md +2 -2
  43. package/skills/agents-relay/agents/troubleshooter.agent.md +5 -3
  44. package/skills/agents-relay/contracts/task-job-contract.md +18 -6
  45. package/workflow/authoritative-unblock.mmd +6 -9
  46. package/workflow/blocker-resolution.mmd +6 -16
  47. package/workflow/orchestrator-rescue.mmd +3 -3
  48. package/workflow/task-lifecycle.mmd +45 -59
  49. package/workflow/task-resolution.mmd +24 -3
  50. package/workflow/troubleshooter.mmd +20 -1
@@ -11,7 +11,13 @@ blocked["state: BLOCKED"]
11
11
  succeeded["state: SUCCEEDED"]
12
12
  failed["state: FAILED"]
13
13
  cancelled["state: CANCELLED"]
14
- platformFallbackSafe["guard: platformFallbackSafe"]
14
+ draftBlockAllowed["guard: troubleshooterTask"]
15
+ queuedReviewBlockAllowed["guard: troubleshooterTask"]
16
+ queuedBlockAllowed["guard: troubleshooterTask"]
17
+ runningBlockAllowed["guard: troubleshooterTask"]
18
+ unblockAllowed["guard: troubleshooterTask"]
19
+ interactiveWaitAllowed["guard: awaitingInteractiveDecision"]
20
+ recoverBlockAllowed["guard: troubleshooterTask"]
15
21
 
16
22
  depSat["guard: dependenciesSatisfied"]
17
23
  depUnsat["guard: dependenciesUnsatisfied"]
@@ -28,14 +34,9 @@ recoveryReopenClearReason["action: mutation.clearFailureReason"]
28
34
  recoveryReopenClearLease["action: mutation.clearLease"]
29
35
  recoveryReopenClearExecution["action: mutation.clearExecution"]
30
36
 
31
- retryAvailableRunning["guard: retryAvailable"]
32
37
  plannerRetryAvailable["guard: retryAvailable"]
33
38
  plannerUnavailableMark["action: mutation.markPlannerUnavailable"]
34
- orphanRetryAvailable["guard: retryAvailable"]
35
- orphanRetryClearError["action: mutation.clearError"]
36
- orphanRetryClearLease["action: mutation.clearLease"]
37
- orphanRetryClearExecution["action: mutation.clearExecution"]
38
- orphanFailMark["action: mutation.markStartupOrphanedExhausted"]
39
+ orphanFailMark["action: mutation.markUnknownOutcome"]
39
40
  orphanFailClearLease["action: mutation.clearLease"]
40
41
  orphanFailClearExecution["action: mutation.clearExecution"]
41
42
  plannerRetryClearError["action: mutation.clearError"]
@@ -43,17 +44,10 @@ plannerRetryClearLease["action: mutation.clearLease"]
43
44
  plannerRetryClearExecution["action: mutation.clearExecution"]
44
45
  plannerFailClearLease["action: mutation.clearLease"]
45
46
  plannerFailClearExecution["action: mutation.clearExecution"]
46
- retryAvailableQueued["guard: retryAvailable"]
47
- leaseRetryRunningClearError["action: mutation.clearError"]
48
- leaseRetryRunningClearLease["action: mutation.clearLease"]
49
- leaseRetryRunningClearExecution["action: mutation.clearExecution"]
50
- leaseFailRunningMark["action: mutation.markLeaseExpired"]
47
+ leaseFailRunningMark["action: mutation.markUnknownOutcome"]
51
48
  leaseFailRunningClearLease["action: mutation.clearLease"]
52
49
  leaseFailRunningClearExecution["action: mutation.clearExecution"]
53
- leaseRetryQueuedClearError["action: mutation.clearError"]
54
- leaseRetryQueuedClearLease["action: mutation.clearLease"]
55
- leaseRetryQueuedClearExecution["action: mutation.clearExecution"]
56
- leaseFailQueuedMark["action: mutation.markLeaseExpired"]
50
+ leaseFailQueuedMark["action: mutation.markUnknownOutcome"]
57
51
  leaseFailQueuedClearLease["action: mutation.clearLease"]
58
52
  leaseFailQueuedClearExecution["action: mutation.clearExecution"]
59
53
 
@@ -80,8 +74,6 @@ completeClearError["action: mutation.clearError"]
80
74
  completeClearReason["action: mutation.clearFailureReason"]
81
75
  unblockRetryClearError["action: mutation.clearError"]
82
76
  unblockRetryClearReason["action: mutation.clearFailureReason"]
83
- unblockDraftClearError["action: mutation.clearError"]
84
- unblockDraftClearReason["action: mutation.clearFailureReason"]
85
77
  failedRetryClearError["action: mutation.clearError"]
86
78
  failedRetryClearReason["action: mutation.clearFailureReason"]
87
79
  recoverStartClearError["action: mutation.clearError"]
@@ -97,7 +89,9 @@ draft -->|on: reconcile| depSat
97
89
  depSat -->|true| reconcileDraftClearError
98
90
  reconcileDraftClearError --> reconcileDraftClearReason
99
91
  reconcileDraftClearReason --> queued
100
- draft -->|on: block| blocked
92
+ draft -->|on: block| draftBlockAllowed
93
+ draftBlockAllowed -->|true| blocked
94
+ draftBlockAllowed -->|false| failed
101
95
  draft -->|on: cancel| cancelled
102
96
 
103
97
  queued -->|on: hold| draft
@@ -122,35 +116,41 @@ reviewApproveQueuedClearReason --> succeeded
122
116
  queued -->|on: review.changes_required| reviewChangesQueuedClearError
123
117
  reviewChangesQueuedClearError --> reviewChangesQueuedClearReason
124
118
  reviewChangesQueuedClearReason --> succeeded
125
- queued -->|on: review.blocked| blocked
126
- queued -->|on: block| blocked
119
+ queued -->|on: review.blocked| queuedReviewBlockAllowed
120
+ queuedReviewBlockAllowed -->|true| blocked
121
+ queuedReviewBlockAllowed -->|false| failed
122
+ queued -->|on: block| queuedBlockAllowed
123
+ queuedBlockAllowed -->|true| blocked
124
+ queuedBlockAllowed -->|false| failed
127
125
  queued -->|on: fail| failed
128
126
  queued -->|on: effect.launchTask.failed| failed
129
127
  queued -->|on: watchdog.failed| failed
130
128
  queued -->|on: worker.delivery_failed| failed
131
129
  queued -->|on: worker.start_ack_failed| failed
132
- queued -->|on: worker.platform_failure| platformFallbackSafe
133
- platformFallbackSafe -->|true| platformFallbackClearFailure
134
- platformFallbackClearFailure["action: mutation.preparePlatformFallback"]
135
- platformFallbackClearFailure --> queued
136
- platformFallbackSafe -->|false| platformFallbackQuarantine
130
+ queued -->|on: worker.platform_failure| platformFallbackQuarantine
137
131
  platformFallbackQuarantine["action: mutation.quarantinePlatformFailure"]
138
- platformFallbackQuarantine --> blocked
132
+ platformFallbackQuarantine --> failed
139
133
  queued -->|on: planner.unavailable| plannerUnavailableMark
140
134
  plannerUnavailableMark --> failed
141
- queued -->|on: execution.orphaned| orphanRetryAvailable
142
- queued -->|on: lease.expired| retryAvailableQueued
143
- retryAvailableQueued -->|true| leaseRetryQueuedClearError
144
- leaseRetryQueuedClearError --> leaseRetryQueuedClearLease
145
- leaseRetryQueuedClearLease --> leaseRetryQueuedClearExecution
146
- leaseRetryQueuedClearExecution --> queued
147
- retryAvailableQueued -->|false| leaseFailQueuedMark
135
+ queued -->|on: execution.orphaned| orphanFailMark
136
+ orphanFailMark --> orphanFailClearLease
137
+ orphanFailClearLease --> orphanFailClearExecution
138
+ orphanFailClearExecution --> failed
139
+ queued -->|on: lease.expired| leaseFailQueuedMark
148
140
  leaseFailQueuedMark --> leaseFailQueuedClearLease
149
141
  leaseFailQueuedClearLease --> leaseFailQueuedClearExecution
150
142
  leaseFailQueuedClearExecution --> failed
151
143
  queued -->|on: cancel| cancelled
152
144
 
153
- running -->|on: task.blocked| blocked
145
+ running -->|on: interactive.waiting| interactiveWaitAllowed
146
+ interactiveWaitAllowed -->|true| runningWaitClearLease
147
+ runningWaitClearLease["action: mutation.clearLease"]
148
+ runningWaitClearLease --> runningWaitClearExecution
149
+ runningWaitClearExecution["action: mutation.clearExecution"]
150
+ runningWaitClearExecution --> draft
151
+ running -->|on: task.blocked| runningBlockAllowed
152
+ runningBlockAllowed -->|true| blocked
153
+ runningBlockAllowed -->|false| failed
154
154
  running -->|on: task.progress| running
155
155
  running -->|on: review.approved| reviewApproveRunningClearError
156
156
  reviewApproveRunningClearError --> reviewApproveRunningClearReason
@@ -158,25 +158,17 @@ reviewApproveRunningClearReason --> succeeded
158
158
  running -->|on: review.changes_required| reviewChangesRunningClearError
159
159
  reviewChangesRunningClearError --> reviewChangesRunningClearReason
160
160
  reviewChangesRunningClearReason --> succeeded
161
- running -->|on: review.blocked| blocked
161
+ running -->|on: review.blocked| runningBlockAllowed
162
162
  running -->|on: task.completed| completeClearError
163
163
  completeClearError --> completeClearReason
164
164
  completeClearReason --> succeeded
165
165
  running -->|on: task.failed| failed
166
166
  running -->|on: worker.platform_failure| runningPlatformFailureQuarantine
167
167
  runningPlatformFailureQuarantine["action: mutation.quarantinePlatformFailure"]
168
- runningPlatformFailureQuarantine --> blocked
168
+ runningPlatformFailureQuarantine --> failed
169
169
  running -->|on: watchdog.failed| failed
170
170
  running -->|on: planner.failed| plannerRetryAvailable
171
- running -->|on: execution.orphaned| orphanRetryAvailable
172
- orphanRetryAvailable -->|true| orphanRetryClearError
173
- orphanRetryClearError --> orphanRetryClearLease
174
- orphanRetryClearLease --> orphanRetryClearExecution
175
- orphanRetryClearExecution --> queued
176
- orphanRetryAvailable -->|false| orphanFailMark
177
- orphanFailMark --> orphanFailClearLease
178
- orphanFailClearLease --> orphanFailClearExecution
179
- orphanFailClearExecution --> failed
171
+ running -->|on: execution.orphaned| orphanFailMark
180
172
  plannerRetryAvailable -->|true| plannerRetryClearError
181
173
  plannerRetryClearError --> plannerRetryClearLease
182
174
  plannerRetryClearLease --> plannerRetryClearExecution
@@ -184,12 +176,7 @@ plannerRetryClearExecution --> queued
184
176
  plannerRetryAvailable -->|false| plannerFailClearLease
185
177
  plannerFailClearLease --> plannerFailClearExecution
186
178
  plannerFailClearExecution --> failed
187
- running -->|on: lease.expired| retryAvailableRunning
188
- retryAvailableRunning -->|true| leaseRetryRunningClearError
189
- leaseRetryRunningClearError --> leaseRetryRunningClearLease
190
- leaseRetryRunningClearLease --> leaseRetryRunningClearExecution
191
- leaseRetryRunningClearExecution --> queued
192
- retryAvailableRunning -->|false| leaseFailRunningMark
179
+ running -->|on: lease.expired| leaseFailRunningMark
193
180
  leaseFailRunningMark --> leaseFailRunningClearLease
194
181
  leaseFailRunningClearLease --> leaseFailRunningClearExecution
195
182
  leaseFailRunningClearExecution --> failed
@@ -197,12 +184,9 @@ running -->|on: task.cancelled| cancelled
197
184
  running -->|on: pause| queued
198
185
  running -->|on: cancel| cancelled
199
186
 
200
- autonomousJob["guard: autonomousJob"]
201
- blocked -->|on: task.unblocked| autonomousJob
202
- autonomousJob -->|true| unblockDraftClearError
203
- unblockDraftClearError --> unblockDraftClearReason
204
- unblockDraftClearReason --> draft
205
- autonomousJob -->|false| unblockRetryClearError
187
+ blocked -->|on: task.unblocked| unblockAllowed
188
+ unblockAllowed -->|true| unblockRetryClearError
189
+ unblockAllowed -->|false| blocked
206
190
  unblockRetryClearError --> unblockRetryClearReason
207
191
  unblockRetryClearReason --> queued
208
192
  blocked -->|on: cancel| cancelled
@@ -220,7 +204,9 @@ recoverComplete -->|true| recoverCompleteClearError
220
204
  recoverCompleteClearError --> recoverCompleteClearReason
221
205
  recoverCompleteClearReason --> succeeded
222
206
  failed -->|on: task.blocked| recoverBlocked
223
- recoverBlocked -->|true| blocked
207
+ recoverBlocked -->|true| recoverBlockAllowed
208
+ recoverBlockAllowed -->|true| blocked
209
+ recoverBlockAllowed -->|false| failed
224
210
  failed -->|on: task.failed| recoverFailed
225
211
  recoverFailed -->|true| failed
226
212
  failed -->|on: task.cancelled| recoverCancelled
@@ -7,27 +7,39 @@ flowchart LR
7
7
  unresolved["state: unresolved"]
8
8
  checkOwner["state: check_owner"]
9
9
  checkPath["state: check_path"]
10
+ checkFreshExecution["state: check_fresh_execution"]
10
11
  activeRecovery["action: resolution.activateRecovery"]
11
12
  sameJob["action: resolution.attachSameJobDependency"]
12
13
  blockerJob["action: resolution.registerBlockerDependency"]
13
14
  escalate["action: resolution.createEscalationGate"]
14
15
  obsolete["action: resolution.cancelSupersede"]
15
16
  resolved["state: resolved"]
17
+ rejected["state: rejected"]
16
18
  recoveryOwner["guard: recoveryOwnerAvailable"]
17
19
  plannerOwner["guard: plannerOwnerAvailable"]
18
20
  exact["guard: exactOriginalRetry"]
19
21
  same["guard: sameJobDependency"]
22
+ fresh["guard: freshRecoveryExecution"]
20
23
  blocker["guard: blockerJobDependency"]
21
24
  gate["guard: escalationGate"]
22
25
  obsoleteGuard["guard: genuinelyObsolete"]
26
+ classifiable["guard: classifiableFailure"]
27
+ classificationKind["guard: classificationSuperseded"]
28
+ classifySuperseded["action: resolution.classifySuperseded"]
29
+ classifyInvalid["action: resolution.classifyInvalid"]
30
+ supersededEvidence["guard: supersededEvidenceComplete"]
31
+ invalidEvidence["guard: invalidEvidenceComplete"]
23
32
 
24
33
  unresolved -->|on: resolution.propose| checkOwner
25
34
  checkOwner -->|on: resolution.propose| recoveryOwner
26
35
  recoveryOwner -->|true| checkPath
27
36
  recoveryOwner -->|false| plannerOwner
28
37
  plannerOwner -->|true| checkPath
29
- plannerOwner -->|false| resolved
30
- checkPath -->|on: resolution.propose| exact
38
+ plannerOwner -->|false| rejected
39
+ checkPath -->|on: resolution.propose| fresh
40
+ fresh -->|true| checkFreshExecution
41
+ fresh -->|false| rejected
42
+ checkFreshExecution -->|on: resolution.propose| exact
31
43
  exact -->|true| activeRecovery
32
44
  exact -->|false| same
33
45
  same -->|true| sameJob
@@ -37,9 +49,18 @@ blocker -->|false| gate
37
49
  gate -->|true| escalate
38
50
  gate -->|false| obsoleteGuard
39
51
  obsoleteGuard -->|true| obsolete
40
- obsoleteGuard -->|false| resolved
52
+ obsoleteGuard -->|false| rejected
41
53
  activeRecovery -->|to: resolved| resolved
42
54
  sameJob -->|to: resolved| resolved
43
55
  blockerJob -->|to: resolved| resolved
44
56
  escalate -->|to: resolved| resolved
45
57
  obsolete -->|to: resolved| resolved
58
+ unresolved -->|on: resolution.classify| classifiable
59
+ classifiable -->|true| classificationKind
60
+ classifiable -->|false| rejected
61
+ classificationKind -->|true| supersededEvidence
62
+ classificationKind -->|false| invalidEvidence
63
+ supersededEvidence -->|true| classifySuperseded
64
+ invalidEvidence -->|true| classifyInvalid
65
+ classifySuperseded --> resolved
66
+ classifyInvalid --> resolved
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Troubleshooter
3
- description: Coordinates diagnosis, recovery, escalation, and resolution of failed Tasks.
3
+ description: Re-runs diagnosis after authoritative unblock, requires fresh resolution evidence, then authorizes recovery of FAILED work.
4
4
  ---
5
5
  flowchart LR
6
6
  %% relay: initial idle
@@ -12,6 +12,9 @@ checkId["state: check_id"]
12
12
  checkBarrier["state: check_barrier"]
13
13
  skip["state: skip"]
14
14
  create["state: create"]
15
+ resume["state: resumed_after_authoritative_unblock"]
16
+ freshProposal["state: fresh_resolution_proposed"]
17
+ failClosed["state: remain_failed_without_original_mutation"]
15
18
 
16
19
  failed["guard: failedWork"]
17
20
  ordinary["guard: ordinaryWork"]
@@ -20,8 +23,13 @@ needsRecovery["guard: needsRecovery"]
20
23
  idUnused["guard: idUnused"]
21
24
  noBarrier["guard: noRecoveryBarrier"]
22
25
  createAction["action: troubleshooter.create"]
26
+ verifyFresh["guard: freshConditionVerification"]
27
+ proposeResolution["action: troubleshooter.proposeFreshResolution"]
28
+ resolutionFresh["guard: resolutionForCurrentExecution"]
29
+ actOnOriginal["action: troubleshooter.applyAuthorizedResolution"]
23
30
 
24
31
  idle -->|on: troubleshooter.reconcile| failed
32
+ idle -->|on: troubleshooter.resumed| resume
25
33
  failed -->|false| skip
26
34
  failed -->|true| checkOrdinary
27
35
 
@@ -45,3 +53,14 @@ checkBarrier -->|on: troubleshooter.reconcile| noBarrier
45
53
  noBarrier -->|false| skip
46
54
  noBarrier -->|true| createAction
47
55
  createAction --> create
56
+
57
+ %% A human response only queues this same Troubleshooter. It must start a new
58
+ %% execution, reverify the condition, and create a new resolution before acting.
59
+ resume -->|on: task.started| verifyFresh
60
+ verifyFresh -->|true| proposeResolution
61
+ verifyFresh -->|false| failClosed
62
+ proposeResolution --> freshProposal
63
+ freshProposal -->|on: resolution.propose| resolutionFresh
64
+ resolutionFresh -->|true| actOnOriginal
65
+ resolutionFresh -->|false| failClosed
66
+ actOnOriginal --> resume