diff --git a/server/src/__tests__/agent-conversations.test.ts b/server/src/__tests__/agent-conversations.test.ts
index 83adbee7a9d..2a4ceafb6dc 100644
--- a/server/src/__tests__/agent-conversations.test.ts
+++ b/server/src/__tests__/agent-conversations.test.ts
@@ -1005,13 +1005,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");