taskforce-loop-engineering 0.16.2 → 0.16.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskforce-loop-engineering",
3
- "version": "0.16.2",
3
+ "version": "0.16.4",
4
4
  "private": false,
5
5
  "description": "OpenClaw-native loop engineering CLI, templates, and skill for verifiable agent work loops.",
6
6
  "type": "module",
@@ -18,7 +18,8 @@
18
18
  "run-loop-cron.sh": "scripts/run-loop-cron.sh"
19
19
  },
20
20
  "scripts": {
21
- "test": "npm run check:human-gates && npm run check && npm run check:competitive && npm run check:operator-workspace",
21
+ "test": "npm run check:isolation && npm run check:human-gates && npm run check && npm run check:competitive && npm run check:operator-workspace",
22
+ "check:isolation": "node --check lib/isolated-verification.mjs && python3 -c \"import ast; ast.parse(open('scripts/isolated-verify.py').read())\" && python3 scripts/isolated-verify-self-test.py && node scripts/isolated-verification-self-test.mjs",
22
23
  "check:operator-workspace": "node --check scripts/operator-workspace-final-judgement.mjs && node --check scripts/dashboard-autostart-install.mjs && node scripts/dashboard-autostart-self-test.mjs && node scripts/operator-workspace-final-judgement.mjs",
23
24
  "check:competitive": "node --check lib/transactional-state-kernel.mjs && node --check lib/goal-api.mjs && node scripts/competitive-acceptance.mjs",
24
25
  "check:adapters": "node --check lib/runtime-adapter-sdk.mjs && node scripts/runtime-adapter-conformance.mjs && node scripts/agent-team-control-plane-self-test.mjs",
@@ -30,7 +31,7 @@
30
31
  "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
32
  "check:project-gates": "node --check lib/core.mjs && node scripts/project-gate-reconciliation-self-test.mjs && node scripts/project-relay-self-test.mjs",
32
33
  "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": "node scripts/context-budget-self-test.mjs && npm run check:project-gates && node scripts/safety-regression-self-test.mjs && 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
+ "check": "node scripts/context-budget-self-test.mjs && npm run check:project-gates && node scripts/safety-regression-self-test.mjs && 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/revision-coverage-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
35
  "pack:dry": "npm pack --dry-run"
35
36
  },
36
37
  "exports": {
@@ -41,7 +42,8 @@
41
42
  "./quota": "./lib/quota-runtime-decision.mjs",
42
43
  "./todo-control-plane": "./lib/todo-control-plane.mjs",
43
44
  "./human-gate-command": "./lib/human-gate-command.mjs",
44
- "./human-gate-channel-adapter": "./lib/human-gate-channel-adapter.mjs"
45
+ "./human-gate-channel-adapter": "./lib/human-gate-channel-adapter.mjs",
46
+ "./isolated-verification": "./lib/isolated-verification.mjs"
45
47
  },
46
48
  "engines": {
47
49
  "node": ">=22"
@@ -27,6 +27,9 @@ try {
27
27
  status: 'blocked', summary: 'Soak still running.', files_changed: ['soak.json'], verification: ['pending'], blockers: ['pending'], risks: [], project_completion: { status: 'in_progress' }
28
28
  });
29
29
  await writeJson(path.join(runtimeDir, 'final_judgement.json'), { version: 1, task_id: taskId, outcome: 'blocked' });
30
+ // Legacy judgements without coverage must be rebuilt once, then stay current.
31
+ assert.equal((await refreshTaskAcceptance(root, { queue, taskId })).outcome, 'refreshed');
32
+ assert.equal((await readJson(path.join(runtimeDir, 'final_judgement.json'))).coverage.planned_checkpoints, 1);
30
33
  assert.equal((await refreshTaskAcceptance(root, { queue, taskId })).outcome, 'already_current');
31
34
 
32
35
  await new Promise((resolve) => setTimeout(resolve, 20));
