fix(chat): use runId from issue run listings in run link guidance

GET /api/issues/{id}/runs returns the run ID as runId, not id. Name the
field each response returns so chat can build the run link, and pin the
listing's field name in the regression test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 123d7fb940)
This commit is contained in:
Dotta committed 2026-11-07 14:31:42 -06:00
1 parent 63613c80dc
commit 05193427cb
2 files changed
+10 -2

No files matched your search

@@ -1006,7 +1006,15 @@ 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('<Route path="agents/:agentId/runs/:runId" element={<AgentDetail />} />');
expect(AGENT_CHAT_DIRECTIVE).toContain("/<prefix>/agents/<agentId>/runs/<runId> using the run's returned agentId and id");
expect(AGENT_CHAT_DIRECTIVE).toContain("/<prefix>/agents/<agentId>/runs/<runId> 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/);
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");
expect(AGENT_CHAT_DIRECTIVE).toContain("read the agent and name it rather than showing a raw ID");
const prompt = buildPaperclipTaskMarkdown({ issue: { id: "chat", identifier: null, title: "Chat", workMode: "ask", conversationAgentId: "agent" } });
expect(prompt).toContain("/<prefix>/agents/<agentId>/runs/<runId>");
+1 -1
View File
@@ -110,7 +110,7 @@ Create ordinary assigned tasks; this conversation is never a parent. Choose the
For review or follow-up tasks, include the existing source materials the assignee needs, not just task identifiers or a rubric. Read the source task's saved documents and comments, then copy the relevant existing content into the handoff or attach resources the recipient can actually read. A new task's tools may only expose its own documents and history. Supplying existing source material is coordination, not creating the assigned deliverable.
For task links, use the company-prefixed relative path /<prefix>/issues/<identifier>, deriving the prefix from the returned task identifier. For approval links, use /<prefix>/approvals/<approvalId> with the same company prefix and the returned approval id, so the person can open the approval to decide it. An absolute URL is appropriate only when its actual origin was supplied by the platform. Never invent a hostname for a Paperclip link. For an execution run, link /<prefix>/agents/<agentId>/runs/<runId> using the run's returned agentId and id. Run listings return agent IDs, not names: read the agent and name it rather than showing a raw ID.
For task links, use the company-prefixed relative path /<prefix>/issues/<identifier>, deriving the prefix from the returned task identifier. For approval links, use /<prefix>/approvals/<approvalId> with the same company prefix and the returned approval id, so the person can open the approval to decide it. An absolute URL is appropriate only when its actual origin was supplied by the platform. Never invent a hostname for a Paperclip link. For an execution run, link /<prefix>/agents/<agentId>/runs/<runId> using the run's returned agentId. Issue run listings (GET /api/issues/{id}/runs) return the run ID as runId; use id only from responses that return the run itself, such as GET /api/heartbeat-runs/{runId}. Run listings return agent IDs, not names: read the agent and name it rather than showing a raw ID.
When a reply concerns a specific agent, such as one you paused, resumed, configured, or reported on, link its profile at /<prefix>/agents/<urlKey or id> using the agent's returned urlKey or id. A profile link is not a mention: use agent:// only when you intend to notify that agent.