mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-07 10:34:44 +00:00
fix(qa): surface tool-search bridge results
This commit is contained in:
@@ -3146,6 +3146,47 @@ describe("qa mock openai server", () => {
|
||||
expect(String(toolPlanOutput.arguments)).toContain("current");
|
||||
});
|
||||
|
||||
it("summarizes QA tool-search bridge outputs with the nested plugin result marker", async () => {
|
||||
const server = await startMockServer();
|
||||
const targetTool = "fake_plugin_tool_17";
|
||||
|
||||
const response = await postResponses(server, {
|
||||
stream: false,
|
||||
input: [
|
||||
makeUserInput(
|
||||
`tool search qa check target=${targetTool}. Call exactly that tool once and then summarize.`,
|
||||
),
|
||||
{
|
||||
type: "function_call_output",
|
||||
call_id: "call_tool_search_code_1",
|
||||
output: JSON.stringify({
|
||||
ok: true,
|
||||
value: {
|
||||
tool: {
|
||||
id: `openclaw:tool-search-e2e-fixture:${targetTool}`,
|
||||
source: "openclaw",
|
||||
sourceName: "tool-search-e2e-fixture",
|
||||
name: targetTool,
|
||||
description: "x".repeat(260),
|
||||
},
|
||||
result: {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: `FAKE_PLUGIN_OK ${targetTool} {"marker":"code"}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(outputText(await response.json())).toBe(`FAKE_PLUGIN_OK ${targetTool}`);
|
||||
});
|
||||
|
||||
it("plans QA tool-search failure calls with denied-input args", async () => {
|
||||
const server = await startMockServer();
|
||||
|
||||
|
||||
@@ -1482,6 +1482,16 @@ function buildAssistantText(
|
||||
"- Re-run with a real model for qualitative coverage.",
|
||||
].join("\n");
|
||||
}
|
||||
if (
|
||||
toolOutput &&
|
||||
(QA_TOOL_SEARCH_PROMPT_RE.test(allInputText) ||
|
||||
QA_TOOL_SEARCH_FAILURE_PROMPT_RE.test(allInputText))
|
||||
) {
|
||||
const targetTool = extractToolSearchTarget(allInputText);
|
||||
if (targetTool && toolOutput.includes(targetTool) && toolOutput.includes("FAKE_PLUGIN_OK")) {
|
||||
return `FAKE_PLUGIN_OK ${targetTool}`;
|
||||
}
|
||||
}
|
||||
if (toolOutput) {
|
||||
const snippet = toolOutput.replace(/\s+/g, " ").trim().slice(0, 220);
|
||||
return `Protocol note: I reviewed the requested material. Evidence snippet: ${snippet || "no content"}`;
|
||||
|
||||
Reference in New Issue
Block a user