agents-relay 2.0.263 → 2.0.264

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 (64) hide show
  1. package/README.md +57 -52
  2. package/bin/migrate-task-ids.mjs +12 -0
  3. package/dist/blocker-recovery.js +9 -16
  4. package/dist/cli-blocker.js +2 -1
  5. package/dist/cli-coordinator.js +19 -7
  6. package/dist/cli-foreground.js +82 -0
  7. package/dist/cli-help.js +61 -72
  8. package/dist/cli-job-create.js +15 -9
  9. package/dist/cli-prompt.js +9 -5
  10. package/dist/cli-support.js +21 -8
  11. package/dist/cli-worker-task.js +9 -3
  12. package/dist/cli.js +50 -36
  13. package/dist/dag-task-runtime.js +16 -12
  14. package/dist/dashboard-html.js +28 -14
  15. package/dist/dashboard-jel.js +87 -31
  16. package/dist/dashboard-style.js +2 -8
  17. package/dist/dependency-revision-execution.js +15 -6
  18. package/dist/final-review-role.js +0 -12
  19. package/dist/job-local-repository-migration.js +137 -0
  20. package/dist/job-pr-number-migration.js +0 -4
  21. package/dist/job-task-id-sequence.js +18 -9
  22. package/dist/job-worktree-cleanup.js +3 -3
  23. package/dist/local-job-registry.js +2 -2
  24. package/dist/local-managed-store.js +2 -2
  25. package/dist/local-merge-delivery.js +16 -3
  26. package/dist/local-merge-projection.js +192 -49
  27. package/dist/no-github.js +2 -1
  28. package/dist/planner-recovery.js +8 -3
  29. package/dist/planner.js +5 -5
  30. package/dist/pool.js +3 -3
  31. package/dist/projection-failure-recovery.js +6 -46
  32. package/dist/reconciler-context.js +5 -5
  33. package/dist/reconciler-review.js +12 -37
  34. package/dist/reconciler-runtime.js +1 -4
  35. package/dist/reconciler.js +5 -5
  36. package/dist/relay-job-merge.js +33 -0
  37. package/dist/relay-store.js +8 -30
  38. package/dist/relay-workflow-operations.js +2 -0
  39. package/dist/relayd-control.js +22 -25
  40. package/dist/relayd-dashboard-actions.js +4 -5
  41. package/dist/relayd-utilities.js +15 -20
  42. package/dist/relayd.js +59 -299
  43. package/dist/review-generation-fence.js +1 -1
  44. package/dist/review-replan.js +6 -1
  45. package/dist/review-revision-model.js +11 -6
  46. package/dist/task-context.js +1 -1
  47. package/dist/task-id-migration.js +229 -0
  48. package/dist/task-transitions.js +1 -1
  49. package/dist/troubleshooter.js +13 -16
  50. package/dist/unified-job-registry.js +9 -0
  51. package/dist/workflow/projection-conflict-v2.js +30 -26
  52. package/dist/workflow/task-related-action-v2.js +1 -2
  53. package/dist/workspace.js +52 -56
  54. package/package.json +4 -2
  55. package/skills/agents-relay/SKILL.md +35 -60
  56. package/skills/agents-relay/agents/planner.agent.md +5 -5
  57. package/skills/agents-relay/bin/services.mjs +21 -3
  58. package/skills/agents-relay/contracts/task-job-contract.md +11 -2
  59. package/skills/agents-relay/evals/capabilities.json +6 -1
  60. package/workflow/projection-conflict.mmd +59 -56
  61. package/workflow/projection-outbox-conflict.mmd +20 -0
  62. package/dist/cli-projection.js +0 -29
  63. package/dist/projection-recovery-runtime.js +0 -121
  64. package/dist/projection-recovery.js +0 -101
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Agents Relay is a TypeScript runtime for durable asynchronous agent Jobs driven locally by SQLite and canonical workflow Graphs. The EventBus wakes reconciliation; an EventBus message or GitHub PR comment is never the lifecycle authority. Job, Plan, Task, Review, Execution, Lease and Recovery state survive daemon restarts in SQLite.
4
4
 
5
- V2 uses a read-only local SQLite Job Registry for discovery. The immutable jobId selects the Job Store even when prNumber is zero; lifecycle transitions are atomic across processes. GitHub is **audit-only**: its PR/head/publish events are persisted for reporting, never consulted to start, stop, or complete local Workflows. Local Git delivery and its confirmed merge receipt—not a remote PR MERGED fact—gate Graph completion. Job creation and local Task operations require no GitHub authentication or PR.
5
+ Every Job is keyed by an immutable local Git identity: `repository` is the Git root directory name and `projectRoot` is its validated canonical path. Every Neo Project is an independent Git repository; worktrees never become Job roots. SQLite owns the durable Job/Task/Review state. Local Git is the source of truth for review and merge. Only after completion, Relay may fast-forward-push verified local `main` if `origin/main` already exists and the effective fetch and push URLs match. No `origin` or no remote `main` means skip; unreachable, mismatched or divergent destinations are retried separately, never changing Job state.
6
6
 
7
7
 
8
8
  Agent frontmatter hints (`skills`, `model`, `reasoning`) are described in [Agent Definition Contract](skills/agents-relay/contracts/agent-contract.md). They are advisory only and do not alter Skill resolution or Router constraints.
@@ -19,11 +19,15 @@ Relay appends `--handoff-file`, optional `--on-needs-user-file`, and `--cwd`
19
19
  without using a shell. No Neo executable is assumed. Missing/failed executors
20
20
  produce `technical_failure` rather than silently resolving a blocker.
21
21
 
22
- **Unified Coordinator/DAG L3 gate:** `npm run test:l3:dag` exercises four
23
- three-Agent scenarios: Script without Review, all Approve, Script Request
24
- Changes then re-Approve, and Model Request Changes then re-Approve. Further
25
- coverage tests real Job activation, atomically created Coordinator, event-driven
26
- direct successor dispatch (including parallel branches and resource starvation),
22
+ **Unified Coordinator/DAG L3 gate:** `npm run test:l3:dag` exercises five
23
+ three-Agent scenarios: mixed Shortcut/Model without Agent Review, all Shortcut
24
+ Approve, Shortcut Request Changes → re-review → Approve, Model Request Changes
25
+ → re-review → Approve, and both Shortcut and Model Request Changes → Approve
26
+ within one DAG. The classic five are also part of `npm run test:verification:l3`.
27
+ Each scenario uses a disposable local Git repo and isolated SQLite, and verifies
28
+ that its temporary directory is removed. Further coverage tests real Job
29
+ activation, atomically created Coordinator, event-driven direct successor
30
+ dispatch (including parallel branches and resource starvation),
27
31
  failed Agent recovery and restart/idempotency. Every Agent is a durable Task;
