agents-relay 2.0.207 → 2.0.209

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 (41) hide show
  1. package/dist/adapters.js +2 -1
  2. package/dist/agent-shortcut.js +113 -41
  3. package/dist/audit-tail.js +52 -0
  4. package/dist/browser-worker-runtime.js +7 -2
  5. package/dist/chatgpt-platform-fallback.js +30 -0
  6. package/dist/cli-shortcut-local.js +49 -0
  7. package/dist/cli-shortcut.js +81 -19
  8. package/dist/cli.js +8 -3
  9. package/dist/decision-audit.js +143 -1
  10. package/dist/execution-routing.js +8 -2
  11. package/dist/force-restate-validation.js +3 -1
  12. package/dist/job-execution-slot.js +4 -1
  13. package/dist/model-routing.js +8 -0
  14. package/dist/reconciler-review.js +39 -13
  15. package/dist/reconciler-runtime.js +46 -52
  16. package/dist/reconciler.js +12 -2
  17. package/dist/relay-job-snapshot-reads.js +5 -2
  18. package/dist/relay-workflow-operations.js +1 -1
  19. package/dist/relayd.js +1 -1
  20. package/dist/route-outcome-recording.js +51 -0
  21. package/dist/runtime-status.js +11 -4
  22. package/dist/shortcut-node-worker.js +128 -0
  23. package/dist/shortcut-stage-contract.js +50 -0
  24. package/dist/shortcut-worker-runner.js +73 -0
  25. package/dist/task-actions.js +4 -13
  26. package/dist/task-inactivity-watchdog.js +7 -0
  27. package/dist/terminal-event-recovery.js +13 -0
  28. package/dist/worker-failure-recovery.js +89 -0
  29. package/dist/workflow/contracts.js +4 -0
  30. package/dist/workflow/definitions-v2.js +2 -0
  31. package/dist/workflow/runtime.js +30 -0
  32. package/dist/workflow/task-resolution.js +1 -4
  33. package/package.json +4 -3
  34. package/skills/agents-relay/agents/planner.agent.md +14 -4
  35. package/skills/agents-relay/agents/reviewer.agent.md +2 -0
  36. package/skills/agents-relay/contracts/orchestrator-workflows.md +6 -0
  37. package/skills/agents-relay/contracts/task-job-contract.md +4 -0
  38. package/workflow/force-restate-validation.mmd +1 -1
  39. package/workflow/review-lifecycle.mmd +1 -1
  40. package/workflow/task-lifecycle.mmd +13 -12
  41. package/workflow/task-resolution.mmd +1 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-relay",
3
- "version": "2.0.207",
3
+ "version": "2.0.209",
4
4
  "description": "Durable async agent jobs coordinated through GitHub pull requests",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,8 +17,9 @@
17
17
  "test:chatgpt-temp-quality": "AGENTS_RELAY_RUN_CHATGPT_TEMP_QUALITY=1 sh -c \"npm run build && node test/quality/run-temporary-chat.mjs\"",
18
18
  "dev": "tsx src/cli.ts",
19
19
  "test:publish": "npm run build && node --import ./test/test-store-env.mjs --test --test-concurrency=1 --test-force-exit test/*.test.js",
