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.

feat(replay-vision): let alerts include scanner reasoning in the message (#80731)

Kim Svatos Dugan919533ef1f10
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 397fe9969035..e1ddc35d33db 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -7297,7 +7297,7 @@ snapshots:
scenes-app-settings-authentication-domains--one-unverified-domain--dark:
hash: v1.k794b7964.d2354aea8e40abfcfeb18691d15e48abc24724460dbc0118185c750d3f8ce6d1.Gcj1tCTTgepeyP-Ep4JIhieodM8RlFeAjTQGNkP2UeQ
scenes-app-settings-authentication-domains--one-unverified-domain--light:
- hash: v1.k794b7964.9f4f53aee807047bda1de6e3898a5c784bca50bb1f0cbf1d3333e3323e056b41.1g_1hgiCN3qaOaI0lA8Ajwhb8mZhXu95OkHJq1dGfv0
+ hash: v1.k794b7964.826b954e1c03e3156d0c10598975c3fd43583672372c163fa08264506f929cd7.C22X_4g68JpmDtmjwe33M24AQZ4CTTIwW2cMZPL0JCo
scenes-app-settings-environment--settings-environment-access-control--dark:
hash: v1.k794b7964.accdd9c00d468382dda33761da2f7edc1a086c418561fcb24274aea3bffa6905.kPKTpBwOGrFJWYZFgEQa0LVY9ymopIu_8QgbuRa9-sg
scenes-app-settings-environment--settings-environment-access-control--light:
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index fb633aa3c07d..150c902c0119 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -476,6 +476,7 @@ export const FEATURE_FLAGS = {
REPLAY_UI_REDESIGN_2026: 'replay-ui-redesign-2026', // owner: #team-replay, New UI layout for replay
REPLAY_VIDEO_BASED_SUMMARIZATION: 'replay-video-based-summarization', // owner: #team-replay
REPLAY_VISION_MODEL_TIER_NAMING_EXPERIMENT: 'replay-vision-model-tier-naming-experiment', // owner: #team-replay multivariate=control,test,lite-standard-pro
+ REPLAY_VISION_SEND_REASONING: 'replay-vision-send-reasoning', // owner: #team-replay, gates the "include reasoning" checkbox on scanner alerts
REVAMPED_PY_NOTEBOOKS: 'revamped-py-notebooks', // owner: #team-data-tools
REVENUE_FIELDS_IN_POWER_USERS_TABLE: 'revenue-fields-in-power-users-table', // owner: @arthurdedeus #team-customer-analytics
REVIEW_HOG: 'review-hog', // owner: #team-devex, gates the Code review menu entry and scene (staff bypass the flag)
diff --git a/products/replay_vision/backend/api/vision_actions.py b/products/replay_vision/backend/api/vision_actions.py
index 27fd03e98172..61824f14b8ed 100644
--- a/products/replay_vision/backend/api/vision_actions.py
+++ b/products/replay_vision/backend/api/vision_actions.py
@@ -152,6 +152,15 @@ class AlertConfigSerializer(serializers.Serializer):
"every_match ignores it (each check covers what's new since the previous one)."
),
)
+ include_reasoning = serializers.BooleanField(
+ required=False,
+ default=False,
+ help_text=(
+ "When true, each example line in the alert message includes the scanner's full reasoning "
+ "for that observation, not just its verdict/score/tags. Useful when piping the message "
+ "somewhere else to read or act on. Defaults to false."
+ ),
+ )
def validate(self, attrs: dict[str, Any]) -> dict[str, Any]:
frequency = attrs.get("frequency", AlertFrequency.ON_BREACH)
diff --git a/products/replay_vision/backend/temporal/vision_actions/alerts.py b/products/replay_vision/backend/temporal/vision_actions/alerts.py
index 87dea06c0b82..2dc04f57bc71 100644
--- a/products/replay_vision/backend/temporal/vision_actions/alerts.py
+++ b/products/replay_vision/backend/temporal/vision_actions/alerts.py
@@ -30,7 +30,11 @@ from products.replay_vision.backend.models.vision_action import (
VisionActionRun,
VisionActionRunStatus,
)
-from products.replay_vision.backend.observation_formatting import describe_output
+from products.replay_vision.backend.observation_formatting import (
+ EVENT_ID_CITATION_RE,
+ SEARCH_SNIPPET_LIMIT,
+ describe_output,
+)
from products.replay_vision.backend.scanner_access import readable_scanner_ids
from products.replay_vision.backend.temporal.decorators import track_activity
from products.replay_vision.backend.temporal.vision_actions.synthesis import (
@@ -374,15 +378,35 @@ def _alert_markdown(
f"{matched_count} {noun} matched in this window.",
]
+ include_reasoning = bool(alert_config.get("include_reasoning"))
examples: list[str] = []
for position, (_, scanner_result, created_at) in enumerate(rows[:EXAMPLE_LINES], start=1):
output = scanner_result.get("model_output") if isinstance(scanner_result, dict) else None
if not isinstance(output, dict):
continue
descriptor = describe_output(output)
- if descriptor:
- examples.append(f"- ({created_at:%Y-%m-%d}) {descriptor} [obs {position}]")
+ reasoning = _reasoning_snippet(output) if include_reasoning else None
+ # A line needs at least one of the two to be worth emitting. When both are present the
+ # reasoning follows the descriptor; the `[obs N]` marker always trails so the citation
+ # resolves the same way whether or not reasoning was requested.
+ parts = [p for p in (descriptor, reasoning) if p]
+ if parts:
+ examples.append(f"- ({created_at:%Y-%m-%d}) {' — '.join(parts)} [obs {position}]")
if examples:
lines.extend(["", "Most recent matches:", *examples])
return "\n".join(lines)
+
+
+def _reasoning_snippet(output: dict[str, Any]) -> str | None:
+ """The scanner's free-text reasoning for one observation, collapsed to a single line and length-capped.
+
+ Recording-derived untrusted text, so it gets the same treatment as the summarizer feed: event-id
+ citations stripped and whitespace collapsed to one line, keeping it from forging extra list items or
+ header lines. `strip_external_links_markdown` runs over the whole message afterwards, defanging any
+ link/image markdown this carries. Falls back to `summary` for scanner types that emit that instead."""
+ text = output.get("reasoning") or output.get("summary")
+ if not isinstance(text, str) or not text.strip():
+ return None
+ clean = re.sub(r"\s+", " ", EVENT_ID_CITATION_RE.sub("", text)).strip()[:SEARCH_SNIPPET_LIMIT]
+ return clean or None
diff --git a/products/replay_vision/backend/tests/test_vision_action_alerts.py b/products/replay_vision/backend/tests/test_vision_action_alerts.py
index aebd4ff4160c..5b0cad90687c 100644
--- a/products/replay_vision/backend/tests/test_vision_action_alerts.py
+++ b/products/replay_vision/backend/tests/test_vision_action_alerts.py
@@ -105,6 +105,32 @@ class TestVisionActionAlerts(BaseTest):
# Every match is already listed, so there's no "see all" overflow link to add noise.
self.assertNotIn("See all", run.synthesized_markdown)
+ @parameterized.expand(
+ [
+ # Default (flag absent): the example line carries only the outcome descriptor, never the
+ # recording-derived reasoning prose.
+ ("default_omits", {}, False),
+ ("explicit_false_omits", {"include_reasoning": False}, False),
+ # Opt-in: the scanner's full reasoning rides alongside the descriptor, for a reader piping
+ # the message elsewhere who wants more than "verdict=yes".
+ ("opt_in_includes", {"include_reasoning": True}, True),
+ ]
+ )
+ def test_include_reasoning_controls_whether_reasoning_appears(
+ self, _label: str, extra_config: dict, expect_reasoning: bool
+ ) -> None:
+ scanner = self._scanner()
+ self._observation(scanner, {"verdict": "yes", "reasoning": "the checkout button did nothing"})
+ action = self._alert(scanner, {"metric": "count", "threshold": 1, **extra_config})
+
+ result, run = self._evaluate(action)
+
+ self.assertEqual(result.status, AlertStatus.FIRED)
+ run.refresh_from_db()
+ # The outcome descriptor is present either way; only the reasoning prose is gated by the flag.
+ self.assertIn("verdict=yes", run.synthesized_markdown)
+ self.assertEqual("the checkout button did nothing" in run.synthesized_markdown, expect_reasoning)
+
def test_many_matches_list_only_examples_and_link_to_the_run(self) -> None:
scanner = self._scanner()
for i in range(7):
diff --git a/products/replay_vision/frontend/generated/api.schemas.ts b/products/replay_vision/frontend/generated/api.schemas.ts
index 6031034e1e25..4d2a391da1de 100644
--- a/products/replay_vision/frontend/generated/api.schemas.ts
+++ b/products/replay_vision/frontend/generated/api.schemas.ts
@@ -164,6 +164,8 @@ export interface AlertConfigApi {
* * `14` - 14 days
* * `30` - 30 days */
window_days?: WindowDaysEnumApi
+ /** When true, each example line in the alert message includes the scanner's full reasoning for that observation, not just its verdict/score/tags. Useful when piping the message somewhere else to read or act on. Defaults to false. */
+ include_reasoning?: boolean
}
/**
diff --git a/products/replay_vision/frontend/generated/api.zod.ts b/products/replay_vision/frontend/generated/api.zod.ts
index f37db2620488..7856fd318fed 100644
--- a/products/replay_vision/frontend/generated/api.zod.ts
+++ b/products/replay_vision/frontend/generated/api.zod.ts
@@ -20,6 +20,7 @@ export const visionActionsCreateBodySynthesisConfigOnePromptGuideMax = 500
export const visionActionsCreateBodyAlertConfigOneFrequencyDefault = `on_breach`
export const visionActionsCreateBodyAlertConfigOneMetricDefault = `count`
export const visionActionsCreateBodyAlertConfigOneDirectionDefault = `above`
+export const visionActionsCreateBodyAlertConfigOneIncludeReasoningDefault = false
export const VisionActionsCreateBody = /* @__PURE__ */ zod
.object({
@@ -146,6 +147,12 @@ export const VisionActionsCreateBody = /* @__PURE__ */ zod
.describe(
"Rolling lookback window for on_breach conditions, ending at each check. Defaults to 1 day. every_match ignores it (each check covers what's new since the previous one).\n\n\* `1` - 1 day\n\* `3` - 3 days\n\* `7` - 7 days\n\* `14` - 14 days\n\* `30` - 30 days"
),
+ include_reasoning: zod
+ .boolean()
+ .default(visionActionsCreateBodyAlertConfigOneIncludeReasoningDefault)
+ .describe(
+ "When true, each example line in the alert message includes the scanner's full reasoning for that observation, not just its verdict\/score\/tags. Useful when piping the message somewhere else to read or act on. Defaults to false."
+ ),
})
.describe(
"The alert condition for mode='alert', applied after `selection` targeting. 'every_match'\nnotifies about each new match since the previous check; 'on_breach' compares a metric to a\nthreshold over a rolling window and notifies on the transition into breach."
@@ -199,6 +206,7 @@ export const visionActionsPartialUpdateBodySynthesisConfigOnePromptGuideMax = 50
export const visionActionsPartialUpdateBodyAlertConfigOneFrequencyDefault = `on_breach`
export const visionActionsPartialUpdateBodyAlertConfigOneMetricDefault = `count`
export const visionActionsPartialUpdateBodyAlertConfigOneDirectionDefault = `above`
+export const visionActionsPartialUpdateBodyAlertConfigOneIncludeReasoningDefault = false
export const VisionActionsPartialUpdateBody = /* @__PURE__ */ zod
.object({
@@ -327,6 +335,12 @@ export const VisionActionsPartialUpdateBody = /* @__PURE__ */ zod
.describe(
"Rolling lookback window for on_breach conditions, ending at each check. Defaults to 1 day. every_match ignores it (each check covers what's new since the previous one).\n\n\* `1` - 1 day\n\* `3` - 3 days\n\* `7` - 7 days\n\* `14` - 14 days\n\* `30` - 30 days"
),
+ include_reasoning: zod
+ .boolean()
+ .default(visionActionsPartialUpdateBodyAlertConfigOneIncludeReasoningDefault)
+ .describe(
+ "When true, each example line in the alert message includes the scanner's full reasoning for that observation, not just its verdict\/score\/tags. Useful when piping the message somewhere else to read or act on. Defaults to false."
+ ),
})
.describe(
"The alert condition for mode='alert', applied after `selection` targeting. 'every_match'\nnotifies about each new match since the previous check; 'on_breach' compares a metric to a\nthreshold over a rolling window and notifies on the transition into breach."
diff --git a/products/replay_vision/frontend/replay_scanners/ActionEditorScene.tsx b/products/replay_vision/frontend/replay_scanners/ActionEditorScene.tsx
index 18ba694babf7..c4ffcddc0fd9 100644
--- a/products/replay_vision/frontend/replay_scanners/ActionEditorScene.tsx
+++ b/products/replay_vision/frontend/replay_scanners/ActionEditorScene.tsx
@@ -2,15 +2,25 @@ import { useActions, useValues } from 'kea'
import { Form } from 'kea-forms'
import { useMemo } from 'react'
-import { LemonButton, LemonInput, LemonInputSelect, LemonSegmentedButton, LemonSelect, Link } from '@posthog/lemon-ui'
+import {
+ LemonButton,
+ LemonCheckbox,
+ LemonInput,
+ LemonInputSelect,
+ LemonSegmentedButton,
+ LemonSelect,
+ Link,
+} from '@posthog/lemon-ui'
import { IntegrationChoice } from 'lib/components/CyclotronJob/integrations/IntegrationChoice'
+import { FEATURE_FLAGS } from 'lib/constants'
import { integrationsLogic } from 'lib/integrations/integrationsLogic'
import { SlackChannelPicker, SlackNotConfiguredBanner } from 'lib/integrations/SlackIntegrationHelpers'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { LemonSearchableSelect } from 'lib/lemon-ui/LemonSelect/LemonSearchableSelect'
import { LemonTextArea } from 'lib/lemon-ui/LemonTextArea/LemonTextArea'
import { Spinner } from 'lib/lemon-ui/Spinner'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { timeZoneLabel } from 'lib/utils/timezones'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { SceneExport } from 'scenes/sceneTypes'
@@ -405,6 +415,7 @@ function ConditionSection({ scannerId }: { scannerId: string }): JSX.Element {
const { actionForm, actionFormErrors } = useValues(actionEditorSceneLogic)
const { setActionFormValue } = useActions(actionEditorSceneLogic)
const { scanner } = useValues(replayScannerLogic({ id: scannerId }))
+ const { featureFlags } = useValues(featureFlagLogic)
const everyMatch = actionForm.alert_frequency === AlertConfigFrequencyEnumApi.EveryMatch
const isScorer = scanner?.scanner_type === 'scorer'
@@ -433,7 +444,7 @@ function ConditionSection({ scannerId }: { scannerId: string }): JSX.Element {
<LemonSegmentedButton
size="small"
- className="max-w-full overflow-x-auto"
+ className="max-w-full"
value={actionForm.alert_frequency}
onChange={(value) => {
setActionFormValue('alert_frequency', value)
@@ -521,6 +532,14 @@ function ConditionSection({ scannerId }: { scannerId: string }): JSX.Element {
{actionFormErrors?.min_score ? (
<span className="text-xs text-danger">{String(actionFormErrors.min_score)}</span>
) : null}
+ {featureFlags[FEATURE_FLAGS.REPLAY_VISION_SEND_REASONING] ? (
+ <LemonCheckbox
+ checked={actionForm.alert_include_reasoning}
+ onChange={(checked) => setActionFormValue('alert_include_reasoning', checked)}
+ label="Include the observation's reasoning in the message"
+ data-attr="vision-action-alert-include-reasoning"
+ />
+ ) : null}
<span className="text-xs text-muted">
{everyMatch
? 'Checked every few minutes; each notification covers the new matches since the last check.'
diff --git a/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.test.ts b/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.test.ts
index 76cfced2a763..e253ef77cd7a 100644
--- a/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.test.ts
@@ -127,6 +127,7 @@ describe('actionEditorSceneLogic', () => {
alert_threshold: 1,
alert_direction: 'above',
alert_window_days: 1,
+ alert_include_reasoning: false,
},
})
diff --git a/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.ts b/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.ts
index 4348610a691f..c09723dd6ffd 100644
--- a/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.ts
@@ -416,6 +416,7 @@ export const actionEditorSceneLogic = kea<actionEditorSceneLogicType>([
alert_threshold: action.alert_config?.threshold ?? 1,
alert_direction: alertDirection,
alert_window_days: action.alert_config?.window_days ?? 1,
+ alert_include_reasoning: action.alert_config?.include_reasoning ?? false,
verdict: action.selection?.verdict ?? [],
tags: action.selection?.tags ?? [],
min_score: action.selection?.min_score ?? null,
diff --git a/products/replay_vision/frontend/replay_scanners/visionActionsLogic.test.ts b/products/replay_vision/frontend/replay_scanners/visionActionsLogic.test.ts
index 69b10380da30..1076b48cf070 100644
--- a/products/replay_vision/frontend/replay_scanners/visionActionsLogic.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/visionActionsLogic.test.ts
@@ -27,6 +27,7 @@ const slackForm: VisionActionForm = {
alert_threshold: 1,
alert_direction: 'above',
alert_window_days: 1,
+ alert_include_reasoning: false,
}
const action = (id: string, enabled = true): VisionActionApi => ({
@@ -187,6 +188,7 @@ describe('visionActionsLogic', () => {
alert_threshold: 1,
alert_direction: 'above',
alert_window_days: 1,
+ alert_include_reasoning: false,
}
const body = buildActionBody(form, 's1')
expect(body.delivery_config).toEqual([])
@@ -219,6 +221,7 @@ describe('visionActionsLogic', () => {
// "at least". Only the average score exposes a direction choice.
alert_direction: 'below',
alert_window_days: 1,
+ alert_include_reasoning: false,
}
const body = buildActionBody(form, 's1')
expect(body.mode).toEqual('alert')
@@ -228,6 +231,7 @@ describe('visionActionsLogic', () => {
threshold: 1,
direction: 'above',
window_days: 1,
+ include_reasoning: false,
})
expect(body.selection).toEqual({ tags: ['rage-click'] })
// Alerts have no user-facing schedule; the stored rrule keeps the trigger well-formed while
@@ -236,12 +240,27 @@ describe('visionActionsLogic', () => {
// Alerts never synthesize, so a stale guide from a mode switch must not persist.
expect(body.synthesis_config).toEqual({ prompt_guide: '' })
- // Every-match alerts carry no threshold machinery — just the frequency and the count metric.
+ // Every-match alerts carry no threshold machinery — just the frequency, count metric, and the
+ // reasoning toggle (which applies regardless of frequency).
const everyMatch = buildActionBody({ ...form, alert_frequency: 'every_match' }, 's1')
- expect(everyMatch.alert_config).toEqual({ frequency: 'every_match', metric: 'count' })
+ expect(everyMatch.alert_config).toEqual({
+ frequency: 'every_match',
+ metric: 'count',
+ include_reasoning: false,
+ })
// The average score keeps the user's direction choice — "below a floor" is its natural alarm.
const avgBelow = buildActionBody({ ...form, alert_metric: 'avg_score', alert_direction: 'below' }, 's1')
expect(avgBelow.alert_config).toEqual(expect.objectContaining({ metric: 'avg_score', direction: 'below' }))
+
+ // The reasoning toggle flows into the config on both frequencies, so an alert piped elsewhere
+ // can carry the scanner's full reasoning, not just the outcome.
+ expect(buildActionBody({ ...form, alert_include_reasoning: true }, 's1').alert_config).toEqual(
+ expect.objectContaining({ include_reasoning: true })
+ )
+ expect(
+ buildActionBody({ ...form, alert_frequency: 'every_match', alert_include_reasoning: true }, 's1')
+ .alert_config
+ ).toEqual(expect.objectContaining({ include_reasoning: true }))
})
})
diff --git a/products/replay_vision/frontend/replay_scanners/visionActionsLogic.ts b/products/replay_vision/frontend/replay_scanners/visionActionsLogic.ts
index 9ee194a22608..05df188402cf 100644
--- a/products/replay_vision/frontend/replay_scanners/visionActionsLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/visionActionsLogic.ts
@@ -48,6 +48,8 @@ export interface VisionActionForm {
alert_threshold: number | null
alert_direction: VisionAlertDirectionEnumApi
alert_window_days: WindowDaysEnumApi
+ // Include each matching observation's full reasoning in the alert message, not just its outcome.
+ alert_include_reasoning: boolean
}
export const NEW_ACTION_FORM = (): VisionActionForm => ({
@@ -70,6 +72,7 @@ export const NEW_ACTION_FORM = (): VisionActionForm => ({
alert_threshold: 1,
alert_direction: VisionAlertDirectionEnumApi.Above,
alert_window_days: 1,
+ alert_include_reasoning: false,
})
// Map the UI form shape to the API body shared by create + partial-update. Kept standalone so the
@@ -107,7 +110,11 @@ export function buildActionBody(form: VisionActionForm, scannerId: string): Para
? {
alert_config:
form.alert_frequency === AlertConfigFrequencyEnumApi.EveryMatch
- ? { frequency: form.alert_frequency, metric: VisionAlertMetricEnumApi.Count }
+ ? {
+ frequency: form.alert_frequency,
+ metric: VisionAlertMetricEnumApi.Count,
+ include_reasoning: form.alert_include_reasoning,
+ }
: {
frequency: form.alert_frequency,
metric: form.alert_metric,
@@ -121,6 +128,7 @@ export function buildActionBody(form: VisionActionForm, scannerId: string): Para
? form.alert_direction
: VisionAlertDirectionEnumApi.Above,
window_days: form.alert_window_days,
+ include_reasoning: form.alert_include_reasoning,
},
}
: {}),
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 9991d42a1f06..ea6d1bc33e4a 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -9473,6 +9473,8 @@ export namespace Schemas {
* * `14` - 14 days
* * `30` - 30 days */
window_days?: WindowDaysEnum;
+ /** When true, each example line in the alert message includes the scanner's full reasoning for that observation, not just its verdict/score/tags. Useful when piping the message somewhere else to read or act on. Defaults to false. */
+ include_reasoning?: boolean;
}
export interface AlertSimulate {
diff --git a/services/mcp/src/generated/replay_vision/api.ts b/services/mcp/src/generated/replay_vision/api.ts
index 007234677ad9..19dbf659406b 100644
--- a/services/mcp/src/generated/replay_vision/api.ts
+++ b/services/mcp/src/generated/replay_vision/api.ts
@@ -44,6 +44,7 @@ export const visionActionsCreateBodySynthesisConfigOnePromptGuideMax = 500
export const visionActionsCreateBodyAlertConfigOneFrequencyDefault = `on_breach`
export const visionActionsCreateBodyAlertConfigOneMetricDefault = `count`
export const visionActionsCreateBodyAlertConfigOneDirectionDefault = `above`
+export const visionActionsCreateBodyAlertConfigOneIncludeReasoningDefault = false
export const VisionActionsCreateBody = /* @__PURE__ */ zod
.object({
@@ -170,6 +171,12 @@ export const VisionActionsCreateBody = /* @__PURE__ */ zod
.describe(
"Rolling lookback window for on_breach conditions, ending at each check. Defaults to 1 day. every_match ignores it (each check covers what's new since the previous one).\n\n\* `1` - 1 day\n\* `3` - 3 days\n\* `7` - 7 days\n\* `14` - 14 days\n\* `30` - 30 days"
),
+ include_reasoning: zod
+ .boolean()
+ .default(visionActionsCreateBodyAlertConfigOneIncludeReasoningDefault)
+ .describe(
+ "When true, each example line in the alert message includes the scanner's full reasoning for that observation, not just its verdict\/score\/tags. Useful when piping the message somewhere else to read or act on. Defaults to false."
+ ),
})
.describe(
"The alert condition for mode='alert', applied after `selection` targeting. 'every_match'\nnotifies about each new match since the previous check; 'on_breach' compares a metric to a\nthreshold over a rolling window and notifies on the transition into breach."
@@ -244,6 +251,7 @@ export const visionActionsPartialUpdateBodySynthesisConfigOnePromptGuideMax = 50
export const visionActionsPartialUpdateBodyAlertConfigOneFrequencyDefault = `on_breach`
export const visionActionsPartialUpdateBodyAlertConfigOneMetricDefault = `count`
export const visionActionsPartialUpdateBodyAlertConfigOneDirectionDefault = `above`
+export const visionActionsPartialUpdateBodyAlertConfigOneIncludeReasoningDefault = false
export const VisionActionsPartialUpdateBody = /* @__PURE__ */ zod
.object({
@@ -372,6 +380,12 @@ export const VisionActionsPartialUpdateBody = /* @__PURE__ */ zod
.describe(
"Rolling lookback window for on_breach conditions, ending at each check. Defaults to 1 day. every_match ignores it (each check covers what's new since the previous one).\n\n\* `1` - 1 day\n\* `3` - 3 days\n\* `7` - 7 days\n\* `14` - 14 days\n\* `30` - 30 days"
),
+ include_reasoning: zod
+ .boolean()
+ .default(visionActionsPartialUpdateBodyAlertConfigOneIncludeReasoningDefault)
+ .describe(
+ "When true, each example line in the alert message includes the scanner's full reasoning for that observation, not just its verdict\/score\/tags. Useful when piping the message somewhere else to read or act on. Defaults to false."
+ ),
})
.describe(
"The alert condition for mode='alert', applied after `selection` targeting. 'every_match'\nnotifies about each new match since the previous check; 'on_breach' compares a metric to a\nthreshold over a rolling window and notifies on the transition into breach."
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-actions-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-actions-create.json
index bdbcff3effde..ba80c596883f 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-actions-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-actions-create.json
@@ -17,6 +17,11 @@
"enum": ["every_match", "on_breach"],
"type": "string"
},
+ "include_reasoning": {
+ "default": false,
+ "description": "When true, each example line in the alert message includes the scanner's full reasoning for that observation, not just its verdict/score/tags. Useful when piping the message somewhere else to read or act on. Defaults to false.",
+ "type": "boolean"
+ },
"metric": {
"default": "count",
"description": "What to measure over the window: 'count' of targeted observations, or 'avg_score' (the mean scorer score; scorer scanners only). every_match supports 'count' only.\n\n* `count` - Count of matching observations\n* `avg_score` - Average score",
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-actions-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-actions-update.json
index 9c9ed4df4e15..bd9060fc7e47 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-actions-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-actions-update.json
@@ -16,6 +16,11 @@
"enum": ["every_match", "on_breach"],
"type": "string"
},
+ "include_reasoning": {
+ "default": false,
+ "description": "When true, each example line in the alert message includes the scanner's full reasoning for that observation, not just its verdict/score/tags. Useful when piping the message somewhere else to read or act on. Defaults to false.",
+ "type": "boolean"
+ },
"metric": {
"default": "count",
"description": "What to measure over the window: 'count' of targeted observations, or 'avg_score' (the mean scorer score; scorer scanners only). every_match supports 'count' only.\n\n* `count` - Count of matching observations\n* `avg_score` - Average score",