28
32
  `QUEUED` does not impose another global Job scheduling pass when capacity is
29
33
  available. The Coordinator has no Worker lease. There is no Shortcut Runner,
@@ -57,16 +61,12 @@ flowchart LR
57
61
  Graphs --> Effects[Stateless actions / effects]
58
62
  Effects --> Store
59
63
  Store --> Views[Dashboard / Recovery]
60
- Effects --> Outbox[Durable external-action outbox]
61
- Outbox --> GH[GitHub Commit / PR / Review / Merge API]
62
- GH --> Facts[Confirmed external facts]
63
- Facts --> Store
64
+ Effects --> Merge[Local Git merge]
65
+ Store --> Delivery[Optional post-completion origin delivery]
64
66
  \`\`\`
65
67
 
66
68
  SQLite holds the sole lifecycle authority; the Graph Engine selects every transition.
67
- GitHub operations are explicitly requested and confirmed by adapters, never used to
68
- discover or reconstruct Job/Task state. EventBus delivery wakes reconciliation;
69
- it cannot replace the durable SQLite record.
69
+ Job execution does not make GitHub API calls. Optional origin delivery runs only after durable local completion; delivery errors never change the SQLite lifecycle. EventBus delivery wakes reconciliation; it cannot replace the durable SQLite record.
70
70
 
71
71
  ### Workflow graph navigation
72
72
 
@@ -87,11 +87,11 @@ These paths always represent the current canonical graphs. Historical graph defi
87
87
 
88
88
  ### Structured runtime observability
89
89
 
90
- `src/observability.ts` is the single structured logging/event boundary that records why a lifecycle or projection decision happened. One correlated record chain (`wake -> graph -> transition -> store commit -> projection outcome`) lets an operator reconstruct a representative task lifecycle without ad-hoc stderr parsing. Records are observational only, never a second durable store; they correlate by repository/PR/job/task/execution, classify failures as deterministic `conflict` vs `transient` retry vs `terminal`, redact secrets/prompts, bound large payloads, and keep routine idle/no-op cycles quiet at the default level. See [`docs/structured-observability.md`](docs/structured-observability.md) for the record contract, fields, noise policy, and redaction rules.
90
+ `src/observability.ts` is the single structured logging/event boundary that records why a lifecycle or projection decision happened. One correlated record chain (`wake -> graph -> transition -> store commit -> projection outcome`) lets an operator reconstruct a representative task lifecycle without ad-hoc stderr parsing. Records are observational only, never a second durable store; they correlate by repository/job/task/execution, classify failures as deterministic `conflict` vs `transient` retry vs `terminal`, redact secrets/prompts, bound large payloads, and keep routine idle/no-op cycles quiet at the default level. See [`docs/structured-observability.md`](docs/structured-observability.md) for the record contract, fields, noise policy, and redaction rules.
91
91
 
92
92
  ## Quick start
93
93
 
94
- For new work, create a local Job through Agents Relay. The external GitHub projection may create a display PR after the first meaningful code commit. Tasks are validated against the SQLite Job, not GitHub markers; existing PR-bound Jobs remain readable.
94
+ For new work, create a local Job through Agents Relay. Local execution, review, and merge do not depend on GitHub. Optional post-completion delivery detects `origin` from the canonical local project root. Tasks are validated against the SQLite Job, not GitHub markers.
95
95
 
96
96
  ~~~sh
97
97
  cat > job.md <<'EOF'
@@ -100,8 +100,12 @@ cat > job.md <<'EOF'
100
100
  Standalone Job context. Put a Mermaid block first when a workflow/state/architecture diagram helps.
101
101
  EOF
102
102
 
103
- npx agents-relay job create --repo OWNER/REPO \
104
- --title "Objective" --objective-file job.md
103
+ npx agents-relay job create --repo LOCAL_ROOT_NAME --project-root "$PWD" \
104
+ --title "Objective" --objective-file job.md --initial-plan
105
+
106
+ # Optional explicit local code branch binding at Job creation:
107
+ # --local-merge-source refs/heads/FEATURE --local-merge-target refs/heads/main
108
+ # Otherwise Relay binds a source branch when code execution first requires it.
105
109
 
106
110
  # Create-only example: the orchestrator explicitly adds these Tasks.
107
111
  # For normal autonomous execution, instead pass --initial-plan at creation
@@ -111,14 +115,15 @@ cat > task.md <<'EOF'
111
115
 
112
116
  Implement this phase using the Job objective as context.
113
117
  EOF
114
- npx agents-relay task create --repo OWNER/REPO --id JOB_ID \
115
- --task-id initial --output task-pr --input-file task.md
118
+ npx agents-relay task create --repo LOCAL_ROOT_NAME --id JOB_ID \
119
+ --output local-git --input-file task.md
116
120
 
117
- npx agents-relay task create --repo OWNER/REPO --id JOB_ID \
118
- --task-id child --output task-pr \
121
+ # Use the actual numeric Task ID returned by the previous create command.
122
+ npx agents-relay task create --repo LOCAL_ROOT_NAME --id JOB_ID \
123
+ --output local-git --deps NUMERIC_TASK_ID_FROM_PREVIOUS_CREATE \
119
124
  --input "Implement the described child task and publish a terminal event."
120
125
 
121
- npx agents-relay reconcile --repo OWNER/REPO --id JOB_ID
126
+ npx agents-relay reconcile --repo LOCAL_ROOT_NAME --id JOB_ID
122
127
  npx agents-relay job show --id JOB_ID
123
128
  ~~~
124
129
 
@@ -127,12 +132,12 @@ Task readiness is explicit: `DRAFT` means the durable task exists but is not exe
127
132
  Mutable draft/queued/retryable task fields can be changed in place without replacing the durable task identity. `task update` rejects `RUNNING`, `SUCCEEDED`, and `CANCELLED` tasks so active execution and terminal history cannot be rewritten. For example:
128
133
 
129
134
  ~~~sh
130
- npx agents-relay task update --repo OWNER/REPO --id JOB_ID --task-id child \
135
+ npx agents-relay task update --repo LOCAL_ROOT_NAME --id JOB_ID --task-id NUMERIC_TASK_ID \
131
136
  --adapter chatgpt --provider chatgpt --model gpt-5.6-sol --reasoning high \
132
137
  --capabilities model,chatgpt,browser-harness
133
138
 
134
139
  # Explicitly release a held DRAFT task
135
- npx agents-relay task update --repo OWNER/REPO --id JOB_ID --task-id child --queue
140
+ npx agents-relay task update --repo LOCAL_ROOT_NAME --id JOB_ID --task-id NUMERIC_TASK_ID --queue
136
141
  ~~~
137
142
 
138
143
  Jobs separate durable lifecycle from derived runtime status. Durable lifecycle is `DRAFT | ACTIVE | COMPLETED | CANCELLED`: a newly created Job is DRAFT, and creating executable work or starting the Planner activates it. Runtime status (`IDLE`, `WAITING`, `QUEUED`, `RUNNING`, `BLOCKED`, `FAILED`, `REVIEWING`, `MERGE_PENDING`, `MERGED`, or `CANCELLED`) is computed from Tasks, Review, and locally confirmed merge facts and is never persisted as lifecycle truth.
@@ -145,7 +150,7 @@ Lifecycle transition authority lives in the directly renderable canonical flowch
145
150
 
146
151
  The canonical Mermaid Graph Engine is the authoritative durable workflow decision path. Job/Task lifecycle transitions plus Review, Planner, Blocker/Unblock, and Troubleshooter orchestration branches are defined by the canonical workflow graphs and executed through the shared graph runtime. TypeScript supplies facts and primitive action/effect implementations; it must not duplicate those workflow branches as a second procedural state machine.
147
152
 
148
- Job objectives and Task inputs are Markdown. Prefer `--objective-file` / `--input-file` (use `-` for stdin) for durable long-form context; inline `--objective` / `--input` remain for short/simple text and are mutually exclusive with the file variants. When a diagram materially clarifies the work, put Mermaid first and then Markdown detail. A newly created Job must capture enough context to finish independently of the originating chat. SQLite owns Job metadata and objectives. Any display PR or historical PR marker is a compatibility/audit projection, not the source of lifecycle truth.
153
+ Job objectives and Task inputs are Markdown. Prefer `--objective-file` / `--input-file` (use `-` for stdin) for durable long-form context; inline `--objective` / `--input` remain for short/simple text and are mutually exclusive with the file variants. When a diagram materially clarifies the work, put Mermaid first and then Markdown detail. A newly created Job must capture enough context to finish independently of the originating chat. SQLite owns Job metadata and objectives. Historical PR markers are compatibility/audit evidence, not the source of lifecycle truth.
149
154
 
150
155
  Every Job is objective-driven. By default, `job create` persists only a DRAFT
151
156
  Job; `--initial-plan` also initializes the first real Planner round and its
@@ -162,8 +167,8 @@ can start the next Planner round; PASS proceeds to the local merge gate.
162
167
  Manual planning syntax:
163
168
 
164
169
  ~~~sh
165
- npx agents-relay plan --repo OWNER/REPO --id JOB_ID --prompt "Plan the implementation from the durable objective"
166
- npx agents-relay plan --repo OWNER/REPO --id JOB_ID --prompt-file guidance.md
170
+ npx agents-relay plan --repo LOCAL_ROOT_NAME --id JOB_ID --prompt "Plan the implementation from the durable objective"
171
+ npx agents-relay plan --repo LOCAL_ROOT_NAME --id JOB_ID --prompt-file guidance.md
167
172
  ~~~
168
173
 
169
174
  The optional prompt is additional round guidance; it does not replace the durable Job objective. New planning rounds use `plan-N`; historical `planner-N` records remain readable.
@@ -179,7 +184,7 @@ All task producers use the same story-size contract: `S`≈5 minutes, `M`≈15 m
179
184
 
180
185
  There is no Job scheduling or cron support. Reconciliation resumes objective planning from durable state, including after a missed wake-up or restart. See [objective-driven Jobs](docs/objective-driven-jobs.md).
181
186
 
182
- GitHub projection creates or reuses a display PR after a meaningful source-branch commit. Job creation is create-only by default and enables auto-merge unless `--no-auto-merge` is set. A Coordinator may be included atomically by supplying its Graph, input and absolute execution paths. Existing Jobs can still change that setting with `job update`. Task execution options belong to `task create`, and the orchestrator may create zero, one, or multiple initial Tasks according to user intent.
187
+ Remote delivery is optional and uses the configured `origin` URL found at delivery time; no remote owner/repository identity is part of a Job. Job creation is create-only by default. A Coordinator may be included atomically by supplying its Graph, input and absolute execution paths. Task execution options belong to `task create`, and the orchestrator may create zero, one, or multiple initial Tasks according to user intent.
183
188
 
184
189
  Use `job update` for partial mutable metadata changes on an already healthy Job marker/binding:
185
190
 
@@ -187,7 +192,7 @@ Use `job update` for partial mutable metadata changes on an already healthy Job
187
192
  npx agents-relay job update --id JOB_ID --priority P0 --no-auto-merge
188
193
  ~~~
189
194
 
190
- Request an eligible new review with `npx agents-relay review job --repo OWNER/REPO --id JOB_ID`.
195
+ Request an eligible new review with `npx agents-relay review job --repo LOCAL_ROOT_NAME --id JOB_ID`.
191
196
  Pass optional `--thread-id THREAD_ID` to persist a reviewer-thread override for subsequent
192
197
  review routing. Without it, Relay uses the stored reviewer thread, then creator thread,
193
198
  or the legacy review path when neither exists. This request wakes graph-owned
@@ -196,21 +201,18 @@ review orchestration; it is not a delivery receipt.
196
201
  Review destinations are durable Job facts. `job create` and `job update` accept
197
202
  `--reviewer-thread-id` and `--creator-thread-id`; a reviewer ID takes precedence
198
203
  over the creator/origin ID. A local runtime invocation may pass
199
- `--thread-id` as an explicit one-run review override. When a destination exists,
200
- final-review routing requires a ChatGPT/webhelm worker and submits the
201
- review request as a verified `new-turn` to that existing thread with the Job ID,
202
- PR number, and immutable review head SHA. Failure still follows the ordinary
204
+ `--thread-id` as an explicit one-run review override. When a destination exists, final-review routing requires a ChatGPT/webhelm worker and submits the review request as a verified `new-turn` to that existing thread with the Job ID and immutable local review head SHA. Failure still follows the ordinary
203
205
  review task retry/recovery path; a transport failure is never treated as
204
206
  review delivery.
205
207
 
206
- `job update` validates the trusted Job marker first. Missing, malformed, duplicated, mismatched, or conflicting bindings fail with a precise diagnostic and are not repaired implicitly. The orchestrator handles exceptional repair explicitly according to the Job contract, then retries the update. `job show` reads one Job and `job list` lists managed Jobs in a repository.
208
+ `job update` validates the trusted Job marker first. Missing, malformed, duplicated, mismatched, or conflicting bindings fail with a precise diagnostic and are not repaired implicitly. The orchestrator handles exceptional repair explicitly according to the Job contract, then retries the update. `job show` reads one Job and `job list` lists local Jobs in a repository.
207
209
 
208
- Managed GitHub task create/update/show/list/retry/cancel and reconcile/serve commands also require a durable Job marker. Orchestrators do not need raw GitHub commands for normal Job creation or metadata updates: Agents Relay uses its authenticated GitHub client internally.
210
+ Task and Job commands address durable SQLite Jobs by local repository identity and numeric ID.
209
211
 
210
- The original init command remains supported for backward compatibility:
212
+ The init command creates a local demo Job from the current Git root:
211
213
 
212
214
  ~~~sh
213
- npx agents-relay init --repo OWNER/REPO --pr 1 --id JOB_ID --title "Objective"
215
+ npx agents-relay init --repo LOCAL_ROOT_NAME --id JOB_ID --title "Objective"
214
216
  ~~~
215
217
 
216
218
  ## npm publishing
@@ -229,7 +231,7 @@ For explicit local demo/test mode:
229
231
  npm install
230
232
  npm run build
231
233
  node dist/cli.js init --file .agents-relay.json --title "Dogfood" --id demo
232
- node dist/cli.js task create --file .agents-relay.json --task-id hello --output task-pr --input "Complete the described task"
234
+ node dist/cli.js task create --file .agents-relay.json --output local-git --input "Complete the described task"
233
235
  node dist/cli.js reconcile --file .agents-relay.json
234
236
  npx agents-relay serve --file .agents-relay.json
235
237
  ~~~
@@ -248,9 +250,9 @@ This small live suite covers two Temporary Chat submission gates: a normal text
248
250
  prompt and a prompt with an attachment. It does not exercise worker lifecycle
249
251
  events, durable-thread reuse, resume, or retry behavior.
250
252
 
251
- Open the dashboard on localhost port 8787. The marker format is intentionally public and append-friendly. Daemon/workspace operation uses `ProjectedDurableStore` over SQLite RelayStore plus the authenticated GitHub projection adapter; GitHubStore is not the daemon operational state database.
253
+ Open the dashboard on localhost port 8787. The marker format is intentionally public and append-friendly. Daemon/workspace operation reads the SQLite RelayStore inventory; historical GitHub audit evidence is not refreshed during Job execution.
252
254
 
253
- Deterministic projection conflicts are safe and observable. A same-id/different-definition `append_task`/`append_plan` is classified once into a durable `conflict` state, stops consuming retry budget, keeps structured divergence evidence, and is never auto-overwritten. Inspect with `agents-relay projection conflicts --repo OWNER/REPO --pr NUMBER` and repair explicitly with `agents-relay projection resolve --repo OWNER/REPO --pr NUMBER --projection-id ID --action requeue|discard-local`. See [docs/architecture-v2.md](docs/architecture-v2.md).
255
+ Deterministic projection conflicts are safe and observable. A same-id/different-definition `append_task`/`append_plan` is classified once into a durable `conflict` state, stops consuming retry budget, keeps structured divergence evidence, and is never auto-overwritten. Historical projection conflict rows remain in SQLite for audit; the PR projection CLI is retired.
254
256
 
255
257
  External product feedback uses the reusable `src/feedback.ts` contract. See [docs/feedback-intake.md](docs/feedback-intake.md) for the schema, attachment limits, privacy rules, materialization path, and provenance envelope for later Jobs/Tasks/PRs.
256
258
 
@@ -258,9 +260,9 @@ reconcile leases and launches ready tasks without waiting inside the runtime sch
258
260
 
259
261
  Router Rules are stored at `~/.agents-relay/execution-router-rules.md` by default and use `[choices]` plus `[routing-instruction]` sections (see the Execution Router doc). `agents-relayd --execution-router-rules PATH` selects a different file for that daemon process; the explicit CLI path takes precedence over `AGENTS_RELAY_EXECUTION_ROUTER_RULES`, which remains supported for compatibility.
260
262
 
261
- `agents-relayd` without `--pr`/`--id` runs in workspace mode by default: it discovers nested Git repositories under `~/Workspace`, keeps only GitHub `origin` remotes, and aggregates their managed PR jobs into one dashboard and worker pool. Pass `--workspace PATH` to use another root. `--repo OWNER/REPO` remains the single-repository pool mode.
263
+ `agents-relayd` discovers Jobs **only from local SQLite**; it does not recursively search Workspace or infer repository identities from the daemon’s current directory. Each Job carries its immutable, canonical Git `projectRoot`; no nested Job path is supported. Run `npx agents-relayd` without `--workspace` or `--repo` for the ordinary daemon. `--repo LOCAL_ROOT_NAME` remains an optional local identity selector; `--workspace-root PATH` (legacy alias `--workspace`) is for execution/worktree placement only and never changes Job discovery. Workspace directory layout changes cannot silently rebind a Job.
262
264
 
263
- For automation, Agents Relay can use GitHub App installation authentication via `AGENTS_RELAY_GITHUB_APP_ID`, `AGENTS_RELAY_GITHUB_APP_INSTALLATION_ID`, and `AGENTS_RELAY_GITHUB_APP_PRIVATE_KEY_FILE` (or matching CLI flags). Webhook mode is local-first: targeted webhook reconciliation is primary, dashboard auto-refresh reads the disposable in-process view restored from SQLite RelayStore state, and the broad watchdog drops to a 30-minute fallback. No separate persisted dashboard Job cache is maintained. See [docs/github-app-rate-limit.md](docs/github-app-rate-limit.md).
265
+ Job execution does not use GitHub App authentication or GitHub webhooks. Legacy webhook and PR evidence remains readable for historical audit; it cannot drive local lifecycle decisions.
264
266
 
265
267
  Run one logical reconciliation authority per Job. `ReconcileCoordinator` serializes in-process work; use a distributed atomic lease before multiple independent reconcilers own the same Job. Do not put secrets, credentials, private prompts, or large private payloads in the PR-body Job marker or PR-comment Task markers; store only summaries and artifact references.
266
268
 
@@ -274,15 +276,15 @@ npx agents-relay context resolve --project-path ~/Workspace/agents-relay --role
274
276
 
275
277
  The command resolves concrete paths only for the current execution. Use `--skills` / `--agents` for explicit selections; no resolved absolute path is written into durable task state.
276
278
 
277
- The minimal agent-network surface is machine-driven registration and discovery. `agent-register` persists an agent identity, responsibility boundary, claimed capabilities, endpoint/runtime, availability, and routing metadata in a trusted PR marker; `agent-discover` applies hard filters and returns evidence-backed candidates. Adapters remain runtimes, not agent identities. See [docs/architecture.md](docs/architecture.md) for the constrained future remote submission contract.
279
+ The minimal agent-network surface is machine-driven registration and discovery. `agent-register` persists an agent identity, responsibility boundary, claimed capabilities, endpoint/runtime, availability, and routing metadata in SQLite; `agent-discover` applies hard filters and returns evidence-backed candidates. Adapters remain runtimes, not agent identities. See [docs/architecture.md](docs/architecture.md) for the constrained future remote submission contract.
278
280
 
279
281
  ### Agent worker lifecycle
280
282
 
281
283
  Managed tasks are descriptive work for agents, not shell commands. Use `codex` or `chatgpt` for worker tasks. Commands such as tests, build tools, Markad Vision, ffmpeg, and other CLIs are invoked by the orchestrator or by an executing agent; they are not worker adapters.
282
284
 
283
- Every model-backed task declares a durable output with `--output task-pr` or `--output file --output-path PATH`. Agents Relay bootstraps workers with the managed PR URL, durable task-comment URL, job/task identity, project, output contract, and mandatory terminal-event contract; workers retrieve the task intent from GitHub rather than receiving a duplicate copy of the stored task prompt.
285
+ Every model-backed task declares a durable output with `--output local-git` (code changes reviewed and merged through local Git) or `--output file --output-path PATH`. The historical internal `task_pr` record kind remains readable, but the public CLI no longer exposes PR output. Agents Relay bootstraps workers with the Job/Task identity, project, output contract, and mandatory terminal-event contract; workers retrieve task intent through the Relay CLI from SQLite.
284
286
 
285
- For Codex and ChatGPT, **correlated worker events are authoritative lifecycle inputs**, not a separate durable store. Event publication uses the configured `events-bus` surface (`publish` for sandboxed/hosted workers, or its local CLI helper with `EVENTS_BUS_EVENT_SOURCE` set); Agents Relay subscribes, validates correlation, applies graph transitions, persists results in RelayStore, and projects them to GitHub. Relay publishes `task.process.launched` only after successful adapter launch; `task.started` is worker-owned and must be a new, correlated start acknowledgement. Codex publishes `task.process.exited` when its synchronous runtime exits, while ChatGPT publishes `task.process.async_exited` after its one-shot submission runtime exits; neither substitutes for `task.completed`, `task.failed`, `task.blocked`, or `task.cancelled`. The executing agent must publish exactly one correlated terminal event. Relay persists the matching durable state only from that terminal event. Model-backed tasks require an event bus and time out explicitly if no terminal event arrives.
287
+ For Codex and ChatGPT, **correlated worker events are authoritative lifecycle inputs**, not a separate durable store. Event publication uses the configured `events-bus` surface (`publish` for sandboxed/hosted workers, or its local CLI helper with `EVENTS_BUS_EVENT_SOURCE` set); Agents Relay subscribes, validates correlation, applies graph transitions, persists results in RelayStore. Relay publishes `task.process.launched` only after successful adapter launch; `task.started` is worker-owned and must be a new, correlated start acknowledgement. Codex publishes `task.process.exited` when its synchronous runtime exits, while ChatGPT publishes `task.process.async_exited` after its one-shot submission runtime exits; neither substitutes for `task.completed`, `task.failed`, `task.blocked`, or `task.cancelled`. The executing agent must publish exactly one correlated terminal event. Relay persists the matching durable state only from that terminal event. Model-backed tasks require an event bus and time out explicitly if no terminal event arrives.
286
288
 
287
289
  External execution uses the single global `webhelm` executable installed by the
288
290
  WebHelm Skill. Before starting Relay, install that Skill through the agent's
@@ -295,7 +297,7 @@ Relay does not discover Skill directories or invoke a separate runtime.
295
297
  The ChatGPT adapter uses Relay's `agents/chatgpt-worker.agent.md` lifecycle contract. A new worker uses `webhelm platform run chatgpt new-thread --session-id SESSION_ID --config <file>` in a caller-owned Session. This is a regular persistent ChatGPT thread, which supports the connected Neo MCP in the verified account. Relay closes the Session after submission, but the ChatGPT thread remains in history. Existing-thread review and handoff continue through `new-turn`. File paths are included in the worker message for Neo MCP reading; they are not uploaded as browser attachments. Submission receipts retain `status: submitted`; the event bus owns task completion.
296
298
 
297
299
  ~~~sh
298
- npx agents-relay task create --repo OWNER/REPO --pr 5 --id JOB_ID \
300
+ npx agents-relay task create --repo LOCAL_ROOT_NAME --id JOB_ID \
299
301
  --task-id research-ui --adapter chatgpt \
300
302
  --capabilities model,chatgpt,browser-harness \
301
303
  --provider openai --model MODEL \
@@ -304,9 +306,7 @@ npx agents-relay task create --repo OWNER/REPO --pr 5 --id JOB_ID \
304
306
  ~~~
305
307
 
306
308
  SQLite and the canonical Graphs are authoritative for terminal lifecycle.
307
- A remote PR merge/close is audit metadata, not completion evidence. Final
308
- Review PASS authorizes local Git merge; confirmed local-merge evidence gates
309
- `COMPLETED`. The dashboard distinguishes durable Job lifecycle from derived
309
+ Remote PR state is not part of Job lifecycle. Final Review PASS authorizes local Git merge; confirmed local-merge evidence gates `COMPLETED`. Optional origin delivery runs only afterward. The dashboard distinguishes durable Job lifecycle from derived
310
310
  runtime status. `/api/runtime-summary` counts only RUNNING Tasks of ACTIVE
311
311
  Jobs with a valid current Worker execution and lease. The Coordinator itself
312
312
  has no Worker lease, and every Script/Model DAG node is an ordinary Task.
@@ -323,7 +323,7 @@ Relay has no orchestrator worker adapter for new work. Orchestrators are externa
323
323
 
324
324
  Historical stores may still contain `adapter: orchestrator`. Reconciliation treats that value only as legacy migration evidence: QUEUED work that never started can be converted in place to normal worker requirements; RUNNING work with an unknown outcome is quarantined as BLOCKED instead of replayed; only explicit durable `externalCompletionVerified` evidence can complete legacy work without execution. New Task creation and Task update reject that adapter.
325
325
 
326
- For managed Jobs, SQLite is the canonical collaboration and lifecycle record; an optional GitHub display PR carries audit information only.
326
+ For managed Jobs, SQLite is the canonical lifecycle record. Existing PR evidence may remain in historical Job snapshots for audit.
327
327
 
328
328
  ### Automatic task troubleshooting
329
329
 
@@ -392,13 +392,18 @@ The caller must report only a release it has actually verified. For local-first
392
392
 
393
393
  ### Project-scoped agent Markdown inheritance
394
394
 
395
- Agent lookup has exactly two layers: Relay built-in `skills/agents-relay/agents/` and `<job-context-root>/agents/`. `job.projectPath` selects the context root within the repository (including monorepo content projects); no workspace/global agent fallback is searched. Project agent frontmatter can specify `extends: relay/planner`, `mode: extend`, and `sections: { replace: [Heading/Subheading], extend: [Other Heading] }` using heading paths, or `mode: replace` for a full behavioral replacement. Relay-owned lifecycle, Job/Task and events contracts are injected separately and cannot be replaced by a project agent. An unextended local agent is a standalone definition. The resolver emits a deterministic SHA-256 of composed Markdown; a missing section or unsupported parent fails instead of silently dropping instructions.
395
+ Agent lookup has exactly two layers: Relay built-in `skills/agents-relay/agents/` and `<job-context-root>/agents/`. `job.projectRoot` selects the independent Git repository context root; no workspace/global agent fallback is searched. Project agent frontmatter can specify `extends: relay/planner`, `mode: extend`, and `sections: { replace: [Heading/Subheading], extend: [Other Heading] }` using heading paths, or `mode: replace` for a full behavioral replacement. Relay-owned lifecycle, Job/Task and events contracts are injected separately and cannot be replaced by a project agent. An unextended local agent is a standalone definition. The resolver emits a deterministic SHA-256 of composed Markdown; a missing section or unsupported parent fails instead of silently dropping instructions.
396
396
 
397
397
  ### Plan-free Graph Jobs (unified start)
398
398
 
399
399
  Create a Job without `--initial-plan`, materialize one queued Agent Graph Task,
400
400
  then activate it with `agents-relay job run --id JOB --task-id TASK`. No
401
- `executionMode` is stored; `job run` only activates and publishes a wake-up.
401
+ `executionMode` is stored; normal `job run` only activates and publishes a wake-up.
402
+ For an immediate foreground run with streaming Task events (no scheduler wait), use
403
+ `agents-relay job run --id JOB --task-id TASK --foreground`. This runs the
404
+ ordinary Reconciler and waits for a terminal Job state; Ctrl+C interrupts
405
+ local workers but preserves durable Job state for normal recovery. Model-backed
406
+ Tasks still require the configured Event Bus.
402
407
  The ordinary Reconciler creates the Coordinator and durable Agent-named Tasks,
403
408
  with the same Script/Model execution, Task Review, Retry and recovery used by
404
409
  all other Jobs. Final Review follows the normal `--review`/`--no-review`
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import { migrateTaskIds } from '../dist/task-id-migration.js';
3
+
4
+ const args=process.argv.slice(2);
5
+ const option=name=>{const index=args.indexOf(name);if(index<0||!args[index+1])throw new Error(`Required: ${name} PATH`);return args[index+1];};
6
+ try {
7
+ const result=await migrateTaskIds(option('--database'),option('--backup'));
8
+ process.stdout.write(JSON.stringify(result,null,2)+'\n');
9
+ } catch(error) {
10
+ process.stderr.write((error instanceof Error?error.message:String(error))+'\n');
11
+ process.exitCode=1;
12
+ }
@@ -6,15 +6,12 @@ import { discoverLocalRelayStoreSnapshots, relayStoreDirectory } from './relay-s
6
6
  import { registerBlockerDependency } from './blockers.js';
7
7
  import { dispatchBlockerRecovery } from './workflow/blocker-recovery.js';
8
8
  function normalizeRepository(value) {
9
- const trimmed = value.trim().replace(/\.git$/, '');
10
- if (!/^[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9_.-]+$/.test(trimmed) || trimmed.includes('..')) {
9
+ const trimmed = value.trim();
10
+ if (!/^[A-Za-z0-9][A-Za-z0-9_.-]*$/.test(trimmed) || trimmed.includes('..')) {
11
11
  throw new Error(`Invalid repository identity: ${value}`);
12
12
  }
13
13
  return trimmed;
14
14
  }
15
- function repositoryOwner(value) {
16
- return value.split('/')[0].toLowerCase();
17
- }
18
15
  function normalizedIntent(value) {
19
16
  return value.trim().replace(/\s+/g, ' ');
20
17
  }
@@ -28,12 +25,14 @@ function intentFingerprint(input, blockedAttempt) {
28
25
  reason: normalizedIntent(input.reason),
29
26
  title: normalizedIntent(input.title),
30
27
  objective: normalizedIntent(input.objective),
31
- projectPath: input.projectPath ?? null,
32
28
  resolutionMode: input.resolutionMode,
33
29
  };
34
30
  return createHash('sha256').update(JSON.stringify(stable)).digest('hex');
35
31
  }
36
32
  function validateInput(input) {
33
+ // A removed nested-Job path must never be silently accepted from untyped callers.
34
+ if (Object.hasOwn(input, 'projectPath'))
35
+ throw new Error('Blocker recovery projectPath is removed; use targetProjectRoot');
37
36
  const requestId = input.requestId.trim();
38
37
  const title = input.title.trim();
39
38
  const objective = input.objective.trim();
@@ -57,15 +56,10 @@ function validateInput(input) {
57
56
  throw new Error(`Blocker recovery objective must identify target repository ${targetRepository}`);
58
57
  if (!normalizedObjective.includes(input.dependentTaskId))
59
58
  throw new Error(`Blocker recovery objective must identify dependent Task ${input.dependentTaskId}`);
60
- if (input.projectPath && (input.projectPath.startsWith('/') || input.projectPath.includes('\\')
61
- || input.projectPath.split('/').some(segment => segment === '' || segment === '.' || segment === '..'))) {
62
- throw new Error('Blocker recovery projectPath must be a normalized repository-relative path');
63
- }
64
59
  if (targetRepository === dependentRepository)
65
60
  throw new Error('Blocker recovery requires a distinct target repository');
66
- if (repositoryOwner(targetRepository) !== repositoryOwner(dependentRepository)) {
67
- throw new Error('Blocker recovery target and dependent repositories must share one owner/workspace trust boundary');
68
- }
61
+ if (!input.targetProjectRoot)
62
+ throw new Error('Blocker recovery requires an explicit targetProjectRoot');
69
63
  }
70
64
  function receipt(input, blockerJobId, outcome, planningRecoveryRequired, request, now) {
71
65
  return {
@@ -97,7 +91,6 @@ function makeRequest(input, now, blockedAttempt) {
97
91
  blockedAttempt,
98
92
  title: input.title.trim(),
99
93
  objective: input.objective.trim(),
100
- projectPath: input.projectPath,
101
94
  resolutionMode: input.resolutionMode,
102
95
  origin: input.origin,
103
96
  authorized: input.authorized,
@@ -203,7 +196,7 @@ export async function ensureBlockerRecovery(input) {
203
196
  }
204
197
  const authorizedRepositories = input.authorizedRepositories.map(normalizeRepository);
205
198
  const targetResolvable = authorizedRepositories.includes(request.targetRepository);
206
- const trustBoundaryValid = repositoryOwner(request.targetRepository) === repositoryOwner(request.dependentRepository);
199
+ const trustBoundaryValid = input.authorizedRepositories.map(normalizeRepository).includes(dependentRepository);
207
200
  const knownRequest = known !== null;
208
201
  const authoritativeDependency = !knownRequest && candidate !== null;
209
202
  const validAdoption = candidate ? adoptionValid(candidate, request) : false;
@@ -222,7 +215,7 @@ export async function ensureBlockerRecovery(input) {
222
215
  idempotencyKey: `blocker-recovery:${request.requestId}`,
223
216
  title: request.title,
224
217
  objective: request.objective,
225
- projectPath: request.projectPath,
218
+ projectRoot: input.targetProjectRoot,
226
219
  noGitHub: true,
227
220
  storeDirectory: directory,
228
221
  });
@@ -4,6 +4,8 @@ export async function runBlockerCommand(action, args) {
4
4
  if (!['add', 'ensure', 'resolve', 'show'].includes(action))
5
5
  throw new Error(usage);
6
6
  if (action === 'ensure') {
7
+ if (hasArg(args, '--project-path'))
8
+ throw new Error('Blocker Job --project-path is removed; use its independent Git root');
7
9
  const dependentRepository = repository(args);
8
10
  const dependentJobId = arg(args, '--id');
9
11
  const targetRepository = arg(args, '--target-repo');
@@ -31,7 +33,6 @@ export async function runBlockerCommand(action, args) {
31
33
  request: {
32
34
  requestId, targetRepository, dependentRepository, dependentJobId, dependentTaskId, reason,
33
35
  title, objective, resolutionMode: modeValue, origin, authorized: true,
34
- projectPath: arg(args, '--project-path') || undefined,
35
36
  },
36
37
  }), null, 2));
37
38
  return;
@@ -2,13 +2,15 @@ import { parseAgentGraph } from './agent-graph.js';
2
2
  import { tryTransitionTaskEvent } from './task-transitions.js';
3
3
  import { dispatchJobLifecycleSync } from './workflow/lifecycle.js';
4
4
  import { noGitHubMode } from './no-github.js';
5
- import { resolveManagedProjectPath, resolveRepositoryProjectPath, resolveWorkspaceRoot } from './workspace.js';
5
+ import { resolveJobProjectRoot, resolveWorkspaceRoot } from './workspace.js';
6
6
  import { arg, hasArg, publishWake, storeFor, textOption, withEventBus } from './cli-support.js';
7
7
  /** Starts an ordinary DRAFT Job. DAG execution, review and recovery are
8
8
  * owned by the same Reconciler and global capacity pool as every other Job. */
9
- export async function runCoordinatorJobCommand(args, id) {
9
+ export async function runCoordinatorJobCommand(args, id, foreground) {
10
10
  if (hasArg(args, '--shortcut-local') || hasArg(args, '--legacy-shortcut-runtime') || hasArg(args, '--event-json') || hasArg(args, '--mode'))
11
11
  throw Error('Legacy Shortcut runners and execution modes are removed');
12
+ if (hasArg(args, '--foreground') && !foreground)
13
+ throw Error('Foreground runner not configured');
12
14
  const loaded = await storeFor(args, false, true);
13
15
  if (loaded.localFile !== null || !loaded.store.mutateJob)
14
16
  throw Error('Job start requires authoritative SQLite');
@@ -26,8 +28,13 @@ export async function runCoordinatorJobCommand(args, id) {
26
28
  throw Error('job run requires a durable Agent Graph Task');
27
29
  parseAgentGraph(graph);
28
30
  const workspaceRoot = await resolveWorkspaceRoot(arg(args, '--workspace-root') || undefined);
29
- const checkout = await resolveManagedProjectPath(noGitHubMode(args) ? undefined : job.repository, arg(args, '--project-path') || job.projectPath || '', workspaceRoot);
30
- const projectPath = resolveRepositoryProjectPath(checkout, job.projectPath);
31
+ const projectRoot = await resolveJobProjectRoot(job);
32
+ if (hasArg(args, '--project-path'))
33
+ throw Error('Job --project-path is removed; use the independent Git repository root');
34
+ if (hasArg(args, '--foreground') && ['COMPLETED', 'CANCELLED'].includes(job.state)) {
35
+ await foreground(loaded.store, id, taskId);
36
+ return;
37
+ }
31
38
  const globalRoot = arg(args, '--global-root') || process.env.AGENTS_HOME || undefined;
32
39
  const sharedRoot = arg(args, '--shared-root') || process.env.AGENTS_RELAY_SHARED_ROOT || undefined;
33
40
  await loaded.store.mutateJob(id, current => {
@@ -36,7 +43,7 @@ export async function runCoordinatorJobCommand(args, id) {
36
43
  throw Error('Coordinator Task disappeared');
37
44
  if (root.agentGraph && root.agentGraph !== graph)
38
45
  throw Error('Coordinator Graph changed after creation');
39
- if (!['DRAFT', 'QUEUED', 'RUNNING'].includes(root.state))
46
+ if (!['DRAFT', 'QUEUED', 'RUNNING'].includes(root.state) && !(hasArg(args, '--foreground') && current.state === 'ACTIVE' && root.agentGraph))
40
47
  throw Error('Coordinator Task is not startable');
41
48
  if (!root.agentGraph) {
42
49
  if (root.state !== 'DRAFT' && root.state !== 'QUEUED')
@@ -50,9 +57,9 @@ export async function runCoordinatorJobCommand(args, id) {
50
57
  if (!transition.accepted || transition.target !== 'QUEUED')
51
58
  throw Error('Coordinator Task queue denied');
52
59
  }
53
- const ctx = { projectPath, workspaceRoot, ...(sharedRoot ? { sharedRoot } : {}), ...(globalRoot ? { globalRoot } : {}), noGitHub: noGitHubMode(args) };
60
+ const ctx = { projectRoot, workspaceRoot, ...(sharedRoot ? { sharedRoot } : {}), ...(globalRoot ? { globalRoot } : {}), noGitHub: noGitHubMode(args) };
54
61
  const existing = current.graphStartContext;
55
- if (existing && ['projectPath', 'workspaceRoot', 'sharedRoot', 'globalRoot', 'noGitHub'].some(k => existing[k] !== ctx[k]))
62
+ if (existing && ['projectRoot', 'workspaceRoot', 'sharedRoot', 'globalRoot', 'noGitHub'].some(k => existing[k] !== ctx[k]))
56
63
  throw Error('Coordinator start context differs from original binding');
57
64
  if (!existing)
58
65
  current.graphStartContext = ctx;
@@ -66,6 +73,11 @@ export async function runCoordinatorJobCommand(args, id) {
66
73
  return current;
67
74
  });
68
75
  const scheduled = await loaded.store.load(id);
76
+ if (hasArg(args, '--foreground')) {
77
+ // Foreground runs the ordinary Reconciler directly: no scheduler wake or second DAG engine.
78
+ await foreground(loaded.store, id, taskId);
79
+ return;
80
+ }
69
81
  await withEventBus(args, bus => publishWake(bus, scheduled, taskId, 'Coordinator Job activated'));
70
82
  console.log(JSON.stringify({ jobId: id, taskId, scheduled: true, state: scheduled.state, graphRuntime: 'tasks' }, null, 2));
71
83
  }
@@ -0,0 +1,82 @@
1
+ export function foregroundEventLine(event, tasks = new Map()) {
2
+ const stamp = event.timestamp.slice(11, 19);
3
+ const actor = tasks.get(event.task_id) ?? event.task_id;
4
+ return `${stamp} ${actor} ${event.type} ${event.message}`.trimEnd();
5
+ }
6
+ export async function runForegroundCoordinator(options) {
7
+ const { store, reconciler, bus, jobId, taskId, reporter } = options;
8
+ const names = new Map();
9
+ const seen = new Set();
10
+ const emit = (event) => {
11
+ if (event.job_id !== jobId || seen.has(event.event_id))
12
+ return;
13
+ seen.add(event.event_id);
14
+ // Bound memory if an agent publishes an unusually large number of progress events.
15
+ if (seen.size > 4096)
16
+ seen.clear();
17
+ reporter(foregroundEventLine(event, names));
18
+ };
19
+ reporter.event = emit;
20
+ const stopWatch = await reconciler.watch(jobId);
21
+ let stopOutput = async () => { };
22
+ try {
23
+ if (bus)
24
+ stopOutput = await bus.subscribe(jobId, async (event) => emit(event));
25
+ }
26
+ catch (error) {
27
+ await stopWatch();
28
+ await reconciler.close();
29
+ throw error;
30
+ }
31
+ const controller = new AbortController();
32
+ const onInterrupt = () => { process.exitCode = 130; controller.abort(); };
33
+ const onTerminate = () => { process.exitCode = 143; controller.abort(); };
34
+ process.on('SIGINT', onInterrupt);
35
+ process.on('SIGTERM', onTerminate);
36
+ const refreshNames = (job) => { for (const task of job.tasks)
37
+ names.set(task.id, task.agentName ?? task.title ?? task.id); };
38
+ const delay = options.pollMs ?? 1000;
39
+ let pausedReported = false;
40
+ reporter(`Coordinator job ${jobId}, task ${taskId}: foreground execution (Ctrl+C stops local execution; durable Job stays recoverable)`);
41
+ try {
42
+ while (true) {
43
+ if (options.signal?.aborted || controller.signal.aborted) {
44
+ reporter(`Leaving foreground for Job ${jobId}; in-flight local workers are interrupted and Relay recovers their durable Tasks.`);
45
+ return store.load(jobId);
46
+ }
47
+ const job = await store.load(jobId);
48
+ refreshNames(job);
49
+ if (job.state === 'COMPLETED' || job.state === 'CANCELLED') {
50
+ reporter(`Job ${jobId}: ${job.state}`);
51
+ if (job.state === 'CANCELLED')
52
+ process.exitCode = 1;
53
+ return job;
54
+ }
55
+ if (job.pause && !pausedReported) {
56
+ reporter(`Job ${jobId}: PAUSED (waiting for resume)`);
57
+ pausedReported = true;
58
+ }
59
+ if (!job.pause)
60
+ pausedReported = false;
61
+ await reconciler.reconcile(jobId);
62
+ const updated = await store.load(jobId);
63
+ refreshNames(updated);
64
+ if (updated.state === 'COMPLETED' || updated.state === 'CANCELLED')
65
+ continue;
66
+ await new Promise(resolve => {
67
+ const timer = setTimeout(done, delay);
68
+ function done() { clearTimeout(timer); controller.signal.removeEventListener('abort', done); options.signal?.removeEventListener('abort', done); resolve(); }
69
+ controller.signal.addEventListener('abort', done, { once: true });
70
+ options.signal?.addEventListener('abort', done, { once: true });
71
+ });
72
+ }
73
+ }
74
+ finally {
75
+ process.off('SIGINT', onInterrupt);
76
+ process.off('SIGTERM', onTerminate);
77
+ await stopOutput();
78
+ await stopWatch();
79
+ await reconciler.close();
80
+ reporter.event = undefined;
81
+ }
82
+ }