20
- "test:fast": "npm run build && node --import ./test/test-store-env.mjs --test --test-concurrency=2 test/workflow-lifecycle.test.js test/workflow-v2-lifecycle-parity.test.js test/workflow-effects.test.js test/relay-store.test.js test/local-authority.test.js test/local-jobid-routing.test.js test/local-sqlite-jobid.test.js test/no-github.test.js test/reconcile-coordinator.test.js test/service-publication.test.js test/github-webhook.test.js",
21
- "test:full": "npm run build && node --import ./test/test-store-env.mjs --test --test-concurrency=1 test/*.test.js && npm run test:verification:l3",
20
+ "test:shortcut:dags": "npm run build && node --import ./test/test-store-env.mjs --test --test-concurrency=1 test/verification/shortcut-dag-matrix.test.mjs test/agent-shortcut.test.js",
21
+ "test:fast": "npm run build && node --import ./test/test-store-env.mjs --test --test-concurrency=2 test/workflow-lifecycle.test.js test/workflow-v2-lifecycle-parity.test.js test/workflow-effects.test.js test/relay-store.test.js test/local-authority.test.js test/local-jobid-routing.test.js test/local-sqlite-jobid.test.js test/no-github.test.js test/reconcile-coordinator.test.js test/service-publication.test.js test/github-webhook.test.js test/verification/shortcut-dag-matrix.test.mjs",
22
+ "test:full": "npm run build && node --import ./test/test-store-env.mjs --test --test-concurrency=1 test/*.test.js test/verification/shortcut-dag-matrix.test.mjs && npm run test:verification:l3",
22
23
  "test:verification:l1": "npm run build && node --test test/verification/harness.test.mjs test/verification/contract.test.mjs test/browser-worker-pool-graph.test.js test/verification/graph-inventory.test.mjs test/verification/dashboard-drilldown.test.mjs test/verification/evidence-matrix.test.mjs test/verification/task-resolution-classification.test.mjs test/verification/planner-contract.test.mjs test/verification/force-restate-validation.test.mjs test/planner-child-recovery.test.js",
23
24
  "test:verification:l4:contracts": "npm run build && node --test test/verification/l4/prompt-evals.test.mjs",
24
25
  "test:verification:l4": "node test/verification/l4/run-all.mjs",
@@ -32,10 +32,10 @@ For every non-satisfied objective:
32
32
 
33
33
  ### Objective decomposition and convergence
34
34
 
35
- - **Never bundle independently testable acceptance layers into one giant Task.** Break objectives into separately verifiable deliverables (for example, contract tests, real-provider compliance, L1 Graph branches, L2 role evidence, and L3 production-ingress and recovery evidence). Give each Task concrete acceptance checks and an observable output.
36
- - Split a large Task when its remaining work spans distinct implementation areas, independently testable failure paths, or more than one meaningful review/recovery cycle. Put shared prerequisites in earlier Tasks and express true dependencies explicitly; independent work may run in parallel.
35
+ - Group implementation, deterministic tests, and self-review under the responsible Agent Task when they share one owner. Create a separate durable Task only for a genuinely independent owner, externally meaningful approval boundary, or separately recoverable outcome; do not split checks by technical layer or require a live-service test before that service can be published.
36
+ - Keep technical phases and review-fix iterations within one Agent Task whenever they share responsibility, including a large multi-area implementation. Split only when different Agent roles own independent durable outcomes or a real approval/ownership boundary requires it; preserve genuine dependencies.
37
37
  - For a failed Task with repeated deterministic acceptance gaps, do not reissue the identical broad assignment. Identify the *missing acceptance cases*, create focused same-Job repair Tasks with valid `same_job_dependency` resolutions, and specify how their evidence unblocks the original Task. Preserve the original failed Task and failure history.
38
- - For event-driven workflows, separate basic ingress/persistence checks from L3 full-path lifecycle and recovery scenarios. Require negative-path, multi-failure recovery and no-false-completion evidence before claiming full objective coverage.
38
+ - For event-driven workflows, require deterministic ingress/persistence, negative-path, restart and no-false-completion evidence before publishing. Do not elevate tests that require the newly published live runtime/provider/device to release-blocking Tasks merely because they are independently observable.
39
39
  - In `assessment`, show the entire remaining objective as a dependency graph, clearly distinguishing already proven work, the executable batch, subsequent verification, and Relay-owned review/merge. Never report overall `satisfied` merely because one batch has passed.
40
40
 
41
41
 
@@ -52,6 +52,16 @@ If an intermediate result does not need that independent lifecycle, keep it insi
52
52
 
53
53
  Keep sibling Tasks at a comparable abstraction level. Do not mix a whole product milestone with tiny implementation steps as peers.
54
54
 
