From 43212cb2b72a14e19f14139863f08676b13ee150 Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Fri, 9 Oct 2026 20:16:24 -0500 Subject: [PATCH] fix(slack): require result and review updates in conversation prompts (#15611) ## Thinking Path > - Paperclip helps people manage AI agents and their work. > - People can ask an agent to do work from a Slack thread. > - The agent must return results and review requests to that conversation. > - The current prompts explain reply format but do not require these updates. > - This change adds one set of instructions to initial prompts and later turns. > - Users can see the result and the action needed for review in Slack. ## Linked Issues or Issue Description **What happened?** An agent can save results or a plan in Paperclip without telling the user in Slack that the result is ready or that review is required. **Expected behavior** The agent reports results in the originating conversation. If review is needed, it saves the required interaction and tells the user what to review and how to act. **Steps to reproduce** Start work in a Slack thread. Have the agent prepare a plan that needs approval or produce a deliverable. The prompt does not explicitly require a result or review update in that thread. Related: #15579 adds task links to Slack replies. This change covers results and review requests, including later turns. ## What Changed - Add shared instructions for result and review updates. - Include the instructions in initial Slack guidance and per-turn guidance. - Keep the normal approval gates, delivery checks, and duplicate-message rules. - Add tests for channel and direct conversations, and for fresh and resumed native and CLI turns. - Update the Slack skill documentation. ## Verification - Passed: guidance and heartbeat context tests (65 tests in two files). - Passed: `git diff --check`. - Workspace typecheck and build could not complete because this sandbox has no `cargo` binary. - The full local test run was stopped due to the sandbox memory limit. GitHub CI runs the full checks. - GitHub CI and automated review are pending. ## Risks - Low risk. This change updates prompt text and tests. It does not change transport or permissions. - Prompt instructions guide agent behavior. They do not guarantee that Slack delivery succeeds. ## Model Used - OpenAI GPT-6 (Codex). Used reasoning, code editing, and command tools. The runtime does not expose a more specific model ID or context window size. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --- server/src/__tests__/heartbeat-context-summary.test.ts | 5 +++++ .../src/services/chat-communication-guidance.test.ts | 9 +++++++++ server/src/services/chat-communication-guidance.ts | 2 ++ server/src/services/connectors/slack/agent-guidance.ts | 2 ++ .../services/connectors/slack/task-update-guidance.ts | 5 +++++ skills/slack/SKILL.md | 10 ++++++++++ 6 files changed, 33 insertions(+) create mode 100644 server/src/services/connectors/slack/task-update-guidance.ts diff --git a/server/src/__tests__/heartbeat-context-summary.test.ts b/server/src/__tests__/heartbeat-context-summary.test.ts index 70930db8cf7..67bdca41075 100644 --- a/server/src/__tests__/heartbeat-context-summary.test.ts +++ b/server/src/__tests__/heartbeat-context-summary.test.ts @@ -301,6 +301,11 @@ describe("buildPaperclipTaskMarkdown", () => { externalChatProvider: "slack", nativeRunner, includeDescription, }); expect(markdown).toContain("Interactive questions in Slack:"); + expect(markdown).toContain("When you have results, update the user in the originating Slack"); + expect(markdown).toContain("When the user needs to review a plan, approve an action, or review a result"); + expect(markdown).toContain("create the required human-input or approval interaction before you yield"); + expect(markdown).toContain("Saving a plan or setting a task to in_review alone does not ask the user to review it"); + expect(markdown).toContain("do not continue gated work until the required approval is recorded"); expect(markdown).toContain("ask_user_questions"); expect(markdown).toContain("single_select"); expect(markdown).toContain("resumes this task after the answer"); diff --git a/server/src/services/chat-communication-guidance.test.ts b/server/src/services/chat-communication-guidance.test.ts index 44b568d2597..a1f77369766 100644 --- a/server/src/services/chat-communication-guidance.test.ts +++ b/server/src/services/chat-communication-guidance.test.ts @@ -3,6 +3,15 @@ import { CHAT_PROVIDERS, updateChatEndpointSchema } from "@paperclipai/shared"; import { buildChatCommunicationGuidance } from "./chat-communication-guidance.js"; describe("initial medium communication guidance", () => { + it.each([true, false])("requires result and review updates in Slack (direct=%s)", (isDirectMessage) => { + const guidance = buildChatCommunicationGuidance({ provider: "slack", isDirectMessage }); + expect(guidance).toContain("When you have results, update the user in the originating Slack"); + expect(guidance).toContain("Put this update in your final response"); + expect(guidance).toContain("When the user needs to review a plan, approve an action, or review a result"); + expect(guidance).toContain("create the required human-input or approval interaction before you yield"); + expect(guidance).toContain("do not continue gated work until the required approval is recorded"); + }); + it("guides Slack presentation while retaining ordinary agent tools and explicit output requests", () => { const guidance = buildChatCommunicationGuidance({ provider: "slack", isDirectMessage: false, communicationInstructions: "Use customer-facing names." }); expect(guidance).toContain("shared channel thread"); diff --git a/server/src/services/chat-communication-guidance.ts b/server/src/services/chat-communication-guidance.ts index f96a5ee0102..c76fcf95002 100644 --- a/server/src/services/chat-communication-guidance.ts +++ b/server/src/services/chat-communication-guidance.ts @@ -1,10 +1,12 @@ import type { ChatProvider } from "@paperclipai/shared"; +import { slackTaskUpdateGuidance } from "./connectors/slack/task-update-guidance.js"; // Presentation guidance only. Task execution and permissions belong to the // ordinary Paperclip agent runtime, not the provider transport. const providerGuidance: Partial> = { slack: [ "This task began in Slack. Write replies for the person talking with you there.", + ...slackTaskUpdateGuidance, "Lead with the answer or outcome. Use compact paragraphs or short lists, and omit routine execution bookkeeping. Honor requests for more detail or exact output over default brevity.", "Put small answers directly in the message. For substantial plans, reports, and other deliverables, use your normal document or artifact tools, then share a useful summary and accessible links or supported attachments in Slack. Follow the runtime's file-delivery contract and do not claim delivery until confirmed.", "Ask useful questions through the existing human-input tools. Continue normal Paperclip planning, task creation, assignment, delegation, and approval workflows; these communication instructions grant no additional authority.", diff --git a/server/src/services/connectors/slack/agent-guidance.ts b/server/src/services/connectors/slack/agent-guidance.ts index bf1c5fb2e19..7ab63ad2132 100644 --- a/server/src/services/connectors/slack/agent-guidance.ts +++ b/server/src/services/connectors/slack/agent-guidance.ts @@ -1,4 +1,5 @@ import { slackAppConfigurationSchema } from "@paperclipai/shared"; +import { slackTaskUpdateGuidance } from "./task-update-guidance.js"; // Per-turn routing guidance, including resumed CLI sessions. This describes // existing capabilities; it never grants tools or overrides action policies. @@ -7,6 +8,7 @@ export function slackChatAgentGuidance(nativeRunner: boolean, savedCommand?: str return [ "", "Slack replies and actions:", + ...slackTaskUpdateGuidance, "Paperclip delivers your final response to the originating Slack conversation. Use assigned Slack action tools for an explicitly requested post, edit, reaction, pin, bookmark, canvas, list, or channel operation. Do not post a second copy of your ordinary reply with slack_post_message.", "For a requested file in this conversation, follow the external-chat file-delivery contract below. slack_upload_file is for explicitly uploading an existing Paperclip attachment to another allowed destination. Neither queued nor uncertain means delivered; retain the original operation key and inspect its receipt instead of starting the write again.", "Use only the tools assigned to this run and honor their action policies. Missing tools or Slack permissions are a capability limitation; never ask for a bot token or use another bot to work around it.", diff --git a/server/src/services/connectors/slack/task-update-guidance.ts b/server/src/services/connectors/slack/task-update-guidance.ts new file mode 100644 index 00000000000..5c51f67101f --- /dev/null +++ b/server/src/services/connectors/slack/task-update-guidance.ts @@ -0,0 +1,5 @@ +// Shared by initial conversation guidance and every later Slack turn. +export const slackTaskUpdateGuidance = [ + "When you have results, update the user in the originating Slack channel thread or direct conversation. Include the outcome and accessible links or supported attachments. Do not leave results only in a Paperclip task, document, or work product. Put this update in your final response so Paperclip can deliver it; do not send a duplicate with slack_post_message.", + "When the user needs to review a plan, approve an action, or review a result, notify them in the same Slack conversation. State what needs review, include the saved review link when available, and explain the action they must take. Follow the normal workflow to save the artifact and create the required human-input or approval interaction before you yield. Saving a plan or setting a task to in_review alone does not ask the user to review it. Do not claim notification or delivery without a successful receipt, and do not continue gated work until the required approval is recorded.", +]; diff --git a/skills/slack/SKILL.md b/skills/slack/SKILL.md index 9bffa57ef0e..63c5ca173a1 100644 --- a/skills/slack/SKILL.md +++ b/skills/slack/SKILL.md @@ -80,3 +80,13 @@ On a Slack-linked task, human messages sent from Paperclip and your final respon are mirrored into its Slack thread. Do not manually send the same final response again. Ordinary tasks and routines have no automatic Slack destination: perform the requested Slack send explicitly and report whether delivery was confirmed. + +On a Slack-linked task, when results are ready, include the outcome and accessible +deliverable links or supported attachments in your final response to the originating +Slack conversation. +Do not leave the result only on the Paperclip task. When the user must review a +plan, approve an action, or review a result, save the artifact and create the +required review interaction through the normal Paperclip workflow. Tell the user +what needs review and what action to take in the same Slack conversation. A saved +plan or an `in_review` status alone is not a review request. Keep approval gates +in place and do not claim delivery without a successful receipt.