taskforce-loop-engineering 0.15.19 → 0.15.20

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.15.20 - 2026-09-29
6
+
7
+ - Add opt-in, source-preserving project backlog relay after accepted scoped tasks; fail closed on external or gated items, missing terminal authority, busy queues, and duplicates.
8
+ - Require a completed backlog-item binding and explicit in-progress terminal record for relay; reject missing or malformed authoritative backlogs instead of falling back to stale initial data.
9
+
5
10
  ## 0.15.19 - 2026-09-19
6
11
 
7
12
  - Recover OpenClaw dispatcher launches rejected during Gateway restart drain by rotating the runtime session and requeueing the task.
package/README.md CHANGED
@@ -425,6 +425,22 @@ loop-engineering project-status --root /path/to/workspace --project launch-site
425
425
  Project intake does not enqueue work or run a scheduler by itself. Use the
426
426
  generated backlog and existing queue commands when the plan is ready.
427
427
 
428
+ For an existing project that should relay from one accepted scoped task to the
429
+ next local item, opt in with `queues[].autostart: true` and an authoritative
430
+ backlog `items`/`tasks` entry with `status: "ready"`, `autoRun: true`,
431
+ `scope: "local_only"`, `externalActionsAllowed: false`,
432
+ `humanGateRequired: false`, a title, and a task body. The completed predecessor
433
+ must have an explicit `projectId`, `backlogItemId` (use `--backlog-item-id` when
434
+ enqueuing), full conversation source, and a `ready_to_apply` judgement. Its
435
+ bound backlog item must already have an accepted/completed status. The project
436
+ must have a readable acceptance ledger or terminal contract with explicit
437
+ `in_progress` or `ongoing` status, and its configured authoritative backlog
438
+ must be readable. The runner enqueues at most one
439
+ dependency-ready item after the accepted task; duplicate markers, a busy
440
+ queue, human gates, missing authority, or accepted project terminal state stop
441
+ the relay. The existing scheduler executes that queued item on its next tick.
442
+ The relay does not infer safe work from prose or promote project acceptance.
443
+
428
444
  ## Observability
429
445
 
430
446
  Use `doctor` for a read-only health view of the loop workspace:
@@ -228,6 +228,7 @@ function parseArgs(argv) {
228
228
  else if (a === '--source-target') args.sourceTarget = argv[++i];
229
229
  else if (a === '--source-account') args.sourceAccount = argv[++i];
230
230
  else if (a === '--source-message-id') args.sourceMessageId = argv[++i];
231
+ else if (a === '--backlog-item-id') args.backlogItemId = argv[++i];
231
232
  else if (a === '--source-reply-to') args.sourceReplyTo = argv[++i];
232
233
  else if (a === '--progress-notify-command') args.progressNotifyCommand = argv[++i];
233
234
  else if (a === '--include-active') args.includeActive = true;
@@ -1637,7 +1638,7 @@ Advanced compatibility commands:
1637
1638
  loop-engineering project-intake --name project --brief "Project brief" [--type auto|web_app|code_project|research|content|ops|qa|knowledge_base|infra_audit|assistant_workflow] [--queue name] [--check "npm test"] [--root <workspace>] [--json]
1638
1639
  loop-engineering project-plan --project project [--root <workspace>] [--json] [--force]
1639
1640
  loop-engineering project-status --project project [--root <workspace>] [--json]
1640
- loop-engineering enqueue --queue name --title "Title" (--task "Body" | --file task.md) [--root <workspace>]
1641
+ loop-engineering enqueue --queue name --title "Title" (--task "Body" | --file task.md) [--backlog-item-id id] [--root <workspace>]
1641
1642
  loop-engineering route-message --message "User message" [--queue name] [--route --confirm-execute] [--supersede-active | --amend-active] [--source-channel name --source-target id --source-account id --source-message-id id --source-reply-to id] [--root <workspace>] [--json]
1642
1643
  loop-engineering run-queue --config configs/loops/queues/name.json [--progress-notify-command "command"] [--root <workspace>]
1643
1644
  loop-engineering run-queue --queue name --dispatcher "command" [--preflight-config configs/loops/name.json] [--root <workspace>]
package/lib/core.mjs CHANGED
@@ -1935,6 +1935,7 @@ export async function enqueueTask(root, options) {
1935
1935
  enqueuedAt: new Date().toISOString(),
1936
1936
  ...(options.riskAssessment ? { riskAssessment: options.riskAssessment } : {}),
1937
1937
  ...(options.projectId ? { projectId: normalizeProjectId(options.projectId) } : {}),
1938
+ ...(options.backlogItemId ? { backlogItemId: normalizeLoopId(options.backlogItemId) } : {}),
1938
1939
  ...(options.supersedesTaskId ? { supersedesTaskId: options.supersedesTaskId } : {}),
1939
1940
  ...(options.supersedeReason ? { supersedeReason: options.supersedeReason } : {}),
1940
1941
  ...(taskSourceFromOptions(options) ? { source: taskSourceFromOptions(options) } : {})
@@ -2589,6 +2590,64 @@ async function projectHasSafeActionableBacklog(root, spec, checkpoint = null) {
2589
2590
  });
2590
2591
  }
