fix: add node tool failure context
This commit is contained in:
@@ -9,6 +9,7 @@ Docs: https://docs.clawd.bot
|
|||||||
- Exec approvals: support wildcard agent allowlists (`*`) across all agents.
|
- Exec approvals: support wildcard agent allowlists (`*`) across all agents.
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
- Nodes tool: include agent/node/gateway context in tool failure logs to speed approval debugging.
|
||||||
- UI: remove the chat stop button and keep the composer aligned to the bottom edge.
|
- UI: remove the chat stop button and keep the composer aligned to the bottom edge.
|
||||||
|
|
||||||
## 2026.1.20
|
## 2026.1.20
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ export function createNodesTool(options?: {
|
|||||||
timeoutMs: typeof params.timeoutMs === "number" ? params.timeoutMs : undefined,
|
timeoutMs: typeof params.timeoutMs === "number" ? params.timeoutMs : undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case "status":
|
case "status":
|
||||||
return jsonResult(await callGatewayTool("node.list", gatewayOpts, {}));
|
return jsonResult(await callGatewayTool("node.list", gatewayOpts, {}));
|
||||||
@@ -262,7 +263,8 @@ export function createNodesTool(options?: {
|
|||||||
case "camera_clip": {
|
case "camera_clip": {
|
||||||
const node = readStringParam(params, "node", { required: true });
|
const node = readStringParam(params, "node", { required: true });
|
||||||
const nodeId = await resolveNodeId(gatewayOpts, node);
|
const nodeId = await resolveNodeId(gatewayOpts, node);
|
||||||
const facing = typeof params.facing === "string" ? params.facing.toLowerCase() : "front";
|
const facing =
|
||||||
|
typeof params.facing === "string" ? params.facing.toLowerCase() : "front";
|
||||||
if (facing !== "front" && facing !== "back") {
|
if (facing !== "front" && facing !== "back") {
|
||||||
throw new Error("invalid facing (front|back)");
|
throw new Error("invalid facing (front|back)");
|
||||||
}
|
}
|
||||||
@@ -441,6 +443,19 @@ export function createNodesTool(options?: {
|
|||||||
default:
|
default:
|
||||||
throw new Error(`Unknown action: ${action}`);
|
throw new Error(`Unknown action: ${action}`);
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
const nodeLabel =
|
||||||
|
typeof params.node === "string" && params.node.trim() ? params.node.trim() : "auto";
|
||||||
|
const gatewayLabel =
|
||||||
|
gatewayOpts.gatewayUrl && gatewayOpts.gatewayUrl.trim()
|
||||||
|
? gatewayOpts.gatewayUrl.trim()
|
||||||
|
: "default";
|
||||||
|
const agentLabel = agentId ?? "unknown";
|
||||||
|
const message = err instanceof Error ? err.message : String(err);
|
||||||
|
throw new Error(
|
||||||
|
`agent=${agentLabel} node=${nodeLabel} gateway=${gatewayLabel} action=${action}: ${message}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user