: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(signals): confirm a scout's repository correction landed (#99735)
posthog[bot]732a4dccb7cf
diff --git a/products/signals/backend/scout_harness/AGENTS.md b/products/signals/backend/scout_harness/AGENTS.mdindex 457bc6ab6aa4..daac98ae3b20 100644--- a/products/signals/backend/scout_harness/AGENTS.md+++ b/products/signals/backend/scout_harness/AGENTS.md@@ -178,7 +178,7 @@ In production it is driven by `SignalsScoutCoordinatorWorkflow` (periodic tick eHarness/tool code calls that service; it still never touches `SignalReport` or the embeddings pipeline directly. See `../scout_report/persistence.py` and the `scouts-emit-reports` spec.Both report-channel actions are tracked on the run as queryable columns: `emit_report` appends to `SignalScoutRun.emitted_report_ids` (via `_record_report_emit`), and `edit_report` appends — deduped — to `edited_report_ids` (via `record_report_edit`), so "which reports did this run author vs. edit?" is a column lookup, not an event-stream or artefact-log join. Both writes are best-effort and post-commit (an edit/emit never fails because its tally write did).`emit_report` is retry-safe, `edit_report` is not. Every emission is stored under a key (`_emit_idempotency_key`: the caller's `idempotency_key`, else a digest of the report's content, run-scoped either way) held by a partial unique index on `SignalReport.scout_idempotency_key`, so a retry after a proxy timeout returns the first report with `idempotent_replay` set instead of authoring a twin. The tool checks the key before the safety judge so a retry costs no LLM call; the index is what settles a retry that arrives while the first call is still judging, surfacing to the tool as `ScoutReportAlreadyEmittedError`. A replay never re-queues the Slack delivery or re-fires autostart, and books its own `idempotent_replay` outcome on `signals_scout_report_emitted` so retries stay measurable without counting as reports. This covers the transport failure only; telling a topic an earlier run already filed from a new one is still the scout's job (inbox search + the `report:` scratchpad pointer).-- A report's routing is correctable in place. `edit_report` takes `suggested_reviewers` and `repository`, each replacing what the report holds and re-running autostart, so a report that surfaced routed to no one, or against the wrong codebase, is fixed rather than re-filed as a duplicate. `repository` takes the same `owner/repo` / `NO_REPO` input `emit_report` does (`_normalize_repository`), and the selection it writes is `autostart_eligible` because a scout naming a repository is a decision, not the reading of the prose that `_refresh_inferred_repository` may overturn. Omitting the field leaves the report's target alone, and a repository-only edit changes Inbox routing without queueing another Slack report delivery.+- A report's routing is correctable in place. `edit_report` takes `suggested_reviewers` and `repository`, each replacing what the report holds and re-running autostart, so a report that surfaced routed to no one, or against the wrong codebase, is fixed rather than re-filed as a duplicate. `repository` takes the same `owner/repo` / `NO_REPO` input `emit_report` does (`_normalize_repository`), and the selection it writes is `autostart_eligible` because a scout naming a repository is a decision, not the reading of the prose that `_refresh_inferred_repository` may overturn. Omitting the field leaves the report's target alone, and a repository-only edit changes Inbox routing without queueing another Slack report delivery. The result's `repository` is the target the report holds once the edit settles, read back from the stored selection rather than echoed from the input, and a requested target the report did not take fails the call — `repository_set` alone reports only this process's intent, which a dropped field or a later write can outlive.- Report metrics are typed report content with a maximum of six entries. `metrics` on `emit_report` is the initial whole set. On `edit_report`, omit it or send null to preserve the current set, send `[]` to clear it, or send a list to replace it. A metrics-only edit changes Inbox content and does not queue another Slack report delivery.Every metric requires a bounded live `InsightVizNode`/`TrendsQuery` built only from `EventsNode` or `ActionsNode` sources. It rejects breakdown and compare mode and produces exactly one output series. An `affected_users` metric uses exactly one series with `math: dau`. An `affected_sessions` metric uses exactly one series with `math: unique_session`. Neither kind uses formulas or group math. Consumers derive `BoldNumber` for the whole-window value and `ActionsBar` for longitudinal buckets. List and detail responses omit legacy authored comparisons.Metrics default to `date_from: "-13d"` with a daily interval. This gives 14 inclusive buckets, including today. A longer window keeps only the trailing 14 strip buckets, while the whole-window value covers the full window. Do not author comparisons. Non-currency units are lowercase. Currency units use uppercase ISO codes such as `USD`.diff --git a/products/signals/backend/scout_harness/prompt.py b/products/signals/backend/scout_harness/prompt.pyindex f165ae60a132..42e79bd02dfa 100644--- a/products/signals/backend/scout_harness/prompt.py+++ b/products/signals/backend/scout_harness/prompt.py@@ -464,7 +464,7 @@ _EDIT_EVIDENCE_VS_NOTE = ("there, and the note is what still lands.")-_EDIT_REPOSITORY_BULLET = "- **Fix a misrouted report.** If a report points at the wrong codebase, set `repository` to the right `owner/repo` instead of authoring a duplicate that carries the correct one. It replaces the report's target and re-runs autostart, so a report that had no repository to open a PR against can now open a draft PR. Pass `NO_REPO` when nothing under version control could change, and omit the field entirely when the target is already right."+_EDIT_REPOSITORY_BULLET = "- **Fix a misrouted report.** If a report points at the wrong codebase, set `repository` to the right `owner/repo` instead of authoring a duplicate that carries the correct one. It replaces the report's target and re-runs autostart, so a report that had no repository to open a PR against can now open a draft PR. Pass `NO_REPO` when nothing under version control could change, and omit the field entirely when the target is already right. The response carries `repository`, the target the report holds afterwards — read it back to confirm the correction landed."_AUTHORING_VS_EDITING_REPORT_BOTH = f"""# Authoring vs. editing: search the inbox firstdiff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.pyindex ed708efe5f82..1396894b1e40 100644--- a/products/signals/backend/scout_harness/serializers.py+++ b/products/signals/backend/scout_harness/serializers.py@@ -1523,6 +1523,19 @@ class EditReportRequestSerializer(serializers.Serializer):),)+ def validate(self, attrs: dict) -> dict:+ """Reject a body field this serializer does not declare.++ The tool definition the scout reads and this endpoint deploy separately, so a scout can send a+ field a running backend does not know yet. DRF drops an undeclared key without a word, which+ turns a correction the caller asked for into a call that reports success and changes nothing.+ Failing the whole edit says so, and costs the caller a retry rather than a wrong report.+ """+ unknown = sorted(set(self.initial_data) - set(self.fields))+ if unknown:+ raise serializers.ValidationError(f"unknown fields: {', '.join(unknown)}")+ return attrs+class EditReportResponseSerializer(serializers.Serializer):report_id = serializers.CharField(help_text="Id of the edited report.")@@ -1538,6 +1551,14 @@ class EditReportResponseSerializer(serializers.Serializer):repository_set = serializers.BooleanField(help_text="Whether the report's repository was replaced (true for a cleared target too).")+ repository = serializers.CharField(+ allow_null=True,+ help_text=(+ "The repository the report points at now, read back from the report rather than echoed "+ "from the request; null when the report has no target. Compare it with the `repository` "+ "you sent to confirm the correction landed."+ ),+ )charts_set = serializers.IntegerField(allow_null=True,help_text=(diff --git a/products/signals/backend/scout_harness/tools/report.py b/products/signals/backend/scout_harness/tools/report.pyindex 8621044a1ab4..8b55f9aef36a 100644--- a/products/signals/backend/scout_harness/tools/report.py+++ b/products/signals/backend/scout_harness/tools/report.py@@ -247,6 +247,11 @@ class EditReportResult:# Nullable for the same reason `charts_set` is: taking the suggestions down reports 0, and 0# would otherwise mean both "cleared" and "never touched".suggested_prompts_set: int | None = None+ # The repository the report points at once the edit settled, read back from the stored selection+ # rather than echoed from the input. A caller that sent `repository` can compare the two: a+ # backend that dropped the field, or a later write that replaced the selection, shows as a target+ # the caller never asked for. None means the report has no target.+ repository: str | None = None# The report's effective title after the edit (the rewritten title, or the stored one for a# note/reviewer-only edit) — telemetry-only, so the edited lifecycle event can classify the report# (`_report_classification_props`) even when the edit didn't touch the title.@@ -783,6 +788,16 @@ def _refresh_inferred_repository(*, team_id: int, report_id: str, attribution: A)+def _settled_repository(report_id: str) -> str | None:+ """The repository the report points at right now, read from its stored selection."""+ from products.signals.backend.report_generation.select_repo import (+ persisted_repo_selection, # noqa: PLC0415 — keeps the sandbox stack off this module's import path+ )++ selection = persisted_repo_selection(report_id)+ return selection.repository if selection is not None else None++async def _resolve_report_repository(*,team_id: int,@@ -1847,6 +1862,38 @@ def _do_edit_report("signals_scout.edit_report: inferred repository refresh failed",extra={"team_id": team.id, "report_id": report_id},)+ # What the report holds once every write above has settled. The caller asked for a correction and+ # gets told whether the report took it, instead of a `repository_set` that only reports this+ # process's intent — a target that never reached the artefact leaves the report routed at the+ # wrong codebase, and the next implementation run works there.+ #+ # Best-effort read: the edit has already committed, so a transient failure degrades to "no target+ # known" rather than failing the call and inviting a retry that appends a second note.+ settled_repository: str | None = None+ try:+ settled_repository = _settled_repository(report_id)+ except Exception:+ logger.warning(+ "signals_scout.edit_report: failed to read back the report's repository",+ extra={"team_id": team.id, "report_id": report_id},+ )+ else:+ if repository is not None and settled_repository != (None if repository == NO_REPO else repository):+ # Raised before the autostart hand-off below: a report whose target is not the one this+ # edit named must not open a draft pull request on the strength of this call.+ logger.error(+ "signals_scout.edit_report: repository correction did not persist",+ extra={+ "team_id": team.id,+ "report_id": report_id,+ "requested": repository,+ "settled": settled_repository,+ },+ )+ raise InvalidScoutReportError(+ f"the repository correction did not persist: the report points at "+ f"{settled_repository or 'no repository'}, not {repository}"+ )# Record the edit on the run tally only when something actually changed — a no-op edit (e.g. a# title rewrite to its current value, or re-sending the charts already stored) must not claim the# run touched the report, or notify its destination a second time about nothing. Ordered BEFORE@@ -1905,6 +1952,7 @@ def _do_edit_report(charts_set=charts_set,metrics_set=metrics_set,suggested_prompts_set=prompts_set,+ repository=settled_repository,report_title=report_title,)return resultdiff --git a/products/signals/backend/scout_harness/views.py b/products/signals/backend/scout_harness/views.pyindex 452516d404e6..f484a87d4dae 100644--- a/products/signals/backend/scout_harness/views.py+++ b/products/signals/backend/scout_harness/views.py@@ -1183,7 +1183,9 @@ class SignalScoutRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):"ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to ""this scout. Reviewers and repository are how you rescue a report that surfaced routed to no one ""or against the wrong codebase: each replaces what the report holds and re-runs autostart, so a "- "report that was missing a qualifying reviewer or a repository can open a draft PR. "+ "report that was missing a qualifying reviewer or a repository can open a draft PR. The response "+ "carries the repository the report holds after the edit, and the call fails when a repository it "+ "named did not land. ""Title/summary edits are best-effort: the pipeline may later re-research them."),operation_id="signals_scout_edit_report",@@ -1225,6 +1227,7 @@ class SignalScoutRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):"evidence_appended": result.evidence_appended,"reviewers_set": result.reviewers_set,"repository_set": result.repository_set,+ "repository": result.repository,"charts_set": result.charts_set,"metrics_set": result.metrics_set,"suggested_prompts_set": result.suggested_prompts_set,diff --git a/products/signals/backend/test/test_scout_report_api.py b/products/signals/backend/test/test_scout_report_api.pyindex 052dfb7ca825..c91d4d420319 100644--- a/products/signals/backend/test/test_scout_report_api.py+++ b/products/signals/backend/test/test_scout_report_api.py@@ -56,6 +56,7 @@ CAPTURE_PATH = "products.signals.backend.scout_harness.tools.report.posthoganaly# The customer-facing copy lands in the scout's own team project via capture_internal (a network boundary).CAPTURE_INTERNAL_PATH = "products.signals.backend.scout_harness.tools.report.capture_internal"CONNECTED_REPOS_PATH = "products.signals.backend.scout_harness.tools.report._connected_repositories"+SET_REPOSITORY_PATH = "products.signals.backend.scout_harness.tools.report.set_scout_report_repository"_CONNECTED_REPOS = ["acme/widgets", "acme/gadgets"]REPORT_TOOLS = ["emit_report", "edit_report"]@@ -1060,6 +1061,9 @@ class TestScoutReportAPI(APIBaseTest):)assert response.status_code == status.HTTP_200_OK, response.json()assert response.json()["repository_set"] is True+ # Read back from the report, not echoed from the request: a correction the caller believes+ # landed but that the report never took leaves it routed at the wrong codebase.+ assert response.json()["repository"] == "acme/gadgets"selection = self._latest_artefact(report_id, SignalReportArtefact.ArtefactType.REPO_SELECTION)assert selection is not Nonecontent = json.loads(selection.content)@@ -1086,10 +1090,60 @@ class TestScoutReportAPI(APIBaseTest):)assert response.status_code == status.HTTP_200_OK, response.json()assert response.json()["repository_set"] is True+ assert response.json()["repository"] is Noneselection = self._latest_artefact(created["report_id"], SignalReportArtefact.ArtefactType.REPO_SELECTION)assert selection is not Noneassert json.loads(selection.content)["repository"] is None+ def test_edit_report_fails_when_the_repository_does_not_stick(self) -> None:+ # A write that reports success without moving the report is the failure this read-back exists+ # for: the scout takes the report as corrected, while every later run still works the old+ # codebase. The call fails instead, and autostart never runs for a target the report rejected.+ run = _make_run(self.team)+ with _safe_judge(), patch(EMBED_PATH), patch(AUTOSTART_PATH, new=AsyncMock()):+ created = self.client.post(+ self._emit_url(str(run.id)), data=self._payload(repository="acme/widgets"), format="json"+ ).json()+ with (+ _safe_judge(),+ patch(AUTOSTART_PATH, new=AsyncMock()) as autostart,+ patch(SET_REPOSITORY_PATH, return_value=True),+ ):+ response = self.client.post(+ self._edit_url(str(run.id)),+ data={"report_id": created["report_id"], "repository": "acme/gadgets"},+ format="json",+ )+ assert response.status_code == status.HTTP_400_BAD_REQUEST+ autostart.assert_not_awaited()+ selection = self._latest_artefact(created["report_id"], SignalReportArtefact.ArtefactType.REPO_SELECTION)+ assert selection is not None+ assert json.loads(selection.content)["repository"] == "acme/widgets"++ def test_edit_report_rejects_a_field_this_backend_does_not_know(self) -> None:+ # The tool definition a scout reads and this endpoint ship separately, so a scout can name a+ # field a running backend has yet to learn. Dropping it silently would apply the rest of the+ # edit and report success, which is how a correction disappears without anyone seeing it.+ run = _make_run(self.team)+ with _safe_judge(), patch(EMBED_PATH), patch(AUTOSTART_PATH, new=AsyncMock()):+ created = self.client.post(+ self._emit_url(str(run.id)), data=self._payload(repository="acme/widgets"), format="json"+ ).json()+ with _safe_judge() as judge:+ response = self.client.post(+ self._edit_url(str(run.id)),+ data={+ "report_id": created["report_id"],+ "append_note": "the fix belongs in the gadgets service",+ "repo": "acme/gadgets",+ },+ format="json",+ )+ assert response.status_code == status.HTTP_400_BAD_REQUEST+ judge.assert_not_awaited()+ note = self._latest_artefact(created["report_id"], SignalReportArtefact.ArtefactType.NOTE)+ assert note is None or "gadgets service" not in note.content+@parameterized.expand([("no_slash", "not-a-repo"),diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex c7dfced4270d..798ad149410b 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -4175,6 +4175,11 @@ export interface EditReportResponseApi {reviewers_set: boolean/** Whether the report's repository was replaced (true for a cleared target too). */repository_set: boolean+ /**+ * The repository the report points at now, read back from the report rather than echoed from the request; null when the report has no target. Compare it with the `repository` you sent to confirm the correction landed.+ * @nullable+ */+ repository: string | null/*** How many charts the report now shows, or null if the edit left its charts as they were (the field omitted, or a re-send of what was already stored). 0 means the edit took the report's charts down.* @nullablediff --git a/products/signals/frontend/generated/api.ts b/products/signals/frontend/generated/api.tsindex e0fcf0805869..93fd767b5526 100644--- a/products/signals/frontend/generated/api.ts+++ b/products/signals/frontend/generated/api.ts@@ -1308,7 +1308,7 @@ export const getSignalsScoutEditReportUrl = (projectId: string, runId: string) =}/**- * Rewrite a report's title/summary, append a note or fresh evidence, set its suggested reviewers, and/or point it at another repository. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Reviewers and repository are how you rescue a report that surfaced routed to no one or against the wrong codebase: each replaces what the report holds and re-runs autostart, so a report that was missing a qualifying reviewer or a repository can open a draft PR. Title/summary edits are best-effort: the pipeline may later re-research them.+ * Rewrite a report's title/summary, append a note or fresh evidence, set its suggested reviewers, and/or point it at another repository. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Reviewers and repository are how you rescue a report that surfaced routed to no one or against the wrong codebase: each replaces what the report holds and re-runs autostart, so a report that was missing a qualifying reviewer or a repository can open a draft PR. The response carries the repository the report holds after the edit, and the call fails when a repository it named did not land. Title/summary edits are best-effort: the pipeline may later re-research them.* @summary Edit an existing report for a run*/export const signalsScoutEditReport = async (diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.tsindex 0ae671b4ab95..bf65ece97dbf 100644--- a/products/signals/frontend/generated/api.zod.ts+++ b/products/signals/frontend/generated/api.zod.ts@@ -1053,7 +1053,7 @@ export const SignalsScoutNotesCreateBody = /* @__PURE__ */ zod.describe('Request body for `notes-create`.')/**- * Rewrite a report's title/summary, append a note or fresh evidence, set its suggested reviewers, and/or point it at another repository. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Reviewers and repository are how you rescue a report that surfaced routed to no one or against the wrong codebase: each replaces what the report holds and re-runs autostart, so a report that was missing a qualifying reviewer or a repository can open a draft PR. Title/summary edits are best-effort: the pipeline may later re-research them.+ * Rewrite a report's title/summary, append a note or fresh evidence, set its suggested reviewers, and/or point it at another repository. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Reviewers and repository are how you rescue a report that surfaced routed to no one or against the wrong codebase: each replaces what the report holds and re-runs autostart, so a report that was missing a qualifying reviewer or a repository can open a draft PR. The response carries the repository the report holds after the edit, and the call fails when a repository it named did not land. Title/summary edits are best-effort: the pipeline may later re-research them.* @summary Edit an existing report for a run*/export const signalsScoutEditReportBodyTitleMax = 300diff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yamlindex 286991fbe89f..0be5b1fa873f 100644--- a/products/signals/mcp/tools.yaml+++ b/products/signals/mcp/tools.yaml@@ -546,8 +546,10 @@ tools:a report routed to the wrong codebase: pass `owner/repo` to replace the report's target in place, ratherthan authoring a duplicate that carries the right one, or the `NO_REPO` sentinel for a report where nothingunder version control could change. It re-runs autostart too, and omitting it leaves the report's target- alone. Prefer `append_note` over rewriting a report you didn't author (additive and audit-friendly);- title/summary edits are best-effort, since the pipeline may later re-research and overwrite them. Optional+ alone. The response carries `repository`, the target the report holds after the edit, read back from the+ report — check it against what you sent, because the call fails when a correction you named did not land.+ Prefer `append_note` over rewriting a report you didn't author (additive and audit-friendly); title/summary+ edits are best-effort, since the pipeline may later re-research and overwrite them. Optional`append_evidence` adds observations to the report's evidence rail, each becoming a bound signal that movesthe report's signal count and weight — use it for a new observation a reader should be able to check, and`append_note` for commentary. Optional `charts` is the full set of queries the inbox renders on the report —diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 2f1c041ef04c..4bac634e6140 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -9854,7 +9854,7 @@}},"scout-edit-report": {- "description": "The report channel's edit half: rewrite a report's `title`/`summary`, append a note, set its `suggested_reviewers`, and/or point it at another `repository`. Can target ANY of the project's inbox reports, not just scout-authored ones — the edit is attributed to this scout. Setting reviewers is how you rescue a report that surfaced routed to no one: it replaces the reviewer list and re-runs autostart, so a report missing a qualifying reviewer can open a draft PR. Each reviewer is a `github_login` and/or a PostHog `user_uuid` (resolved server-side to the linked GitHub login). Optional `repository` is the same rescue for a report routed to the wrong codebase: pass `owner/repo` to replace the report's target in place, rather than authoring a duplicate that carries the right one, or the `NO_REPO` sentinel for a report where nothing under version control could change. It re-runs autostart too, and omitting it leaves the report's target alone. Prefer `append_note` over rewriting a report you didn't author (additive and audit-friendly); title/summary edits are best-effort, since the pipeline may later re-research and overwrite them. Optional `append_evidence` adds observations to the report's evidence rail, each becoming a bound signal that moves the report's signal count and weight — use it for a new observation a reader should be able to check, and `append_note` for commentary. Optional `charts` is the full set of queries the inbox renders on the report — it replaces the report's charts rather than adding to them (omit it to leave them alone), so read the report first when you mean to add one. Optional `metrics` is the report's complete typed impact-metric set: omit it or send null to preserve the set, send an empty list to clear it, or send the complete replacement. Every submitted metric requires a bounded live InsightVizNode/TrendsQuery built only from EventsNode or ActionsNode sources, with no more than 1,000 estimated longitudinal points; its snapshot is only an optional cached fallback. An affected-users metric uses one series with `math: dau`. Consumers derive a `BoldNumber` query for each metric's whole-window `aggregated_value` and an `ActionsBar` query for its longitudinal buckets; never sum affected-user buckets. NOT idempotent - a retried `append_note` appends a second note. Opt-in: only available to scouts that list `edit_report` in their skill's `allowed_tools`.",+ "description": "The report channel's edit half: rewrite a report's `title`/`summary`, append a note, set its `suggested_reviewers`, and/or point it at another `repository`. Can target ANY of the project's inbox reports, not just scout-authored ones — the edit is attributed to this scout. Setting reviewers is how you rescue a report that surfaced routed to no one: it replaces the reviewer list and re-runs autostart, so a report missing a qualifying reviewer can open a draft PR. Each reviewer is a `github_login` and/or a PostHog `user_uuid` (resolved server-side to the linked GitHub login). Optional `repository` is the same rescue for a report routed to the wrong codebase: pass `owner/repo` to replace the report's target in place, rather than authoring a duplicate that carries the right one, or the `NO_REPO` sentinel for a report where nothing under version control could change. It re-runs autostart too, and omitting it leaves the report's target alone. The response carries `repository`, the target the report holds after the edit, read back from the report — check it against what you sent, because the call fails when a correction you named did not land. Prefer `append_note` over rewriting a report you didn't author (additive and audit-friendly); title/summary edits are best-effort, since the pipeline may later re-research and overwrite them. Optional `append_evidence` adds observations to the report's evidence rail, each becoming a bound signal that moves the report's signal count and weight — use it for a new observation a reader should be able to check, and `append_note` for commentary. Optional `charts` is the full set of queries the inbox renders on the report — it replaces the report's charts rather than adding to them (omit it to leave them alone), so read the report first when you mean to add one. Optional `metrics` is the report's complete typed impact-metric set: omit it or send null to preserve the set, send an empty list to clear it, or send the complete replacement. Every submitted metric requires a bounded live InsightVizNode/TrendsQuery built only from EventsNode or ActionsNode sources, with no more than 1,000 estimated longitudinal points; its snapshot is only an optional cached fallback. An affected-users metric uses one series with `math: dau`. Consumers derive a `BoldNumber` query for each metric's whole-window `aggregated_value` and an `ActionsBar` query for its longitudinal buckets; never sum affected-user buckets. NOT idempotent - a retried `append_note` appends a second note. Opt-in: only available to scouts that list `edit_report` in their skill's `allowed_tools`.","category": "Signals","feature": "signals","summary": "Edit an existing report for a run",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex faacf424aa82..9d21e2ec886c 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -10426,7 +10426,7 @@}},"scout-edit-report": {- "description": "The report channel's edit half: rewrite a report's `title`/`summary`, append a note, set its `suggested_reviewers`, and/or point it at another `repository`. Can target ANY of the project's inbox reports, not just scout-authored ones — the edit is attributed to this scout. Setting reviewers is how you rescue a report that surfaced routed to no one: it replaces the reviewer list and re-runs autostart, so a report missing a qualifying reviewer can open a draft PR. Each reviewer is a `github_login` and/or a PostHog `user_uuid` (resolved server-side to the linked GitHub login). Optional `repository` is the same rescue for a report routed to the wrong codebase: pass `owner/repo` to replace the report's target in place, rather than authoring a duplicate that carries the right one, or the `NO_REPO` sentinel for a report where nothing under version control could change. It re-runs autostart too, and omitting it leaves the report's target alone. Prefer `append_note` over rewriting a report you didn't author (additive and audit-friendly); title/summary edits are best-effort, since the pipeline may later re-research and overwrite them. Optional `append_evidence` adds observations to the report's evidence rail, each becoming a bound signal that moves the report's signal count and weight — use it for a new observation a reader should be able to check, and `append_note` for commentary. Optional `charts` is the full set of queries the inbox renders on the report — it replaces the report's charts rather than adding to them (omit it to leave them alone), so read the report first when you mean to add one. Optional `metrics` is the report's complete typed impact-metric set: omit it or send null to preserve the set, send an empty list to clear it, or send the complete replacement. Every submitted metric requires a bounded live InsightVizNode/TrendsQuery built only from EventsNode or ActionsNode sources, with no more than 1,000 estimated longitudinal points; its snapshot is only an optional cached fallback. An affected-users metric uses one series with `math: dau`. Consumers derive a `BoldNumber` query for each metric's whole-window `aggregated_value` and an `ActionsBar` query for its longitudinal buckets; never sum affected-user buckets. NOT idempotent - a retried `append_note` appends a second note. Opt-in: only available to scouts that list `edit_report` in their skill's `allowed_tools`.",+ "description": "The report channel's edit half: rewrite a report's `title`/`summary`, append a note, set its `suggested_reviewers`, and/or point it at another `repository`. Can target ANY of the project's inbox reports, not just scout-authored ones — the edit is attributed to this scout. Setting reviewers is how you rescue a report that surfaced routed to no one: it replaces the reviewer list and re-runs autostart, so a report missing a qualifying reviewer can open a draft PR. Each reviewer is a `github_login` and/or a PostHog `user_uuid` (resolved server-side to the linked GitHub login). Optional `repository` is the same rescue for a report routed to the wrong codebase: pass `owner/repo` to replace the report's target in place, rather than authoring a duplicate that carries the right one, or the `NO_REPO` sentinel for a report where nothing under version control could change. It re-runs autostart too, and omitting it leaves the report's target alone. The response carries `repository`, the target the report holds after the edit, read back from the report — check it against what you sent, because the call fails when a correction you named did not land. Prefer `append_note` over rewriting a report you didn't author (additive and audit-friendly); title/summary edits are best-effort, since the pipeline may later re-research and overwrite them. Optional `append_evidence` adds observations to the report's evidence rail, each becoming a bound signal that moves the report's signal count and weight — use it for a new observation a reader should be able to check, and `append_note` for commentary. Optional `charts` is the full set of queries the inbox renders on the report — it replaces the report's charts rather than adding to them (omit it to leave them alone), so read the report first when you mean to add one. Optional `metrics` is the report's complete typed impact-metric set: omit it or send null to preserve the set, send an empty list to clear it, or send the complete replacement. Every submitted metric requires a bounded live InsightVizNode/TrendsQuery built only from EventsNode or ActionsNode sources, with no more than 1,000 estimated longitudinal points; its snapshot is only an optional cached fallback. An affected-users metric uses one series with `math: dau`. Consumers derive a `BoldNumber` query for each metric's whole-window `aggregated_value` and an `ActionsBar` query for its longitudinal buckets; never sum affected-user buckets. NOT idempotent - a retried `append_note` appends a second note. Opt-in: only available to scouts that list `edit_report` in their skill's `allowed_tools`.","category": "Signals","feature": "signals","summary": "Edit an existing report for a run",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 5435aa076d1b..43da16201bd9 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -31266,6 +31266,11 @@ export namespace Schemas {reviewers_set: boolean;/** Whether the report's repository was replaced (true for a cleared target too). */repository_set: boolean;+ /**+ * The repository the report points at now, read back from the report rather than echoed from the request; null when the report has no target. Compare it with the `repository` you sent to confirm the correction landed.+ * @nullable+ */+ repository: string | null;/*** How many charts the report now shows, or null if the edit left its charts as they were (the field omitted, or a re-send of what was already stored). 0 means the edit took the report's charts down.* @nullablediff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex dfbeff4c9371..0b690149d28f 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -1449,7 +1449,7 @@ export const SignalsScoutRunsRetrieveParams = () => zod.object({})/**- * Rewrite a report's title/summary, append a note or fresh evidence, set its suggested reviewers, and/or point it at another repository. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Reviewers and repository are how you rescue a report that surfaced routed to no one or against the wrong codebase: each replaces what the report holds and re-runs autostart, so a report that was missing a qualifying reviewer or a repository can open a draft PR. Title/summary edits are best-effort: the pipeline may later re-research them.+ * Rewrite a report's title/summary, append a note or fresh evidence, set its suggested reviewers, and/or point it at another repository. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Reviewers and repository are how you rescue a report that surfaced routed to no one or against the wrong codebase: each replaces what the report holds and re-runs autostart, so a report that was missing a qualifying reviewer or a repository can open a draft PR. The response carries the repository the report holds after the edit, and the call fails when a repository it named did not land. Title/summary edits are best-effort: the pipeline may later re-research them.* @summary Edit an existing report for a run*/export const SignalsScoutEditReportParams = () => zod.object({