taskforce-loop-engineering 0.15.17 → 0.15.19

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,18 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.15.19 - 2026-09-19
6
+
7
+ - Recover OpenClaw dispatcher launches rejected during Gateway restart drain by rotating the runtime session and requeueing the task.
8
+ - Match only explicit restart-admission signatures on non-zero exits, leaving unrelated HTTP 503 responses and successful diagnostic text untouched.
9
+
10
+ ## 0.15.18 - 2026-09-18
11
+
12
+ - Recover non-zero dispatcher runs that report OpenClaw's missing user-visible-answer prompt by rotating the runtime session and requeueing the task.
13
+ - Preserve structured `incomplete_turn` and abandoned-liveness recovery even when a dispatcher wrapper exits successfully.
14
+ - Prevent successful recovered turns or ordinary task text that quotes the prompt from being misclassified and replayed.
15
+ - Add regression coverage for both recoverable failure and successful-output false-positive cases.
16
+
5
17
  ## 0.15.17 - 2026-09-13
6
18
 
7
19
  - Stop OpenClaw doctor and disposable smoke probes from attaching the synthetic `doctor` account to dry-run notifications.
package/lib/core.mjs CHANGED
@@ -9009,6 +9009,19 @@ 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 },
9018
+ // OpenClaw closes websocket admission while the Gateway drains for a
9019
+ // restart. A worker launched inside that short window receives HTTP 503
9020
+ // before task execution begins. Exact non-zero admission/drain signatures
9021
+ // are runtime interruptions, not development failures.
9022
+ { category: 'gateway_restart', pattern: 'gateway websocket admission closed', nonZeroOnly: true },
9023
+ { category: 'gateway_restart', pattern: 'gateway is draining for restart', nonZeroOnly: true },
9024
+ { category: 'gateway_restart', pattern: 'unavailable during gateway restart', nonZeroOnly: true },
9012
9025
  { category: 'compaction_timeout', pattern: 'compaction timed out' },
9013
9026
  { category: 'compaction_timeout', pattern: 'transcript compaction failed' },
9014
9027
  { category: 'transport_error', pattern: 'connection reset' },
@@ -9030,7 +9043,12 @@ export function dispatchFailureClassification(result, retry = {}) {
9030
9043
  // exitCode=0 or the queue may accept partial work and replay a stale gate.
9031
9044
  const output = `${result.stderr ?? ''}\n${result.stdout ?? ''}`.toLowerCase();
9032
9045
  const runtimePatterns = retry.recoverableRuntimePatterns ?? DEFAULT_RECOVERABLE_RUNTIME_PATTERNS;
9033
- const runtimeMatch = runtimePatterns.find((entry) => output.includes(String(entry.pattern ?? entry).toLowerCase()));
9046
+ const runtimeMatch = runtimePatterns.find((entry) => {
9047
+ const pattern = typeof entry === 'string' ? entry : entry.pattern;
9048
+ const nonZeroOnly = typeof entry === 'object' && entry !== null && entry.nonZeroOnly === true;
9049
+ return (!nonZeroOnly || result.exitCode !== 0)
9050
+ && output.includes(String(pattern ?? entry).toLowerCase());
9051
+ });
9034
9052
  if (runtimeMatch) {
9035
9053
  return {
9036
9054
  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.17",
3
+ "version": "0.15.19",
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,125 @@ 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 worker started while OpenClaw is draining for a Gateway restart exits
112
+ // before task execution. It must use runtime recovery instead of becoming a
113
+ // development failure.
114
+ const classification = dispatchFailureClassification({
115
+ exitCode: 1,
116
+ timedOut: false,
117
+ stderr: '[openclaw] Could not start the CLI.\nReason: gateway rejected websocket upgrade (HTTP 503): Gateway websocket admission closed',
118
+ stdout: ''
119
+ });
120
+ assert.equal(classification.category, 'gateway_restart');
121
+ assert.equal(classification.recoverableRuntime, true);
122
+ assert.equal(classification.requiresHumanAction, false);
123
+ }
124
+
125
+ {
126
+ // Unrelated HTTP 503 responses do not prove a Gateway restart.
127
+ const classification = dispatchFailureClassification({
128
+ exitCode: 1,
129
+ timedOut: false,
130
+ stderr: 'upstream returned HTTP 503',
131
+ stdout: ''
132
+ });
133
+ assert.equal(classification.category, 'retryable_failure');
134
+ assert.equal(classification.recoverableRuntime, false);
135
+ }
136
+
137
+ {
138
+ // Successful task output may quote the diagnostic without being replayed.
139
+ const classification = dispatchFailureClassification({
140
+ exitCode: 0,
141
+ timedOut: false,
142
+ stderr: '',
143
+ stdout: 'Documented diagnostic: Gateway websocket admission closed'
144
+ });
145
+ assert.equal(classification.category, 'ok');
146
+ assert.equal(classification.recoverableRuntime, undefined);
147
+ }
148
+
149
+ {
150
+ // A recovered turn may retain the earlier recovery prompt in its result.
151
+ // Once the wrapper exits successfully with a real visible answer, the weak
152
+ // natural-language signature must not override the successful outcome.
153
+ const classification = dispatchFailureClassification({
154
+ exitCode: 0,
155
+ timedOut: false,
156
+ stderr: '',
157
+ stdout: JSON.stringify({
158
+ 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.',
159
+ finalAssistantVisibleText: 'Recovery completed successfully; the final result is ready.',
160
+ finalAssistantRawText: 'Recovery completed successfully; the final result is ready.',
161
+ replayInvalid: false,
162
+ livenessState: 'working',
163
+ completion: { stopReason: 'stop', finishReason: 'stop' }
164
+ }, null, 2)
165
+ });
166
+ assert.equal(classification.category, 'ok');
167
+ assert.equal(classification.recoverableRuntime, undefined);
168
+ }
169
+
170
+ {
171
+ // Successful tasks can legitimately discuss the OpenClaw diagnostic text.
172
+ // Quoting it in task content must not turn a successful dispatch into a
173
+ // recoverable runtime interruption.
174
+ const classification = dispatchFailureClassification({
175
+ exitCode: 0,
176
+ timedOut: false,
177
+ stderr: '',
178
+ stdout: JSON.stringify({
179
+ taskBody: 'Review the diagnostic text "did not produce a user-visible answer" and propose a regression test.',
180
+ finalAssistantVisibleText: 'The review is complete and the regression test is documented.',
181
+ completion: { stopReason: 'stop', finishReason: 'stop' }
182
+ }, null, 2)
183
+ });
184
+ assert.equal(classification.category, 'ok');
185
+ assert.equal(classification.recoverableRuntime, undefined);
186
+ }
187
+
69
188
  {
70
189
  const classification = dispatchFailureClassification({
71
190
  exitCode: 0,
@@ -1,7 +1,7 @@
1
1
  # npm Package
2
2
 
3
3
  Package name: `taskforce-loop-engineering`
4
- Version: `0.15.17`
4
+ Version: `0.15.19`
5
5
 
6
6
  Install from npm:
7
7