2591
2592
 
2593
+ export async function projectRelayNext(root, { queue, task, finalJudgement } = {}) {
2594
+ if (!task?.projectId || finalJudgement?.outcome !== 'ready_to_apply' || finalJudgement.requires_human_gate) return null;
2595
+ const project = normalizeProjectId(task.projectId);
2596
+ const spec = await readJson(projectConfigPathFor(root, project));
2597
+ if (!spec.queues?.some((entry) => entry.queue === queue && entry.autostart === true)) return null;
2598
+ const acceptance = await projectAcceptanceRecord(root, spec);
2599
+ const ledger = acceptance?.record;
2600
+ if (!ledger || typeof ledger !== 'object' || Array.isArray(ledger)
2601
+ || !['in_progress', 'ongoing'].includes(ledger.status)
2602
+ || ledger.terminalState?.accepted === true || ledger.terminalAccepted === true) return null;
2603
+ if (!task.source?.channel || !task.source?.target || !task.source?.account || !task.source?.message_id) return null;
2604
+ // A completed queue task is not proof that any particular backlog item was
2605
+ // accepted. Require a durable binding before advancing to another item.
2606
+ const predecessorId = task.backlogItemId;
2607
+ if (typeof predecessorId !== 'string' || !/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/.test(predecessorId)) return null;
2608
+ const queueState = await queueStatus(root, queue);
2609
+ if (queueState.queued || queueState.active || queueState.waiting) return null;
2610
+ const backlogSource = spec.backlogSource ?? spec.authoritativeBacklog;
2611
+ if (typeof backlogSource !== 'string' || !backlogSource.trim()) return null;
2612
+ let backlog;
2613
+ try {
2614
+ backlog = await readJson(path.resolve(root, safeRelativePath(backlogSource, 'project backlog source')));
2615
+ } catch { return null; }
2616
+ const items = Array.isArray(backlog?.items) ? backlog.items : Array.isArray(backlog?.tasks) ? backlog.tasks : null;
2617
+ if (!items?.length) return null;
2618
+ const byId = new Map(items.map((item) => [item.id, item]));
2619
+ const complete = new Set(['accepted', 'complete', 'completed', 'done', 'phase_complete']);
2620
+ if (!complete.has(byId.get(predecessorId)?.status)) return null;
2621
+ const queuedBodies = [];
2622
+ for (const subdir of ['inbox', 'active', 'waiting', 'done', 'failed', 'canceled']) {
2623
+ for (const file of await listJson(queueSubdirFor(root, queue, subdir))) {
2624
+ queuedBodies.push(String((await readJson(path.join(queueSubdirFor(root, queue, subdir), file))).body ?? ''));
2625
+ }
2626
+ }
2627
+ const item = items.find((candidate) => {
2628
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/.test(String(candidate.id ?? ''))) return false;
2629
+ if (candidate.status !== 'ready' || candidate.autoRun !== true || candidate.scope !== 'local_only'
2630
+ || candidate.externalActionsAllowed !== false || candidate.humanGateRequired !== false
2631
+ || candidate.blocked === true || candidate.requires_human_input === true
2632
+ || typeof candidate.title !== 'string' || !candidate.title.trim()
2633
+ || typeof candidate.task !== 'string' || !candidate.task.trim()) return false;
2634
+ const dependencies = candidate.dependsOn ?? candidate.depends_on ?? [];
2635
+ if (!Array.isArray(dependencies) || !dependencies.every((id) => complete.has(byId.get(id)?.status))) return false;
2636
+ return !queuedBodies.some((body) => body.includes(`[project-relay:${project}/${candidate.id}]`));
2637
+ });
2638
+ if (!item) return null;
2639
+ const marker = `[project-relay:${project}/${item.id}]`;
2640
+ const result = await enqueueTask(root, {
2641
+ queue,
2642
+ title: item.title,
2643
+ task: `${marker}\n${item.task}\nLocal-only project continuation. This does not authorize external writes or satisfy project terminal acceptance.`,
2644
+ projectId: project,
2645
+ backlogItemId: item.id,
2646
+ ...taskSourceOptions(task.source)
2647
+ });
2648
+ return { project, itemId: item.id, taskId: result.task.id, file: result.file };
2649
+ }
2650
+
2592
2651
  async function tasksById(root, queue) {
2593
2652
  const tasks = new Map();
2594
2653
  for (const subdir of ['inbox', 'active', 'waiting', 'done', 'failed', 'canceled']) {
@@ -5557,6 +5616,7 @@ export async function queueRevisionPlan(root, queue, taskId, options = {}) {
5557
5616
  body,
5558
5617
  source: task.source ?? null,
5559
5618
  projectId: task.projectId ?? task.project_id ?? null,
5619
+ backlogItemId: task.backlogItemId ?? null,
5560
5620
  revisionOf: task.id,
5561
5621
  revisionSourceRun: task.runPath,
5562
5622
  revisionRequestPath,
@@ -5592,6 +5652,7 @@ export async function queueRevisionNext(root, queue, taskId, options = {}) {
5592
5652
  title: plan.plannedTask.title,
5593
5653
  task: plan.plannedTask.body,
5594
5654
  projectId: plan.plannedTask.projectId ?? undefined,
5655
+ backlogItemId: plan.plannedTask.backlogItemId ?? undefined,
5595
5656
  ...taskSourceOptions(plan.plannedTask.source)
5596
5657
  });
5597
5658
  const nextTask = {
@@ -5646,6 +5707,7 @@ export async function queueRevisionApplyPlan(root, planPath, options = {}) {
5646
5707
  title: plan.plannedTask.title,
5647
5708
  task: plan.plannedTask.body,
5648
5709
  projectId: plan.plannedTask.projectId ?? undefined,
5710
+ backlogItemId: plan.plannedTask.backlogItemId ?? undefined,
5649
5711
  ...taskSourceOptions(plan.plannedTask.source)
5650
5712
  });
5651
5713
  const guard = plan.revisionPolicyGuard ?? plan.plannedTask.revisionPolicyGuard ?? null;
@@ -9797,6 +9859,15 @@ export async function runQueueOnce(root, options) {
9797
9859
  });
9798
9860
  }
