: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
feat(signals): finish the report-check authoring hardening for scouts (#103103)
posthog[bot]945f520463a9
diff --git a/products/signals/backend/report_metrics.py b/products/signals/backend/report_metrics.pyindex 1d2fa6d77354..5dbd7f2b179a 100644--- a/products/signals/backend/report_metrics.py+++ b/products/signals/backend/report_metrics.py@@ -29,6 +29,10 @@ from products.signals.backend.report_charts import validate_report_query_METRIC_ID_RE = re.compile(r"^[a-z0-9][a-z0-9_-]*$")_RELATIVE_DATE_FROM_RE = re.compile(r"^-([1-9]\d*)(h|d|w|m|y)$")+_RELATIVE_DATE_FROM_ERROR = (+ "query.source.dateRange.date_from must be a relative window such as `-30d`, because the query runs again "+ "later and must measure the same trailing period each time"+)MAX_REPORT_METRICS = 6MAX_REPORT_METRICS_QUERY_CHARS = 60_000@@ -267,13 +271,13 @@ def validate_live_metric_query(value: dict[str, Any]) -> dict[str, Any]:value = {**value, "source": source}date_range = source.get("dateRange")if not isinstance(date_range, dict):- raise ValueError("query.source.dateRange.date_from must be a relative time window such as `-30d`")+ raise ValueError(_RELATIVE_DATE_FROM_ERROR)date_from = date_range.get("date_from")if not isinstance(date_from, str):- raise ValueError("query.source.dateRange.date_from must be a relative time window such as `-30d`")+ raise ValueError(_RELATIVE_DATE_FROM_ERROR)relative_window = _RELATIVE_DATE_FROM_RE.fullmatch(date_from)if relative_window is None:- raise ValueError("query.source.dateRange.date_from must be a relative time window such as `-30d`")+ raise ValueError(_RELATIVE_DATE_FROM_ERROR)amount, unit = relative_window.groups()window_seconds = int(amount) * _RELATIVE_WINDOW_SECONDS[unit]if window_seconds > MAX_LIVE_METRIC_WINDOW_DAYS * _RELATIVE_WINDOW_SECONDS["d"]:diff --git a/products/signals/backend/scout_harness/prompt.py b/products/signals/backend/scout_harness/prompt.pyindex bec053ee9579..425a302da81d 100644--- a/products/signals/backend/scout_harness/prompt.py+++ b/products/signals/backend/scout_harness/prompt.py@@ -283,11 +283,11 @@ Surfacing a finding is half the job: nothing automatically tells you whether theIf the `scout_fleet` roster shows `signals-scout-inbox-validation` running here with `emit` on, re-measuring **resolved inbox reports** is its territory, so keep yours to the follow-ups only you track. It enqueues only reports resolved in about the last 14 days, though, so an older one of yours is still yours: dropped by both is the outcome this queue exists to prevent."""-# The check channel. `task:write` reaches the check tools from any posture, so the gate here is not-# about scope like the re-surface clause: it is about having a report to hang a check on. A-# signal-channel scout holds a finding id and no report, so it keeps the scratchpad queue as its-# whole loop.-_FOLLOWUP_CHECK_ON_REPORT = """- **A follow-up that hangs on a report belongs on the report.** A scratchpad entry is yours alone, so a run that never comes back to it leaves the loop open and nobody else can see that it is open. When the expectation sits on a report — one you authored, or one that covers your finding — write it onto the report with `scout-report-check-create` and let the coordinator do the re-measuring. A check carries the same expectation, probe, and validate-after date the entry above holds. Choose `metric_threshold` when one number settles the claim, and the coordinator measures it with no run at all. Choose `agent` when the claim needs investigating, and a run is dispatched to answer it later. Either way the verdict lands on the report where a person reads it. Read `scout-report-check-list` before you add one, since a report carries at most 5 open checks and a sibling may already watch your claim. Keep a scratchpad entry for what no report covers, and name the check id in the entry when you write both, so you never re-measure what the coordinator already measured.+# The check channel. The check tools need `signal_scout_report:write` plus the `edit_report` tool+# grant, which the caller below already checks. The extra gate here is about having a report to hang+# a check on: a signal-channel scout holds a finding id and no report, so it keeps the scratchpad+# queue as its whole loop.+_FOLLOWUP_CHECK_ON_REPORT = """- **A follow-up that hangs on a report belongs on the report.** A scratchpad entry is yours alone, so a run that never comes back to it leaves the loop open and nobody else can see that it is open. When the expectation sits on a report — one you authored, or one that covers your finding — write it onto the report with `scout-report-check-create` and let the coordinator do the re-measuring. A check carries the same expectation, probe, and validate-after date the entry above holds. Choose `metric_threshold` when one number settles the claim, and the coordinator measures it with no run at all. Choose `agent` when the claim needs investigating, and a run is dispatched to answer it later. Either way the verdict lands on the report where a person reads it. Read `scout-report-check-list` before you add one, since a report carries at most 5 open checks and a sibling may already watch your claim. Keep a scratchpad entry for what no report covers, and name the check id in the entry when you write both, so you never re-measure what the coordinator already measured. Cancel a check you wrote in error with `scout-report-check-cancel`, before its first run."""_FOLLOWUP_RESURFACE_SIGNAL = (@@ -632,7 +632,7 @@ _REPORT_CHARTS = f"""# Attaching charts- **A chart renders data, it does not run code.** HogVM `bytecode`, a nested `HogQuery`, `sendRawQuery`, and a nested `SuggestedQuestionsQuery` (whose runner would buy an LLM completion per reader) are each refused wherever they sit in the node. A warehouse query is fine through HogQL: keep `connectionId`, drop `sendRawQuery`.- **Place it from the summary.** A markdown link with a `chart:` target, `[Daily signups](chart:signups-drop)`, draws the chart at that point in the body; reference it once, since repeating doesn't draw a second copy, and an unreferenced chart still renders after the prose. Two references in one paragraph sit side by side, so give a pair you want compared a paragraph of their own; one inside a table cell or heading has no room to draw, so its chart falls to the end. The inbox sizes a chart from its query, so set `size` (`small`, `medium`, `large`) only when it gets that wrong.- **Write prose that stands on its own.** A report can also be delivered to Slack, where nothing draws a chart and a reference degrades to its plain label. "Signups fell 60% over the week" survives that; "the chart below shows the drop" leaves a Slack reader with nothing.-- **Pin the window** to absolute dates wherever the node supports it, so the reader sees the data you wrote about rather than whatever a relative range resolves to days later.+- **Pin the window** to absolute dates wherever the node supports it, so the reader sees the data you wrote about rather than whatever a relative range resolves to days later. This holds for charts alone. A metric and a follow-up check measure the period before each run, so each one needs a relative `dateRange.date_from` and an empty `date_to`. An absolute window is refused there.- **At most {MAX_REPORT_CHARTS} per report**, far more than most reports should use. Every chart runs its query when someone opens the report, so three charts a reader studies beat a dozen they scroll past.- **`charts` on an edit is the report's whole set, not an addition.** It replaces what the report had, the way `summary` replaces the summary, so to keep a chart send it again (`inbox-reports-retrieve` returns the current `charts` to start from). Leave `charts` out entirely and the report keeps the ones it has; send `charts: []` to take them all down, which is what you want once the finding has moved on and the old chart would mislead. When an edit advances the report's evidence window, re-send the chart under the same `chart_id` with a refreshed window: fresh numbers beside a chart still pinned to the original dates read as a report gone stale.@@ -1345,7 +1345,7 @@ def build_run_prompt(- **team_id**: `{team_id}`, implicit on every MCP call.- **skill_name**: `{skill.name}`, your steering layer.- **skill_version**: `{skill.version}`, the version it is pinned to, written as a bare number and never `v`-prefixed. `skill_name` and `skill_version` are the two arguments the `skill-get` call in *First: read your skill* takes.{authors_line}-- **run_id**: `{run_id}`, passed when calling `{emit_tool}`.+- **run_id**: `{run_id}`, passed to every `scout-*` tool that takes it, including `{emit_tool}` and the report-check tools.- **started_at**: `{started_at_iso}`, when this run began (UTC). Informational; use current clock time for queries about "now"."""# Everything above this block is identical across runs of the same channel, so both runtimes'# prefix caches can reuse it. Every per-team and per-run interpolation belongs here, per-team@@ -1367,7 +1367,7 @@ def build_run_prompt(return f"""{intro}# How to call tools-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. 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.+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.# First: read your skilldiff --git a/products/signals/backend/test/test_report_metrics.py b/products/signals/backend/test/test_report_metrics.pyindex 6a6c8acffed2..0fa54e684dbe 100644--- a/products/signals/backend/test/test_report_metrics.py+++ b/products/signals/backend/test/test_report_metrics.py@@ -270,7 +270,7 @@ class TestReportMetric(SimpleTestCase):content = _affected_users_metric().model_dump(mode="json")content["query"]["source"]["dateRange"]["date_from"] = date_from- with self.assertRaisesRegex(ValidationError, "relative time window|must not exceed"):+ with self.assertRaisesRegex(ValidationError, "relative window|must not exceed"):ReportMetric.model_validate(content)for date_from in ("-8784h", "-366d", "-52w", "-12m", "-1y"):diff --git a/products/signals/backend/test/test_scout_harness.py b/products/signals/backend/test/test_scout_harness.pyindex 75e773af04e9..bc65ca0803cb 100644--- a/products/signals/backend/test/test_scout_harness.py+++ b/products/signals/backend/test/test_scout_harness.py@@ -1328,6 +1328,8 @@ class TestPromptBuilder(BaseTest):# whose skill does not list `edit_report`, so only such a scout is pointed at them.if "edit_report" in allowed_tools:assert "scout-report-check-create" in section.split("# ")[0]+ # A check written in error stays on the report unless the scout knows it can withdraw it.+ assert "scout-report-check-cancel" in section.split("# ")[0]else:assert "scout-report-check" not in promptdiff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yamlindex 18f8ca2779d9..c5faf7f0dffa 100644--- a/products/signals/mcp/tools.yaml+++ b/products/signals/mcp/tools.yaml@@ -112,6 +112,20 @@ tools:Replace the `content` of an existing artefact, addressed by its id, when new information supersedes it. Thenew content is validated against the artefact type's schema. Editing the latest row of a status type changesthe report's canonical status; to re-assess while keeping history, append a new artefact instead.+ inbox-report-checks-create:+ operation: signals_scout_report_check_create+ enabled: true+ scopes:+ - signal_scout_report:write+ annotations:+ readOnly: false+ destructive: false+ idempotent: false+ title: Write a follow-up check (removed)+ description: >+ Removed. A scout run writes checks with scout-report-check-create, and the research pipeline writes its own;+ there is no create surface for a person or a task token. Read a report's checks with+ inbox-report-checks-list.inbox-report-checks-list:operation: signals_report_checks_listenabled: true@@ -913,6 +927,19 @@ tools:this before writing a check: a report already carrying one for the same claim needs no second, and a reportholds at most five open checks at a time. A `pending` check is waiting for the report to resolve before itsclock starts; every status other than `pending` and `active` is terminal.+ scout-report-checks-list:+ operation: signals_scout_report_checks_list+ enabled: true+ scopes:+ - signal_scout_report:write+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ title: List a report's follow-up checks (deprecated)+ description:+ 'DEPRECATED: renamed to scout-report-check-list. This alias forwards to the same endpoint and will be+ removed. Call scout-report-check-list directly with the same arguments.'scout-run-now:operation: signals_scout_config_runenabled: truediff --git a/products/signals/skills/authoring-scouts/references/report-contract.md b/products/signals/skills/authoring-scouts/references/report-contract.mdindex 21216fdd0250..fc24c27ef8db 100644--- a/products/signals/skills/authoring-scouts/references/report-contract.md+++ b/products/signals/skills/authoring-scouts/references/report-contract.md@@ -376,7 +376,7 @@ A reference inside a code span, a table cell, or a heading has no room to drawOnly `InsightVizNode` and `SavedInsightNode` charts render there, at most three per report with referenced charts first; a `DataVisualizationNode` chart shows only in the inbox."Signups fell 60% over the week" survives that; "the chart below shows the drop" leaves a Slack reader with nothing.-**Pin the window** to absolute dates wherever the node supports it, so a reader opening the report days later sees the data you wrote about rather than whatever a relative range resolves to then.+**Pin the window** to absolute dates wherever the node supports it, so a reader opening the report days later sees the data you wrote about rather than whatever a relative range resolves to then. This holds for charts alone. A metric and a follow-up check measure the period before each run, so each one needs a relative `dateRange.date_from` and an empty `date_to`. An absolute window is refused there.**`charts` on an edit is the report's whole set, not an addition.**It replaces what the report had, the way `summary` replaces the summary — so send every chart you want kept, and re-send an id under a newer window to refresh that chart.diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex cfc8761c9540..09ba67f601c2 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -6018,6 +6018,20 @@"readOnlyHint": false}},+ "inbox-report-checks-create": {+ "description": "Removed. A scout run writes checks with scout-report-check-create, and the research pipeline writes its own; there is no create surface for a person or a task token. Read a report's checks with inbox-report-checks-list.",+ "category": "Signals",+ "feature": "signals",+ "summary": "Write a follow-up check (removed)",+ "title": "Write a follow-up check (removed)",+ "required_scopes": ["signal_scout_report:write"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ }+ },"inbox-report-checks-list": {"description": "List the follow-up checks on one report, newest first. Each row carries the expectation and why it was written, its schedule (`next_run_at`, `run_interval_minutes`, `runs_remaining`, `expires_at`), its `status` (`pending`, `active`, `passed`, `failed`, `errored`, `expired`, or `cancelled`) and its `last_outcome`. A `pending` check waits for its report to resolve before its clock starts. Checks are written by scout runs and by the research pipeline, so this surface reads them and does not create them. `query` and `baseline_value` read as null when you cannot read the data they describe.","category": "Signals",@@ -10176,6 +10190,20 @@"readOnlyHint": true}},+ "scout-report-checks-list": {+ "description": "DEPRECATED: renamed to scout-report-check-list. This alias forwards to the same endpoint and will be removed. Call scout-report-check-list directly with the same arguments.",+ "category": "Signals",+ "feature": "signals",+ "summary": "List a report's follow-up checks (deprecated)",+ "title": "List a report's follow-up checks (deprecated)",+ "required_scopes": ["signal_scout_report:write"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ }+ },"scout-run-now": {"description": "Dispatch one on-demand run of a scout by its config `id`, regardless of its schedule — useful to test a scout right after authoring it, or to refresh its findings on demand. The run executes asynchronously and inherits the scheduled path's guards: it returns 429 if the project is over its Signals credits quota or its daily scout-run budget, and 409 if a run for this scout is already in progress. A manual run counts against the same daily run budget the scheduled runs draw from, so avoid triggering repeated runs of the same scout in a short window — each one consumes the project's scout-run allowance for the day. A manual run does not change the scout's schedule, and a disabled scout can still be run this way (to test before enabling). Pass an optional `note` to steer this run alone (\"focus on the checkout regression\"): the agent reads it next to the scout's durable notes and weighs it the same way, and it is never read by another run — use it instead of `scout-notes-create`, which would also steer every later scheduled run. A run carrying a note needs `llm_skill:write` as well, since the agent reads the note verbatim while holding privileged tools. Returns the workflow id immediately — poll `scout-runs-list` for the resulting run and its findings.","category": "Signals",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex ddf78e8b7c88..62adee325c78 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -6215,6 +6215,20 @@"readOnlyHint": false}},+ "inbox-report-checks-create": {+ "description": "Removed. A scout run writes checks with scout-report-check-create, and the research pipeline writes its own; there is no create surface for a person or a task token. Read a report's checks with inbox-report-checks-list.",+ "category": "Signals",+ "feature": "signals",+ "summary": "Write a follow-up check (removed)",+ "title": "Write a follow-up check (removed)",+ "required_scopes": ["signal_scout_report:write"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ }+ },"inbox-report-checks-list": {"description": "List the follow-up checks on one report, newest first. Each row carries the expectation and why it was written, its schedule (`next_run_at`, `run_interval_minutes`, `runs_remaining`, `expires_at`), its `status` (`pending`, `active`, `passed`, `failed`, `errored`, `expired`, or `cancelled`) and its `last_outcome`. A `pending` check waits for its report to resolve before its clock starts. Checks are written by scout runs and by the research pipeline, so this surface reads them and does not create them. `query` and `baseline_value` read as null when you cannot read the data they describe.","category": "Signals",@@ -10748,6 +10762,20 @@"readOnlyHint": true}},+ "scout-report-checks-list": {+ "description": "DEPRECATED: renamed to scout-report-check-list. This alias forwards to the same endpoint and will be removed. Call scout-report-check-list directly with the same arguments.",+ "category": "Signals",+ "feature": "signals",+ "summary": "List a report's follow-up checks (deprecated)",+ "title": "List a report's follow-up checks (deprecated)",+ "required_scopes": ["signal_scout_report:write"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ }+ },"scout-run-now": {"description": "Dispatch one on-demand run of a scout by its config `id`, regardless of its schedule — useful to test a scout right after authoring it, or to refresh its findings on demand. The run executes asynchronously and inherits the scheduled path's guards: it returns 429 if the project is over its Signals credits quota or its daily scout-run budget, and 409 if a run for this scout is already in progress. A manual run counts against the same daily run budget the scheduled runs draw from, so avoid triggering repeated runs of the same scout in a short window — each one consumes the project's scout-run allowance for the day. A manual run does not change the scout's schedule, and a disabled scout can still be run this way (to test before enabling). Pass an optional `note` to steer this run alone (\"focus on the checkout regression\"): the agent reads it next to the scout's durable notes and weighs it the same way, and it is never read by another run — use it instead of `scout-notes-create`, which would also steer every later scheduled run. A run carrying a note needs `llm_skill:write` as well, since the agent reads the note verbatim while holding privileged tools. Returns the workflow id immediately — poll `scout-runs-list` for the resulting run and its findings.","category": "Signals",diff --git a/services/mcp/src/tools/exec.ts b/services/mcp/src/tools/exec.tsindex afd4f833a5b3..a3bd1346002b 100644--- a/services/mcp/src/tools/exec.ts+++ b/services/mcp/src/tools/exec.ts@@ -29,9 +29,11 @@ import {type ZodObjectAny,} from './types'-/** Upper bound on a `search` regex pattern — keeps a pathological pattern from- * forcing catastrophic backtracking against tool metadata. */-const MAX_SEARCH_PATTERN_LENGTH = 400+/** Upper bound on the size of a `search` regex — wide enough for an anchored+ * alternation of a whole toolset, the longest pattern an agent composes.+ * Length is all it bounds: matching cost rides on the pattern's shape, and a+ * dozen characters are enough to backtrack catastrophically. */+const MAX_SEARCH_PATTERN_LENGTH = 800/** Advertised on `tools/list` and on the runtime Tool. OpenAI's plugin verifier* requires these three hints (plus idempotent) to be present, not just defineddiff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.tsindex 1cc54645595e..e8f846d19327 100644--- a/services/mcp/src/tools/generated/signals.ts+++ b/services/mcp/src/tools/generated/signals.ts@@ -147,6 +147,59 @@ const inboxReportArtefactsUpdate = (): ToolBase<},})+const InboxReportChecksCreateSchema = () => {+ const SignalsScoutReportCheckCreateBody = orvalSchemas.SignalsScoutReportCheckCreateBody()+ const SignalsScoutReportCheckCreateParams = orvalSchemas.SignalsScoutReportCheckCreateParams()+ return SignalsScoutReportCheckCreateParams.omit({ project_id: true }).extend(+ SignalsScoutReportCheckCreateBody.shape+ )+}++const inboxReportChecksCreate = (): ToolBase<+ ReturnType<typeof InboxReportChecksCreateSchema>,+ Schemas.ScoutCheckSummary+> => ({+ name: 'inbox-report-checks-create',+ schema: InboxReportChecksCreateSchema(),+ handler: async (context: Context, params: z.infer<ReturnType<typeof InboxReportChecksCreateSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.title !== undefined) {+ body['title'] = params.title+ }+ if (params.rationale !== undefined) {+ body['rationale'] = params.rationale+ }+ if (params.kind !== undefined) {+ body['kind'] = params.kind+ }+ if (params.config !== undefined) {+ body['config'] = params.config+ }+ if (params.next_run_at !== undefined) {+ body['next_run_at'] = params.next_run_at+ }+ if (params.run_interval_minutes !== undefined) {+ body['run_interval_minutes'] = params.run_interval_minutes+ }+ if (params.runs_remaining !== undefined) {+ body['runs_remaining'] = params.runs_remaining+ }+ if (params.expires_at !== undefined) {+ body['expires_at'] = params.expires_at+ }+ if (params.report_id !== undefined) {+ body['report_id'] = params.report_id+ }+ const result = await context.api.request<Schemas.ScoutCheckSummary>({+ method: 'POST',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/runs/${encodeURIComponent(String(params.run_id))}/report-check-create/`,+ body,+ })+ return result+ },+})+const InboxReportChecksListSchema = () => {const SignalsReportChecksListParams = orvalSchemas.SignalsReportChecksListParams()const SignalsReportChecksListQueryParams = orvalSchemas.SignalsReportChecksListQueryParams()@@ -1392,6 +1445,33 @@ const scoutReportCheckList = (): ToolBase<},})+const ScoutReportChecksListSchema = () => {+ const SignalsScoutReportChecksListParams = orvalSchemas.SignalsScoutReportChecksListParams()+ const SignalsScoutReportChecksListQueryParams = orvalSchemas.SignalsScoutReportChecksListQueryParams()+ return SignalsScoutReportChecksListParams.omit({ project_id: true }).extend(+ SignalsScoutReportChecksListQueryParams.shape+ )+}++const scoutReportChecksList = (): ToolBase<+ ReturnType<typeof ScoutReportChecksListSchema>,+ Schemas.ScoutCheckSummary[]+> => ({+ name: 'scout-report-checks-list',+ schema: ScoutReportChecksListSchema(),+ handler: async (context: Context, params: z.infer<ReturnType<typeof ScoutReportChecksListSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.ScoutCheckSummary[]>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/runs/${encodeURIComponent(String(params.run_id))}/report-checks/`,+ query: {+ report_id: params.report_id,+ },+ })+ return result+ },+})+const ScoutRunNowSchema = () => {const SignalsScoutConfigRunBody = orvalSchemas.SignalsScoutConfigRunBody()const SignalsScoutConfigRunParams = orvalSchemas.SignalsScoutConfigRunParams()@@ -2295,6 +2375,7 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {'inbox-report-artefacts-list': inboxReportArtefactsList,'inbox-report-artefacts-retrieve': inboxReportArtefactsRetrieve,'inbox-report-artefacts-update': inboxReportArtefactsUpdate,+ 'inbox-report-checks-create': inboxReportChecksCreate,'inbox-report-checks-list': inboxReportChecksList,'inbox-report-checks-retrieve': inboxReportChecksRetrieve,'inbox-reports-bulk-set-state': inboxReportsBulkSetState,@@ -2329,6 +2410,7 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {'scout-report-check-cancel': scoutReportCheckCancel,'scout-report-check-create': scoutReportCheckCreate,'scout-report-check-list': scoutReportCheckList,+ 'scout-report-checks-list': scoutReportChecksList,'scout-run-now': scoutRunNow,'scout-runs-emission-reports': scoutRunsEmissionReports,'scout-runs-emissions-list': scoutRunsEmissionsList,diff --git a/services/mcp/tests/unit/exec.test.ts b/services/mcp/tests/unit/exec.test.tsindex 1f1a102118d3..74a4960bd281 100644--- a/services/mcp/tests/unit/exec.test.ts+++ b/services/mcp/tests/unit/exec.test.ts@@ -1644,9 +1644,23 @@ describe('exec tool', () => {expect(JSON.parse(result as string)).toEqual(['feature-flag-get-all'])})+ it('accepts an anchored alternation of a whole toolset', async () => {+ const flagTool = makeMockTool({ name: 'feature-flag-get-all', title: 'List feature flags' })+ const exec = createExec([flagTool])+ const alternation = [+ ...Array.from({ length: 20 }, (_, index) => `^scout-some-long-tool-name-${index}$`),+ '^feature-flag-get-all$',+ ].join('|')+ expect(alternation.length).toBeGreaterThan(400)++ const result = await exec.handler(mockContext, { command: `search ${alternation}` })++ expect(JSON.parse(result as string)).toEqual(['feature-flag-get-all'])+ })+it('rejects an overly long search pattern before compiling the regex', async () => {const exec = createExec([makeMockTool()])- const longPattern = 'a'.repeat(401)+ const longPattern = 'a'.repeat(801)await expect(exec.handler(mockContext, { command: `search ${longPattern}` })).rejects.toThrow(/pattern too long/i)