From 95c618e07884f8e243784e4245d90e263db9931d Mon Sep 17 00:00:00 2001 From: Dotta Date: Sat, 7 Nov 2026 13:21:14 -0600 Subject: [PATCH] fix(chat): tell chat how to link execution runs and name their agents Chat guidance defined only the task-link template. Asked to show a task's runs, the chat agent had GET /api/issues/{id}/runs data with agentId and run id but no run route or agent name, so it listed raw UUIDs instead of linking each run and naming its agent. Add the registered //agents//runs/ route and ask chat to read and name the agent rather than show a raw ID. Co-Authored-By: Claude Opus 5.5 (cherry picked from commit 5c326e2fb75cd2b684c9c2c3cf9802a90d534de9) --- server/src/__tests__/agent-conversations.test.ts | 10 ++++++++++ server/src/services/agent-conversations.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/server/src/__tests__/agent-conversations.test.ts b/server/src/__tests__/agent-conversations.test.ts index 8d72f9b7d90..58a3982506a 100644 --- a/server/src/__tests__/agent-conversations.test.ts +++ b/server/src/__tests__/agent-conversations.test.ts @@ -1,3 +1,4 @@ +import { readFileSync } from "node:fs"; import { createLocalAgentJwt } from "../agent-auth-jwt.js"; import { applyRunnerGoalPrpEvent } from "../services/runner-goals.js"; import { mkdtemp, rm } from "node:fs/promises"; @@ -995,6 +996,15 @@ describe("chat prompt policy", () => { expect(AGENT_CHAT_DIRECTIVE).toContain("In Ask mode, discuss the plan without creating or revising documents or approval cards"); }); + 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(AGENT_CHAT_DIRECTIVE).toContain("//agents//runs/ using the run's 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("//agents//runs/"); + }); + it.each([true, false])("preserves rejected-plan changes in task markdown (includeDescription=%s)", (includeDescription) => { const prompt = buildPaperclipTaskMarkdown({ issue: { id: "chat", identifier: null, title: "Chat", workMode: "planning", conversationAgentId: "agent" }, diff --git a/server/src/services/agent-conversations.ts b/server/src/services/agent-conversations.ts index ec108aca3ec..3f5cd5c5ed7 100644 --- a/server/src/services/agent-conversations.ts +++ b/server/src/services/agent-conversations.ts @@ -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 //issues/, deriving the prefix from the returned task identifier. An absolute URL is appropriate only when its actual origin was supplied by the platform. Never invent a hostname for a Paperclip link. +For task links, use the company-prefixed relative path //issues/, deriving the prefix from the returned task identifier. 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 //agents//runs/ 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 status updates, distinguish recorded task status from active execution and verified progress. Read the latest relevant comments and run outcome before explaining a blocker or claiming work is underway. Use the advertised API tools for another task's details when needed. A completed dependency does not prove a block is stale; report the assignee's recorded reason. Agent configuration may be redacted: an empty configuration object without configuration-read permission does not prove settings are disabled or at their defaults. If the evidence is unavailable, say what you could verify and what remains unknown rather than guessing or recommending a status change.