9799
9861
 
9862
+ if (finalStatus === 'completed') {
9863
+ try {
9864
+ run.projectRelay = await projectRelayNext(root, { queue, task, finalJudgement: finalJudgement?.judgement });
9865
+ } catch (error) {
9866
+ run.projectRelay = { error: error instanceof Error ? error.message : String(error) };
9867
+ }
9868
+ await writeJson(runPath, run);
9869
+ }
9870
+
9800
9871
  const progressNotifications = await Promise.all(liveProgressNotifications);
9801
9872
  return {
9802
9873
  processed: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskforce-loop-engineering",
3
- "version": "0.15.19",
3
+ "version": "0.15.20",
4
4
  "private": false,
5
5
  "description": "OpenClaw-native loop engineering CLI, templates, and skill for verifiable agent work loops.",
6
6
  "type": "module",
@@ -28,9 +28,9 @@
28
28
  "check:config-drift": "node scripts/distribution-skill-self-test.mjs && node --check scripts/config-drift-self-test.mjs && node scripts/config-drift-self-test.mjs",
29
29
  "check:openclaw-install": "node --check scripts/openclaw-install.mjs && node --check scripts/openclaw-doctor.mjs && node --check scripts/openclaw-smoke.mjs && node --check scripts/openclaw-manage.mjs && node scripts/openclaw-install-self-test.mjs",
30
30
  "check:hermes-install": "node --check scripts/hermes-install.mjs && node --check scripts/hermes-doctor.mjs && node --check scripts/hermes-smoke.mjs && node scripts/hermes-install-self-test.mjs",
31
- "check:project-gates": "node --check lib/core.mjs && node scripts/project-gate-reconciliation-self-test.mjs",
31
+ "check:project-gates": "node --check lib/core.mjs && node scripts/project-gate-reconciliation-self-test.mjs && node scripts/project-relay-self-test.mjs",
32
32
  "check:human-gates": "node --check lib/human-gate-command.mjs && node --check lib/human-gate-channel-adapter.mjs && node scripts/human-gate-command-self-test.mjs && node scripts/human-gate-final-judgement.mjs",
33
- "check": "npm run check:config-drift && npm run check:openclaw-install && npm run check:hermes-install && node --check bin/loop-engineering.mjs && node --check lib/core.mjs && node --check lib/action-reservations.mjs && node --check lib/todo-control-plane.mjs && node --check lib/quota-runtime-decision.mjs && node --check lib/operator-dashboard.mjs && node scripts/action-reservation-self-test.mjs && node scripts/todo-control-plane-self-test.mjs && node scripts/quota-runtime-decision-self-test.mjs && node scripts/operator-dashboard-self-test.mjs && node scripts/final-judgement-self-test.mjs && node scripts/route-notify-self-test.mjs && node scripts/scheduler-heartbeat-self-test.mjs && node scripts/human-gate-lifecycle-v2-self-test.mjs && node bin/loop-engineering.mjs verify --config templates/workspace-health.json --root . && node bin/loop-engineering.mjs queue-status --queue smoke --root . --json >/dev/null && node bin/loop-engineering.mjs project-intake --root /tmp/loop-engineering-check --name smoke-project --brief \"Build a small website project\" --type auto --check \"npm test\" --json >/dev/null && node bin/loop-engineering.mjs project-plan --root /tmp/loop-engineering-check --project smoke-project --force --json >/dev/null && node bin/loop-engineering.mjs project-status --root /tmp/loop-engineering-check --project smoke-project --json >/dev/null && node bin/loop-engineering.mjs queue-scheduler-tick --queue smoke --root /tmp/loop-engineering-check --plan-only --force-due --json >/dev/null && node bin/loop-engineering.mjs queue-scheduler-tick --queue smoke-progress --root /tmp/loop-engineering-check --plan-only --force-due --progress-report --progress-report-when-not-due --json >/dev/null && node bin/loop-engineering.mjs workflow-metrics --queue smoke --root . --json >/dev/null && node bin/loop-engineering.mjs workflow-tune-plan --queue smoke --root . --json >/dev/null && node bin/loop-engineering.mjs code-queue-init --queue smoke-code --root /tmp/loop-engineering-check --force >/dev/null && node bin/loop-engineering.mjs code-worktree-list --queue smoke-code --root /tmp/loop-engineering-check --json >/dev/null && node bin/loop-engineering.mjs code-task-status --queue smoke-code --root /tmp/loop-engineering-check --json >/dev/null && node bin/loop-engineering.mjs code-task-dashboard --queue smoke-code --root /tmp/loop-engineering-check --json >/dev/null && node bin/loop-engineering.mjs code-worktree-cleanup-plan --queue smoke-code --root /tmp/loop-engineering-check --json >/dev/null && node bin/loop-engineering.mjs code-worktree-cleanup --queue smoke-code --root /tmp/loop-engineering-check --confirm-cleanup --json >/dev/null && node bin/loop-engineering.mjs code-patch-verify --patch README.md --root . --json >/dev/null && node bin/loop-engineering.mjs code-patch-apply-plan --patch README.md --json >/dev/null && node bin/loop-engineering.mjs queue-revision-ci-self-test --queue smoke-ci --root /tmp/loop-engineering-check --json >/dev/null && node bin/loop-engineering.mjs summarize --root . --json >/dev/null && node bin/loop-engineering.mjs dashboard-health --root . --max-age-seconds 999999999 --json >/dev/null && node bin/loop-engineering.mjs doctor --root . --json >/dev/null",
33
+ "check": "npm run check:project-gates && npm run check:config-drift && npm run check:openclaw-install && npm run check:hermes-install && node --check bin/loop-engineering.mjs && node --check lib/core.mjs && node --check lib/action-reservations.mjs && node --check lib/todo-control-plane.mjs && node --check lib/quota-runtime-decision.mjs && node --check lib/operator-dashboard.mjs && node scripts/action-reservation-self-test.mjs && node scripts/todo-control-plane-self-test.mjs && node scripts/quota-runtime-decision-self-test.mjs && node scripts/operator-dashboard-self-test.mjs && node scripts/final-judgement-self-test.mjs && node scripts/route-notify-self-test.mjs && node scripts/scheduler-heartbeat-self-test.mjs && node scripts/human-gate-lifecycle-v2-self-test.mjs && node bin/loop-engineering.mjs verify --config templates/workspace-health.json --root . && node bin/loop-engineering.mjs queue-status --queue smoke --root . --json >/dev/null && node bin/loop-engineering.mjs project-intake --root /tmp/loop-engineering-check --name smoke-project --brief \"Build a small website project\" --type auto --check \"npm test\" --json >/dev/null && node bin/loop-engineering.mjs project-plan --root /tmp/loop-engineering-check --project smoke-project --force --json >/dev/null && node bin/loop-engineering.mjs project-status --root /tmp/loop-engineering-check --project smoke-project --json >/dev/null && node bin/loop-engineering.mjs queue-scheduler-tick --queue smoke --root /tmp/loop-engineering-check --plan-only --force-due --json >/dev/null && node bin/loop-engineering.mjs queue-scheduler-tick --queue smoke-progress --root /tmp/loop-engineering-check --plan-only --force-due --progress-report --progress-report-when-not-due --json >/dev/null && node bin/loop-engineering.mjs workflow-metrics --queue smoke --root . --json >/dev/null && node bin/loop-engineering.mjs workflow-tune-plan --queue smoke --root . --json >/dev/null && node bin/loop-engineering.mjs code-queue-init --queue smoke-code --root /tmp/loop-engineering-check --force >/dev/null && node bin/loop-engineering.mjs code-worktree-list --queue smoke-code --root /tmp/loop-engineering-check --json >/dev/null && node bin/loop-engineering.mjs code-task-status --queue smoke-code --root /tmp/loop-engineering-check --json >/dev/null && node bin/loop-engineering.mjs code-task-dashboard --queue smoke-code --root /tmp/loop-engineering-check --json >/dev/null && node bin/loop-engineering.mjs code-worktree-cleanup-plan --queue smoke-code --root /tmp/loop-engineering-check --json >/dev/null && node bin/loop-engineering.mjs code-worktree-cleanup --queue smoke-code --root /tmp/loop-engineering-check --confirm-cleanup --json >/dev/null && node bin/loop-engineering.mjs code-patch-verify --patch README.md --root . --json >/dev/null && node bin/loop-engineering.mjs code-patch-apply-plan --patch README.md --json >/dev/null && node bin/loop-engineering.mjs queue-revision-ci-self-test --queue smoke-ci --root /tmp/loop-engineering-check --json >/dev/null && node bin/loop-engineering.mjs summarize --root . --json >/dev/null && node bin/loop-engineering.mjs dashboard-health --root . --max-age-seconds 999999999 --json >/dev/null && node bin/loop-engineering.mjs doctor --root . --json >/dev/null",
34
34
  "pack:dry": "npm pack --dry-run"
35
35
  },
