taskforce-loop-engineering 0.16.4 → 0.16.6

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,34 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - Add a manually dispatched `Release` workflow (`.github/workflows/release.yml`). It verifies the version, the commit on main and the changelog section, and runs the full test suite. It then creates the tag and GitHub release and publishes to npm (trusted publishing or `NPM_TOKEN`) and ClawHub (`CLAWHUB_TOKEN`) from the `release` environment. Every step skips work that is already done, so a failed run can be dispatched again.
6
+
7
+ ## 0.16.6 - 2026-11-28
8
+
9
+ Loop speed release: workers complete whole milestones per turn instead of tiny steps, continuations are scheduled right after the run, and workers are told the dispatch timeout. Publication does not upgrade installed CLIs or generated integrations. OpenClaw picks up the new worker instructions with the package upgrade (re-run `loop-engineering-openclaw-manage --action upgrade --confirm-upgrade` as usual). Hermes needs its generated files regenerated: run `loop-engineering-hermes-doctor`, which now warns about out-of-date files, then rerun the installer with `--confirm-install --force` and the same `--queue` and `--language`; this also rewrites the queue config, scheduler units and managed `AGENTS.md` block, so back up local changes first. Without that, Hermes still gets the scheduler change but not the new turn-size and time-budget prompt.
10
+
11
+ - Stop splitting Loop work into needlessly small turns. Worker instructions no longer say "work on one bounded objective this turn" or, without live context telemetry, "finish one small objective and checkpoint"; workers complete as much of the current milestone as the turn allows, checkpoint after verified sub-steps and hand off only when the remaining work will not fit. The deterministic dev plan and the code-project template no longer ask for "the smallest useful change", and the distributed skill says the same.
12
+ - Schedule continuations right after the run: an accepted project milestone that continues (`project_in_progress`) or a validated context handoff is now its own `continuation` scheduler group and runs again the minimum interval after the run ends. Previously it fell into the unknown group, got no speed-up, and long-run headroom delayed the next tick to 1.25× the previous run's duration after its start, idling for a quarter of every long turn. Real runtime interruptions keep their recovery headroom.
13
+ - Tell workers the dispatch timeout. The runner sets `LOOP_TURN_TIMEOUT_MS` and the OpenClaw worker instructions ask for a checkpoint and handoff by about 80% of it, so the larger turns hand off instead of being killed at the timeout, which loses unsaved work and spends one of the default two runtime recovery attempts.
14
+ - The Hermes one-shot dispatcher now asks the worker to complete as much of the task as the turn allows, checkpoint verified sub-steps and finish before about 80% of `LOOP_TURN_TIMEOUT_MS`. Custom dispatchers receive `LOOP_TURN_TIMEOUT_MS` too (documented in the README). Generated Hermes files change only after rerunning the installer with `--confirm-install --force`.
15
+ - `loop-engineering-hermes-doctor` warns when an installed Hermes dispatcher, wrapper or notifier differs from what the current package generates, telling apart a copy from an older version and one edited by hand, and names the installer command that regenerates it. The warnings do not change the doctor's status or exit code. The generated-script sources moved to `scripts/hermes-sources.mjs`, shared by the installer and the doctor.
16
+
17
+ ## 0.16.5 - 2026-11-02
18
+
19
+ Security and correctness release for 0.16.1–0.16.4. Publication does not upgrade installed CLIs or generated integrations; re-run `loop-engineering-openclaw-manage --action upgrade --confirm-upgrade` (Hermes: rerun the installer with `--confirm-install --force`).
20
+
21
+ - Keep a task's milestone identity across revision rounds, runtime and orphan recovery and operator requeues; it only advances after an accepted milestone continues the project. The 0.16.1–0.16.4 template renamed the milestone on every dispatch, so a bounded task revised along the template could never be accepted and a resolved historical blocker vetoed it. Checkpoints that declare `revises_checkpoint_id` now join the chain they revise, which also repairs records written by those versions.
22
+ - A project run recovered after a runtime interruption no longer fails as "no new accepted milestone" or "accepted checkpoints do not cover required": work written by the interrupted run counts as progress (recovery stays bounded by `retry.runtimeRecoveryMaxAttempts`).
23
+ - Cap consecutive context handoffs (`retry.maxContextHandoffs`, default 10, reset when a milestone is accepted): a worker whose verification evidence differed every turn (e.g. a run-specific log path) could hand off forever, starting a new paid session each tick.
24
+ - Blockers and uncertain external actions written only in a context handoff are now recorded in the final judgement (`handoff_blockers`, `handoff_pending_actions`, reasons and next actions) and listed in the terminal notification. A handoff is passed only to the session right after it, so a later session is no longer shown an out-of-date `nextAction`.
25
+ - Scope inference ignores 不/别 inside ordinary words (特别, 不同, 区别 ...), does not treat "第一步之后" as a bounded cue, and splits clauses at " - " and "without X, complete Y"; real negations ("不要只处理", "不仅是有界里程碑") still mark a project.
26
+ - A checkpoint whose `verification` is not an array no longer crashes acceptance through revision coverage (the task used to stick in `active/` and be re-dispatched); with several planned milestones a review counts only for the milestone it names, so one accepted revision cannot cover two milestones; an unreadable gate, task or checkpoint is skipped during gate reconciliation instead of failing every run of the queue.
27
+ - **Security:** isolated verification started by root now passes `--cap-drop ALL` to bwrap and masks root-only secrets of the bound `/etc` (`shadow`, `gshadow`, `sudoers`, SSH host keys, `ssl/private`); previously a root host gave the sandbox full capabilities, so a verification command could remount `/usr` or `/etc` read-write, modify host binaries and still pass, and could read `/etc/shadow`. Run the supervisor as a non-root user for full identity separation.
28
+ - The undeclared-input audit follows symlinks the command creates (including renamed and relative ones) and rejects another thread's `/proc/.../task/<tid>/` aliases, so `ln -s /work /tmp/w; cat /tmp/w/hidden.txt` no longer passes unnoticed.
29
+ - Fix intermittent false failures of isolated verification when processes are killed in `exit_group` or `wait4` during PID-namespace teardown (`unfinished`/`overlapping file syscall`).
30
+ - The isolation supervisor's timeout now covers input freezing, and SIGTERM tears down the traced sandbox, so a caller timeout no longer orphans strace, bwrap and the command.
31
+ - A failed isolated verification reports its `reason`; the live isolation self-test names missing tools (`LOOP_SKIP_ISOLATION_TESTS=1` skips it) instead of failing on an unrelated `stderr.log` read.
32
+
5
33
  ## 0.16.4 - 2026-10-29
