taskforce-loop-engineering 0.15.16 → 0.15.18

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,19 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.15.18 - 2026-09-18
6
+
7
+ - Recover non-zero dispatcher runs that report OpenClaw's missing user-visible-answer prompt by rotating the runtime session and requeueing the task.
8
+ - Preserve structured `incomplete_turn` and abandoned-liveness recovery even when a dispatcher wrapper exits successfully.
9
+ - Prevent successful recovered turns or ordinary task text that quotes the prompt from being misclassified and replayed.
10
+ - Add regression coverage for both recoverable failure and successful-output false-positive cases.
11
+
12
+ ## 0.15.17 - 2026-09-13
13
+
14
+ - Stop OpenClaw doctor and disposable smoke probes from attaching the synthetic `doctor` account to dry-run notifications.
15
+ - Preserve normal account forwarding for real source-bound notifications while remaining compatible with OpenClaw installations that reject unknown account ids during dry-run validation.
16
+ - Add strict installer regression coverage that rejects any synthetic `--account doctor` delivery.
17
+
5
18
  ## 0.15.16 - 2026-09-13
6
19
 
7
20
  - Resolve canonical project identifiers from nested checkpoint completion metadata so migrated project tasks continue against the correct authoritative backlog.
package/lib/core.mjs CHANGED
@@ -9009,6 +9009,12 @@ const DEFAULT_RECOVERABLE_RUNTIME_PATTERNS = [
9009
9009
  { category: 'incomplete_turn', pattern: '"kind": "incomplete_turn"' },
9010
9010
  { category: 'incomplete_turn', pattern: '"livenessState": "abandoned"' },
9011
9011
  { category: 'incomplete_turn', pattern: 'stopped before confirming the turn was complete' },
9012
+ // The OpenClaw embedded runner injects a recovery prompt when an assistant
9013
+ // turn completes its tool calls without a user-visible answer. A dispatch
9014
+ // that exits non-zero with this signature hit a session protocol failure,
9015
+ // not a task defect: classify it as a recoverable incomplete turn so the
9016
+ // runtime recovery path rotates the worker session and resumes.
9017
+ { category: 'incomplete_turn', pattern: 'did not produce a user-visible answer', nonZeroOnly: true },
9012
9018
  { category: 'compaction_timeout', pattern: 'compaction timed out' },
9013
9019
  { category: 'compaction_timeout', pattern: 'transcript compaction failed' },
9014
9020
  { category: 'transport_error', pattern: 'connection reset' },
@@ -9030,7 +9036,12 @@ export function dispatchFailureClassification(result, retry = {}) {
9030
9036
  // exitCode=0 or the queue may accept partial work and replay a stale gate.
9031
9037
  const output = `${result.stderr ?? ''}\n${result.stdout ?? ''}`.toLowerCase();
9032
9038
  const runtimePatterns = retry.recoverableRuntimePatterns ?? DEFAULT_RECOVERABLE_RUNTIME_PATTERNS;
9033
- const runtimeMatch = runtimePatterns.find((entry) => output.includes(String(entry.pattern ?? entry).toLowerCase()));
9039
+ const runtimeMatch = runtimePatterns.find((entry) => {
9040
+ const pattern = typeof entry === 'string' ? entry : entry.pattern;
9041
+ const nonZeroOnly = typeof entry === 'object' && entry !== null && entry.nonZeroOnly === true;
9042
+ return (!nonZeroOnly || result.exitCode !== 0)
9043
+ && output.includes(String(pattern ?? entry).toLowerCase());
9044
+ });
9034
9045
  if (runtimeMatch) {
9035
9046
  return {
9036
9047
  category: runtimeMatch.category ?? 'runtime_interruption',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskforce-loop-engineering",
3
- "version": "0.15.16",
3
+ "version": "0.15.18",
4
4
  "private": false,
5
5
  "description": "OpenClaw-native loop engineering CLI, templates, and skill for verifiable agent work loops.",
6
6
  "type": "module",
@@ -66,6 +66,86 @@ assert.equal(inferTaskScope({ body: 'Continue the overall project with a product
66
66
  assert.equal(classification.requiresHumanAction, false);
67
67
  }
68
68
 
69
+ {
70
+ // The OpenClaw embedded runner injects a recovery prompt when an assistant
71
+ // turn completes tool calls without a user-visible answer. A non-zero exit
72
+ // with this signature is a recoverable session protocol failure, so the
73
+ // runtime recovery path must rotate the worker session, not fail the task.
74
+ const classification = dispatchFailureClassification({
75
+ exitCode: 1,
76
+ timedOut: false,
77
+ stderr: '',
78
+ stdout: JSON.stringify({
79
+ finalPromptText: 'The previous assistant turn completed its tool calls but did not produce a user-visible answer. Continue from the current transcript and produce the final user-visible answer now. Do not repeat completed tool calls or restart from scratch.',
80
+ finalAssistantVisibleText: 'The tool run finished, but no final summary was produced. I did not repeat any completed actions.',
81
+ replayInvalid: true,
82
+ livenessState: 'working',
83
+ completion: { stopReason: 'stop', finishReason: 'stop' }
84
+ }, null, 2)
85
+ });
86
+ assert.equal(classification.category, 'incomplete_turn');
87
+ assert.equal(classification.recoverableRuntime, true);
88
+ assert.equal(classification.requiresHumanAction, false);
89
+ }
90
+
91
+ {
92
+ // A healthy turn may still carry replayInvalid on the session. With a real
93
+ // final visible answer and exitCode 0 it must stay a plain success.
94
+ const classification = dispatchFailureClassification({
95
+ exitCode: 0,
96
+ timedOut: false,
97
+ stderr: '',
98
+ stdout: JSON.stringify({
99
+ finalAssistantVisibleText: '本轮已完成并写入 cp546.json。',
100
+ finalAssistantRawText: '本轮已完成并写入 cp546.json。',
101
+ replayInvalid: true,
102
+ livenessState: 'working',
103
+ completion: { stopReason: 'stop', finishReason: 'stop' }
104
+ }, null, 2)
105
+ });
106
+ assert.equal(classification.category, 'ok');
107
+ assert.equal(classification.recoverableRuntime, undefined);
108
+ }
109
+
110
+ {
111
+ // A recovered turn may retain the earlier recovery prompt in its result.
112
+ // Once the wrapper exits successfully with a real visible answer, the weak
113
+ // natural-language signature must not override the successful outcome.
114
+ const classification = dispatchFailureClassification({
115
+ exitCode: 0,
116
+ timedOut: false,
117
+ stderr: '',
118
+ stdout: JSON.stringify({
119
+ finalPromptText: 'The previous assistant turn completed its tool calls but did not produce a user-visible answer. Continue from the current transcript and produce the final user-visible answer now.',
120
+ finalAssistantVisibleText: 'Recovery completed successfully; the final result is ready.',
121
+ finalAssistantRawText: 'Recovery completed successfully; the final result is ready.',
122
+ replayInvalid: false,
123
+ livenessState: 'working',
124
+ completion: { stopReason: 'stop', finishReason: 'stop' }
125
+ }, null, 2)
126
+ });
127
+ assert.equal(classification.category, 'ok');
128
+ assert.equal(classification.recoverableRuntime, undefined);
129
+ }
130
+
131
+ {
132
+ // Successful tasks can legitimately discuss the OpenClaw diagnostic text.
133
+ // Quoting it in task content must not turn a successful dispatch into a
134
+ // recoverable runtime interruption.
135
+ const classification = dispatchFailureClassification({
136
+ exitCode: 0,
137
+ timedOut: false,
138
+ stderr: '',
139
+ stdout: JSON.stringify({
140
+ taskBody: 'Review the diagnostic text "did not produce a user-visible answer" and propose a regression test.',
141
+ finalAssistantVisibleText: 'The review is complete and the regression test is documented.',
142
+ completion: { stopReason: 'stop', finishReason: 'stop' }
143
+ }, null, 2)
144
+ });
145
+ assert.equal(classification.category, 'ok');
146
+ assert.equal(classification.recoverableRuntime, undefined);
147
+ }
148
+
69
149
  {
70
150
  const classification = dispatchFailureClassification({
71
151
  exitCode: 0,
@@ -70,7 +70,7 @@ async function main() {
70
70
  if (await present(notifier)) {
71
71
  const smoke = await run(process.execPath, [notifier, 'Loop Engineering notification dry-run'], {
72
72
  cwd: args.root,
73
- env: { ...process.env, LOOP_NOTIFICATION_DRY_RUN: '1', LOOP_NOTIFICATION_SOURCE: JSON.stringify({ channel: 'feishu', target: 'user:loop-doctor-dry-run', account: 'doctor', reply_to: 'doctor-message' }) }
73
+ env: { ...process.env, LOOP_NOTIFICATION_DRY_RUN: '1', LOOP_NOTIFICATION_SOURCE: JSON.stringify({ channel: 'feishu', target: 'user:loop-doctor-dry-run', reply_to: 'doctor-message' }) }
74
74
  });
75
75
  checks.push({ id: 'notification_dry_run', ok: smoke.code === 0, detail: (smoke.stdout || smoke.stderr).trim().slice(0, 500) });
76
76
  }
@@ -15,6 +15,10 @@ await writeFile(mockOpenClaw, `#!/usr/bin/env node
15
15
  import { mkdir, writeFile } from 'node:fs/promises';
16
16
  import path from 'node:path';
17
17
  const args = process.argv.slice(2);
18
+ if (args.includes('--account') && args[args.indexOf('--account') + 1] === 'doctor') {
19
+ console.error('Unknown account: doctor');
20
+ process.exit(1);
21
+ }
18
22
  if (args[0] === '--version') console.log('OpenClaw mock 1.0');
19
23
  else if (args[0] === 'agents' && args[1] === 'list') console.log(JSON.stringify([{ id: 'builder' }]));
20
24
  else {
@@ -132,6 +136,7 @@ const doctorResult = await new Promise((resolve) => {
132
136
  if (doctorResult.code !== 0) throw new Error(`doctor failed: ${doctorResult.stderr}`);
133
137
  const doctorReport = JSON.parse(doctorResult.stdout);
134
138
  if (doctorReport.status !== 'ok' || doctorReport.externalWrite !== false || !doctorReport.checks.some((check) => check.id === 'notification_dry_run' && check.ok) || !doctorReport.checks.some((check) => check.id === 'human_gate_bridge_self_test' && check.ok)) throw new Error('doctor did not complete safe notification and Human Gate self-tests');
139
+ if (JSON.parse(await readFile(deliveryCapture, 'utf8')).includes('doctor')) throw new Error('doctor notification forwarded a synthetic account');
135
140
  const smoke = new URL('./openclaw-smoke.mjs', import.meta.url).pathname;
136
141
  const smokeSource = await readFile(smoke, 'utf8');
137
142
  if (!smokeSource.includes('Do not change user or project files, configuration, credentials, or external state.')
@@ -151,6 +156,7 @@ const smokeResult = await new Promise((resolve) => {
151
156
  if (smokeResult.code !== 0) throw new Error(`smoke failed: ${smokeResult.stderr}`);
152
157
  const smokeReport = JSON.parse(smokeResult.stdout);
153
158
  if (smokeReport.status !== 'ok' || smokeReport.externalWrite !== false || !smokeReport.steps.every((step) => step.ok)) throw new Error('end-to-end smoke did not pass safely');
159
+ if (JSON.parse(await readFile(deliveryCapture, 'utf8')).includes('doctor')) throw new Error('smoke notification forwarded a synthetic account');
154
160
  try { await readFile(path.join(root, `configs/loops/queues/${smokeReport.smokeQueue}.json`)); throw new Error('smoke config was not cleaned'); } catch (error) { if (error.code !== 'ENOENT') throw error; }
155
161
  try { await readFile(path.join(root, `runtime/loops/${smokeReport.smokeQueue}/state.json`)); throw new Error('smoke runtime was not cleaned'); } catch (error) { if (error.code !== 'ENOENT') throw error; }
156
162
  for (const generated of ['scripts/loops/openclaw-loop-dispatch.mjs', 'scripts/loops/openclaw-loop.mjs', 'scripts/loops/openclaw-loop-notify.mjs', 'scripts/loops/openclaw-loop-gate.mjs']) {
@@ -65,7 +65,7 @@ async function main() {
65
65
  await writeFile(smokeConfig, `${JSON.stringify(config, null, 2)}\n`);
66
66
  const smokeRuntimeRel = path.relative(args.root, smokeRuntime);
67
67
  const message = `走 loop:Perform a read-only integration smoke. Do not change user or project files, configuration, credentials, or external state. Writing the required Loop checkpoint and verification evidence under ${smokeRuntimeRel}/ is allowed and required; do not write anywhere else. Report SMOKE_OK with verification evidence.`;
68
- const route = await run(args.loopBin, ['route-message', '--root', args.root, '--queue', smokeQueue, '--message', message, '--route', '--confirm-execute', '--source-channel', 'feishu', '--source-target', 'user:loop-smoke-dry-run', '--source-account', 'doctor', '--source-message-id', `smoke-${runToken}`, '--source-reply-to', `smoke-${runToken}`, '--json'], { cwd: args.root });
68
+ const route = await run(args.loopBin, ['route-message', '--root', args.root, '--queue', smokeQueue, '--message', message, '--route', '--confirm-execute', '--source-channel', 'feishu', '--source-target', 'user:loop-smoke-dry-run', '--source-message-id', `smoke-${runToken}`, '--source-reply-to', `smoke-${runToken}`, '--json'], { cwd: args.root });
69
69
  steps.push({ id: 'route', ok: route.code === 0 });
70
70
  if (route.code !== 0) throw new Error(`route failed: ${route.stderr || route.stdout}`);
71
71
  const routed = JSON.parse(route.stdout);
@@ -1,7 +1,7 @@
1
1
  # npm Package
2
2
 
3
3
  Package name: `taskforce-loop-engineering`
4
- Version: `0.15.16`
4
+ Version: `0.15.18`
5
5
 
6
6
  Install from npm:
7
7