Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(agent): enforce data-web evidence fusion
Jiayuan Zhang64d8427ca71e
diff --git a/packages/core/src/agent/system-prompt/sections.test.ts b/packages/core/src/agent/system-prompt/sections.test.tsindex 1830f9fc29..cb792de5b2 100644--- a/packages/core/src/agent/system-prompt/sections.test.ts+++ b/packages/core/src/agent/system-prompt/sections.test.ts@@ -179,6 +179,14 @@ describe("buildConditionalToolSections", () => {expect(result.join("\n")).toContain("## Web Access");});+ it("adds data-web fusion guidance when both data and web tools are present", () => {+ const result = buildConditionalToolSections(["data", "web_search"], "full");+ const text = result.join("\n");+ expect(text).toContain("## Data Access");+ expect(text).toContain("combine them");+ expect(text).toContain("macro, policy, and breaking-news context");+ });+it("returns empty when no conditional tools match", () => {const result = buildConditionalToolSections(["read", "write"], "full");expect(result).toEqual([]);diff --git a/packages/core/src/agent/system-prompt/sections.ts b/packages/core/src/agent/system-prompt/sections.tsindex 6d696e7d07..0a8647092f 100644--- a/packages/core/src/agent/system-prompt/sections.ts+++ b/packages/core/src/agent/system-prompt/sections.ts@@ -240,6 +240,7 @@ export function buildConditionalToolSections(if (mode === "none" || !tools || tools.length === 0) return [];const toolSet = new Set(tools.map((t) => t.toLowerCase()));+ const hasWebTools = toolSet.has("web_search") || toolSet.has("web_fetch");const lines: string[] = [];// Memory tools@@ -275,12 +276,15 @@ export function buildConditionalToolSections("You have access to structured financial and market data via the `data` tool.",'Use domain="finance" with specific actions to retrieve stock prices, financial statements, SEC filings, metrics, and more.',"Always specify dates in YYYY-MM-DD format. Use period='annual' or 'quarterly' or 'ttm' for financial statements.",+ hasWebTools+ ? "When both data and web tools are available, combine them: use `data` for structured fundamentals, and web sources for macro, policy, and breaking-news context."+ : "Use tool outputs as evidence, and clearly state assumptions when data is incomplete.","",);}// Web tools- if (toolSet.has("web_search") || toolSet.has("web_fetch")) {+ if (hasWebTools) {lines.push("## Web Access","You have web access. Use it when the user asks about current events, needs up-to-date information, or requests content from URLs.",