taskforce-loop-engineering 0.16.1 → 0.16.2
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 +7 -0
- package/README.md +12 -0
- package/lib/openclaw-diagnostic-source.mjs +71 -0
- package/package.json +2 -2
- package/scripts/openclaw-diagnostic-source-self-test.mjs +27 -0
- package/scripts/openclaw-doctor.mjs +27 -8
- package/scripts/openclaw-install-self-test.mjs +111 -3
- package/scripts/openclaw-smoke.mjs +14 -5
- package/skills/taskforce-loop-engineering/SKILL.md +6 -0
- package/skills/taskforce-loop-engineering/references/npm-package.md +8 -1
- package/skills/taskforce-loop-engineering/references/openclaw-diagnostics.md +93 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.16.2 - 2026-10-24
|
|
6
|
+
|
|
7
|
+
- Discover OpenClaw diagnostic channel/account pairs from the selected CLI, with explicit source channel, account and target filters. Doctor covers all matching accounts; smoke covers one source per run.
|
|
8
|
+
- Fail closed on malformed account inventories, missing installation records, executable mismatch and managed notifier/dispatcher drift.
|
|
9
|
+
- Preserve the installed CLI invocation for profile-sensitive wrappers and isolate inherited human-input/notification sources in diagnostic subprocesses, preventing wrong-route false positives without changing production notification precedence.
|
|
10
|
+
- Add Feishu, Telegram and Slack regression coverage with actual CLI/source/dry-run assertions; synchronize distributed skill instructions and acceptance boundaries. Dry-run diagnostics do not prove real message delivery, and publishing does not upgrade existing integrations.
|
|
11
|
+
|
|
5
12
|
## 0.16.1 - 2026-10-23
|
|
6
13
|
|
|
7
14
|
- Restrict terminal-lock governance exemptions to accepted, gate-free later reviews. A `needs_human_acceptance` project label no longer hides current blockers or failed acceptance; protect ordinary retries and context recovery with terminal-checkpoint regressions through both core and installed mock dispatchers.
|
package/README.md
CHANGED
|
@@ -1423,3 +1423,15 @@ https://clawhub.ai/ambitioncn/skills/taskforce-loop-engineering
|
|
|
1423
1423
|
# P2 multi-agent control plane
|
|
1424
1424
|
|
|
1425
1425
|
Loop Engineering includes typed executable todos with capability/authority-aware atomic claim, lease and fencing, deterministic dependency/quota scheduling, durable peer handoff, orphan recovery, and P0/P1 safety integration. See [docs/multi-agent-control-plane.md](docs/multi-agent-control-plane.md) for the data contract, CLI, and migration path.
|
|
1426
|
+
|
|
1427
|
+
### Multi-IM diagnostic probes
|
|
1428
|
+
|
|
1429
|
+
OpenClaw doctor discovers channels/accounts using `openclaw channels list --json`
|
|
1430
|
+
in the selected CLI/profile environment and dry-runs each configured account. It
|
|
1431
|
+
does not assume Feishu. Smoke uses the first successfully checked source; choose
|
|
1432
|
+
a specific route with `--source-channel telegram --source-account personal`. Both
|
|
1433
|
+
commands accept `--source-target` for channel plugins requiring a special target
|
|
1434
|
+
format. Targets are synthetic by default and notification probes always use
|
|
1435
|
+
dry-run; success does not prove real delivery. Missing/invalid inventories and
|
|
1436
|
+
unmatched explicit selections fail rather than silently falling back to Feishu.
|
|
1437
|
+
Smoke still executes a real isolated worker task and cleans its temporary queue.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { access, readFile, realpath } from 'node:fs/promises';
|
|
2
|
+
import { constants } from 'node:fs';
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
|
|
6
|
+
async function executableIdentity(command, root) {
|
|
7
|
+
if (typeof command !== 'string' || !command.trim()) throw new Error('Missing OpenClaw executable');
|
|
8
|
+
const candidates = command.includes(path.sep)
|
|
9
|
+
? [path.resolve(root, command)]
|
|
10
|
+
: String(process.env.PATH || '').split(path.delimiter).map((dir) => path.resolve(root, dir, command));
|
|
11
|
+
for (const candidate of candidates) {
|
|
12
|
+
try { await access(candidate, constants.X_OK); return await realpath(candidate); } catch { /* try next PATH entry */ }
|
|
13
|
+
}
|
|
14
|
+
throw new Error('Cannot resolve OpenClaw executable');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Bind discovery to the recorded installation and its unchanged generated callers.
|
|
18
|
+
export async function verifyDiagnosticRuntime(args) {
|
|
19
|
+
const manifest = JSON.parse(await readFile(path.join(args.root, 'runtime/loop-engineering-openclaw-install.json'), 'utf8'));
|
|
20
|
+
if (manifest.status !== 'installed') throw new Error('OpenClaw installation is incomplete');
|
|
21
|
+
const selected = await executableIdentity(args.openclawBin, args.root);
|
|
22
|
+
const installed = await executableIdentity(manifest.openclawBin, args.root);
|
|
23
|
+
if (selected !== installed) throw new Error('Diagnostic OpenClaw CLI differs from installed CLI; select the installed executable or explicitly repair the integration');
|
|
24
|
+
for (const file of ['scripts/loops/openclaw-loop-notify.mjs', 'scripts/loops/openclaw-loop-dispatch.mjs']) {
|
|
25
|
+
const entry = manifest.managedFiles?.find((item) => item.path === file);
|
|
26
|
+
const content = await readFile(path.join(args.root, file));
|
|
27
|
+
if (!entry?.sha256 || createHash('sha256').update(content).digest('hex') !== entry.sha256) {
|
|
28
|
+
throw new Error('Installed notifier/dispatcher differs from install manifest; repair the integration before diagnostics');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// Preserve the recorded invocation name: symlink names can select profiles.
|
|
32
|
+
return manifest.openclawBin;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Discover through the selected CLI/profile; never read or print channel credentials.
|
|
36
|
+
export async function diagnosticSources(args, run) {
|
|
37
|
+
const result = await run(args.openclawBin, ['channels', 'list', '--json'], { cwd: args.root });
|
|
38
|
+
if (result.code !== 0) throw new Error('Cannot discover OpenClaw channels for this profile');
|
|
39
|
+
let chat;
|
|
40
|
+
try { chat = JSON.parse(result.stdout).chat; } catch { throw new Error('Invalid OpenClaw channels JSON'); }
|
|
41
|
+
if (!chat || typeof chat !== 'object' || Array.isArray(chat)) throw new Error('Missing OpenClaw chat channel inventory');
|
|
42
|
+
const sources = [];
|
|
43
|
+
for (const [channel, entry] of Object.entries(chat)) {
|
|
44
|
+
if (args.sourceChannel && channel !== args.sourceChannel) continue;
|
|
45
|
+
const accounts = Array.isArray(entry) ? entry : entry?.accounts;
|
|
46
|
+
if (!channel.trim() || !Array.isArray(accounts)) throw new Error('Malformed OpenClaw channel account list');
|
|
47
|
+
for (const account of accounts) {
|
|
48
|
+
if (typeof account !== 'string' || !account.trim()) throw new Error('Malformed OpenClaw account entry');
|
|
49
|
+
if (args.sourceAccount && account !== args.sourceAccount) continue;
|
|
50
|
+
sources.push({ channel, account, target: args.sourceTarget || diagnosticTarget(channel), reply_to: '1' });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (!sources.length) throw new Error('No matching configured IM channel/account; check the selected OpenClaw profile or --source-channel/--source-account');
|
|
54
|
+
return sources;
|
|
55
|
+
}
|
|
56
|
+
function diagnosticTarget(channel) {
|
|
57
|
+
if (channel === 'telegram') return '1';
|
|
58
|
+
if (channel === 'discord') return 'channel:100000000000000001';
|
|
59
|
+
if (channel === 'slack') return 'channel:C00000000000';
|
|
60
|
+
if (channel === 'whatsapp' || channel === 'signal') return '+12025550100';
|
|
61
|
+
if (channel === 'feishu') return 'user:loop-diagnostic-dry-run';
|
|
62
|
+
return 'loop-diagnostic-dry-run';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Diagnostic subprocesses must not inherit a stale higher-precedence route.
|
|
66
|
+
export function diagnosticEnvironment(env = process.env) {
|
|
67
|
+
const clean = { ...env };
|
|
68
|
+
delete clean.LOOP_HUMAN_INPUT_SOURCE;
|
|
69
|
+
delete clean.LOOP_NOTIFICATION_SOURCE;
|
|
70
|
+
return clean;
|
|
71
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taskforce-loop-engineering",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "OpenClaw-native loop engineering CLI, templates, and skill for verifiable agent work loops.",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"demo:adapter": "node examples/adapter-sdk-demo.mjs",
|
|
27
27
|
"check:production-trust": "node --check lib/runtime-adapter-v1.mjs && node --check lib/durable-journal.mjs && node --check lib/execution-ledger.mjs && node --check lib/production-evidence.mjs && node --check lib/upgrade-planner.mjs && node scripts/production-acceptance.mjs",
|
|
28
28
|
"check:config-drift": "node scripts/distribution-skill-self-test.mjs && node --check scripts/config-drift-self-test.mjs && node scripts/config-drift-self-test.mjs",
|
|
29
|
-
"check:openclaw-install": "node --check scripts/openclaw-install.mjs && node --check scripts/openclaw-doctor.mjs && node --check scripts/openclaw-smoke.mjs && node --check scripts/openclaw-manage.mjs && node scripts/openclaw-install-self-test.mjs",
|
|
29
|
+
"check:openclaw-install": "node --check scripts/openclaw-install.mjs && node --check scripts/openclaw-doctor.mjs && node --check scripts/openclaw-smoke.mjs && node --check scripts/openclaw-manage.mjs && node scripts/openclaw-install-self-test.mjs && node scripts/openclaw-diagnostic-source-self-test.mjs && DIAGNOSTIC_TEST_CHANNEL=telegram node scripts/openclaw-install-self-test.mjs && DIAGNOSTIC_TEST_CHANNEL=slack node scripts/openclaw-install-self-test.mjs",
|
|
30
30
|
"check:hermes-install": "node --check scripts/hermes-install.mjs && node --check scripts/hermes-doctor.mjs && node --check scripts/hermes-smoke.mjs && node scripts/hermes-install-self-test.mjs",
|
|
31
31
|
"check:project-gates": "node --check lib/core.mjs && node scripts/project-gate-reconciliation-self-test.mjs && node scripts/project-relay-self-test.mjs",
|
|
32
32
|
"check:human-gates": "node --check lib/human-gate-command.mjs && node --check lib/human-gate-channel-adapter.mjs && node scripts/human-gate-command-self-test.mjs && node scripts/human-gate-final-judgement.mjs",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { diagnosticSources } from '../lib/openclaw-diagnostic-source.mjs';
|
|
3
|
+
const args = { root: '/tmp', openclawBin: 'profile-cli' };
|
|
4
|
+
const inventory = { telegram: ['personal'], feishu: { accounts: ['main', 'other'] }, slack: { accounts: ['team'] }, discord: [], signal: { accounts: ['phone'] } };
|
|
5
|
+
const run = async (bin, argv) => {
|
|
6
|
+
assert.equal(bin, 'profile-cli');
|
|
7
|
+
assert.deepEqual(argv, ['channels', 'list', '--json']);
|
|
8
|
+
return { code: 0, stdout: JSON.stringify({ chat: inventory }) };
|
|
9
|
+
};
|
|
10
|
+
assert.equal((await diagnosticSources(args, run)).length, 5);
|
|
11
|
+
assert.deepEqual(await diagnosticSources({ ...args, sourceChannel: 'telegram' }, run), [{ channel: 'telegram', account: 'personal', target: '1', reply_to: '1' }]);
|
|
12
|
+
assert.equal((await diagnosticSources({ ...args, sourceAccount: 'other', sourceTarget: 'custom-target' }, run))[0].target, 'custom-target');
|
|
13
|
+
for (const selection of [{ sourceChannel: 'absent' }, { sourceAccount: 'missing' }]) await assert.rejects(diagnosticSources({ ...args, ...selection }, run), /No matching/);
|
|
14
|
+
for (const result of [{ code: 1 }, { code: 0, stdout: 'not json' }, { code: 0, stdout: '{}' }, { code: 0, stdout: '{"chat":{}}' }]) await assert.rejects(diagnosticSources(args, async () => result));
|
|
15
|
+
console.log('diagnostic source selection: passed');
|
|
16
|
+
|
|
17
|
+
for (const broken of [null, {}, 'accounts', { accounts: 'bad' }, ['personal', 42], ['personal', ''], ['personal', ' '], ['personal', null]]) {
|
|
18
|
+
const mixed = async () => ({ code: 0, stdout: JSON.stringify({ chat: { telegram: ['personal'], slack: broken } }) });
|
|
19
|
+
await assert.rejects(diagnosticSources(args, mixed), /Malformed/);
|
|
20
|
+
await assert.rejects(diagnosticSources({ ...args, sourceAccount: 'personal' }, mixed), /Malformed/);
|
|
21
|
+
assert.equal((await diagnosticSources({ ...args, sourceChannel: 'telegram' }, mixed)).length, 1);
|
|
22
|
+
await assert.rejects(diagnosticSources({ ...args, sourceChannel: 'slack' }, mixed), /Malformed/);
|
|
23
|
+
}
|
|
24
|
+
const empty = async () => ({ code: 0, stdout: JSON.stringify({ chat: { telegram: ['personal'], slack: [] } }) });
|
|
25
|
+
assert.equal((await diagnosticSources(args, empty)).length, 1);
|
|
26
|
+
await assert.rejects(diagnosticSources({ ...args, sourceChannel: 'slack' }, empty), /No matching/);
|
|
27
|
+
console.log('mixed-validity inventory regression: passed');
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { access, readFile } from 'node:fs/promises';
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
+
import { diagnosticSources, verifyDiagnosticRuntime, diagnosticEnvironment } from '../lib/openclaw-diagnostic-source.mjs';
|
|
5
6
|
|
|
6
7
|
function parseArgs(argv) {
|
|
7
8
|
const out = { root: process.cwd(), queue: 'agent-tasks', workerAgent: 'main', openclawBin: 'openclaw', json: false };
|
|
@@ -11,6 +12,12 @@ function parseArgs(argv) {
|
|
|
11
12
|
else if (arg === '--queue') out.queue = argv[++i];
|
|
12
13
|
else if (arg === '--worker-agent') out.workerAgent = argv[++i];
|
|
13
14
|
else if (arg === '--openclaw-bin') out.openclawBin = argv[++i];
|
|
15
|
+
else if (['--source-channel', '--source-account', '--source-target'].includes(arg)) {
|
|
16
|
+
const key = { '--source-channel': 'sourceChannel', '--source-account': 'sourceAccount', '--source-target': 'sourceTarget' }[arg];
|
|
17
|
+
const value = argv[++i];
|
|
18
|
+
if (!value || value.startsWith('--')) throw new Error(`Missing value for ${arg}`);
|
|
19
|
+
out[key] = value;
|
|
20
|
+
}
|
|
14
21
|
else if (arg === '--json') out.json = true;
|
|
15
22
|
else if (arg === '--help' || arg === '-h') out.help = true;
|
|
16
23
|
else throw new Error(`Unknown argument: ${arg}`);
|
|
@@ -34,7 +41,7 @@ async function present(file) { try { await access(file); return true; } catch {
|
|
|
34
41
|
async function main() {
|
|
35
42
|
const args = parseArgs(process.argv.slice(2));
|
|
36
43
|
if (args.help) {
|
|
37
|
-
console.log('Usage: loop-engineering-openclaw-doctor [--root workspace] [--queue agent-tasks] [--worker-agent main] [--openclaw-bin openclaw] [--json]');
|
|
44
|
+
console.log('Usage: loop-engineering-openclaw-doctor [--root workspace] [--queue agent-tasks] [--worker-agent main] [--openclaw-bin openclaw] [--source-channel channel] [--source-account account] [--source-target dry-run-target] [--json]');
|
|
38
45
|
return;
|
|
39
46
|
}
|
|
40
47
|
const required = [
|
|
@@ -53,6 +60,13 @@ async function main() {
|
|
|
53
60
|
);
|
|
54
61
|
const checks = [];
|
|
55
62
|
for (const relative of required) checks.push({ id: `file:${relative}`, ok: await present(path.join(args.root, relative)) });
|
|
63
|
+
let runtimeVerified = false;
|
|
64
|
+
try {
|
|
65
|
+
const executable = await verifyDiagnosticRuntime(args);
|
|
66
|
+
args.openclawBin = executable;
|
|
67
|
+
runtimeVerified = true;
|
|
68
|
+
checks.push({ id: 'diagnostic_runtime', ok: true, detail: executable });
|
|
69
|
+
} catch (error) { checks.push({ id: 'diagnostic_runtime', ok: false, detail: error.message }); }
|
|
56
70
|
const cli = await run(args.openclawBin, ['--version'], { cwd: args.root });
|
|
57
71
|
checks.push({ id: 'openclaw_cli', ok: cli.code === 0, detail: (cli.stdout || cli.stderr).trim().slice(0, 300) });
|
|
58
72
|
const agentsResult = await run(args.openclawBin, ['agents', 'list', '--json'], { cwd: args.root });
|
|
@@ -67,12 +81,17 @@ async function main() {
|
|
|
67
81
|
} catch (error) { checks.push({ id: 'queue_config', ok: false, detail: error.message }); }
|
|
68
82
|
}
|
|
69
83
|
const notifier = path.join(args.root, 'scripts/loops/openclaw-loop-notify.mjs');
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
84
|
+
let notificationSources = [];
|
|
85
|
+
try { if (runtimeVerified) notificationSources = await diagnosticSources(args, run); }
|
|
86
|
+
catch (error) { checks.push({ id: 'notification_channels', ok: false, detail: error.message }); }
|
|
87
|
+
if (runtimeVerified && await present(notifier)) {
|
|
88
|
+
for (const source of notificationSources) {
|
|
89
|
+
const smoke = await run(process.execPath, [notifier, 'Loop Engineering notification dry-run'], {
|
|
90
|
+
cwd: args.root,
|
|
91
|
+
env: { ...diagnosticEnvironment(), LOOP_NOTIFICATION_DRY_RUN: '1', LOOP_NOTIFICATION_SOURCE: JSON.stringify(source) }
|
|
92
|
+
});
|
|
93
|
+
checks.push({ id: 'notification_dry_run', channel: source.channel, account: source.account, ok: smoke.code === 0, detail: (smoke.stdout || smoke.stderr).trim().slice(0, 500) });
|
|
94
|
+
}
|
|
76
95
|
}
|
|
77
96
|
const gateBridge = path.join(args.root, 'scripts/loops/openclaw-loop-gate.mjs');
|
|
78
97
|
if (await present(gateBridge)) {
|
|
@@ -82,7 +101,7 @@ async function main() {
|
|
|
82
101
|
checks.push({ id: 'human_gate_bridge_self_test', ok: selfTest.code === 0 && /"externalWrite":false/.test(selfTest.stdout), detail: (selfTest.stdout || selfTest.stderr).trim().slice(0, 500) });
|
|
83
102
|
}
|
|
84
103
|
const failed = checks.filter((check) => !check.ok);
|
|
85
|
-
const report = { version: 1, status: failed.length ? 'fail' : 'ok', readOnly: true, externalWrite: false, root: args.root, queue: args.queue, workerAgent: args.workerAgent, checks, failed: failed.map((check) => check.id) };
|
|
104
|
+
const report = { version: 1, status: failed.length ? 'fail' : 'ok', readOnly: true, externalWrite: false, root: args.root, queue: args.queue, workerAgent: args.workerAgent, notificationSources, checks, failed: failed.map((check) => check.id) };
|
|
86
105
|
console.log(args.json ? JSON.stringify(report, null, 2) : `OpenClaw Loop doctor: ${report.status}\nchecks: ${checks.length - failed.length}/${checks.length}\nfailed: ${report.failed.join(', ') || 'none'}`);
|
|
87
106
|
if (failed.length) process.exitCode = 1;
|
|
88
107
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { chmod, mkdtemp, readFile, readdir, rm, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { chmod, mkdtemp, readFile, readdir, rm, writeFile, symlink } from 'node:fs/promises';
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
import { tmpdir } from 'node:os';
|
|
5
5
|
import path from 'node:path';
|
|
@@ -14,14 +14,22 @@ const systemctlCapture = path.join(root, 'systemctl-calls.jsonl');
|
|
|
14
14
|
process.env.XDG_CONFIG_HOME = path.join(root, 'xdg');
|
|
15
15
|
process.env.SYSTEMCTL_CAPTURE = systemctlCapture;
|
|
16
16
|
await writeFile(mockOpenClaw, `#!/usr/bin/env node
|
|
17
|
-
import { mkdir, writeFile } from 'node:fs/promises';
|
|
17
|
+
import { mkdir, writeFile, appendFile } from 'node:fs/promises';
|
|
18
18
|
import path from 'node:path';
|
|
19
19
|
const args = process.argv.slice(2);
|
|
20
|
+
if (process.env.DIAGNOSTIC_CALLS) await appendFile(process.env.DIAGNOSTIC_CALLS, JSON.stringify({ invocation: process.env.TEST_INVOKED_AS, args }) + '\\n');
|
|
20
21
|
if (args.includes('--account') && args[args.indexOf('--account') + 1] === 'doctor') {
|
|
21
22
|
console.error('Unknown account: doctor');
|
|
22
23
|
process.exit(1);
|
|
23
24
|
}
|
|
25
|
+
if (args[0] === 'message' && process.env.TEST_IM_CHANNEL) {
|
|
26
|
+
const value = (flag) => args[args.indexOf(flag) + 1];
|
|
27
|
+
if (!args.includes('--dry-run') || value('--channel') !== process.env.TEST_IM_CHANNEL || value('--account') !== (process.env.TEST_IM_ACCOUNT || 'main')) {
|
|
28
|
+
console.error('Wrong channel/account or unsafe notification'); process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
24
31
|
if (args[0] === '--version') console.log('OpenClaw mock 1.0');
|
|
32
|
+
else if (args[0] === 'channels' && args[1] === 'list') console.log(process.env.TEST_BROKEN_INVENTORY || JSON.stringify({ chat: { [process.env.TEST_IM_CHANNEL || 'feishu']: [process.env.TEST_IM_ACCOUNT || 'main'] } }));
|
|
25
33
|
else if (args[0] === 'agents' && args[1] === 'list') console.log(JSON.stringify([{ id: 'builder' }]));
|
|
26
34
|
else {
|
|
27
35
|
if (args[0] === 'agent' && process.env.LOOP_CHECKPOINTS_DIR) {
|
|
@@ -236,6 +244,8 @@ const deliveredArgs = JSON.parse(await readFile(deliveryCapture, 'utf8'));
|
|
|
236
244
|
for (const expected of ['message', 'send', '--channel', 'slack', '--target', 'channel:C123', '--account', 'work', '--reply-to', 'M456', 'async result']) {
|
|
237
245
|
if (!deliveredArgs.includes(expected)) throw new Error(`notifier did not forward ${expected}`);
|
|
238
246
|
}
|
|
247
|
+
process.env.TEST_IM_CHANNEL = process.env.DIAGNOSTIC_TEST_CHANNEL || 'feishu';
|
|
248
|
+
process.env.TEST_IM_ACCOUNT = 'diagnostic-account';
|
|
239
249
|
const doctor = new URL('./openclaw-doctor.mjs', import.meta.url).pathname;
|
|
240
250
|
const doctorResult = await new Promise((resolve) => {
|
|
241
251
|
const child = spawn(process.execPath, [doctor, '--root', root, '--queue', 'test-tasks', '--worker-agent', 'builder', '--openclaw-bin', mockOpenClaw, '--json'], { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
@@ -249,6 +259,98 @@ const doctorReport = JSON.parse(doctorResult.stdout);
|
|
|
249
259
|
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');
|
|
250
260
|
if (JSON.parse(await readFile(deliveryCapture, 'utf8')).includes('doctor')) throw new Error('doctor notification forwarded a synthetic account');
|
|
251
261
|
const smoke = new URL('./openclaw-smoke.mjs', import.meta.url).pathname;
|
|
262
|
+
|
|
263
|
+
// Different executable, same reported version/inventory: never probe installed A
|
|
264
|
+
// after discovering B, and never let smoke dispatch a worker after this failure.
|
|
265
|
+
async function diagnosticRun(script, executable, extraEnv = {}) {
|
|
266
|
+
return new Promise((resolve) => {
|
|
267
|
+
const child = spawn(process.execPath, [script, '--root', root, '--queue', 'test-tasks', '--worker-agent', 'builder', '--openclaw-bin', executable, '--json'], { env: { ...process.env, ...extraEnv }, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
268
|
+
let stdout = ''; let stderr = '';
|
|
269
|
+
child.stdout.on('data', (chunk) => { stdout += chunk; });
|
|
270
|
+
child.stderr.on('data', (chunk) => { stderr += chunk; });
|
|
271
|
+
child.on('close', (code) => resolve({ code, stdout, stderr }));
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
const alternate = path.join(root, 'alternate-openclaw.mjs');
|
|
275
|
+
await writeFile(alternate, await readFile(mockOpenClaw));
|
|
276
|
+
await chmod(alternate, 0o755);
|
|
277
|
+
const deliveryBefore = await readFile(deliveryCapture, 'utf8');
|
|
278
|
+
const mismatch = await diagnosticRun(doctor, alternate);
|
|
279
|
+
assert.equal(mismatch.code, 1);
|
|
280
|
+
assert.ok(JSON.parse(mismatch.stdout).failed.includes('diagnostic_runtime'));
|
|
281
|
+
assert.ok(!JSON.parse(mismatch.stdout).checks.some((check) => check.id === 'notification_dry_run'));
|
|
282
|
+
const mismatchSmoke = await diagnosticRun(smoke, alternate);
|
|
283
|
+
assert.equal(mismatchSmoke.code, 1);
|
|
284
|
+
assert.match(mismatchSmoke.stderr, /diagnostic_runtime/);
|
|
285
|
+
assert.equal(await readFile(deliveryCapture, 'utf8'), deliveryBefore);
|
|
286
|
+
assert.ok(!(await readdir(path.join(root, 'configs/loops/queues'))).some((name) => name.startsWith('smoke-')));
|
|
287
|
+
// PATH and symlink aliases of the same runtime remain valid.
|
|
288
|
+
const alias = path.join(root, 'alias-openclaw');
|
|
289
|
+
await symlink(mockOpenClaw, alias);
|
|
290
|
+
assert.equal((await diagnosticRun(doctor, alias)).code, 0);
|
|
291
|
+
assert.equal((await diagnosticRun(doctor, path.basename(mockOpenClaw), { PATH: root + path.delimiter + process.env.PATH })).code, 0);
|
|
292
|
+
// Conflicting inherited sources must never override any reported route.
|
|
293
|
+
const callsFile = path.join(root, 'diagnostic-calls.jsonl');
|
|
294
|
+
const staleEnv = {
|
|
295
|
+
LOOP_HUMAN_INPUT_SOURCE: JSON.stringify({ channel: 'feishu', account: 'stale', target: 'user:stale' }),
|
|
296
|
+
LOOP_NOTIFICATION_SOURCE: JSON.stringify({ channel: 'slack', account: 'stale', target: 'channel:stale' }),
|
|
297
|
+
DIAGNOSTIC_CALLS: callsFile
|
|
298
|
+
};
|
|
299
|
+
async function capturedCalls() {
|
|
300
|
+
return (await readFile(callsFile, 'utf8')).trim().split('\n').filter(Boolean).map((line) => JSON.parse(line));
|
|
301
|
+
}
|
|
302
|
+
function assertRoutes(calls, sources) {
|
|
303
|
+
const messages = calls.filter((call) => call.args[0] === 'message');
|
|
304
|
+
assert.equal(messages.length, sources.length);
|
|
305
|
+
messages.forEach(({ args }, index) => {
|
|
306
|
+
const value = (flag) => args[args.indexOf(flag) + 1];
|
|
307
|
+
assert.ok(args.includes('--dry-run'));
|
|
308
|
+
assert.equal(value('--channel'), sources[index].channel);
|
|
309
|
+
assert.equal(value('--account'), sources[index].account);
|
|
310
|
+
assert.equal(value('--target'), sources[index].target);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
await writeFile(callsFile, '');
|
|
314
|
+
const multi = await diagnosticRun(doctor, mockOpenClaw, { ...staleEnv, TEST_IM_CHANNEL: '', TEST_BROKEN_INVENTORY: JSON.stringify({ chat: { telegram: ['one', 'two'], slack: { accounts: ['team'] } } }) });
|
|
315
|
+
assert.equal(multi.code, 0, multi.stderr);
|
|
316
|
+
assertRoutes(await capturedCalls(), JSON.parse(multi.stdout).notificationSources);
|
|
317
|
+
|
|
318
|
+
// A shared shell wrapper selects its profile from $0 (not realpath).
|
|
319
|
+
// Even when the caller supplies the B alias, all probes must use installed A.
|
|
320
|
+
const originalMock = await readFile(mockOpenClaw, 'utf8');
|
|
321
|
+
const backingMock = path.join(root, 'backing-mock.mjs');
|
|
322
|
+
await writeFile(backingMock, originalMock);
|
|
323
|
+
try {
|
|
324
|
+
await writeFile(mockOpenClaw, `#!/bin/sh
|
|
325
|
+
export TEST_INVOKED_AS="$0"
|
|
326
|
+
case "$0" in *alias-openclaw) export TEST_IM_CHANNEL=telegram TEST_IM_ACCOUNT=profile-b ;; esac
|
|
327
|
+
exec node "$(dirname "$0")/backing-mock.mjs" "$@"
|
|
328
|
+
`);
|
|
329
|
+
await writeFile(callsFile, '');
|
|
330
|
+
const profiled = await diagnosticRun(doctor, alias, staleEnv);
|
|
331
|
+
assert.equal(profiled.code, 0, profiled.stderr);
|
|
332
|
+
const report = JSON.parse(profiled.stdout);
|
|
333
|
+
assert.equal(report.notificationSources[0].channel, process.env.TEST_IM_CHANNEL);
|
|
334
|
+
const calls = await capturedCalls();
|
|
335
|
+
assert.ok(calls.some((call) => call.args[0] === 'channels'));
|
|
336
|
+
assert.ok(calls.every((call) => call.invocation === mockOpenClaw));
|
|
337
|
+
assertRoutes(calls, report.notificationSources);
|
|
338
|
+
} finally { await writeFile(mockOpenClaw, originalMock); }
|
|
339
|
+
// A stale/tampered generated caller must fail even if manifest CLI matches.
|
|
340
|
+
const notifierPath = path.join(root, 'scripts/loops/openclaw-loop-notify.mjs');
|
|
341
|
+
const notifierOriginal = await readFile(notifierPath, 'utf8');
|
|
342
|
+
try {
|
|
343
|
+
await writeFile(notifierPath, notifierOriginal.replace(JSON.stringify(mockOpenClaw), JSON.stringify(alternate)));
|
|
344
|
+
const drift = await diagnosticRun(doctor, mockOpenClaw);
|
|
345
|
+
assert.equal(drift.code, 1);
|
|
346
|
+
assert.ok(JSON.parse(drift.stdout).failed.includes('diagnostic_runtime'));
|
|
347
|
+
} finally { await writeFile(notifierPath, notifierOriginal); }
|
|
348
|
+
const brokenInventory = { TEST_BROKEN_INVENTORY: JSON.stringify({ chat: { [process.env.TEST_IM_CHANNEL]: ['diagnostic-account'], broken: { accounts: 'invalid' } } }) };
|
|
349
|
+
const malformed = await diagnosticRun(doctor, mockOpenClaw, brokenInventory);
|
|
350
|
+
assert.equal(malformed.code, 1);
|
|
351
|
+
assert.ok(JSON.parse(malformed.stdout).failed.includes('notification_channels'));
|
|
352
|
+
assert.equal((await diagnosticRun(smoke, mockOpenClaw, brokenInventory)).code, 1);
|
|
353
|
+
|
|
252
354
|
const smokeSource = await readFile(smoke, 'utf8');
|
|
253
355
|
if (!smokeSource.includes('Do not change user or project files, configuration, credentials, or external state.')
|
|
254
356
|
|| !smokeSource.includes('Writing the required Loop checkpoint and verification evidence under')
|
|
@@ -257,8 +359,9 @@ if (!smokeSource.includes('Do not change user or project files, configuration, c
|
|
|
257
359
|
throw new Error('OpenClaw smoke permission boundary or checkpoint requirement is missing');
|
|
258
360
|
}
|
|
259
361
|
const loopBin = new URL('../bin/loop-engineering.mjs', import.meta.url).pathname;
|
|
362
|
+
await writeFile(callsFile, '');
|
|
260
363
|
const smokeResult = await new Promise((resolve) => {
|
|
261
|
-
const child = spawn(process.execPath, [smoke, '--root', root, '--queue', 'test-tasks', '--worker-agent', 'builder', '--openclaw-bin', mockOpenClaw, '--loop-bin', loopBin, '--json'], { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
364
|
+
const child = spawn(process.execPath, [smoke, '--root', root, '--queue', 'test-tasks', '--worker-agent', 'builder', '--openclaw-bin', mockOpenClaw, '--loop-bin', loopBin, '--json'], { env: { ...process.env, ...staleEnv }, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
262
365
|
let stdout = ''; let stderr = '';
|
|
263
366
|
child.stdout.on('data', (chunk) => { stdout += chunk; });
|
|
264
367
|
child.stderr.on('data', (chunk) => { stderr += chunk; });
|
|
@@ -266,8 +369,13 @@ const smokeResult = await new Promise((resolve) => {
|
|
|
266
369
|
});
|
|
267
370
|
if (smokeResult.code !== 0) throw new Error(`smoke failed: ${smokeResult.stderr}`);
|
|
268
371
|
const smokeReport = JSON.parse(smokeResult.stdout);
|
|
372
|
+
assert.equal(smokeReport.notificationSource.channel, process.env.TEST_IM_CHANNEL);
|
|
373
|
+
assert.equal(smokeReport.notificationSource.account, 'diagnostic-account');
|
|
374
|
+
assertRoutes(await capturedCalls(), [smokeReport.notificationSource, smokeReport.notificationSource]);
|
|
269
375
|
if (smokeReport.status !== 'ok' || smokeReport.externalWrite !== false || !smokeReport.steps.every((step) => step.ok)) throw new Error('end-to-end smoke did not pass safely');
|
|
270
376
|
if (JSON.parse(await readFile(deliveryCapture, 'utf8')).includes('doctor')) throw new Error('smoke notification forwarded a synthetic account');
|
|
377
|
+
delete process.env.TEST_IM_CHANNEL;
|
|
378
|
+
delete process.env.TEST_IM_ACCOUNT;
|
|
271
379
|
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; }
|
|
272
380
|
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; }
|
|
273
381
|
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']) {
|
|
@@ -3,6 +3,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
3
3
|
import { access, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
4
4
|
import { spawn } from 'node:child_process';
|
|
5
5
|
import path from 'node:path';
|
|
6
|
+
import { diagnosticEnvironment } from '../lib/openclaw-diagnostic-source.mjs';
|
|
6
7
|
|
|
7
8
|
function parseArgs(argv) {
|
|
8
9
|
const out = { root: process.cwd(), queue: 'agent-tasks', workerAgent: 'main', openclawBin: 'openclaw', loopBin: 'loop-engineering', json: false, keepArtifacts: false };
|
|
@@ -14,6 +15,12 @@ function parseArgs(argv) {
|
|
|
14
15
|
else if (arg === '--openclaw-bin') out.openclawBin = argv[++i];
|
|
15
16
|
else if (arg === '--loop-bin') out.loopBin = argv[++i];
|
|
16
17
|
else if (arg === '--keep-artifacts') out.keepArtifacts = true;
|
|
18
|
+
else if (['--source-channel', '--source-account', '--source-target'].includes(arg)) {
|
|
19
|
+
const key = { '--source-channel': 'sourceChannel', '--source-account': 'sourceAccount', '--source-target': 'sourceTarget' }[arg];
|
|
20
|
+
const value = argv[++i];
|
|
21
|
+
if (!value || value.startsWith('--')) throw new Error(`Missing value for ${arg}`);
|
|
22
|
+
out[key] = value;
|
|
23
|
+
}
|
|
17
24
|
else if (arg === '--json') out.json = true;
|
|
18
25
|
else if (arg === '--help' || arg === '-h') out.help = true;
|
|
19
26
|
else throw new Error(`Unknown argument: ${arg}`);
|
|
@@ -23,7 +30,7 @@ function parseArgs(argv) {
|
|
|
23
30
|
|
|
24
31
|
function run(command, args, options = {}) {
|
|
25
32
|
return new Promise((resolve) => {
|
|
26
|
-
const child = spawn(command, args, { cwd: options.cwd, env: options.env || process.env, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
33
|
+
const child = spawn(command, args, { cwd: options.cwd, env: diagnosticEnvironment(options.env || process.env), stdio: ['ignore', 'pipe', 'pipe'] });
|
|
27
34
|
let stdout = ''; let stderr = '';
|
|
28
35
|
child.stdout.on('data', (chunk) => { stdout += chunk; });
|
|
29
36
|
child.stderr.on('data', (chunk) => { stderr += chunk; });
|
|
@@ -38,7 +45,7 @@ function safeId(value) { if (!/^[a-zA-Z0-9._-]+$/.test(value)) throw new Error('
|
|
|
38
45
|
async function main() {
|
|
39
46
|
const args = parseArgs(process.argv.slice(2));
|
|
40
47
|
if (args.help) {
|
|
41
|
-
console.log('Usage: loop-engineering-openclaw-smoke [--root workspace] [--queue agent-tasks] [--worker-agent main] [--openclaw-bin openclaw] [--loop-bin loop-engineering] [--keep-artifacts] [--json]');
|
|
48
|
+
console.log('Usage: loop-engineering-openclaw-smoke [--root workspace] [--queue agent-tasks] [--worker-agent main] [--openclaw-bin openclaw] [--loop-bin loop-engineering] [--keep-artifacts] [--source-channel channel] [--source-account account] [--source-target dry-run-target] [--json]');
|
|
42
49
|
return;
|
|
43
50
|
}
|
|
44
51
|
safeId(args.queue);
|
|
@@ -51,10 +58,12 @@ async function main() {
|
|
|
51
58
|
const steps = [];
|
|
52
59
|
let taskId = null;
|
|
53
60
|
try {
|
|
54
|
-
const doctor = await run(process.execPath, [doctorScript, '--root', args.root, '--queue', args.queue, '--worker-agent', args.workerAgent, '--openclaw-bin', args.openclawBin, '--json'], { cwd: args.root });
|
|
61
|
+
const doctor = await run(process.execPath, [doctorScript, '--root', args.root, '--queue', args.queue, '--worker-agent', args.workerAgent, '--openclaw-bin', args.openclawBin, ...['sourceChannel', 'sourceAccount', 'sourceTarget'].flatMap((key) => args[key] ? [{ sourceChannel: '--source-channel', sourceAccount: '--source-account', sourceTarget: '--source-target' }[key], args[key]] : []), '--json'], { cwd: args.root });
|
|
55
62
|
steps.push({ id: 'doctor', ok: doctor.code === 0 });
|
|
56
63
|
if (doctor.code !== 0) throw new Error(`doctor failed: ${doctor.stderr || doctor.stdout}`);
|
|
57
64
|
const doctorReport = JSON.parse(doctor.stdout);
|
|
65
|
+
const source = doctorReport.notificationSources?.[0];
|
|
66
|
+
if (!source) throw new Error('doctor did not resolve a configured notification source');
|
|
58
67
|
const gateSelfTestOk = doctorReport.checks?.some((check) => check.id === 'human_gate_bridge_self_test' && check.ok);
|
|
59
68
|
steps.push({ id: 'human_gate_bridge_self_test', ok: gateSelfTestOk === true });
|
|
60
69
|
if (!gateSelfTestOk) throw new Error('doctor did not verify the installed Human Gate bridge');
|
|
@@ -66,7 +75,7 @@ async function main() {
|
|
|
66
75
|
await writeFile(smokeConfig, `${JSON.stringify(config, null, 2)}\n`);
|
|
67
76
|
const smokeRuntimeRel = path.relative(args.root, smokeRuntime);
|
|
68
77
|
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.`;
|
|
69
|
-
const route = await run(args.loopBin, ['route-message', '--root', args.root, '--queue', smokeQueue, '--message', message, '--route', '--confirm-execute', '--source-channel',
|
|
78
|
+
const route = await run(args.loopBin, ['route-message', '--root', args.root, '--queue', smokeQueue, '--message', message, '--route', '--confirm-execute', '--source-channel', source.channel, '--source-target', source.target, '--source-account', source.account, '--source-message-id', `smoke-${runToken}`, '--source-reply-to', `smoke-${runToken}`, '--json'], { cwd: args.root });
|
|
70
79
|
steps.push({ id: 'route', ok: route.code === 0 });
|
|
71
80
|
if (route.code !== 0) throw new Error(`route failed: ${route.stderr || route.stdout}`);
|
|
72
81
|
const routed = JSON.parse(route.stdout);
|
|
@@ -89,7 +98,7 @@ async function main() {
|
|
|
89
98
|
const terminalOk = terminalNotify.code === 0 && terminal?.sent === 1;
|
|
90
99
|
steps.push({ id: 'terminal_dry_run_return', ok: terminalOk });
|
|
91
100
|
if (!terminalOk) throw new Error(`terminal dry-run failed: ${terminalNotify.stderr || terminalNotify.stdout}`);
|
|
92
|
-
const report = { version: 1, status: 'ok', readOnlyTask: true, externalWrite: false, queue: args.queue, smokeQueue, workerAgent: args.workerAgent, taskId, steps, keptArtifacts: args.keepArtifacts };
|
|
101
|
+
const report = { version: 1, status: 'ok', readOnlyTask: true, externalWrite: false, queue: args.queue, smokeQueue, workerAgent: args.workerAgent, notificationSource: source, taskId, steps, keptArtifacts: args.keepArtifacts };
|
|
93
102
|
console.log(args.json ? JSON.stringify(report, null, 2) : `OpenClaw Loop smoke: ok\ntask: ${taskId}\nexternal write: no\nartifacts: ${args.keepArtifacts ? smokeRuntime : 'cleaned'}`);
|
|
94
103
|
} finally {
|
|
95
104
|
if (!args.keepArtifacts) {
|
|
@@ -90,6 +90,12 @@ loop-engineering-openclaw-smoke \
|
|
|
90
90
|
|
|
91
91
|
If the CLI or integration is missing and the user requested installation or repair, install it within the authorized host/workspace scope, then run doctor and the disposable smoke. If the user only asked what is missing, report the exact package, repository, commands, and current deployment state without mutating the system.
|
|
92
92
|
|
|
93
|
+
### Multi-IM Diagnostic Acceptance
|
|
94
|
+
|
|
95
|
+
Before OpenClaw doctor/smoke, follow [the multi-IM diagnostic procedure](references/openclaw-diagnostics.md): select the correct CLI/profile, check installed capabilities, and discover actual channels/accounts rather than assuming Feishu. Doctor probes all matching accounts; smoke exercises one selected source per run. For multi-channel acceptance, explicitly test each required channel/account pair and record the coverage.
|
|
96
|
+
|
|
97
|
+
Notification probes are dry-run only, not evidence of real delivery or authenticated inbound approval support. Smoke still executes a real worker in a disposable queue. Updating this skill alone does not upgrade the installed CLI; the discovery/selection behavior requires package version 0.16.2 or newer; 0.16.1 does not include it.
|
|
98
|
+
|
|
93
99
|
### Hermes Agent Integration
|
|
94
100
|
|
|
95
101
|
The core CLI is platform-neutral, but Hermes conversation routing requires its own dispatcher and notifier. Generate a plan and verify its installation confirmation summary identifies Hermes, the absolute Hermes CLI path, intended workspace and queue, systemd scheduler, source-bound notification routing, and `writes enabled: no (plan only)`. If any field identifies the wrong platform or destination, stop. Confirm installation only after that review, then run the read-only doctor and disposable smoke:
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
# npm Package
|
|
2
2
|
|
|
3
3
|
Package name: `taskforce-loop-engineering`
|
|
4
|
-
Version: `
|
|
4
|
+
Version source: the candidate checkout's `package.json`; do not infer the installed
|
|
5
|
+
or public-registry version from this skill. Check the actual installed package
|
|
6
|
+
and `npm view taskforce-loop-engineering version` separately.
|
|
7
|
+
|
|
8
|
+
The multi-IM OpenClaw diagnostic changes require `0.16.2` or newer;
|
|
9
|
+
the `0.16.1` package does not support them. A skill update alone does
|
|
10
|
+
not install these capabilities. See [OpenClaw multi-IM diagnostics](openclaw-diagnostics.md)
|
|
11
|
+
for capability checks, channel/account selection, and acceptance boundaries.
|
|
5
12
|
|
|
6
13
|
Install from npm:
|
|
7
14
|
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# OpenClaw Multi-IM Diagnostics
|
|
2
|
+
|
|
3
|
+
## Compatibility and scope
|
|
4
|
+
|
|
5
|
+
This procedure requires package version 0.16.2 or newer; 0.16.1 does not
|
|
6
|
+
include these capabilities. Until a compatible release is installed, use a reviewed
|
|
7
|
+
source candidate for validation and report installed diagnostics as unchanged. Do not
|
|
8
|
+
pass new flags to an old binary or claim that updating the skill upgrades code.
|
|
9
|
+
This procedure applies to OpenClaw; it does not change Hermes diagnostics.
|
|
10
|
+
|
|
11
|
+
1. Identify the installed package, managed workspace, worker and queue. Check
|
|
12
|
+
`loop-engineering-openclaw-doctor --help` and
|
|
13
|
+
`loop-engineering-openclaw-smoke --help` for all three source flags below.
|
|
14
|
+
Help alone is not acceptance: verify discovery and dry-run report results.
|
|
15
|
+
2. Select the intended OpenClaw CLI/profile environment. `--root` selects a
|
|
16
|
+
workspace, not an OpenClaw profile. Both commands accept `--openclaw-bin`
|
|
17
|
+
for the selected executable; retain that profile's normal environment.
|
|
18
|
+
Inspect `openclaw channels list --json` using that same CLI/environment.
|
|
19
|
+
Doctor resolves executable aliases and requires the same executable as the
|
|
20
|
+
install manifest, plus unchanged manifest hashes for notifier/dispatcher.
|
|
21
|
+
A missing/incomplete manifest, different CLI, or caller drift fails
|
|
22
|
+
`diagnostic_runtime`: no notification probe or smoke worker runs. Choose
|
|
23
|
+
the installed CLI or repair the integration within the authorized scope;
|
|
24
|
+
`--openclaw-bin` does not rewrite installed callers.
|
|
25
|
+
Never print channel credentials to diagnose selection.
|
|
26
|
+
3. Run doctor. Without source filters, it discovers channel/account pairs from
|
|
27
|
+
the inventory and dry-runs each through the installed notifier. Inspect
|
|
28
|
+
`notificationSources` and the per-account `notification_dry_run` checks.
|
|
29
|
+
A configured inventory is not proof of a connected channel.
|
|
30
|
+
4. Run smoke only within the authorized worker-execution scope. It first
|
|
31
|
+
requires doctor to pass, then uses the first returned source for the isolated
|
|
32
|
+
task's routing and terminal notification dry-run. It executes a real worker,
|
|
33
|
+
so it is not merely a read-only notification probe and may consume model
|
|
34
|
+
resources. It removes its temporary queue/config/runtime unless
|
|
35
|
+
`--keep-artifacts` is requested; verify cleanup and required task artifacts.
|
|
36
|
+
5. For acceptance across multiple IMs/accounts, repeat smoke with explicit
|
|
37
|
+
channel/account pairs. One default smoke does not cover every configured
|
|
38
|
+
route. Report tested pairs, failures, retained evidence and cleanup status.
|
|
39
|
+
|
|
40
|
+
## Explicit selection
|
|
41
|
+
|
|
42
|
+
Both doctor and smoke accept:
|
|
43
|
+
|
|
44
|
+
- `--source-channel`: filter to an actual configured IM channel.
|
|
45
|
+
- `--source-account`: filter to an actual account ID. Pair with a channel to
|
|
46
|
+
avoid matching the same account name across different IMs.
|
|
47
|
+
- `--source-target`: override the synthetic dry-run destination when a plugin
|
|
48
|
+
requires a particular target format. This does not enable real sending or
|
|
49
|
+
change channel/account discovery.
|
|
50
|
+
|
|
51
|
+
For a configured Telegram account named `personal` (replace all placeholders
|
|
52
|
+
and select its actual profile environment first):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
loop-engineering-openclaw-doctor --root /path/to/workspace --queue agent-tasks --worker-agent main --source-channel telegram --source-account personal --source-target 1 --json
|
|
56
|
+
loop-engineering-openclaw-smoke --root /path/to/workspace --queue agent-tasks --worker-agent main --source-channel telegram --source-account personal --source-target 1 --json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Targets are synthetic by default. Discovery failure, malformed/empty channel
|
|
60
|
+
inventory or unmatched filters must fail closed; never fall back to Feishu or
|
|
61
|
+
silently drop the account. Within the selected channels, malformed account
|
|
62
|
+
lists or non-string/blank account entries fail even alongside valid entries
|
|
63
|
+
and even when an account filter would exclude them. An explicit channel filter
|
|
64
|
+
excludes unrelated channels from validation. Empty account arrays are valid,
|
|
65
|
+
but fail selection if no matching accounts remain. Correct the profile or selection instead of editing
|
|
66
|
+
a temporary test script to hardcode another IM.
|
|
67
|
+
|
|
68
|
+
## Evidence boundaries
|
|
69
|
+
|
|
70
|
+
Notification probes remain dry-run even with an explicit target. Passing them
|
|
71
|
+
proves only the tested routing/argument path, not real outbound delivery,
|
|
72
|
+
inbound reception, or trusted approval callback transport. Real end-to-end
|
|
73
|
+
messaging requires separate authorization and observed delivery/receipt.
|
|
74
|
+
Do not infer universal IM support from Feishu, Telegram and Slack mock tests;
|
|
75
|
+
other configured plugins need their own acceptance evidence. Keep diagnostic
|
|
76
|
+
coverage distinct from production notification and human-gate support.
|
|
77
|
+
|
|
78
|
+
### Diagnostic invocation and environment isolation
|
|
79
|
+
|
|
80
|
+
After checking executable identity and managed caller hashes, doctor uses the
|
|
81
|
+
exact CLI invocation recorded by installation for version, agent, channel and
|
|
82
|
+
notification checks. PATH/symlink aliases remain accepted when they resolve to
|
|
83
|
+
the same executable, but their invocation names are not used to select a second
|
|
84
|
+
profile. To change the installed profile, explicitly repair the integration.
|
|
85
|
+
Equal realpaths alone do not establish profile equivalence for name-sensitive
|
|
86
|
+
wrappers.
|
|
87
|
+
|
|
88
|
+
Doctor notification probes and smoke subprocesses discard inherited
|
|
89
|
+
`LOOP_HUMAN_INPUT_SOURCE` and `LOOP_NOTIFICATION_SOURCE` before supplying their
|
|
90
|
+
own discovered/task source. Production human-gate source precedence is unchanged.
|
|
91
|
+
Regression checks compare reported channel/account/target against captured
|
|
92
|
+
message arguments (including `--dry-run`), with conflicting inherited sources,
|
|
93
|
+
multiple accounts, and invocation-name-sensitive wrappers.
|