36
36
  "exports": {
@@ -0,0 +1,70 @@
1
+ import assert from 'node:assert/strict';
2
+ import { mkdtemp, mkdir, readFile, writeFile, unlink } from 'node:fs/promises';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { ensureQueueDirs, projectRelayNext, queueStatus } from '../lib/core.mjs';
6
+
7
+ const root = await mkdtemp(path.join(os.tmpdir(), 'loop-project-relay-'));
8
+ const queue = 'relay-test';
9
+ const project = 'relay-project';
10
+ const configFile = path.join(root, 'configs/loops/projects', `${project}.json`);
11
+ const backlogFile = path.join(root, 'project/backlog.json');
12
+ const ledgerFile = path.join(root, 'project/ledger.json');
13
+ const writeJson = async (file, value) => {
14
+ await mkdir(path.dirname(file), { recursive: true });
15
+ await writeFile(file, `${JSON.stringify(value)}\n`);
16
+ };
17
+ const spec = { schemaVersion: 1, project, type: 'code_project', queues: [{ queue, kind: 'standard', autostart: true }],
18
+ backlogSource: 'project/backlog.json', acceptanceLedger: 'project/ledger.json' };
19
+ const item = { id: 'local-1', status: 'ready', title: 'Local proof', task: 'Verify the local entry', autoRun: true,
20
+ scope: 'local_only', externalActionsAllowed: false, humanGateRequired: false, dependsOn: [] };
21
+ const predecessor = { id: 'local-0', status: 'accepted' };
22
+ const task = { id: 'accepted-task', projectId: project, backlogItemId: predecessor.id,
23
+ source: { channel: 'feishu', target: 'owner', account: 'main', message_id: 'message-1' } };
24
+ const finalJudgement = { outcome: 'ready_to_apply', requires_human_gate: false };
25
+ await ensureQueueDirs(root, queue);
26
+ await writeJson(configFile, spec);
27
+ await writeJson(backlogFile, { items: [predecessor, item] });
28
+ await writeJson(ledgerFile, { status: 'in_progress' });
29
+
30
+ assert.equal(await projectRelayNext(root, { queue, task, finalJudgement: { outcome: 'blocked' } }), null);
31
+ assert.equal(await projectRelayNext(root, { queue, task: { ...task, source: null }, finalJudgement }), null);
32
+ await writeJson(configFile, { ...spec, queues: [{ queue, kind: 'standard', autostart: false }] });
33
+ assert.equal(await projectRelayNext(root, { queue, task, finalJudgement }), null);
34
+ await writeJson(configFile, spec);
35
+ for (const unsafe of [{ ...item, humanGateRequired: true }, { ...item, externalActionsAllowed: true },
36
+ { ...item, scope: 'production' }, { ...item, autoRun: false }, { ...item, blocked: true },
37
+ { ...item, dependsOn: ['unaccepted'] }]) {
38
+ await writeJson(backlogFile, { items: [predecessor, unsafe] });
39
+ assert.equal(await projectRelayNext(root, { queue, task, finalJudgement }), null);
40
+ }
41
+ await writeJson(backlogFile, { items: [predecessor, item] });
42
+ await writeJson(configFile, { ...spec, acceptanceLedger: 'project/missing-ledger.json' });
43
+ assert.equal(await projectRelayNext(root, { queue, task, finalJudgement }), null, 'missing terminal authority fails closed');
44
+ await writeJson(configFile, spec);
45
+ assert.equal(await projectRelayNext(root, { queue, task: { ...task, backlogItemId: undefined }, finalJudgement }), null,
46
+ 'unbound predecessor cannot authorize a relay');
47
+ await writeJson(backlogFile, { items: [{ ...predecessor, status: 'ready' }, item] });
48
+ assert.equal(await projectRelayNext(root, { queue, task, finalJudgement }), null,
49
+ 'a completed task with a stale ready backlog item cannot relay itself');
50
+ await writeJson(backlogFile, { items: [predecessor, item] });
51
+ await writeJson(ledgerFile, null);
52
+ assert.equal(await projectRelayNext(root, { queue, task, finalJudgement }), null, 'null ledger fails closed');
53
+ await writeJson(ledgerFile, { status: 'unknown' });
54
+ assert.equal(await projectRelayNext(root, { queue, task, finalJudgement }), null, 'unknown ledger state fails closed');
55
+ await writeJson(ledgerFile, { status: 'in_progress' });
56
+ await unlink(backlogFile);
57
+ assert.equal(await projectRelayNext(root, { queue, task, finalJudgement }), null, 'missing authoritative backlog fails closed');
58
+ await writeJson(backlogFile, { items: [predecessor, item] });
59
+ const result = await projectRelayNext(root, { queue, task, finalJudgement });
60
+ assert.equal(result.itemId, 'local-1');
61
+ const queued = JSON.parse(await readFile(path.join(root, result.file), 'utf8'));
62
+ assert.equal(queued.projectId, project);
63
+ assert.equal(queued.backlogItemId, item.id);
64
+ assert.equal(queued.source.message_id, 'message-1');
65
+ assert.match(queued.body, /\[project-relay:relay-project\/local-1\]/);
66
+ assert.equal(await projectRelayNext(root, { queue, task, finalJudgement }), null, 'busy queue must not enqueue twice');
67
+ assert.equal((await queueStatus(root, queue)).queued, 1);
68
+ await writeJson(ledgerFile, { status: 'accepted' });
69
+ assert.equal(await projectRelayNext(root, { queue, task, finalJudgement }), null, 'accepted project cannot relay');
70
+ console.log('project relay self-test passed');