fix(qa): surface tool-search bridge results · openclaw/openclaw@4506d8b
vincentkoc
·
2026-06-22
·
via Recent Commits to openclaw:main
File tree
extensions/qa-lab/src/providers/mock-openai
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3146,6 +3146,47 @@ describe("qa mock openai server", () => {
|
3146 | 3146 | expect(String(toolPlanOutput.arguments)).toContain("current"); |
3147 | 3147 | }); |
3148 | 3148 | |
| 3149 | +it("summarizes QA tool-search bridge outputs with the nested plugin result marker", async () => { |
| 3150 | +const server = await startMockServer(); |
| 3151 | +const targetTool = "fake_plugin_tool_17"; |
| 3152 | + |
| 3153 | +const response = await postResponses(server, { |
| 3154 | +stream: false, |
| 3155 | +input: [ |
| 3156 | +makeUserInput( |
| 3157 | +`tool search qa check target=${targetTool}. Call exactly that tool once and then summarize.`, |
| 3158 | +), |
| 3159 | +{ |
| 3160 | +type: "function_call_output", |
| 3161 | +call_id: "call_tool_search_code_1", |
| 3162 | +output: JSON.stringify({ |
| 3163 | +ok: true, |
| 3164 | +value: { |
| 3165 | +tool: { |
| 3166 | +id: `openclaw:tool-search-e2e-fixture:${targetTool}`, |
| 3167 | +source: "openclaw", |
| 3168 | +sourceName: "tool-search-e2e-fixture", |
| 3169 | +name: targetTool, |
| 3170 | +description: "x".repeat(260), |
| 3171 | +}, |
| 3172 | +result: { |
| 3173 | +content: [ |
| 3174 | +{ |
| 3175 | +type: "text", |
| 3176 | +text: `FAKE_PLUGIN_OK ${targetTool} {"marker":"code"}`, |
| 3177 | +}, |
| 3178 | +], |
| 3179 | +}, |
| 3180 | +}, |
| 3181 | +}), |
| 3182 | +}, |
| 3183 | +], |
| 3184 | +}); |
| 3185 | + |
| 3186 | +expect(response.status).toBe(200); |
| 3187 | +expect(outputText(await response.json())).toBe(`FAKE_PLUGIN_OK ${targetTool}`); |
| 3188 | +}); |
| 3189 | + |
3149 | 3190 | it("plans QA tool-search failure calls with denied-input args", async () => { |
3150 | 3191 | const server = await startMockServer(); |
3151 | 3192 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1482,6 +1482,16 @@ function buildAssistantText(
|
1482 | 1482 | "- Re-run with a real model for qualitative coverage.", |
1483 | 1483 | ].join("\n"); |
1484 | 1484 | } |
| 1485 | +if ( |
| 1486 | +toolOutput && |
| 1487 | +(QA_TOOL_SEARCH_PROMPT_RE.test(allInputText) || |
| 1488 | +QA_TOOL_SEARCH_FAILURE_PROMPT_RE.test(allInputText)) |
| 1489 | +) { |
| 1490 | +const targetTool = extractToolSearchTarget(allInputText); |
| 1491 | +if (targetTool && toolOutput.includes(targetTool) && toolOutput.includes("FAKE_PLUGIN_OK")) { |
| 1492 | +return `FAKE_PLUGIN_OK ${targetTool}`; |
| 1493 | +} |
| 1494 | +} |
1485 | 1495 | if (toolOutput) { |
1486 | 1496 | const snippet = toolOutput.replace(/\s+/g, " ").trim().slice(0, 220); |
1487 | 1497 | return `Protocol note: I reviewed the requested material. Evidence snippet: ${snippet || "no content"}`; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。