6
34
 
7
35
  - Measure project continuation by newly accepted, evidence-bound milestone identities, preserving explicit and inferred project plans; renamed plans and duplicate snapshots no longer count as progress.
package/README.md CHANGED
@@ -284,7 +284,11 @@ loop-engineering-hermes-smoke \
284
284
  ```
285
285
 
286
286
  The doctor checks the Hermes CLI, `hermes send`, generated files, queue wiring,
287
- and a delivery dry-run. The smoke creates a temporary queue, executes a bounded
287
+ and a delivery dry-run. After a package upgrade, it also warns when a generated
288
+ dispatcher, wrapper or notifier is out of date (or was edited by hand) and prints
289
+ the installer command that regenerates it; rerunning with `--force` also rewrites
290
+ the queue config, scheduler units and managed `AGENTS.md` block, so back up local
291
+ changes first. The smoke creates a temporary queue, executes a bounded
288
292
  Hermes worker task, verifies contract/plan/final-judgement artifacts, tests the
289
293
  notification return path without sending externally, and removes its artifacts.
290
294
 
@@ -729,8 +733,14 @@ LOOP_HUMAN_REVISION_REQUEST_FILE_REL
729
733
  LOOP_RUN_ID
730
734
  LOOP_ATTEMPT
731
735
  LOOP_MAX_ATTEMPTS
736
+ LOOP_TURN_TIMEOUT_MS
732
737
  ```
733
738
 
739
+ `LOOP_TURN_TIMEOUT_MS` is the dispatch timeout after which the runner kills the
740
+ turn. Custom dispatchers should pass it to the worker so it checkpoints and
741
+ finishes (or hands off) before then; a killed turn loses unsaved work and
742
+ spends a runtime recovery attempt.
743
+
734
744
  Before dispatch, `run-queue` writes planning artifacts under
735
745
  `runtime/loops/<queue>/tasks/<task_id>/`: `task_contract.json`,
736
746
  `acceptance_plan.json`, `dev_plan.json`, `checkpoints/`, `reviews/`, and
@@ -42,8 +42,22 @@ same input digest. Failed file accesses are checked against the recorded working
42
42
  directory or directory descriptor, including nested paths and resumed calls.
43
43
  Swallowing a missing undeclared input error does not make verification pass.
44
44
  Missing, malformed, stale, or red receipts fail verification.
45
- The queue run records the evidence directory and digest in its verification
46
- artifact. `code-task-run` repeats isolated verification after applying a
45
+ The queue run records the evidence directory, digest and, for a failed run, a
46
+ short `reason` (supervisor error, read-audit violation, timeout or failed
47
+ receipt check) in its verification artifact.
48
+
49
+ The sandboxed command holds no capabilities. When the supervisor runs as root,
50
+ bwrap is started with `--cap-drop ALL`, so the command can neither remount the
51
+ read-only system binds nor write the host `/usr` or `/etc`; the usual root-only
52
+ secrets of the bound `/etc` (`shadow`, `gshadow`, `sudoers`, SSH host keys,
53
+ `ssl/private`) are masked. The sandbox identity still maps to host root, so
54
+ other root-only files in the bound system directories remain readable: run the
55
+ supervisor as a non-root user when that matters. (Running the sandbox as an
56
+ unprivileged identity under root is not portable: hosts that restrict
57
+ unprivileged user namespaces, such as Ubuntu 23.10+, deny it the capabilities
58
+ bwrap needs to set up the sandbox network.) The supervisor's `--timeout` covers freezing as well as the
59
+ command, and a SIGTERM to the supervisor tears down the traced sandbox, which
60
+ runs in its own session. `code-task-run` repeats isolated verification after applying a
47
61
  reviewed patch; its evidence lives beside the project root in
48
62
  `.loop-isolation-evidence/<task-id>/`.
49
63
 
@@ -74,8 +88,21 @@ The supervisor models its explicit mount roots and runtime-file ancestors;
74
88
  unresolved traversal through dynamic external mounts or symlink ancestors fails
75
89
  closed. This is bounded trace auditing, not unrestricted syscall emulation.
76
90
 
91
+ Symlinks the command creates (in `/tmp` or `/out`, which start empty) are
92
+ recorded from the trace, followed through renames, and resolved before a failed
93
+ access is audited, so probing an undeclared input through such a link is still
94
+ rejected. Process exits and child waits that never return during PID-namespace
95
+ teardown are not treated as unfinished file syscalls.
96
+
77
97
  Failed `/proc/self/cwd`, `/proc/thread-self/cwd` and self `root` probes are
78
98
  resolved using the traced process cwd or the sandbox root before source-input
79
99
  auditing. Raw suffix components are retained. Unresolved process/fd aliases