@@ -24,7 +24,7 @@ assert.equal(dispatchFailureClassification({ exitCode: 1, stderr: 'Permission de
24
24
 
25
25
  const roots = [];
26
26
  try {
27
- for (const scenario of ['yield', 'stale', 'malformed', 'missing-checkpoint', 'checkpoint-gate', 'pending-action', 'overflow', 'human-error', 'oversized', 'project-soft', 'project-hard', 'project-no-usage', 'terminal', 'pending-action-overflow', 'checkpoint-gate-overflow', 'stale-overflow', 'malformed-overflow', 'yield-overflow', 'yield-human-error', 'pending-action-failure']) {
27
+ for (const scenario of ['yield', 'repeat-yield', 'empty-yield', 'stale', 'malformed', 'missing-checkpoint', 'checkpoint-gate', 'pending-action', 'overflow', 'human-error', 'oversized', 'project-soft', 'project-hard', 'project-no-usage', 'terminal', 'pending-action-overflow', 'checkpoint-gate-overflow', 'stale-overflow', 'malformed-overflow', 'yield-overflow', 'yield-human-error', 'pending-action-failure']) {
28
28
  const root = await mkdtemp(path.join(tmpdir(), 'loop-context-'));
29
29
  roots.push(root);
30
30
  const worker = path.join(root, 'worker.mjs');
@@ -46,7 +46,7 @@ if (scenario.startsWith('project-') || scenario === 'terminal') {
46
46
  process.exit(0);
47
47
  }
48
48
 
49
- if (scenario !== 'missing-checkpoint') await writeFile(checkpoint, JSON.stringify({ task_id: e.LOOP_TASK_ID, loop_run_id: e.LOOP_RUN_ID, checkpoint_id: e.LOOP_RUN_ID, status: scenario === 'checkpoint-gate' ? 'needs_human_input' : 'in_progress', summary: 'bounded progress', blockers: scenario === 'checkpoint-gate' ? ['Need approval'] : [], verification: [], risks: [], next_action: 'continue' }));
49
+ if (scenario !== 'missing-checkpoint') await writeFile(checkpoint, JSON.stringify({ task_id: e.LOOP_TASK_ID, loop_run_id: e.LOOP_RUN_ID, checkpoint_id: e.LOOP_RUN_ID, status: scenario === 'checkpoint-gate' ? 'needs_human_input' : 'in_progress', summary: 'bounded progress', blockers: scenario === 'checkpoint-gate' ? ['Need approval'] : [], verification: scenario === 'empty-yield' ? [] : ['verified unit ' + (scenario === 'repeat-yield' ? 'same' : e.LOOP_SESSION_GENERATION)], risks: [], next_action: 'continue' }));
50
50
  const handoff = { version: 1, taskId: e.LOOP_TASK_ID, runId: scenario === 'stale' ? 'old-run' : e.LOOP_RUN_ID, generation: Number(e.LOOP_SESSION_GENERATION), attempt: Number(e.LOOP_ATTEMPT), reason: 'context_budget', checkpoint, summary: 'progress', completed: ['read source'], remaining: ['verify changes'], evidence: [checkpoint], nextAction: 'inspect test', authority: 'local only', pendingActions: scenario === 'pending-action' ? ['unknown payment outcome'] : [], blockers: [] };
51
51
  await writeFile(e.LOOP_CONTEXT_HANDOFF_FILE, scenario === 'malformed' ? '{' : scenario === 'oversized' ? ' '.repeat(17000) : JSON.stringify(handoff));
52
52
  if (original !== scenario) { console.error(original.endsWith('-human-error') ? 'Permission denied; context_length_exceeded' : original.endsWith('-failure') ? 'generic failure' : 'context_length_exceeded'); process.exitCode = 1; }
@@ -72,16 +72,34 @@ if (original !== scenario) { console.error(original.endsWith('-human-error') ? '
72
72
  } else if (scenario === 'terminal') {
73
73
  assert.equal(first.status, 'completed');
74
74
  assert.equal((await runQueueOnce(root, options)).processed, false, 'high token usage cannot replay completed work');
75
- } else if (['yield', 'overflow', 'yield-overflow'].includes(scenario)) {
75
+ } else if (['yield', 'repeat-yield', 'overflow', 'yield-overflow'].includes(scenario)) {
76
76
  assert.equal(first.status, 'runtime_interrupted', scenario);
77
77
  const task = JSON.parse(await readFile(path.join(root, first.taskPath), 'utf8'));
78
78
  assert.equal(task.runtimeSessionGeneration, 1);
79
79
  assert.equal(task.sessionTickCount, 0);
80
80
  if (scenario === 'yield') assert.ok(task.contextHandoffFile);
81
- const second = await runQueueOnce(root, options);
82
- assert.equal(second.status, 'runtime_interrupted');
83
- const third = await runQueueOnce(root, options);
84
- assert.equal(third.status, 'runtime_blocked', 'recovery is bounded');
81
+ if (scenario === 'yield') {
82
+ // Normal progress can rotate beyond the exception budget, even with
83
+ // an already exhausted exception counter. It must not reset it either.
84
+ task.runtimeRecoveryCount = 2;
85
+ await writeFile(path.join(root, first.taskPath), JSON.stringify(task));
86
+ for (let tick = 0; tick < 4; tick++) {
87
+ const next = await runQueueOnce(root, options);
88
+ assert.equal(next.status, 'runtime_interrupted');
89
+ const saved = JSON.parse(await readFile(path.join(root, next.taskPath), 'utf8'));
90
+ assert.equal(saved.runtimeRecoveryCount, 2);
91
+ assert.equal(saved.contextHandoffCount, tick + 2);
92
+ assert.equal(saved.runtimeSessionGeneration, tick + 2);
93
+ }
94
+ } else if (scenario === 'repeat-yield') {
95
+ assert.equal((await runQueueOnce(root, options)).status, 'runtime_blocked');
96
+ assert.equal((await runQueueOnce(root, options)).processed, false);
97
+ } else {
98
+ const second = await runQueueOnce(root, options);
99
+ assert.equal(second.status, 'runtime_interrupted');
100
+ const third = await runQueueOnce(root, options);
101
+ assert.equal(third.status, 'runtime_blocked', 'exception recovery is bounded');
102
+ }
85
103
  } else if (['pending-action', 'checkpoint-gate', 'human-error', 'pending-action-overflow', 'checkpoint-gate-overflow', 'yield-human-error', 'pending-action-failure'].includes(scenario)) {
86
104
  assert.equal(first.status, 'needs_human_input', scenario);
87
105
  assert.equal((await runQueueOnce(root, options)).processed, false, 'blocked work cannot auto-replay');