From a49018080165e19c1150777484ef6bc5b718e69a Mon Sep 17 00:00:00 2001 From: Dotta Date: Sat, 7 Nov 2026 16:09:03 -0600 Subject: [PATCH] test(chat): check run route and issue-run field without source-layout literals Match the registered run route path and the runsForIssue select block's runId field instead of a full JSX line and a fixed character window, so harmless refactors do not break the guidance regression test. Co-Authored-By: Claude Opus 5.5 --- server/src/__tests__/agent-conversations.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/__tests__/agent-conversations.test.ts b/server/src/__tests__/agent-conversations.test.ts index 672b3e7d4df..f4741601774 100644 --- a/server/src/__tests__/agent-conversations.test.ts +++ b/server/src/__tests__/agent-conversations.test.ts @@ -998,13 +998,13 @@ describe("chat prompt policy", () => { it("tells chat how to link execution runs to the registered run route and name their agents", () => { const app = readFileSync(new URL("../../../ui/src/App.tsx", import.meta.url), "utf8"); - expect(app).toContain('} />'); + expect(app).toMatch(//agents//runs/ using the run's returned agentId."); // Issue run listings expose the run ID as runId, not id; the guidance must name the field each response returns. const activity = readFileSync(new URL("../services/activity.ts", import.meta.url), "utf8"); - const listing = activity.slice(activity.indexOf("runsForIssue"), activity.indexOf("runsForIssue") + 4000); - expect(listing).toContain("runId: heartbeatRuns.id,"); - expect(listing).not.toMatch(/\bid: heartbeatRuns\.id\b/); + const listing = activity.match(/runsForIssue:\s*async\b[\s\S]*?\.select\(\{([\s\S]*?)\n\s*\}\)/)?.[1] ?? ""; + expect(listing).toMatch(/^\s*runId:\s*heartbeatRuns\.id\s*,/m); + expect(listing).not.toMatch(/^\s*id:/m); expect(AGENT_CHAT_DIRECTIVE).toContain("Issue run listings (GET /api/issues/{id}/runs) return the run ID as runId"); expect(AGENT_CHAT_DIRECTIVE).toContain("use id only from responses that return the run itself, such as GET /api/heartbeat-runs/{runId}"); expect(AGENT_CHAT_DIRECTIVE).not.toContain("returned agentId and id");