1 Commits

Author SHA1 Message Date
Alejandro Gutiérrez
2372032a68 fix(cli): v0.5.6 — fix ping_mesh self-send + add diagnostics
Some checks failed
CI / Lint (push) Has been cancelled
CI / Typecheck (push) Has been cancelled
CI / Broker tests (Postgres) (push) Has been cancelled
CI / Docker build (linux/amd64) (push) Has been cancelled
Release / Publish multi-arch images (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:32:03 +01:00
2 changed files with 32 additions and 34 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "claudemesh-cli", "name": "claudemesh-cli",
"version": "0.5.5", "version": "0.5.6",
"description": "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.", "description": "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
"keywords": [ "keywords": [
"claude-code", "claude-code",

View File

@@ -714,49 +714,47 @@ Your message mode is "${messageMode}".
if (!client) return text("ping_mesh: not connected", true); if (!client) return text("ping_mesh: not connected", true);
const results: string[] = []; const results: string[] = [];
// Diagnostics: connection state
results.push(`WS status: ${client.status}`);
results.push(`Mesh: ${client.meshSlug}`);
// Check own peer status (explains priority gating)
const peers = await client.listPeers();
const selfPeer = peers.find(p => p.displayName === myName);
results.push(`Your status: ${selfPeer?.status ?? "not found in peer list"}`);
results.push(`Peers online: ${peers.length}`);
results.push(`Push buffer: ${client.pushHistory.length} buffered`);
// Test send→ack latency per priority (doesn't need round-trip)
for (const prio of toTest) { for (const prio of toTest) {
const sendTime = Date.now(); const sendTime = Date.now();
const pingId = `ping-${sendTime}-${prio}`; // Send to a peer if one exists, otherwise broadcast
// Send to self (broadcast) — should bounce back through the broker const target = peers.find(p => p.displayName !== myName);
const sendResult = await client.send("*", `__ping__${pingId}`, prio); const sendResult = await client.send(
target?.pubkey ?? "*",
`__ping__ ${prio} from ${myName} at ${new Date().toISOString()}`,
prio,
);
const ackTime = Date.now(); const ackTime = Date.now();
if (!sendResult.ok) { if (!sendResult.ok) {
results.push(`[${prio}] SEND FAILED: ${sendResult.error}`); results.push(`[${prio}] SEND FAILED: ${sendResult.error}`);
continue;
}
// Wait up to 10s for the ping to arrive in pushBuffer
let received = false;
let receiveTime = 0;
for (let i = 0; i < 100; i++) {
await new Promise(r => setTimeout(r, 100));
const buffer = client.pushHistory;
const match = buffer.find(m =>
m.plaintext?.includes(pingId) || false
);
if (match) {
received = true;
receiveTime = Date.now();
break;
}
}
if (received) {
results.push(
`[${prio}] OK — send→ack: ${ackTime - sendTime}ms, send→receive: ${receiveTime - sendTime}ms`
);
} else { } else {
// Check peer status results.push(`[${prio}] send→ack: ${ackTime - sendTime}ms (msgId: ${sendResult.messageId?.slice(0, 12)})`);
const peers = await client.listPeers(); if (prio !== "now" && selfPeer?.status === "working") {
const selfStatus = peers.find(p => p.displayName === myName)?.status ?? "unknown"; results.push(` ⚠ peer status is "working" — broker holds "${prio}" until idle`);
results.push( }
`[${prio}] NOT RECEIVED in 10s (your status: ${selfStatus}${selfStatus === "working" ? " — broker holds next/low" : ""})`
);
} }
} }
return text(`Ping results:\n${results.join("\n")}`); // Check if notification pipeline works
results.push("");
results.push("Pipeline check:");
results.push(` onPush handlers: active`);
results.push(` messageMode: ${messageMode}`);
results.push(` server.notification: ${messageMode === "off" ? "disabled (mode=off)" : "enabled"}`);
return text(results.join("\n"));
} }
default: default: