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IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CA2b7B,CAAC"} |
@@ -68,2 +68,30 @@ import { truncateToolResult } from "../tools/TruncateResult.js"; | ||
| })); | ||
| /** | ||
| * Markers of a model describing tool activity that never happened. | ||
| * | ||
| * A worker offered tools and asked for evidence will sometimes write what a | ||
| * successful transcript looks like instead of calling anything — tool names, | ||
| * call ids, `"status": "success"`, and rows of data underneath. Observed in a | ||
| * timesheet product: employee ids and hours that exist nowhere, carrying a | ||
| * `tool_call_id` and labelled successful, against a connector that received no | ||
| * request at all. | ||
| * | ||
| * Prose is not the problem. A worker may legitimately answer "the results do | ||
| * not cover this" without calling anything. What must never pass is a claim of | ||
| * execution, because the evidence normalizer reads structures like | ||
| * `evidence_items` and would take invented rows for retrieved ones. | ||
| */ | ||
| const FABRICATED_TOOL_RESULT_MARKERS = [ | ||
| /"?tool_call_id"?\s*[:=]/i, | ||
| /"?evidence_items"?\s*[:=]/i, | ||
| /"?raw_data_excerpt"?\s*[:=]/i, | ||
| /"?tool_name"?\s*[:=]/i, | ||
| /"?status"?\s*[:=]\s*"?success"?/i, | ||
| ]; | ||
| const claimsToolExecution = (output) => { | ||
| if (!output) | ||
| return false; | ||
| // Two independent markers, so a passing mention of a tool name is not enough. | ||
| return FABRICATED_TOOL_RESULT_MARKERS.filter((marker) => marker.test(output)).length >= 2; | ||
| }; | ||
| const buildTaskMessages = (input, hasTools) => { | ||
@@ -83,2 +111,6 @@ const system = [ | ||
| "Prefer several complementary calls over one broad one — unused calls cost nothing, a missing one costs the answer.", | ||
| // A worker asked for evidence has been observed writing what a | ||
| // successful transcript looks like — call ids, statuses and rows of | ||
| // invented data — instead of calling anything. | ||
| "Never describe a tool result you did not receive. If you call nothing, say what you could not determine; do not write out call ids, statuses, or example rows as though a tool had returned them.", | ||
| ].join("\n") | ||
@@ -184,2 +216,20 @@ : "No tools are available. Answer from the task description alone or state what is missing.", | ||
| const output = selection.message.content.trim(); | ||
| // A worker that was given tools, called none, and then described tool | ||
| // results has invented them. Passing that on as a successful task makes | ||
| // fabricated rows indistinguishable from retrieved ones by the time the | ||
| // normalizer sees them, so it fails here instead. | ||
| if (toolDefinitions.length > 0 && claimsToolExecution(output)) { | ||
| return finish({ | ||
| status: "failed", | ||
| errorCode: "GATEWAY_WORKER_FABRICATED_TOOL_RESULT", | ||
| errorMessage: "The worker reported tool results without calling any tool. Its output has been " + | ||
| "discarded rather than treated as evidence.", | ||
| metadata: { | ||
| pass: "direct", | ||
| modelCallCount: modelCalls.length, | ||
| toolCallCount: 0, | ||
| fabricatedToolResult: true, | ||
| }, | ||
| }); | ||
| } | ||
| return finish({ | ||
@@ -192,2 +242,5 @@ status: "succeeded", | ||
| toolCallCount: 0, | ||
| // Nothing was retrieved, so nothing downstream may treat this as | ||
| // having been. | ||
| ...(toolDefinitions.length > 0 ? { noToolsExecuted: true } : {}), | ||
| ...(droppedForBudget > 0 ? { droppedToolCalls: droppedForBudget } : {}), | ||
@@ -194,0 +247,0 @@ }, |
+3
-3
| { | ||
| "name": "@mcoda/codali", | ||
| "version": "0.1.123", | ||
| "version": "0.1.124", | ||
| "description": "Standalone tool-runner adapter for mcoda.", | ||
@@ -38,4 +38,4 @@ "type": "module", | ||
| "@modelcontextprotocol/sdk": "1.30.0", | ||
| "@mcoda/db": "0.1.123", | ||
| "@mcoda/shared": "0.1.123" | ||
| "@mcoda/db": "0.1.124", | ||
| "@mcoda/shared": "0.1.124" | ||
| }, | ||
@@ -42,0 +42,0 @@ "scripts": { |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 3 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 4 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
3654353
0.08%77425
0.07%71
-1.39%+ Added
+ Added
- Removed
- Removed
Updated
Updated