80
- (including `/dev/fd`) fail closed; optional accesses via unknown dynamic aliases
100
+ (including `/dev/fd` and another thread's `/proc/.../task/<tid>/` view) fail closed; optional accesses via unknown dynamic aliases
81
101
  may therefore be rejected. This does not claim general procfs emulation.
102
+
103
+ ## Running the self-tests
104
+
105
+ `npm test` starts with the live sandbox tests and needs Linux with bubblewrap,
106
+ strace and Python 3 (`apt-get install bubblewrap strace python3`). Without them
107
+ the test names the missing tools and fails; set `LOOP_SKIP_ISOLATION_TESTS=1`
108
+ to skip only those live tests on a machine that cannot run the sandbox.
@@ -60,12 +60,22 @@ export function validHandoff(value, { taskId, runId, generation, attempt }) {
60
60
  if (!['completed', 'remaining', 'evidence', 'pendingActions', 'blockers'].every(k => Array.isArray(value[k]) && value[k].every(x => typeof x === 'string'))) return false;
61
61
  return value.remaining.length > 0 && value.evidence.length > 0;
62
62
  }
63
+ // Larger turns must not run into the dispatch timeout: a killed turn loses
64
+ // its unsaved work and counts against runtime recovery attempts, while a
65
+ // handoff does not.
66
+ function turnTimeoutInstruction(value) {
67
+ const ms = Number(value);
68
+ if (!Number.isFinite(ms) || ms <= 0) return [];
69
+ const minutes = (x) => Math.max(1, Math.floor(x / 60000));
70
+ return ['TIME BUDGET: This turn is stopped after about ' + minutes(ms) + ' minutes. By about ' + minutes(ms * 0.8) + ' minutes in, stop starting new sub-steps, save a checkpoint and hand off any remaining work instead of running into the limit.'];
71
+ }
63
72
  export function contextWorkerInstructions(env = process.env) {
64
73
  const policy = JSON.parse(env.LOOP_CONTEXT_POLICY || JSON.stringify(DEFAULT_CONTEXT_POLICY));
65
74
  return [
66
- 'CONTEXT BUDGET: Work on one bounded objective this turn. Read only necessary file ranges. Keep each tool response around 8 KiB or less; put full logs in task artifacts and return paths plus short excerpts. This is a cooperative tool-output budget, not runtime enforcement.',
75
+ 'CONTEXT BUDGET: Complete as much of the current milestone as this turn allows; do not stop after one small step, because every extra turn repeats planning, acceptance and scheduling. Save a checkpoint at natural boundaries (after each verified sub-step) so progress survives a handoff. Read only necessary file ranges. Keep each tool response around 8 KiB or less; put full logs in task artifacts and return paths plus short excerpts. This is a cooperative tool-output budget, not runtime enforcement.',
67
76
  'Read the resume manifest at ' + (env.LOOP_RESUME_FILE || '(unavailable)') + ' and only the latest relevant checkpoint; never reload entire session transcripts or all historical checkpoints.',
68
- 'At approximately ' + Math.round(policy.softRatio * 100) + '% of the model context window, save a checkpoint and prepare handoff. At ' + Math.round(policy.hardRatio * 100) + '% stop new work and hand off. If live usage is unavailable, finish one small objective and checkpoint; do not invent token measurements.',
77
+ 'At approximately ' + Math.round(policy.softRatio * 100) + '% of the model context window, save a checkpoint and prepare handoff. At ' + Math.round(policy.hardRatio * 100) + '% stop new work and hand off. If live usage is unavailable, keep working through the milestone, checkpoint after each verified sub-step, and hand off only when the remaining work clearly will not fit this turn; do not invent token measurements.',
78
+ ...turnTimeoutInstruction(env.LOOP_TURN_TIMEOUT_MS),
69
79
  'Before repeating an external/paid/destructive operation, verify its previous outcome using durable receipts/reservations; an uncertain outcome is a blocker, never permission to replay. Preserve existing human gates and amendment versions.',
70
80
  'If unfinished work needs a fresh session, first write a normal progress checkpoint (not ready_for_acceptance) with task_id and loop_run_id matching this run, then write JSON to ' + (env.LOOP_CONTEXT_HANDOFF_FILE || '(unavailable)') + ' and finish the turn. Never claim completion merely because you handed off.',
71
81
  'Handoff schema (max 16 KiB): ' + JSON.stringify({ version: 1, taskId: env.LOOP_TASK_ID, runId: env.LOOP_RUN_ID, generation: Number(env.LOOP_SESSION_GENERATION || 0), attempt: Number(env.LOOP_ATTEMPT || 1), reason: 'context_budget', checkpoint: 'path to the current progress checkpoint', summary: 'brief current state', completed: ['completed work'], remaining: ['remaining work'], evidence: ['checkpoint and verification paths'], nextAction: 'one concrete next step', authority: 'authorized scope and gates', pendingActions: ['uncertain external action receipts to reconcile, if any'], blockers: [] }),
package/lib/core.mjs CHANGED
@@ -1366,17 +1366,29 @@ export async function reconcileProjectGates(root, options = {}) {
1366
1366
  : [...new Set((await projectSpecs(root)).flatMap((spec) => (spec.queues ?? []).map((item) => item.queue)))];
1367
1367
  const specs = new Map((await projectSpecs(root)).map((spec) => [spec.project, spec]));
1368
1368
  const results = [];
1369
+ const skipped = [];
1369
1370
  for (const queue of queues) {
1370
1371
  await ensureQueueDirs(root, queue);
1371
1372
  const gatesDir = path.join(queueDirFor(root, queue), 'human-input', 'gates');
1372
1373
  for (const file of await listJson(gatesDir)) {
1373
1374
  const full = path.join(gatesDir, file);
1374
- let gate = await readJson(full);
1375
- if (gate.status !== 'waiting_for_human') continue;
1376
- const found = await findTaskFile(root, queue, gate.task_id);
1377
- const task = found ? await readJson(found.file) : null;
1378
- const checkpointFile = path.join(taskRuntimeDirFor(root, queue, gate.task_id), 'checkpoints', `${gate.checkpoint_id}.json`);
1379
- const checkpoint = await exists(checkpointFile) ? await readJson(checkpointFile) : null;
1375
+ // One unreadable gate, task or checkpoint must not stop reconciliation
1376
+ // (and so every run) for the whole queue. Leave that gate waiting.
1377
+ let gate;
1378
+ let found;
1379
+ let task;
1380
+ let checkpoint;
1381
+ try {
1382
+ gate = await readJson(full);
1383
+ if (gate?.status !== 'waiting_for_human') continue;
1384
+ found = await findTaskFile(root, queue, gate.task_id);
1385
+ task = found ? await readJson(found.file) : null;
1386
+ const checkpointFile = path.join(taskRuntimeDirFor(root, queue, gate.task_id), 'checkpoints', `${gate.checkpoint_id}.json`);
1387
+ checkpoint = await exists(checkpointFile) ? await readJson(checkpointFile) : null;
1388
+ } catch (error) {
1389
+ skipped.push({ queue, gateId: gate?.gate_id ?? file, outcome: 'skipped_unreadable', reason: error instanceof Error ? error.message : String(error) });
1390
+ continue;
1391
+ }
1380
1392
  if (!gate.project_id || !Array.isArray(gate.requirement_ids) || !gate.contract_hash) {
1381
1393
  gate = { ...gate, ...await gateProjectMetadata(root, task, checkpoint) };
1382
1394
  await writeJson(full, gate);
@@ -1423,7 +1435,7 @@ export async function reconcileProjectGates(root, options = {}) {
1423
1435
  results.push({ queue, gateId: gate.gate_id, projectId: gate.project_id, outcome: invalid.status, reason: invalid.code });
1424
1436
  }
1425
1437
  }
1426
- return { inspectedQueues: queues.length, reconciled: results.length, results };
1438
+ return { inspectedQueues: queues.length, reconciled: results.length, results, ...(skipped.length ? { skipped } : {}) };
1427
1439
  }
1428
1440
 
1429
1441
  function projectLatestIntakePath(root, project) {
@@ -1496,7 +1508,7 @@ const PROJECT_TEMPLATES = {
1496
1508
  ],
1497
1509
  backlog: [
1498
1510
  ['Inspect project baseline', 'Identify the current structure, existing checks, and likely implementation boundaries.'],
1499
- ['Implement first scoped change', 'Complete the smallest useful code change from the brief.'],
1511
+ ['Implement first scoped change', 'Complete the first coherent code change from the brief end to end, including its tests.'],
1500
1512
  ['Verify behavior', 'Run the project checks and record evidence.'],
1501
1513
  ['Prepare review bundle', 'Produce reviewable patch and closeout artifacts.']
1502
1514
  ]
@@ -2352,7 +2364,11 @@ async function terminalNotificationMessage(root, queue, task, language = 'en') {
2352
2364
  const needsHuman = ['needs_human_input', 'blocked', 'ready_for_human_review'].includes(task.status);
2353
2365
  const summary = compactNotificationText(checkpoint?.summary);
2354
2366
  const verificationCount = Array.isArray(checkpoint?.verification) ? checkpoint.verification.length : 0;
2355
- const blockers = Array.isArray(checkpoint?.blockers) ? checkpoint.blockers.filter(Boolean) : [];
2367
+ const blockers = [
2368
+ ...(Array.isArray(checkpoint?.blockers) ? checkpoint.blockers.filter(Boolean) : []),
2369
+ ...(Array.isArray(judgement?.handoff_blockers) ? judgement.handoff_blockers : []),
2370
+ ...(Array.isArray(judgement?.handoff_pending_actions) ? judgement.handoff_pending_actions.map((item) => (language === 'zh' ? '结果未知的外部操作:' : 'unknown external outcome: ') + item) : [])
2371
+ ];
2356
2372
  const outcome = judgement?.outcome;
2357
2373
  const nextAction = compactNotificationText(judgement?.next_actions?.[0] ?? checkpoint?.next_action, 300);
2358
2374
  if (language === 'zh') return [
@@ -3500,7 +3516,7 @@ export function inferTaskScope(task) {
3500
3516
  // Apply the same object-local negation rule to EVERY local-scope cue.
3501
3517
  // Removing a negated cue also prevents a nested cue ("backlog item" or
3502
3518
  // "第一步") from overriding the project objective.
3503
- const cue = /有界.{0,20}?里程碑|bounded.{0,30}?milestone|(?:only\s*|仅|只)(?:推进|处理|执行|完成|验证)|阶段完成|任务完成|第\s*(?:\d+|一)\s*(?:项|步)|选项\s*\d+|boundary item|backlog item|(?:取消|撤销|移除).{0,40}(?:功能|范围|计划|必做|门槛)|(?:cancel|remove|drop|withdraw).{0,40}(?:feature|scope|requirement|backlog item|completion gate)|(?:product[-_ ]scope|产品范围).{0,20}(?:decision|amendment|决策|修订)/g;
3519
+ const cue = /有界.{0,20}?里程碑|bounded.{0,30}?milestone|(?:only\s*|仅|只)(?:推进|处理|执行|完成|验证)|阶段完成|任务完成|第\s*(?:\d+|一)\s*(?:项|步)(?!\s*(?:之后|以后|完成后|结束后|后))|选项\s*\d+|boundary item|backlog item|(?:取消|撤销|移除).{0,40}(?:功能|范围|计划|必做|门槛)|(?:cancel|remove|drop|withdraw).{0,40}(?:feature|scope|requirement|backlog item|completion gate)|(?:product[-_ ]scope|产品范围).{0,20}(?:decision|amendment|决策|修订)/g;
3504
3520
  // Negation governs the following object phrase, including arbitrary modifiers.
3505
3521
  // End its scope at clause/contrast boundaries or an explicit context object,
3506
3522
  // not at a whitelist of adjectives (first/initial/one/etc.). Coordinated
@@ -3509,14 +3525,16 @@ export function inferTaskScope(task) {
3509
3525
  // Explicit double-negative obligations are affirmative. Do not count every
3510
3526
  // negative word: unrelated prohibitions can coexist in the same clause.
3511
3527
  prefix = prefix.replace(/(?:\b(?:not|never)|n['’]t)\s+(?:fail\s+to|avoid(?:\s+doing)?)\b|\bwithout\s+failing\s+to\b|(?:不能不|不得不|不是不)/g, ' ');
3528
+ // 不/别 inside ordinary words (特别, 不同, 区别, 别的 ...) is not negation.
3529
+ prefix = prefix.replace(/特别|区别|分别|差别|级别|类别|识别|个别|告别|别的|别人|别处|不同|不管|不论|不过|不少|不断|不错|不止|不久/g, ' ');
3512
3530
  const negations = [...prefix.matchAll(/(?:不|勿|别)|\b(?:not|never|no|without|neither|nor)\b|n['’]t\b/g)];
3513
3531
  if (!negations.length) return false;
3514
3532
  const tail = prefix.slice(negations.at(-1).index);
3515
3533
  // These boundaries introduce a separate affirmative instruction after a
3516
3534
  // negated context, e.g. without deploying the project ... implement X.
3517
- return !/(?:project[-_ ]level\b[^,;.!?]*\b(?:implement|complete|do|execute)\b)|(?:前提下|情况下)|,\s*(?:and|or)\s+(?:implement|complete|execute|do)\b|\bwithout\s+\w+ing\b[^,;.!?]*\b(?:implement|complete|execute|do)\b|\b(?:while|then|however|instead)\b/.test(tail);
3535
+ return !/(?:project[-_ ]level\b[^,;.!?]*\b(?:implement|complete|do|execute)\b)|(?:前提下|情况下)|\bwithout\s+(?!\w+ing\b)[^,;.!?]*?\b(?:complete|implement|execute|finish)\b|,\s*(?:and|or)\s+(?:implement|complete|execute|do)\b|\bwithout\s+\w+ing\b[^,;.!?]*\b(?:implement|complete|execute|do)\b|\b(?:while|then|however|instead)\b/.test(tail);
3518
3536
  };
3519
- const boundedMilestone = requestText.split(/[,,](?!\s*(?:or\b|and\b|nor\b|或|以及))|[。;;.!?\n]|\bbut\b|而是|但是/).some((clause) => {
3537
+ const boundedMilestone = requestText.split(/[,,](?!\s*(?:or\b|and\b|nor\b|或|以及))|[。;;.!?\n]|\s[-–—]\s|\bbut\b|而是|但是/).some((clause) => {
3520
3538
  let prefix = '';
3521
3539
  let offset = 0;
3522
3540
  for (const match of clause.matchAll(cue)) {
@@ -3908,7 +3926,7 @@ export async function writeAcceptancePlan(root, queue, task, taskContract, optio
3908
3926
  };
3909
3927
  }
3910
3928
 
3911
- function buildDevPlan(contract, acceptancePlan, firstCheckpointId = 'cp1') {
3929
+ function buildDevPlan(contract, acceptancePlan, firstCheckpointId = 'cp1', milestoneId = firstCheckpointId, revisesCheckpointId = null) {
3912
3930
  const gated = contract.requires_human_gate;
3913
3931
  return {
3914
3932
  version: 1,
@@ -3920,7 +3938,7 @@ function buildDevPlan(contract, acceptancePlan, firstCheckpointId = 'cp1') {
3920
3938
  requires_human_gate: contract.requires_human_gate,
3921
3939
  approach: gated
3922
3940
  ? 'Read the task contract and acceptance plan, produce bounded local artifacts and checkpoint evidence, and stop before any live instrumentation, process control, external action, or repeated human-blocked retry.'
3923
- : 'Read the task contract and acceptance plan, make the smallest useful change, and record checkpoint evidence before claiming completion.',
3941
+ : 'Read the task contract and acceptance plan, complete the requested change in as few turns as practical (checkpointing verified sub-steps along the way), and record checkpoint evidence before claiming completion.',
3924
3942
  acceptance_alignment: {
3925
3943
  functional_checks: acceptancePlan.functional_checks.map((_, index) => `functional:${index + 1}`),
3926
3944
  regression_checks: acceptancePlan.regression_checks.map((_, index) => `regression:${index + 1}`),
@@ -3928,7 +3946,7 @@ function buildDevPlan(contract, acceptancePlan, firstCheckpointId = 'cp1') {
3928
3946
  },
3929
3947
  checkpoints: [
3930
3948
  {
3931
- id: firstCheckpointId,
3949
+ id: milestoneId,
3932
3950
  goal: 'Produce the first complete development result for acceptance review.',
3933
3951
  required_evidence: [
3934
3952
  'Summary of files changed or artifacts created',
@@ -3943,8 +3961,8 @@ function buildDevPlan(contract, acceptancePlan, firstCheckpointId = 'cp1') {
3943
3961
  version: 1,
3944
3962
  task_id: contract.task_id,
3945
3963
  checkpoint_id: firstCheckpointId,
3946
- milestone_id: firstCheckpointId,
3947
- revises_checkpoint_id: null,
3964
+ milestone_id: milestoneId,
3965
+ revises_checkpoint_id: revisesCheckpointId,
3948
3966
  revision_coverage: null,
3949
3967
  status: 'ready_for_acceptance | blocked | needs_human_input',
3950
3968
  summary: 'What changed and why.',
@@ -3972,6 +3990,19 @@ function buildDevPlan(contract, acceptancePlan, firstCheckpointId = 'cp1') {
3972
3990
  };
3973
3991
  }
3974
3992
 
3993
+ // What last put this task back in the queue: a judged and accepted project
3994
+ // milestone (project_continued), a runtime or orphan recovery of an
3995
+ // unfinished run (recovered), an operator requeue, or nothing (first run).
3996
+ function lastTaskTransition(task) {
3997
+ const at = (field) => Date.parse(task?.[field] ?? '') || 0;
3998
+ const transitions = [
3999
+ ['project_continued', at('projectContinuedAt')],
4000
+ ['recovered', Math.max(at('runtimeInterruptedAt'), at('orphanRecoveredAt'))],
4001
+ ['requeued', task?.orphanRecoveredAt && at('requeuedAt') === at('orphanRecoveredAt') ? 0 : at('requeuedAt')]
4002
+ ].filter(([, time]) => time > 0).sort((a, b) => b[1] - a[1]);
4003
+ return transitions[0]?.[0] ?? 'first_run';
4004
+ }
4005
+
3975
4006
  export async function writeDevPlan(root, queue, task, taskContract, acceptancePlan) {
3976
4007
  const dir = taskRuntimeDirFor(root, queue, task.id);
3977
4008
  const checkpointsDir = path.join(dir, 'checkpoints');
@@ -3986,7 +4017,20 @@ export async function writeDevPlan(root, queue, task, taskContract, acceptancePl
3986
4017
  let checkpointNumber = 1;
3987
4018
  while (usedCheckpointNumbers.has(checkpointNumber)) checkpointNumber += 1;
3988
4019
  const nextCheckpointId = `cp${checkpointNumber}`;
3989
- let plan = buildDevPlan(taskContract.contract, acceptancePlan.plan, nextCheckpointId);
4020
+ // Each dispatch writes a new checkpoint file, but the milestone it serves
4021
+ // only changes once that milestone was judged accepted and the project
4022
+ // continued. A revision round, runtime recovery, orphan recovery or operator
4023
+ // requeue keeps the milestone, so its reviews stay one chain: otherwise the
4024
+ // new id splits them and the old review (or blocker) stays live forever, or
4025
+ // an already-written accepted checkpoint no longer counts after recovery.
4026
+ const previousPlan = await readJson(file).catch(() => null);
4027
+ const previousMilestone = previousPlan?.task_id === task.id && previousPlan.generated_by === 'deterministic_dev_planner_v1'
4028
+ && Array.isArray(previousPlan.checkpoints) && previousPlan.checkpoints.length === 1
4029
+ ? previousPlan.checkpoints[0]?.id ?? null : null;
4030
+ const milestoneId = previousMilestone && lastTaskTransition(task) !== 'project_continued' ? previousMilestone : nextCheckpointId;
4031
+ const latestCheckpoint = milestoneId === nextCheckpointId ? null
4032
+ : [...usedCheckpointNumbers].sort((a, b) => b - a).map((number) => `cp${number}`)[0] ?? null;
4033
+ let plan = buildDevPlan(taskContract.contract, acceptancePlan.plan, nextCheckpointId, milestoneId, latestCheckpoint);
3990
4034
  if (taskContract.contract.task_scope === 'project') {
3991
4035
  const existing = await readJson(file).catch(() => null);
3992
4036
  if (existing?.task_id === task.id &&
@@ -4420,7 +4464,10 @@ function applyRevisionCoverage(reviews, planned, contract) {
4420
4464
  || !old.checkpointDigest || entry.checkpoint_sha256 !== old.checkpointDigest
4421
4465
  || typeof entry.resolution !== 'string' || !entry.resolution.trim()
4422
4466
  || !Array.isArray(evidence) || !evidence.length
4423
- || !evidence.every(item => typeof item === 'string' && item.trim() && review.verification?.includes(item))
4467
+ // verification may be malformed (an object or a string); only an array
4468
+ // of exact entries can bind coverage evidence, and it must not throw.
4469
+ || !Array.isArray(review.verification)
4470
+ || !evidence.every(item => typeof item === 'string' && item.trim() && review.verification.includes(item))
4424
4471
  || reversedClock) valid = false;
4425
4472
  if (old) { seen.add(old.checkpointId); targets.push(old); }
4426
4473
  }
@@ -4439,10 +4486,25 @@ export function selectEffectiveAcceptanceReviews(devPlan, acceptanceReviews, con
4439
4486
  const allReviews = applyRevisionCoverage(acceptanceReviews?.reviews ?? [], planned, contract);
4440
4487
  const protectedReviews = allReviews.filter(review => review.invalidCheckpoint || review.invalidRevisionCoverage);
4441
4488
  const groups = new Map();
4442
- for (const review of allReviews.filter(review => !protectedReviews.includes(review))) {
4489
+ const candidates = allReviews.filter(review => !protectedReviews.includes(review));
4490
+ const byCheckpoint = new Map(candidates.map(review => [review.checkpointId, review]));
4491
+ const baseKey = (review) => review.milestoneId ?? (planned.length <= 1 ? planned[0]?.id ?? '__legacy__' : review.checkpointId);
4492
+ // A checkpoint that declares revises_checkpoint_id continues that
4493
+ // checkpoint's milestone even when it carries a different milestone id
4494
+ // (plans written by 0.16.1-0.16.4 renamed the milestone on every dispatch).
4495
+ const chainKey = (review) => {
4496
+ let current = review;
4497
+ const seen = new Set();
4498
+ while (current.revisesCheckpointId && byCheckpoint.has(current.revisesCheckpointId) && !seen.has(current.checkpointId)) {
4499
+ seen.add(current.checkpointId);
4500
+ current = byCheckpoint.get(current.revisesCheckpointId);
4501
+ }
4502
+ return baseKey(current);
4503
+ };
4504
+ for (const review of candidates) {
4443
4505
  // Explicit identities never inherit another milestone's clocks. Legacy
4444
4506
  // unlabelled snapshots retain the single-plan chronology compatibility.
4445
- const key = review.milestoneId ?? (planned.length <= 1 ? planned[0]?.id ?? '__legacy__' : review.checkpointId);
4507
+ const key = chainKey(review);
4446
4508
  const group = groups.get(key) ?? [];
4447
4509
  group.push(review);
4448
4510
  groups.set(key, group);
@@ -4461,6 +4523,15 @@ export function selectEffectiveAcceptanceReviews(devPlan, acceptanceReviews, con
4461
4523
  return selected;
4462
4524
  }
4463
4525
 
4526
+ // With several planned milestones a review covers only the milestone it
4527
+ // names (legacy reviews without one fall back to their checkpoint id), so a
4528
+ // revision written as checkpoint "cp2" for milestone "cp1" cannot also count
4529
+ // as milestone cp2. A single-milestone plan is one review chain, as before.
4530
+ function reviewCoversMilestone(review, milestoneId, plannedCount) {
4531
+ if (plannedCount <= 1) return review.milestoneId === milestoneId || review.checkpointId === milestoneId;
4532
+ return review.milestoneId != null ? review.milestoneId === milestoneId : review.checkpointId === milestoneId;
4533
+ }
4534
+
4464
4535
  function acceptedMilestoneIds(devPlan, acceptanceReviews, contract) {
4465
4536
  const effective = selectEffectiveAcceptanceReviews(devPlan, acceptanceReviews, contract);
4466
4537
  const planned = devPlan?.checkpoints ?? [];
@@ -4469,7 +4540,7 @@ function acceptedMilestoneIds(devPlan, acceptanceReviews, contract) {
4469
4540
  // that does not bind those snapshots to a newly named milestone. Progress
4470
4541
  // needs a durable checkpoint/milestone identity, never just the plan label.
4471
4542
  const reviews = effective.filter(r =>
4472
- r.milestoneId === cp.id || r.checkpointId === cp.id);
4543
+ reviewCoversMilestone(r, cp.id, planned.length));
4473
4544
  return reviews.length > 0 && reviews.every(r => r.status === 'accepted');
4474
4545
  }).map(cp => cp.id);
4475
4546
  }
@@ -4487,7 +4558,7 @@ export function buildFinalJudgement(contract, acceptancePlan, devPlan, checkpoin
4487
4558
  const reviewCount = effectiveReviews.length;
4488
4559
  const acceptedCount = requiredCheckpoints > 0
4489
4560
  ? devPlan.checkpoints.filter(checkpoint => effectiveReviews.some(review => review.status === 'accepted'
4490
- && (review.milestoneId === checkpoint.id || review.checkpointId === checkpoint.id
4561
+ && (reviewCoversMilestone(review, checkpoint.id, requiredCheckpoints)
4491
4562
  || (requiredCheckpoints === 1 && review.milestoneId == null)))).length
4492
4563
  : effectiveReviews.filter((item) => item.status === 'accepted').length;
4493
4564
  const reviseCount = effectiveReviews.filter((item) => item.status === 'revise').length;
@@ -5004,7 +5075,7 @@ function queueSchedulerOutcomeGroup(status) {
5004
5075
  function updateSchedulerCounters(previous, group) {
5005
5076
  const counters = previous?.counters ?? {};
5006
5077
  return {
5007
- consecutiveSuccesses: group === 'success' ? (counters.consecutiveSuccesses ?? 0) + 1 : 0,
5078
+ consecutiveSuccesses: group === 'success' || group === 'continuation' ? (counters.consecutiveSuccesses ?? 0) + 1 : 0,
5008
5079
  consecutiveFailures: group === 'failure' ? (counters.consecutiveFailures ?? 0) + 1 : 0,
5009
5080
  consecutiveIdle: group === 'idle' ? (counters.consecutiveIdle ?? 0) + 1 : 0,
5010
5081
  consecutiveHumanGates: group === 'human_gate' ? (counters.consecutiveHumanGates ?? 0) + 1 : 0,
@@ -5022,10 +5093,24 @@ function computeQueueSchedulerInterval(previous, policy, observed) {
5022
5093
  const previousInterval = Number.isFinite(previous?.currentIntervalMs)
5023
5094
  ? previous.currentIntervalMs
5024
5095
  : policy.initialIntervalMs;
5025
- const group = queueSchedulerOutcomeGroup(observed.status);
5096
+ const group = observed.continuation ? 'continuation' : queueSchedulerOutcomeGroup(observed.status);
5026
5097
  let next = previousInterval;
5027
5098
  const reasons = [];
5028
5099
 
5100
+ // A task that just made accepted progress (a project milestone, or a
5101
+ // validated context handoff) is waiting to continue. Run it again as soon
5102
+ // as the minimum interval after this run ends: the long-run headroom below
5103
+ // would otherwise idle for a quarter of every long turn, and the queue lock
5104
+ // already prevents overlap.
5105
+ if (group === 'continuation') {
5106
+ return {
5107
+ intervalMs: clamp(policy.minIntervalMs, policy.minIntervalMs, policy.maxIntervalMs),
5108
+ group,
5109
+ reasons: ['continuation_after_progress'],
5110
+ fromRunEnd: true
5111
+ };
5112
+ }
5113
+
5029
5114
  if (group === 'success' && observed.statusAfter.queued > 0) {
5030
5115
  next = previousInterval * policy.speedupFactor;
5031
5116
  reasons.push('queued_work_after_success_speedup');
@@ -5274,12 +5359,18 @@ export async function queueSchedulerTick(root, options) {
5274
5359
  durationMs: runDurationMs(run),
5275
5360
  statusBefore,
5276
5361
  statusAfter,
5362
+ continuation: status === 'project_in_progress'
5363
+ || (status === 'runtime_interrupted' && run?.dispatchFailureClassification?.category === 'context_handoff'),
5277
5364
  runPath: runResult?.runPath ?? null,
5278
5365
  taskId: runResult?.run?.taskId ?? null
5279
5366
  };
5280
5367
  const decision = computeQueueSchedulerInterval(previous, policy, observed);
5281
5368
  const counters = updateSchedulerCounters(previous, decision.group);
5282
- const nextRunAt = new Date(nowMs + decision.intervalMs).toISOString();
5369
+ // Continuations count from the end of this run, not from the tick start.
5370
+ const scheduledFromMs = decision.fromRunEnd
5371
+ ? (options.nowMs !== undefined ? nowMs + (observed.durationMs ?? 0) : Date.now())
5372
+ : nowMs;
5373
+ const nextRunAt = new Date(scheduledFromMs + decision.intervalMs).toISOString();
5283
5374
  const progressNotification = decideQueueProgressNotification(previousProgress, progressPolicy, observed, decision, nowMs);
5284
5375
  const progressReport = {
5285
5376
  version: 1,
@@ -10278,9 +10369,13 @@ export async function runQueueOnce(root, options) {
10278
10369
  devPlan = await writeDevPlan(root, queue, task, taskContract, acceptancePlan);
10279
10370
  const priorReviews = await writeAcceptanceReviews(root, queue, task, taskContract, acceptancePlan, devPlan, { persist: false });
10280
10371
  invalidCheckpointBaseline = priorReviews.reviews.some(review => review.invalidCheckpoint === true);
10281
- priorAcceptedMilestoneIds = invalidCheckpointBaseline ? null
10372
+ // A recovered run resumes work whose checkpoints were never judged: what
10373
+ // the interrupted run wrote is this run's progress, not its baseline.
10374
+ // Recovery is bounded by retry.runtimeRecoveryMaxAttempts.
10375
+ const resumingUnjudgedRun = lastTaskTransition(task) === 'recovered';
10376
+ priorAcceptedMilestoneIds = invalidCheckpointBaseline || resumingUnjudgedRun ? null
10282
10377
  : acceptedMilestoneIds(devPlan.plan, priorReviews, taskContract.contract);
10283
- priorCheckpointCount = (await checkpointSummary(root, devPlan)).count;
10378
+ priorCheckpointCount = resumingUnjudgedRun ? null : (await checkpointSummary(root, devPlan)).count;
10284
10379
  priorPlannedCheckpointCount = devPlan.plan.checkpoints?.length ?? null;
10285
10380
  progress.emit('planning', 'dev_plan', 'Wrote development plan', {
10286
10381
  taskId: task.id,
@@ -10322,6 +10417,7 @@ export async function runQueueOnce(root, options) {
10322
10417
  ...taskPlanningEnv(root, taskContract, acceptancePlan, devPlan),
10323
10418
  LOOP_SESSION_GENERATION: String(task.runtimeSessionGeneration ?? 0),
10324
10419
  LOOP_CONTEXT_POLICY: JSON.stringify(budgetPolicy),
10420
+ LOOP_TURN_TIMEOUT_MS: String(timeoutMs),
10325
10421
  LOOP_RESUME_FILE: resumeFile,
10326
10422
  LOOP_CONTEXT_HANDOFF_FILE: contextPrefix + '.handoff.json',
10327
10423
  LOOP_CONTEXT_USAGE_FILE: contextPrefix + '.usage.json',
@@ -10390,7 +10486,12 @@ export async function runQueueOnce(root, options) {
10390
10486
  if (proof.blocked || handoff.blockers.length || handoff.pendingActions.length) finalStatus = 'needs_human_input';
10391
10487
  else if (dispatch?.exitCode === 0 && !dispatchClassification?.requiresHumanAction) {
10392
10488
  handoffProgressFingerprint = proof.progressFingerprint;
10393
- if (!handoffProgressFingerprint || (task.contextHandoffProgress ?? []).includes(handoffProgressFingerprint)) {
10489
+ // The fingerprint only catches exact repeats; a worker that
10490
+ // varies a log path or timestamp each turn would otherwise
10491
+ // start a new paid session every tick forever.
10492
+ const maxHandoffs = Number(options.retry?.maxContextHandoffs ?? 10);
10493
+ if (!handoffProgressFingerprint || (task.contextHandoffProgress ?? []).includes(handoffProgressFingerprint)
10494
+ || Number(task.contextHandoffCount ?? 0) >= maxHandoffs) {
10394
10495
  finalStatus = 'runtime_blocked';
10395
10496
  }
10396
10497
  dispatchClassification = { category: 'context_handoff', recoverableRuntime: true, requiresHumanAction: false };
@@ -10524,6 +10625,21 @@ export async function runQueueOnce(root, options) {
10524
10625
  });
10525
10626
  finalStatus = queueStatusFromFinalJudgement(finalStatus, finalJudgement);
10526
10627
  }
10628
+ // Blockers and uncertain external actions reported only in a handoff
10629
+ // must reach the person who has to resolve them.
10630
+ if (finalJudgement?.judgement && contextHandoff && (contextHandoff.blockers?.length || contextHandoff.pendingActions?.length)) {
10631
+ const judgement = finalJudgement.judgement;
10632
+ judgement.handoff_blockers = contextHandoff.blockers;
10633
+ judgement.handoff_pending_actions = contextHandoff.pendingActions;
10634
+ judgement.reasons = [...(judgement.reasons ?? []),
10635
+ ...contextHandoff.blockers.map((item) => `Context handoff blocker: ${item}`),
10636
+ ...contextHandoff.pendingActions.map((item) => `External action with unknown outcome: ${item}`)];
10637
+ judgement.next_actions = [
10638
+ ...(contextHandoff.pendingActions.length ? [`Verify the outcome of ${contextHandoff.pendingActions.join('; ')} before any retry; never replay it blindly.`] : []),
10639
+ ...(contextHandoff.blockers.length ? [`Resolve: ${contextHandoff.blockers.join('; ')}.`] : []),
10640
+ ...(judgement.next_actions ?? [])];
10641
+ await writeJson(path.join(root, finalJudgement.file), judgement);
10642
+ }
10527
10643
  if (!revisionRequest) {
10528
10644
  revisionRequest = await writeRevisionRequest(root, queue, task, taskContract, acceptancePlan, devPlan, finalJudgement, acceptanceReviews);
10529
10645
  }
@@ -10554,6 +10670,8 @@ export async function runQueueOnce(root, options) {
10554
10670
  completedTask.projectContinuedAt = finishedAt;
10555
10671
  completedTask.projectContinuationCount = (task.projectContinuationCount ?? 0) + 1;
10556
10672
  completedTask.runtimeRecoveryCount = 0;
10673
+ completedTask.contextHandoffCount = 0;
10674
+ completedTask.contextHandoffProgress = [];
10557
10675
  completedTask.sessionTickCount = Number(task.sessionTickCount ?? 0) + 1;
10558
10676
  const rotation = contextRotation(contextUsage, completedTask.sessionTickCount, budgetPolicy);
10559
10677
  completedTask.contextBudget = rotation;
@@ -10573,10 +10691,13 @@ export async function runQueueOnce(root, options) {
10573
10691
  }
10574
10692
  completedTask.runtimeSessionGeneration = Number(task.runtimeSessionGeneration ?? 0) + 1;
10575
10693
  completedTask.sessionTickCount = 0;
10576
- if (contextHandoff) completedTask.contextHandoffFile = path.relative(root, contextPrefix + '.handoff.json');
10577
10694
  completedTask.runtimeInterruptedAt = finishedAt;
10578
10695
  completedTask.runtimeInterruption = dispatchAttempts[dispatchAttempts.length - 1]?.failureClassification ?? null;
10579
10696
  }
10697
+ // A handoff only describes the run that wrote it. Clear it otherwise, so
10698
+ // a later session is never pointed at an out-of-date nextAction.
10699
+ if (contextHandoff) completedTask.contextHandoffFile = path.relative(root, contextPrefix + '.handoff.json');
10700
+ else delete completedTask.contextHandoffFile;
10580
10701
  const completedFile = path.join(destination, path.basename(activeFile));
10581
10702
  // Claim the active file by moving it. If an operator canceled or parked
10582
10703
  // the task meanwhile, the file is gone and their copy stays authoritative
@@ -38,10 +38,23 @@ export async function runIsolatedVerification({ cwd, command, inputs, runtimeFil
38
38
  ...result,
39
39
  exitCode: accepted ? 0 : 1,
40
40
  isolation: { status: accepted ? 'passed' : 'failed_or_unknown', evidenceDir,
41
- inputDigest: terminal?.input_digest ?? null, runnerSha256: runnerHash }
41
+ inputDigest: terminal?.input_digest ?? null, runnerSha256: runnerHash,
42
+ // Say why, so an operator does not have to open terminal.json.
43
+ ...(accepted ? {} : { reason: isolationFailureReason(result, terminal, runnerHash === afterHash) }) }
42
44
  };
43
45
  }
44
46
 
47
+ function isolationFailureReason(result, terminal, runnerUnchanged) {
48
+ if (!runnerUnchanged) return 'isolation supervisor changed during verification';
49
+ if (!terminal) return result.timedOut ? 'isolation supervisor timed out before writing a receipt' : `no isolation receipt (supervisor exit ${result.exitCode}): ${String(result.stderr ?? '').trim().slice(-300)}`;
50
+ if (terminal.error) return terminal.error;
51
+ if (terminal.timed_out) return 'verification command timed out';
52
+ if (terminal.read_violations?.length) return `read audit failed: ${terminal.read_violations.slice(0, 3).join('; ')}`;
53
+ if (terminal.exit_code !== 0) return `verification command exited ${terminal.exit_code}`;
54
+ const failed = ['snapshot_unchanged', 'source_unchanged', 'host_tools_unchanged', 'runtime_files_unchanged', 'process_group_gone'].filter((key) => terminal[key] !== true);
55
+ return failed.length ? `receipt check failed: ${failed.join(', ')}` : 'receipt did not match the requested command';
56
+ }
57
+
45
58
  export function isolatedEvidenceDir(base, index) {
46
59
  return path.join(base, `isolation-${index + 1}-${randomUUID()}`);
47
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskforce-loop-engineering",
3
- "version": "0.16.4",
3
+ "version": "0.16.6",
4
4
  "private": false,
5
5
  "description": "OpenClaw-native loop engineering CLI, templates, and skill for verifiable agent work loops.",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
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",
32
32
  "check:project-gates": "node --check lib/core.mjs && node scripts/project-gate-reconciliation-self-test.mjs && node scripts/project-relay-self-test.mjs",
33
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",
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
+ "check": "node scripts/context-budget-self-test.mjs && npm run check:project-gates && node scripts/safety-regression-self-test.mjs && node scripts/continuation-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",
35
35
  "pack:dry": "npm pack --dry-run"
36
36
  },
37
37
  "exports": {