55
+ ### Publish-first live acceptance
56
+
57
+ Classify each acceptance check **before planning Tasks**: pre-publish (verifiable in source/build/isolated runtime), live-only (requires newly published service, real account/provider/device or live traffic), or mandatory pre-release gate (security, data integrity, legal compliance or explicit approval).
58
+
59
+ - Complete pre-publish checks and independent immutable-head Final Review before Relay merge/delivery. **Never defer mandatory pre-release gates.** Do not create merge/deploy Tasks or infer delivery from model output.
60
+ - **Do not create a blocking pre-publish Task**, human escalation or repeated Planner round for live-only verification unavailable before publication. Record `NOT_RUN` or `PENDING_POST_PUBLISH` (never PASS), including residual risk; this does not constitute failed implementation.
61
+ - In the durable Plan `assessment`, provide a **post-publish acceptance handoff**: scenario, target release/version, evidence gap, risk, owner (`orchestrator` or `user`), prerequisites, and receipt-triggered follow-up. After actual publication, the orchestrator can run supported live tests or set up an authorized scheduled watcher/separate Job; otherwise request manual verification. **Never claim a watcher/reminder exists until it is actually created.**
62
+ - When only authorized live-only checks remain, pre-publish evidence and mandatory gates are complete, return `objective_status: "satisfied"` with `next_tasks: []` to reach Relay Final Review; preserve the handoff and `NOT_RUN` status. The code Job may complete, but live acceptance remains pending in the separate post-publish process.
63
+ - Preserve historical failed/deferred Tasks. Resolve them via supported cancellation/supersession and durable evidence/authorization, never silent deletion, invented success, or repeated E2E work. Diagnose version-mismatched Plan admission as a runtime issue instead of creating another live-only Task. After publication, defects require separate recovery/rollback work, not reopening a completed Job.
64
+
55
65
  ### Architecture Lens
56
66
 
57
67
  When the resolved project context exposes a canonical design-principles
@@ -118,7 +128,7 @@ If evidence is absent or execution outcome is unknown, disposition that historic
118
128
 
119
129
  - Prefer independently verifiable Tasks with stable IDs, but do not split work solely to make Tasks smaller.
120
130
  - When a Task depends on mutable repository or product state, distinguish a frozen evidence target from the current execution head. A SHA may freeze that Task's own review/source evidence, but do not copy an upstream SHA into a dependent release, deploy, publication, or other follow-on Task unless the objective explicitly requires that same frozen target. After dependencies complete, downstream Tasks must resolve and verify the current durable Job/PR head before acting.
121
- - When fresh UI, browser, store, runtime, or visual evidence is material to the Task outcome, say so explicitly in the Task input and require evidence from the real current state. Existing screenshots, prepared assets, or prior observations are not substitutes for fresh evidence unless the objective explicitly allows reuse.
131
+ - When fresh UI, browser, store, runtime, or visual evidence is material to a **pre-publish** Task, require current authentic evidence. If it is possible only after deployment, use the post-publish acceptance handoff above; existing screenshots or prior observations never substitute for live evidence.
122
132
  - When a Job needs multi-perspective review, use the visible `review-chair` agent or an Agent Graph to select specialist roles dynamically. Keep specialist Tasks as independent siblings against the same immutable target/version, and leave worker/model/provider routing to Relay.
123
133
  - A Task describes what an agent must accomplish; never emit a shell command as a worker Task.
124
134
  - Use dependencies only for Task IDs inside the current Job, and only when execution order actually matters. Never encode cross-Job or cross-repository dependencies in `dependencies`.
@@ -13,6 +13,8 @@ Review exactly the immutable target/version specified by the Review Task. Do not
13
13
 
14
14
  Reconstruct all material acceptance requirements from the durable Job objective and Task, then evaluate each with direct evidence. Check correctness, completeness, provenance, quality, regressions, explicit approvals and externally observable outcomes where applicable. Missing evidence is not PASS. If validation cannot complete, report task.failed. Keep review independent of implementation work.
15
15
 
