Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(signals): tell scouts the close-out summary tool is a harness tool (#104788)

posthog[bot]9ba59db026bf
diff --git a/docs/internal/task-run-api.md b/docs/internal/task-run-api.md
index 07a64859823a..05f5a794aff4 100644
--- a/docs/internal/task-run-api.md
+++ b/docs/internal/task-run-api.md
@@ -59,6 +59,8 @@ Send a JSON object with a `summary` string of 1 to 1,500 characters after trimmi
The endpoint requires permission to control the task. A task-bound sandbox token can update only its own task.
The update does not complete the run or change its structured `output`.
Cloud agent runs write the summary through the `task_summary_update` local tool; local Desktop sessions do not have the tool.
+The tool belongs to the sandbox harness, so an agent calls it as `mcp__posthog-code-tools__task_summary_update`.
+It is not in the PostHog MCP catalog, so tool discovery through the `mcp__posthog__exec` dispatcher never returns it.
Generic run-state updates cannot change the summary or its inherited value.
A resumed run uses its source run's summary until it saves a new summary.
diff --git a/products/signals/backend/scout_harness/prompt.py b/products/signals/backend/scout_harness/prompt.py
index 8f189a2fa3fe..f5cdfe39caf5 100644
--- a/products/signals/backend/scout_harness/prompt.py
+++ b/products/signals/backend/scout_harness/prompt.py
@@ -171,6 +171,11 @@ def _governed_metrics_section(project_has_governed_metrics: bool) -> str:
return _GOVERNED_METRICS_NUDGE if project_has_governed_metrics else ""
+# The close-out summary tool is a sandbox harness tool, not a PostHog MCP tool, so it is absent from
+# the `mcp__posthog__exec` catalog and has to be called under its qualified name.
+_TASK_SUMMARY_TOOL = "task_summary_update"
+_TASK_SUMMARY_TOOL_ID = f"mcp__posthog-code-tools__{_TASK_SUMMARY_TOOL}"
+
# The close-out step is identical on every channel bar the word for what the run produces, and it is
# numbered differently (the report channel has an extra search step), so both are rendered from here.
_CLOSE_OUT_STEP_TEMPLATE = """{number}. **Close out.** End your turn with a JSON object matching the schema in *Output format* below. Its `summary` field is your run close-out; see *Writing the summary* for how to structure it. A quiet day is a real outcome: "looked, found nothing meaningful" is a genuine, useful summary, not a failure, so don't manufacture {output} to fill space. The harness parses the JSON and writes `summary` to the run row as searchable prose. Before that, call `task_summary_update` with the same close-out text, per *Writing the summary*."""
@@ -712,7 +717,7 @@ Your close-out `summary` renders in the scout's run history **collapsed to the f
Keep it a close-out, not a transcript: methodology and tool-by-tool narration belong in the task log.
-The `task_summary_update` tool holds the same close-out for the task run row, which is what a reader sees without opening the transcript. Send it the same verdict-first text you put in `summary`. Run ritual does not belong there: your skill version, the emit-eligibility gate, and a list of scratchpad keys tell a reader nothing about what you found."""
+The `{_TASK_SUMMARY_TOOL}` tool holds the same close-out for the task run row, which is what a reader sees without opening the transcript. It is a harness tool in your sandbox, so call it directly as `{_TASK_SUMMARY_TOOL_ID}`; it is not on the `mcp__posthog__exec` interface, per *How to call tools*. Send it the same verdict-first text you put in `summary`. Run ritual does not belong there: your skill version, the emit-eligibility gate, and a list of scratchpad keys tell a reader nothing about what you found."""
# Rendered only for a team whose knowledge base is reachable and looks maintained — the runner
# resolves `business_knowledge.is_maintained_for_team` per run (`business_knowledge_maintained`).
@@ -1383,6 +1388,8 @@ def build_run_prompt(
Every tool named in this prompt, the `scout-*` harness tools and all PostHog MCP tools alike, is invoked through the `mcp__posthog__exec` interface as `call <tool_name> <json>`, never as a direct tool call. Bare names like `skill-get`, `scout-project-profile-get`, or `{emit_tool}` are how you *refer* to a tool, so don't burn opening moves trying to invoke them directly. For any tool you haven't already used, `search <regex>` to find it and `info <tool_name>` to read its schema on that same interface, then `call` it. Search by prefix, one family at a time (`search ^scout-`, `search ^inbox-report`), and confirm a single name with `info <tool_name>`. Do not build one pattern that lists every tool you hold: `search` refuses a pattern over 800 characters. If a `scout-*` tool comes back unknown, the server may still expose it under its legacy `signals-scout-*` name: `search scout` and call whichever name the catalog returns.
+One tool named in this prompt is not on that interface: `{_TASK_SUMMARY_TOOL}`, the close-out summary tool. It is a harness tool your sandbox mounts, so call it directly as `{_TASK_SUMMARY_TOOL_ID}`. `search` and `info` on `mcp__posthog__exec` do not know it under any spelling, so a lookup there tells you nothing and is not a gap to report through `agent-feedback`. If the qualified name is not in your tool catalog, this run does not mount it: write the close-out in your final JSON `summary` as usual and move on.
+
# First: read your skill
Your bound skill is the brain of this run. *Your run identity*, at the end of this prompt, names it and pins its version. Before doing anything else, call:
diff --git a/products/signals/backend/test/test_scout_harness.py b/products/signals/backend/test/test_scout_harness.py
index 3ac1ed630553..3d203e2043c2 100644
--- a/products/signals/backend/test/test_scout_harness.py
+++ b/products/signals/backend/test/test_scout_harness.py
@@ -532,9 +532,32 @@ class TestCloseOutTaskSummary(SimpleTestCase):
close_out_step = next(line for line in prompt.splitlines() if "**Close out.**" in line)
writing_summary = prompt.split("# Writing the summary")[1].split("\n# ")[0]
+ how_to_call_tools = prompt.split("# How to call tools")[1].split("\n# ")[0]
assert "task_summary_update" in close_out_step
assert "task_summary_update" in writing_summary
+ # The close-out tool is a harness tool, not a PostHog MCP tool. Without the qualified name
+ # in both sections, the "every tool goes through mcp__posthog__exec" rule sends the scout
+ # to search a catalog the tool was never in, and the run row stays blank.
+ assert scout_prompt._TASK_SUMMARY_TOOL_ID in writing_summary
+ assert scout_prompt._TASK_SUMMARY_TOOL_ID in how_to_call_tools
+
+
+class TestCloseOutSummaryToolContract(SimpleTestCase):
+ _HARNESS_ROOT = Path(__file__).parents[3] / "desktop/packages/harness/src/extensions"
+
+ def test_prompt_names_the_tool_the_harness_registers(self) -> None:
+ # The prompt hardcodes the qualified tool id the scout calls. The harness owns both halves
+ # of that id, so a rename there leaves scouts calling a tool that no longer exists, with
+ # nothing in Python to catch it.
+ registry = (self._HARNESS_ROOT / "local-tools/registry.ts").read_text()
+ task_summary = (self._HARNESS_ROOT / "task-system-prompt/task-summary.ts").read_text()
+ server_name = re.search(r'LOCAL_TOOLS_MCP_NAME = "([^"]+)"', registry)
+ tool_name = re.search(r'TASK_SUMMARY_TOOL_NAME = "([^"]+)"', task_summary)
+ assert server_name and tool_name, "the harness constants moved — update this contract"
+
+ assert scout_prompt._TASK_SUMMARY_TOOL == tool_name.group(1)
+ assert scout_prompt._TASK_SUMMARY_TOOL_ID == f"mcp__{server_name.group(1)}__{tool_name.group(1)}"
class TestPromptCrossReferences(SimpleTestCase):