16
+ For **publish-first live acceptance**, distinguish checks verifiable before release from checks that genuinely require the newly published runtime, real device, or external provider. A properly classified and handed-off live-only check is **NOT_RUN**, never PASS, but must not by itself cause a `task.failed` or `changes-required` verdict before publication. Verify that required pre-release quality/security/compliance/approval gates passed, that the future live test has a named owner and executable post-publish follow-up, and that remaining risks are disclosed. Missing mandatory pre-release evidence or a fabricated post-publish handoff remains blocking. Do not approve an unreviewed source/head or perform deployment yourself.
17
+
16
18
  For spec-oriented delivery, select read-only `speckit-analyze` to check
17
19
  `spec.md`, `plan.md`, and `tasks.md` consistency when those artifacts exist.
18
20
  Use `speckit-checklist` only as requirements-quality guidance; do not create
@@ -54,4 +54,10 @@ For a managed Job, Relay owns Job completion. A satisfied Plan, successful imple
54
54
 
55
55
  Post-merge publication and deployment activity is separate from Job lifecycle. Events or evidence such as `package.published`, published version metadata, service restart, and deployment verification may be attached after the Job is already `COMPLETED`; they must not hold the Job open, reopen it, or redefine completion. If post-merge deployment needs remediation, record that as separate deployment/recovery work rather than mutating the completed implementation Job lifecycle.
56
56
 
57
+ ## Live acceptance after publication
58
+
59
+ Use **publish-first live acceptance** when verification genuinely requires a running published build, real provider/account, device, or runtime. The Planner completes available build/isolated tests and mandatory pre-merge gates, then hands off unrun live-only scenarios as explicit `NOT_RUN` / `PENDING_POST_PUBLISH` evidence, not successful tests. Do not let a live-only check become a pre-merge Task or repeated Plan round just because its environment is unavailable. Independent Final Review and normal Relay merge/delivery remain mandatory.
60
+
61
+ After a **verified** publication/deployment receipt, the orchestrator uses the handoff to run supported live checks and monitor health if capable and authorized. A persistent watcher requires a real scheduled automation/monitoring mechanism; never promise background execution without creating one. If the scenario requires a user action or unsupported device/account, provide a concrete manual-acceptance checklist and request/reminder rather than holding the completed code Job open. Record exact version, test owner, evidence and final status separately; failures trigger a new post-release fix/rollback workflow. Security, legal, data-loss and explicit pre-release approval requirements are **not** deferrable under this policy.
62
+
57
63
  If a PR closes without merge, check the Job state through Relay CLI; do not infer a successful completion.
@@ -22,6 +22,8 @@ Use `job create` with standalone objective Markdown, or `job adopt` for an exist
22
22
  Any task producer — orchestrator, planner, or nested task-producing agent — must follow this contract.
23
23
  Task producers choose semantic task properties such as objective, dependencies, worker requirements, priority, and `storySize`. They do not normally choose an adapter, provider/model, or raw timeout milliseconds.
24
24
 
25
+ Before Task decomposition, distinguish tests achievable before publishing from live-only acceptance requiring the newly deployed runtime. The latter must be handed off for post-publish orchestrator or manual verification with an explicit `NOT_RUN`/`PENDING_POST_PUBLISH` status; do not create release-blocking Tasks for an unavailable future environment. Do not defer mandatory pre-publish security, compliance, or human approval gates. The authoritative policy and follow-up contract are in `agents/planner.agent.md` and `contracts/orchestrator-workflows.md`.
26
+
25
27
  `Task.timeoutMs` is the inactivity window. Only an accepted `task.started` or newer `task.progress` event for the exact current execution resets it; duplicate, stale, and out-of-order progress does not.
26
28
 
27
29
  ### Planning graph and semantic Task tree
@@ -66,6 +68,8 @@ This is a worker result-content contract, not a requirement for dedicated `rootC
66
68
 
67
69
  Keep these concepts distinct: observation is not root cause; hypothesis is not root cause; requested approach is not implemented solution; implementation is not validation.
68
70
 
71
+ Reviewers apply the same publish-first evidence boundary: they must not call a post-publish live-only test PASS, but may approve pre-publish implementation when all mandatory pre-release gates pass and deferred scenarios have an explicit owner, evidence gap, risk and actionable handoff. Missing mandatory pre-publish evidence still blocks approval. No reviewer may authorize an unverified merge or treat an unevaluated provider receipt as success.
72
+
69
73
  ### Worker self-review before success
70
74
 
71
75
  Every artifact-changing implementation worker follows the shared [worker self-review loop](worker-self-review.md), regardless of its selected agent name or runtime adapter. Complete the implement → self-review → fix → re-review cycle until the latest full review has no actionable findings. Include review rounds, fixes, validation evidence, and the clean-review result in the durable Task result. The worker's self-review never substitutes for an independent final Reviewer, human approval, or Relay's Graph-owned lifecycle gates.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Plan Apply Convergence Validation
3
- description: Validates hypothetical Plan application and, for Force Restate, historical consistency before the atomic commit action.
3
+ description: Validates Plan objective completion and, for Force Restate, historical consistency before the atomic commit action. Explicitly resolved cancel_supersede Tasks and failed Tasks classified superseded by a succeeded target are historical evidence, not unfinished implementation.
4
4
  ---
5
5
  flowchart LR
6
6
  %% relay: initial idle
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Review Lifecycle
3
- description: Manages review creation, immutable verdicts, changes-required, and re-review.
3
+ description: Manages review creation, immutable verdicts, changes-required, and re-review. The implementationComplete guard ignores only durably resolved cancel_supersede cancellations and failed Tasks with a valid superseded classification targeting succeeded work.
4
4
  ---
5
5
  flowchart LR
6
6
  %% relay: initial none
@@ -24,9 +24,8 @@ depUnsat["guard: dependenciesUnsatisfied"]
24
24
  runnable["guard: runnable"]
25
25
  dispatchable["guard: dispatchable"]
26
26
  shortcutExecution["guard: shortcutExecution"]
27
- shortcutFallback["guard: shortcutFallback"]
28
27
  shortcutHasGraph["guard: shortcutHasGraph"]
29
- shortcutEffectsSafe["guard: shortcutEffectsSafe"]
28
+ shortcutDirectInvocation["guard: shortcutDirectInvocation"]
30
29
  recoverStart["guard: recoverableExecution"]
31
30
  recoverComplete["guard: recoverableExecution"]
32
31
  recoverBlocked["guard: recoverableExecution"]
@@ -37,11 +36,12 @@ recoveryReopenClearError["action: mutation.clearError"]
37
36
  recoveryReopenClearReason["action: mutation.clearFailureReason"]
38
37
  recoveryReopenClearLease["action: mutation.clearLease"]
39
38
  recoveryReopenClearExecution["action: mutation.clearExecution"]
40
- shortcutWorkerFallback["action: mutation.markShortcutWorkerFallback"]
41
39
  shortcutRecoveryRequired["action: mutation.markShortcutRecoveryRequired"]
42
40
 
43
41
  plannerRetryAvailable["guard: retryAvailable"]
44
42
  platformFallbackSafe["guard: platformFallbackSafe"]
43
+ noStartFallbackAllowed["guard: noStartFallbackAllowed"]
44
+ prepareNoStartFallback["action: mutation.prepareNoStartFallback"]
45
45
  preparePlatformFallback["action: mutation.preparePlatformFallback"]
46
46
  plannerUnavailableMark["action: mutation.markPlannerUnavailable"]
47
47
  orphanFailMark["action: mutation.markUnknownOutcome"]
@@ -113,12 +113,12 @@ runnable -->|true| reconcileQueuedClearError
113
113
  reconcileQueuedClearError --> reconcileQueuedClearReason
114
114
  reconcileQueuedClearReason --> queued
115
115
  queued -->|on: dispatch| shortcutExecution
116
- shortcutExecution -->|true| shortcutFallback
116
+ shortcutExecution -->|true| shortcutHasGraph
117
117
  shortcutExecution -->|false| dispatchable
118
- shortcutFallback -->|true| dispatchable
119
- shortcutFallback -->|false| shortcutHasGraph
120
- shortcutHasGraph -->|true| shortcutLaunch
121
- shortcutHasGraph -->|false| dispatchable
118
+ shortcutHasGraph -->|true| shortcutDirectInvocation
119
+ shortcutDirectInvocation -->|true| shortcutLaunch
120
+ shortcutDirectInvocation -->|false| queued
121
+ shortcutHasGraph -->|false| queued
122
122
  dispatchable -->|true| dispatchLaunch
123
123
  dispatchLaunch --> queued
124
124
  shortcutLaunch --> queued
@@ -146,6 +146,10 @@ queued -->|on: effect.launchShortcut.failed| failed
146
146
  queued -->|on: watchdog.failed| failed
147
147
  queued -->|on: worker.delivery_failed| failed
148
148
  queued -->|on: worker.start_ack_failed| failed
149
+ queued -->|on: worker.no_start_failed| noStartFallbackAllowed
150
+ noStartFallbackAllowed -->|true| prepareNoStartFallback
151
+ prepareNoStartFallback --> queued
152
+ noStartFallbackAllowed -->|false| failed
149
153
  queued -->|on: worker.platform_failure| platformFallbackSafe
150
154
  platformFallbackSafe -->|true| preparePlatformFallback
151
155
  preparePlatformFallback --> queued
@@ -193,10 +197,7 @@ running -->|on: task.completed| completeClearError
193
197
  completeClearError --> completeClearReason
194
198
  completeClearReason --> succeeded
195
199
  running -->|on: task.failed| failed
196
- running -->|on: shortcut.failed| shortcutEffectsSafe
197
- shortcutEffectsSafe -->|true| shortcutWorkerFallback
198
- shortcutWorkerFallback --> failed
199
- shortcutEffectsSafe -->|false| shortcutRecoveryRequired
200
+ running -->|on: shortcut.failed| shortcutRecoveryRequired
200
201
  shortcutRecoveryRequired --> failed
201
202
  running -->|on: worker.platform_failure| runningPlatformFailureQuarantine
202
203
  runningPlatformFailureQuarantine["action: mutation.quarantinePlatformFailure"]
@@ -9,7 +9,6 @@ checkOwner["state: check_owner"]
9
9
  checkPath["state: check_path"]
10
10
  checkFreshExecution["state: check_fresh_execution"]
11
11
  activeRecovery["action: resolution.activateRecovery"]
12
- shortcutWorkerFallback["action: resolution.activateShortcutWorkerFallback"]
13
12
  sameJob["action: resolution.attachSameJobDependency"]
14
13
  blockerJob["action: resolution.registerBlockerDependency"]
15
14
  escalate["action: resolution.createEscalationGate"]
@@ -19,7 +18,6 @@ rejected["state: rejected"]
19
18
  recoveryOwner["guard: recoveryOwnerAvailable"]
20
19
  plannerOwner["guard: plannerOwnerAvailable"]
21
20
  exact["guard: exactOriginalRetry"]
22
- shortcutInterrupted["guard: shortcutInterrupted"]
23
21
  same["guard: sameJobDependency"]
24
22
  fresh["guard: freshRecoveryExecution"]
25
23
  blocker["guard: blockerJobDependency"]
@@ -42,9 +40,7 @@ checkPath -->|on: resolution.propose| fresh
42
40
  fresh -->|true| checkFreshExecution
43
41
  fresh -->|false| rejected
44
42
  checkFreshExecution -->|on: resolution.propose| exact
45
- exact -->|true| shortcutInterrupted
46
- shortcutInterrupted -->|true| shortcutWorkerFallback
47
- shortcutInterrupted -->|false| activeRecovery
43
+ exact -->|true| activeRecovery
48
44
  exact -->|false| same
49
45
  same -->|true| sameJob
50
46
  same -->|false| blocker
@@ -55,7 +51,6 @@ gate -->|false| obsoleteGuard
55
51
  obsoleteGuard -->|true| obsolete
56
52
  obsoleteGuard -->|false| rejected
57
53
  activeRecovery -->|to: resolved| resolved
58
- shortcutWorkerFallback -->|to: resolved| resolved
59
54
  sameJob -->|to: resolved| resolved
60
55
  blockerJob -->|to: resolved| resolved
61
56
  escalate -->|to: resolved| resolved