: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): per-source steering for the emission actionability gate (#83475)
Andrew Maguire68f8c8e9ab15
diff --git a/products/signals/ARCHITECTURE.md b/products/signals/ARCHITECTURE.mdindex 46d6ca1299d9..4f1c20dc294e 100644--- a/products/signals/ARCHITECTURE.md+++ b/products/signals/ARCHITECTURE.md@@ -525,13 +525,14 @@ Per-team configuration for which signal sources are enabled.| `source_product` | CharField | One of: `session_replay`, `llm_analytics`, `github`, `linear`, `zendesk`, `conversations`, `error_tracking`, `signals_scout` (`SourceProduct` enum) || `source_type` | CharField | One of: `session_analysis_cluster`, `evaluation_report`, `issue`, `ticket`, `issue_created`, `issue_reopened`, `issue_spiking`, `cross_source_issue` (`SourceType` enum) || `enabled` | Boolean | Whether this source is active (default `True`) |-| `config` | JSONField | Source-specific configuration |+| `config` | JSONField | Source-specific configuration, plus the shared steering keys (`steering`, `default_not_actionable`) read by the emission actionability gate || `created_by` | FK → User | User who created the config (nullable) |**Behavioral notes:**- `llm_analytics` signals go through the standard enabled-row check like every other source. `evaluation_report` is the only type AI observability emits, gated by its own `(llm_analytics, evaluation_report)` row (the inbox "AI observability" toggle). The per-result workflow and activity remain registered only so existing Temporal histories can finish replaying.- For session replay configs, serializer validation enforces that `config.recording_filters` is a JSON object when present.+- Two `config` keys steer the emission actionability gate per source: `config.steering` (free text, the team's preferences about the source's records — injected into the canonical actionability prompt, never replacing it) and `config.default_not_actionable` (boolean — flips the gate's "when in doubt" posture from keep to filter). Serializer validation enforces `steering` is a string capped at `STEERING_MAX_LENGTH` (2000 chars) and `default_not_actionable` is a boolean; injection escapes braces so the text can never break the gate's one-word output contract (see `backend/emission/steering.py`). The keys apply to sources that run `run_signal_pipeline` (data warehouse imports and Conversations); other sources persist them unread today, and future consumers (report research, the autostart gate) are expected to read the same text.- The serializer exposes a computed `status` field:- data-import-backed sources (`github`, `linear`, `zendesk`) derive status from `ExternalDataSchema`- The `signals_scout` source variant pairs with `source_type=cross_source_issue` and is the emission channel used by the headless Signals agent's `emit_signal_*` tools. It is the only `(source_product, source_type)` pair the agent emits today.diff --git a/products/signals/backend/contracts.py b/products/signals/backend/contracts.pyindex 83172d0bf246..408c65a5450f 100644--- a/products/signals/backend/contracts.py+++ b/products/signals/backend/contracts.py@@ -11,6 +11,17 @@ from pydantic.fields import FieldInfofrom products.signals.backend.enums import ReportPriority, SignalSourceProduct, SignalSourceType+# ── Source-config steering keys ─────────────────────────────────────────────────+# Public keys of `SignalSourceConfig.config` shared by every emission source. Defined here+# (not in `emission/`) so the serializer can validate them without importing the emission+# package, whose __init__ eagerly registers every emitter and must stay off the web path.++STEERING_KEY = "steering"+DEFAULT_NOT_ACTIONABLE_KEY = "default_not_actionable"+# Server-side cap on steering text. The serializer rejects longer input; reads truncate+# defensively so a row written by another path cannot bloat every gate prompt.+STEERING_MAX_LENGTH = 2000+class ContractModel(BaseModel):# Emitted payloads are validated against these models at the emit boundary; unknown fields arediff --git a/products/signals/backend/emission/AGENTS.md b/products/signals/backend/emission/AGENTS.mdindex 514b96966c11..575fb33f8553 100644--- a/products/signals/backend/emission/AGENTS.md+++ b/products/signals/backend/emission/AGENTS.md@@ -20,7 +20,9 @@ The core signal pipeline (`products/signals/backend/emission/pipeline.py`) is so1. **Record fetcher** — each source defines a `record_fetcher` callable on its config2. **Emitter** — transforms each record dict into a `SignalEmitterOutput` (or `None` to skip)3. **Summarization** — optionally summarizes long descriptions via LLM-4. **Actionability filter** — optionally filters non-actionable records via LLM+4. **Actionability filter** — optionally filters non-actionable records via LLM.+ Teams can steer this gate per source via two keys on `SignalSourceConfig.config`: `steering` (plain-language rules injected into the canonical prompt) and `default_not_actionable` (flips the "when in doubt" posture from keep to filter).+ See `steering.py` — the injection escapes braces and caps length so team text can never break the prompt's one-word output contract, and every canonical actionability prompt must keep the `When in doubt, classify as ACTIONABLE` posture line the injection anchors on.5. **Emission** — emits surviving outputs as Signals via `products/signals/backend/api/emit_signal`### Registry@@ -93,6 +95,9 @@ DEBUG=1 ./manage.py emit_signals_from_fixture --type zendesk --team-id 1 --fixtuand maps to the matching auto-registered config in `registry.py`.The command requires `DEBUG=True` and is intended for local iteration only.+Fixture runs (and `emit_signals_from_llm`) read the team's `SignalSourceConfig.config` steering keys exactly like production, so a team with `steering` or `default_not_actionable` set can filter records a plain run would keep.+For an unsteered baseline, clear those keys on the source's config row first.+## Maintaining this fileIf the pipeline architecture, registry pattern, or conventions change significantly, update this AGENTS.md to reflect the new reality.diff --git a/products/signals/backend/emission/conversations_coordinator.py b/products/signals/backend/emission/conversations_coordinator.pyindex 2070477a9aa7..92cae1bad4f2 100644--- a/products/signals/backend/emission/conversations_coordinator.py+++ b/products/signals/backend/emission/conversations_coordinator.py@@ -21,6 +21,7 @@ from posthog.temporal.common.heartbeat import LivenessHeartbeater as Heartbeaterfrom products.signals.backend.emission import InternalSourceType, get_signal_configfrom products.signals.backend.emission.pipeline import run_signal_pipeline+from products.signals.backend.emission.steering import afetch_source_configfrom products.signals.backend.models import SignalSourceConfiglogger = structlog.get_logger(__name__)@@ -75,12 +76,16 @@ async def emit_conversations_signals_activity(inputs: EmitConversationsSignalsInexcept Team.DoesNotExist:log.warning("Team no longer exists, skipping")return {"status": "skipped", "reason": "team_deleted", "signals_emitted": 0}+ # Before the record fetch: the conversations fetcher records emission optimistically, so a+ # failure after it returns would permanently skip this batch on the Temporal retry.+ source_config = await afetch_source_config(team.id, config.source_product, config.source_type)records = await database_sync_to_async(config.record_fetcher, thread_sensitive=False)(team, config, {})return await run_signal_pipeline(team=team,config=config,records=records,extra=inputs.properties_to_log,+ source_config=source_config,)diff --git a/products/signals/backend/emission/emit_signals.py b/products/signals/backend/emission/emit_signals.pyindex 9b1d7e7cf778..b498c3863b42 100644--- a/products/signals/backend/emission/emit_signals.py+++ b/products/signals/backend/emission/emit_signals.py@@ -16,6 +16,7 @@ from posthog.temporal.common.heartbeat import LivenessHeartbeater as Heartbeaterfrom products.signals.backend.emission import get_signal_configfrom products.signals.backend.emission.pipeline import run_signal_pipeline+from products.signals.backend.emission.steering import afetch_source_configfrom products.warehouse_sources.backend.facade.hooks import EmitSignalsActivityInputsfrom products.warehouse_sources.backend.facade.models import ExternalDataSchema@@ -46,6 +47,9 @@ async def emit_data_import_signals_activity(inputs: EmitSignalsActivityInputs) -"last_synced_at": inputs.last_synced_at,"extra": inputs.properties_to_log,}+ # Before the record fetch: fetchers record emission optimistically, so a failure after+ # they return would permanently skip this batch on the Temporal retry.+ source_config = await afetch_source_config(team.id, config.source_product, config.source_type)records = await database_sync_to_async(config.record_fetcher, thread_sensitive=False)(team, config, fetcher_context)@@ -54,6 +58,7 @@ async def emit_data_import_signals_activity(inputs: EmitSignalsActivityInputs) -config=config,records=records,extra=inputs.properties_to_log,+ source_config=source_config,)diff --git a/products/signals/backend/emission/pipeline.py b/products/signals/backend/emission/pipeline.pyindex 4eb5ac728a31..277162198bbc 100644--- a/products/signals/backend/emission/pipeline.py+++ b/products/signals/backend/emission/pipeline.py@@ -17,6 +17,7 @@ from posthog.models import Organization, Teamfrom posthog.sync import database_sync_to_asyncfrom products.signals.backend.emission.registry import SignalEmitter, SignalEmitterOutput, SignalSourceTableConfig+from products.signals.backend.emission.steering import apply_steering, steering_from_configfrom products.signals.backend.facade.api import emit_signalfrom products.signals.backend.temporal import metricsfrom products.signals.backend.temporal.drop_telemetry import summarize_drop_error@@ -42,6 +43,8 @@ LLM_CALL_TIMEOUT_SECONDS = 120# Backoff between LLM retry attempts (delay = initial * coefficient ^ (attempt - 1))LLM_RETRY_INITIAL_DELAY_SECONDS = 5LLM_RETRY_BACKOFF_COEFFICIENT = 2.0+# Cap on the serialized record metadata block shown to the steered actionability gate.+RECORD_METADATA_MAX_CHARS = 2000# Anthropic's Messages API requires max_tokens, so this is a deliberately high safety ceiling# rather than a tuned budget. The risk we care about is a response being cut off mid-output, not# runaway generation — the actual outputs here are tiny (a short summary or a one-word verdict).@@ -277,8 +280,16 @@ async def _check_actionability(output: SignalEmitterOutput,actionability_prompt: str,gateway_mode: bool | None = None,+ include_record_metadata: bool = False,) -> bool:- prompt = actionability_prompt.format(description=output.description)+ description = output.description+ if include_record_metadata and output.extra:+ # Steering rules often reference metadata (labels, state, priority) that emitters keep in+ # `extra` rather than in the description, so the steered gate gets to see it. Bounded, and+ # substituted through the `{description}` placeholder so it is never format-processed.+ metadata = json.dumps(output.extra, default=str)[:RECORD_METADATA_MAX_CHARS]+ description = f"{description}\n\n<record_metadata>\n{metadata}\n</record_metadata>"+ prompt = actionability_prompt.format(description=description)extra_headers = _signals_extra_headers(output, stage="actionability", gateway_mode=gateway_mode, team_id=team_id)for attempt in range(LLM_MAX_ATTEMPTS):if attempt > 0:@@ -317,6 +328,7 @@ async def filter_actionable(outputs: list[SignalEmitterOutput],actionability_prompt: str,extra: dict[str, Any],+ include_record_metadata: bool = False,) -> list[SignalEmitterOutput]:client = build_async_anthropic_client(product="signals", ai_product=EMISSION_AI_PRODUCT, team_id=team.id)gateway_mode = resolve_ai_gateway_config() is not None@@ -329,7 +341,12 @@ async def filter_actionable(async with semaphore:try:result = await _check_actionability(- client, team.id, output, actionability_prompt, gateway_mode=gateway_mode+ client,+ team.id,+ output,+ actionability_prompt,+ gateway_mode=gateway_mode,+ include_record_metadata=include_record_metadata,)except Exception:logger.exception(@@ -463,7 +480,14 @@ async def run_signal_pipeline(config: SignalSourceTableConfig,records: list[dict[str, Any]],extra: dict[str, Any],+ source_config: dict[str, Any] | None = None,) -> dict[str, Any]:+ """Run records through the shared emission pipeline (emit, summarize, gate, emit signals).++ `source_config` is the team's `SignalSourceConfig.config` blob for this source; its+ steering keys customize the actionability gate (see `steering.py`). Callers that have+ no per-team row (e.g. fixture smoke tests) can omit it for canonical behavior.+ """source_label = f"{config.source_product}/{config.source_type}"if not records:@@ -504,17 +528,22 @@ async def run_signal_pipeline(_capture_pipeline_stage("signal_data_source_summarized", team, organization, output)if config.actionability_prompt:+ steering = steering_from_config(source_config)pre_filter_by_id = {o.source_id: o for o in outputs}outputs = await filter_actionable(team=team,outputs=outputs,- actionability_prompt=config.actionability_prompt,+ actionability_prompt=apply_steering(config.actionability_prompt, steering),extra=extra,+ # Only steered teams get the metadata block, so unsteered prompts stay byte-identical.+ include_record_metadata=steering.active,)post_filter_ids = {o.source_id for o in outputs}for source_id, output in pre_filter_by_id.items():if source_id not in post_filter_ids:- _capture_pipeline_stage("signal_data_source_filtered", team, organization, output)+ _capture_pipeline_stage(+ "signal_data_source_filtered", team, organization, output, {"steering_applied": steering.active}+ )if not outputs:logger.warning(f"No actionable records after filtering for {source_label}", **extra)diff --git a/products/signals/backend/emission/steering.py b/products/signals/backend/emission/steering.pynew file mode 100644index 000000000000..278cadd302b6--- /dev/null+++ b/products/signals/backend/emission/steering.py@@ -0,0 +1,114 @@+"""Per-source steering for the shared emission pipeline.++Teams steer the actionability gate through two keys on ``SignalSourceConfig.config``:++- ``steering`` (string): the team's plain-language preferences about this source's+ records (what matters, what to skip, what's out of scope). The actionability gate is+ the first consumer; the semantics are deliberately stage-agnostic so future pipeline+ stages can read the same text.+- ``default_not_actionable`` (bool): flips the gate's posture from "keep everything+ except what the rules exclude" to "only keep what clearly qualifies".++Teams supply rules, never prompt text: the canonical prompt scaffolding stays+upstream-owned, and the one-word output contract the gate parses is preserved. Steering+text is injected into the prompt *template* with braces escaped, so hostile input+(format-string syntax, stray braces) cannot make the later ``.format(description=...)``+raise and trip the gate's fail-open path.+"""++from collections.abc import Mapping+from typing import Any++from posthog.dataclasses import frozen++from products.signals.backend.contracts import DEFAULT_NOT_ACTIONABLE_KEY, STEERING_KEY, STEERING_MAX_LENGTH+from products.signals.backend.models import SignalSourceConfig++# Every canonical actionability prompt states its lenient posture on a line starting with+# this marker; the posture flip and the steering block anchor on it.+_POSTURE_MARKER = "When in doubt, classify as ACTIONABLE"+# Must stand alone: `default_not_actionable` is valid without steering text, so this line+# references the prompt's own ACTIONABLE criteria rather than a preferences block that may+# not be present.+_ALLOWLIST_POSTURE_LINE = (+ "When in doubt, classify as NOT_ACTIONABLE. This team only wants records that clearly match "+ "the ACTIONABLE criteria above, so err on the side of filtering."+)+_RESPONSE_MARKER = "Respond with exactly one word"++_STEERING_PREAMBLE = (+ "The team that owns this source has written preferences about its records: what matters, what to "+ "skip, and what is out of scope. Apply them when classifying; where they conflict with the guidance "+ "above, the team's preferences win. They never change the required output format."+)+++@frozen+class SourceSteering:+ text: str = ""+ default_not_actionable: bool = False++ @property+ def active(self) -> bool:+ return bool(self.text) or self.default_not_actionable+++def steering_from_config(config: Mapping[str, Any] | None) -> SourceSteering:+ """Parse a ``SignalSourceConfig.config`` blob into steering knobs.++ Defensive on purpose: the blob is API/MCP-writable JSON, and a malformed value must+ degrade to the canonical gate behavior rather than break emission.+ """+ if not isinstance(config, Mapping):+ return SourceSteering()+ raw_text = config.get(STEERING_KEY)+ text = raw_text.strip()[:STEERING_MAX_LENGTH] if isinstance(raw_text, str) else ""+ return SourceSteering(text=text, default_not_actionable=config.get(DEFAULT_NOT_ACTIONABLE_KEY) is True)+++def apply_steering(prompt: str, steering: SourceSteering) -> str:+ """Inject a team's steering into an actionability prompt template.++ Returns the template unchanged when steering is inactive. Operates on the template+ (before ``.format(description=...)``) because that is the only string whose markers+ are trusted: after formatting, record content could itself contain the marker lines.+ Steering braces are doubled so the later format call renders them literally instead+ of raising and hitting the gate's assume-actionable failure path.+ """+ if not steering.active:+ return prompt++ lines = prompt.split("\n")+ marker_index = next((i for i, line in enumerate(lines) if line.startswith(_POSTURE_MARKER)), None)++ inserted: list[str] = []+ if steering.default_not_actionable:+ if marker_index is not None:+ lines[marker_index] = _ALLOWLIST_POSTURE_LINE+ else:+ inserted.append(_ALLOWLIST_POSTURE_LINE)+ if steering.text:+ escaped = steering.text.replace("{", "{{").replace("}", "}}")+ inserted.extend(["", _STEERING_PREAMBLE, "<team_preferences>", escaped, "</team_preferences>"])++ if not inserted:+ return "\n".join(lines)++ if marker_index is not None:+ insert_at = marker_index + 1+ else:+ # Custom prompt without the canonical posture line: keep the steering above the+ # output-contract instruction so the one-word contract stays last.+ response_index = next((i for i, line in enumerate(lines) if line.startswith(_RESPONSE_MARKER)), None)+ insert_at = response_index if response_index is not None else len(lines)+ return "\n".join(lines[:insert_at] + inserted + lines[insert_at:])+++async def afetch_source_config(team_id: int, source_product: str, source_type: str) -> dict[str, Any]:+ """The team's ``SignalSourceConfig.config`` blob for one emission source, or ``{}``."""+ config = (+ await SignalSourceConfig.objects.filter(team_id=team_id, source_product=source_product, source_type=source_type)+ .values_list("config", flat=True)+ .afirst()+ )+ return config if isinstance(config, dict) else {}diff --git a/products/signals/backend/emission/tests/test_emit_signals.py b/products/signals/backend/emission/tests/test_emit_signals.pyindex 7911b755e64e..e7c302996f1b 100644--- a/products/signals/backend/emission/tests/test_emit_signals.py+++ b/products/signals/backend/emission/tests/test_emit_signals.py@@ -16,6 +16,7 @@ from temporalio.worker import Workerfrom posthog.hogql import ast+from products.signals.backend.emission._prompts import ISSUE_ACTIONABILITY_PROMPTfrom products.signals.backend.emission.emit_signals import (EmitDataImportSignalsWorkflow,EmitSignalsActivityInputs,@@ -644,6 +645,79 @@ class TestPipelineStageTelemetry:]+class TestRunSignalPipelineSteering:+ @pytest.mark.asyncio+ async def test_source_config_steering_customizes_actionability_prompt(self):+ team = MagicMock(id=1)+ team.uuid = uuid.UUID("00000000-0000-0000-0000-000000000001")+ config = _make_config(actionability_prompt=ISSUE_ACTIONABILITY_PROMPT)+ records = [{"id": "chore_1", "description": "Bump lodash to 4.17.21"}]++ captured_prompts: list[str] = []++ async def create(*args, **kwargs):+ captured_prompts.append(kwargs["messages"][0]["content"])+ return _make_llm_response("NOT_ACTIONABLE")++ mock_llm_client = MagicMock()+ mock_llm_client.messages.create = create++ with (+ patch(f"{PIPELINE_MODULE_PATH}.build_async_anthropic_client", return_value=mock_llm_client),+ patch(f"{PIPELINE_MODULE_PATH}.activity"),+ patch(f"{PIPELINE_MODULE_PATH}.emit_signal", new_callable=AsyncMock),+ patch(f"{PIPELINE_MODULE_PATH}.posthoganalytics.capture") as capture,+ ):+ result = await run_signal_pipeline(+ team=team,+ config=config,+ records=records,+ extra={},+ source_config={"steering": "Ignore issues labeled chore", "default_not_actionable": True},+ )++ assert result == {"status": "success", "reason": "no_actionable_records", "signals_emitted": 0}+ (prompt,) = captured_prompts+ assert "<team_preferences>" in prompt+ assert "Ignore issues labeled chore" in prompt+ assert "When in doubt, classify as NOT_ACTIONABLE" in prompt+ assert "Bump lodash to 4.17.21" in prompt+ # Steered gates also see the record's extra metadata, where emitters keep labels/state.+ assert "<record_metadata>" in prompt+ assert '"chore_1"' in prompt++ filtered_calls = [+ call for call in capture.call_args_list if call.kwargs["event"] == "signal_data_source_filtered"+ ]+ assert [call.kwargs["properties"]["steering_applied"] for call in filtered_calls] == [True]++ @pytest.mark.asyncio+ async def test_without_source_config_prompt_is_unchanged(self):+ team = MagicMock(id=1)+ team.uuid = uuid.UUID("00000000-0000-0000-0000-000000000001")+ config = _make_config(actionability_prompt=ISSUE_ACTIONABILITY_PROMPT)+ records = [{"id": "issue_1", "description": "Export button broken"}]++ captured_prompts: list[str] = []++ async def create(*args, **kwargs):+ captured_prompts.append(kwargs["messages"][0]["content"])+ return _make_llm_response("ACTIONABLE")++ mock_llm_client = MagicMock()+ mock_llm_client.messages.create = create++ with (+ patch(f"{PIPELINE_MODULE_PATH}.build_async_anthropic_client", return_value=mock_llm_client),+ patch(f"{PIPELINE_MODULE_PATH}.activity"),+ patch(f"{PIPELINE_MODULE_PATH}.emit_signal", new_callable=AsyncMock),+ patch(f"{PIPELINE_MODULE_PATH}.posthoganalytics.capture"),+ ):+ await run_signal_pipeline(team=team, config=config, records=records, extra={})++ assert captured_prompts == [ISSUE_ACTIONABILITY_PROMPT.format(description="Export button broken")]++class TestEmitDataImportSignalsWorkflow:def test_parse_inputs(self):schema_id = str(uuid.uuid4())@@ -754,6 +828,7 @@ class TestEmitActivityTableNameResolution:patch(f"{ACTIVITY_MODULE_PATH}.Heartbeater"),patch(f"{ACTIVITY_MODULE_PATH}.get_signal_config", return_value=config),patch(f"{ACTIVITY_MODULE_PATH}._fetch_schema_and_team", fetch_mock),+ patch(f"{ACTIVITY_MODULE_PATH}.afetch_source_config", AsyncMock(return_value={})),patch(f"{ACTIVITY_MODULE_PATH}.run_signal_pipeline", new_callable=AsyncMock) as run_mock,):run_mock.return_value = {"status": "success", "signals_emitted": 0}@@ -770,3 +845,39 @@ class TestEmitActivityTableNameResolution:)assert captured_context["table_name"] == expected_hogql_name+++class TestEmitActivitySourceConfigThreading:+ @pytest.mark.asyncio+ async def test_passes_team_source_config_to_pipeline(self):+ config = _make_config(record_fetcher=lambda team, config, context: [])+ team = MagicMock(id=7)+ schema = MagicMock()+ schema.table.name = "test_table"++ with (+ patch(f"{ACTIVITY_MODULE_PATH}.Heartbeater"),+ patch(f"{ACTIVITY_MODULE_PATH}.get_signal_config", return_value=config),+ patch(f"{ACTIVITY_MODULE_PATH}._fetch_schema_and_team", AsyncMock(return_value=(schema, team))),+ patch(f"{ACTIVITY_MODULE_PATH}.get_data_warehouse_table_name", return_value="test.table"),+ patch(+ f"{ACTIVITY_MODULE_PATH}.afetch_source_config",+ AsyncMock(return_value={"steering": "skip chores"}),+ ) as fetch_mock,+ patch(f"{ACTIVITY_MODULE_PATH}.run_signal_pipeline", new_callable=AsyncMock) as run_mock,+ ):+ run_mock.return_value = {"status": "success", "signals_emitted": 0}+ await emit_data_import_signals_activity(+ EmitSignalsActivityInputs(+ team_id=7,+ schema_id=uuid.uuid4(),+ source_id=uuid.uuid4(),+ job_id="job-x",+ source_type="GitHub",+ schema_name="issues",+ last_synced_at=None,+ )+ )++ fetch_mock.assert_awaited_once_with(team.id, config.source_product, config.source_type)+ assert run_mock.call_args.kwargs["source_config"] == {"steering": "skip chores"}diff --git a/products/signals/backend/emission/tests/test_steering.py b/products/signals/backend/emission/tests/test_steering.pynew file mode 100644index 000000000000..6467626893b8--- /dev/null+++ b/products/signals/backend/emission/tests/test_steering.py@@ -0,0 +1,91 @@+import pytest++from products.signals.backend.emission._prompts import ISSUE_ACTIONABILITY_PROMPT+from products.signals.backend.emission.registry import _SIGNAL_TABLE_CONFIGS+from products.signals.backend.emission.steering import (+ _POSTURE_MARKER,+ STEERING_MAX_LENGTH,+ SourceSteering,+ apply_steering,+ steering_from_config,+)+++class TestSteeringFromConfig:+ @pytest.mark.parametrize(+ "config,expected_text,expected_default_not_actionable",+ [+ (None, "", False),+ ({}, "", False),+ ("not a dict", "", False),+ ({"steering": " skip chore issues "}, "skip chore issues", False),+ ({"steering": 42}, "", False),+ ({"steering": ["skip", "chores"]}, "", False),+ ({"default_not_actionable": True}, "", True),+ ({"default_not_actionable": "yes"}, "", False),+ ({"default_not_actionable": 1}, "", False),+ ({"steering": "rules", "default_not_actionable": True}, "rules", True),+ ],+ )+ def test_parses_defensively(self, config, expected_text, expected_default_not_actionable):+ steering = steering_from_config(config)++ assert steering.text == expected_text+ assert steering.default_not_actionable is expected_default_not_actionable++ def test_truncates_oversized_text(self):+ steering = steering_from_config({"steering": "x" * (STEERING_MAX_LENGTH + 500)})++ assert len(steering.text) == STEERING_MAX_LENGTH+++class TestApplySteering:+ def test_inactive_steering_leaves_prompt_byte_identical(self):+ assert apply_steering(ISSUE_ACTIONABILITY_PROMPT, SourceSteering()) == ISSUE_ACTIONABILITY_PROMPT++ def test_injects_text_after_posture_line_and_survives_format(self):+ hostile = "Ignore issues labeled {chore}. Also {0}, {description} and { unbalanced"+ prompt = apply_steering(ISSUE_ACTIONABILITY_PROMPT, SourceSteering(text=hostile))++ formatted = prompt.format(description="Some issue body")++ assert hostile in formatted+ assert "Some issue body" in formatted+ assert "<team_preferences>" in formatted+ # The team block sits between the posture line and the record content.+ assert formatted.index(_POSTURE_MARKER) < formatted.index(hostile) < formatted.index("Some issue body")+ assert formatted.rstrip().endswith("Respond with exactly one word: ACTIONABLE or NOT_ACTIONABLE")++ def test_default_not_actionable_swaps_posture_line(self):+ prompt = apply_steering(ISSUE_ACTIONABILITY_PROMPT, SourceSteering(default_not_actionable=True))++ assert _POSTURE_MARKER not in prompt+ assert "When in doubt, classify as NOT_ACTIONABLE" in prompt+ assert prompt.count("Respond with exactly one word") == 1+ assert "{description}" in prompt++ def test_markerless_prompt_gets_steering_before_response_instruction(self):+ custom = "Actionable? {description}\nRespond with exactly one word: ACTIONABLE or NOT_ACTIONABLE"+ prompt = apply_steering(custom, SourceSteering(text="skip chores", default_not_actionable=True))++ assert "When in doubt, classify as NOT_ACTIONABLE" in prompt+ assert "skip chores" in prompt+ assert prompt.endswith("Respond with exactly one word: ACTIONABLE or NOT_ACTIONABLE")++ def test_markerless_prompt_without_response_line_appends_steering(self):+ prompt = apply_steering("Actionable? {description}", SourceSteering(text="skip chores"))++ assert prompt.startswith("Actionable? {description}")+ assert prompt.rstrip().endswith("</team_preferences>")+++def test_every_registered_actionability_prompt_carries_posture_marker():+ # The posture flip and steering injection anchor on this line; a source whose custom+ # prompt drops it would silently ignore a team's default_not_actionable setting.+ prompts = {+ key: config.actionability_prompt for key, config in _SIGNAL_TABLE_CONFIGS.items() if config.actionability_prompt+ }+ assert prompts++ missing = [key for key, prompt in prompts.items() if _POSTURE_MARKER not in prompt]+ assert missing == []diff --git a/products/signals/backend/management/AGENTS.md b/products/signals/backend/management/AGENTS.mdindex 9d693d58c6ca..51edeb7f18c5 100644--- a/products/signals/backend/management/AGENTS.md+++ b/products/signals/backend/management/AGENTS.md@@ -159,6 +159,7 @@ Idempotent — skips any report that already has a `task_run` artefact referenci## Tips- Compare runs by saving output: `list_signal_reports --json > run_baseline.json`+- `emit_signals_from_fixture` and `emit_signals_from_llm` apply the team's `SignalSourceConfig.config` steering keys (`steering`, `default_not_actionable`) like production does — clear them on the source's config row for an unsteered baseline- Read each command's source for all available flags — they are in this directory- If you are looking for the local-only debug commands `analyze_report.py`, `select_repo.py`, or `parse_sandbox_log.py`, those are documented in `../report_generation/AGENTS.md`- **If you change any command or the flow, update this file to match**diff --git a/products/signals/backend/management/commands/emit_signals_from_fixture.py b/products/signals/backend/management/commands/emit_signals_from_fixture.pyindex 5aa6db4f7c43..2112c4868f58 100644--- a/products/signals/backend/management/commands/emit_signals_from_fixture.py+++ b/products/signals/backend/management/commands/emit_signals_from_fixture.py@@ -9,6 +9,7 @@ from posthog.models import Teamfrom products.signals.backend.emission import get_signal_configfrom products.signals.backend.emission.pipeline import run_signal_pipeline+from products.signals.backend.models import SignalSourceConfig# Maps the CLI --type arg to (registry source_type, registry schema_name, fixture filename).# These sources are auto-registered at module load by registry._register_all_emitters().@@ -103,12 +104,23 @@ class Command(BaseCommand):f"Loaded {len(records)} {options['type']} records from {fixture_path}, running pipeline for team {team.id}")+ # Same lookup the production activities do, so team steering (`config.steering` /+ # `config.default_not_actionable`) is exercised by fixture runs too.+ source_config = (+ SignalSourceConfig.objects.filter(+ team_id=team.id, source_product=config.source_product, source_type=config.source_type+ )+ .values_list("config", flat=True)+ .first()+ )+result = asyncio.run(run_signal_pipeline(team=team,config=config,records=records,extra={"command": "emit_signals_from_fixture", "source": options["type"]},+ source_config=source_config if isinstance(source_config, dict) else None,))self.stdout.write(self.style.SUCCESS(f"Pipeline finished: {result}"))diff --git a/products/signals/backend/management/commands/emit_signals_from_llm.py b/products/signals/backend/management/commands/emit_signals_from_llm.pyindex 4c98e1415e24..e1367298a2a9 100644--- a/products/signals/backend/management/commands/emit_signals_from_llm.py+++ b/products/signals/backend/management/commands/emit_signals_from_llm.py@@ -230,6 +230,14 @@ class Command(BaseCommand):config = get_signal_config(registry_source, registry_schema)if config is None:raise CommandError(f"No signal config registered for {registry_source}/{registry_schema}")+ # Same lookup the production activities do, so team steering applies here too.+ source_config = (+ SignalSourceConfig.objects.filter(+ team_id=team.id, source_product=config.source_product, source_type=config.source_type+ )+ .values_list("config", flat=True)+ .first()+ )self.stdout.write(f"Emitting {len(records)} {source_kind} records through run_signal_pipeline...")result = asyncio.run(run_signal_pipeline(@@ -237,6 +245,7 @@ class Command(BaseCommand):config=config,records=records,extra={"command": "emit_signals_from_llm", "source": source_kind},+ source_config=source_config if isinstance(source_config, dict) else None,))emit_summary[source_kind] = (diff --git a/products/signals/backend/serializers.py b/products/signals/backend/serializers.pyindex 73c485c72a52..958a50b0feee 100644--- a/products/signals/backend/serializers.py+++ b/products/signals/backend/serializers.py@@ -12,6 +12,7 @@ from posthog.models import Userfrom products.signals.backend import contractsfrom products.signals.backend.billing import REFUND_INELIGIBILITY_REASONS, refund_ineligibility_reason+from products.signals.backend.contracts import DEFAULT_NOT_ACTIONABLE_KEY, STEERING_KEY, STEERING_MAX_LENGTHfrom products.signals.backend.enums import SignalSourceProduct, SignalSourceTypefrom .artefact_schemas import NON_WRITABLE_ARTEFACT_TYPES@@ -39,8 +40,36 @@ _DATA_IMPORT_SOURCE_MAP: dict[tuple[str, str], tuple[str, str]] = {}+_SOURCE_CONFIG_HELP_TEXT = (+ "Per-source settings as a JSON object. Keys read by the emission actionability gate on sources "+ "that define one (most data warehouse imports, and Conversations): "+ "`steering` (string, max 2000 characters) holds the team's preferences about this source's "+ "records in plain language: what matters, what to skip, what's out of scope. The emission "+ "actionability gate applies it when deciding which records become signals; rules apply from "+ "the next sync and nothing already emitted is retracted. "+ "`default_not_actionable` (boolean, default false) flips the gate's default: instead of "+ "keeping every record the steering rules don't exclude, only records that clearly match the "+ "team's preferences are kept. "+ "Other sources store these keys without reading them yet; future pipeline stages will consume "+ "the same steering text. "+ "Some sources read additional keys, for example `recording_filters` and `sample_rate` for "+ "session analysis."+)+++# Declared as an open object WITHOUT typed `properties`: Orval turns properties into a+# key-stripping `zod.object`, which would silently drop source-specific keys (e.g. session+# replay's `recording_filters`) from MCP tool calls. The open shape generates a passthrough+# `zod.record`, and the steering keys are documented in the description instead.+@extend_schema_field({"type": "object", "additionalProperties": True, "description": _SOURCE_CONFIG_HELP_TEXT})+class _SourceConfigField(serializers.JSONField):+ """`config` blob typed as an open JSON object in the OpenAPI schema. Runtime behavior is+ plain JSONField; steering-key validation stays in the serializer's `validate`."""++class SignalSourceConfigSerializer(serializers.ModelSerializer):status = serializers.SerializerMethodField()+ config = _SourceConfigField(required=False, help_text=_SOURCE_CONFIG_HELP_TEXT)class Meta:model = SignalSourceConfig@@ -92,7 +121,23 @@ class SignalSourceConfigSerializer(serializers.ModelSerializer):source_product = attrs.get("source_product", getattr(self.instance, "source_product", None))source_type = attrs.get("source_type", getattr(self.instance, "source_type", None))enabled = attrs.get("enabled", getattr(self.instance, "enabled", False))- config = attrs.get("config", {})+ config = attrs.get("config")+ # `is not None` rather than truthiness: falsy non-dict values ([], "", 0, false) must be+ # rejected, not silently persisted.+ if config is not None:+ if not isinstance(config, dict):+ raise serializers.ValidationError({"config": "config must be a JSON object"})+ # Presence-based checks so an explicit null is rejected like any other wrong type.+ if STEERING_KEY in config:+ steering = config[STEERING_KEY]+ if not isinstance(steering, str):+ raise serializers.ValidationError({"config": "steering must be a string"})+ if len(steering) > STEERING_MAX_LENGTH:+ raise serializers.ValidationError(+ {"config": f"steering must be at most {STEERING_MAX_LENGTH} characters"}+ )+ if DEFAULT_NOT_ACTIONABLE_KEY in config and not isinstance(config[DEFAULT_NOT_ACTIONABLE_KEY], bool):+ raise serializers.ValidationError({"config": "default_not_actionable must be a boolean"})if source_product == SignalSourceConfig.SourceProduct.SESSION_REPLAY and config:recording_filters = config.get("recording_filters")if recording_filters is not None and not isinstance(recording_filters, dict):diff --git a/products/signals/backend/test/test_signal_source_config_api.py b/products/signals/backend/test/test_signal_source_config_api.pyindex 4b6a504f593e..9865116930d3 100644--- a/products/signals/backend/test/test_signal_source_config_api.py+++ b/products/signals/backend/test/test_signal_source_config_api.py@@ -175,6 +175,39 @@ class TestSignalSourceConfigAPI(APIBaseTest):)assert response.status_code == expected_status, response.json()+ @parameterized.expand(+ [+ ("valid_steering", {"steering": "Ignore issues labeled chore"}, status.HTTP_201_CREATED),+ ("steering_at_cap", {"steering": "x" * 2000}, status.HTTP_201_CREATED),+ ("steering_over_cap", {"steering": "x" * 2001}, status.HTTP_400_BAD_REQUEST),+ ("steering_not_string", {"steering": ["skip", "chores"]}, status.HTTP_400_BAD_REQUEST),+ ("valid_default_not_actionable", {"default_not_actionable": True}, status.HTTP_201_CREATED),+ ("default_not_actionable_not_bool", {"default_not_actionable": "yes"}, status.HTTP_400_BAD_REQUEST),+ (+ "both_keys_valid",+ {"steering": "Release checklists are never actionable", "default_not_actionable": False},+ status.HTTP_201_CREATED,+ ),+ # Falsy non-dict values must be rejected, not skipped by a truthiness guard.+ ("config_list", [], status.HTTP_400_BAD_REQUEST),+ ("config_string", "skip chores", status.HTTP_400_BAD_REQUEST),+ # Explicit nulls violate the key types and must not persist.+ ("steering_null", {"steering": None}, status.HTTP_400_BAD_REQUEST),+ ("default_not_actionable_null", {"default_not_actionable": None}, status.HTTP_400_BAD_REQUEST),+ ]+ )+ def test_create_steering_config_validation(self, _name, config, expected_status):+ # Steering keys are shared by every emission source, so they validate on a+ # non-session-replay source too.+ response = self.client.post(+ self._url(),+ data={"source_product": "github", "source_type": "issue", "enabled": False, "config": config},+ format="json",+ )+ assert response.status_code == expected_status, response.json()+ if expected_status == status.HTTP_201_CREATED:+ assert response.json()["config"] == config+# --- List ---def test_list_source_configs(self):diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex 3ff059c45e4f..0485a74ac10b 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -3893,12 +3893,18 @@ export const SignalSourceConfigSourceTypeEnumApi = {CiDurationRegression: 'ci_duration_regression',} as const+/**+ * Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis.+ */+export type SignalSourceConfigApiConfig = { [key: string]: unknown }+export interface SignalSourceConfigApi {readonly id: stringsource_product: SignalSourceConfigSourceProductEnumApisource_type: SignalSourceConfigSourceTypeEnumApienabled?: boolean- config?: unknown+ /** Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis. */+ config?: SignalSourceConfigApiConfigreadonly created_at: stringreadonly updated_at: string/** @nullable */@@ -3914,12 +3920,18 @@ export interface PaginatedSignalSourceConfigListApi {results: SignalSourceConfigApi[]}+/**+ * Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis.+ */+export type PatchedSignalSourceConfigApiConfig = { [key: string]: unknown }+export interface PatchedSignalSourceConfigApi {readonly id?: stringsource_product?: SignalSourceConfigSourceProductEnumApisource_type?: SignalSourceConfigSourceTypeEnumApienabled?: boolean- config?: unknown+ /** Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis. */+ config?: PatchedSignalSourceConfigApiConfigreadonly created_at?: stringreadonly updated_at?: string/** @nullable */diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.tsindex 6ad92e2d8ce2..37b82fdafe8b 100644--- a/products/signals/frontend/generated/api.zod.ts+++ b/products/signals/frontend/generated/api.zod.ts@@ -1359,7 +1359,12 @@ export const SignalsSourceConfigsCreateBody = /* @__PURE__ */ zod.object({'\* `session_analysis_cluster` - Session analysis cluster\n\* `evaluation_report` - Evaluation report\n\* `issue` - Issue\n\* `ticket` - Ticket\n\* `issue_created` - Issue created\n\* `issue_reopened` - Issue reopened\n\* `issue_spiking` - Issue spiking\n\* `cross_source_issue` - Cross source issue\n\* `alert_state_change` - Alert state change\n\* `health_issue` - Health issue\n\* `endpoint_execution_failed` - Endpoint execution failed\n\* `endpoint_breakdown_limit_exceeded` - Endpoint breakdown limit exceeded\n\* `scanner_finding` - Scanner finding\n\* `anomaly_investigation` - Anomaly investigation\n\* `ci_flaky_check` - CI flaky check\n\* `ci_broken_default_branch` - CI broken default branch\n\* `ci_duration_regression` - CI duration regression'),enabled: zod.boolean().optional(),- config: zod.unknown().optional(),+ config: zod+ .record(zod.string(), zod.unknown())+ .optional()+ .describe(+ "Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis."+ ),})export const SignalsSourceConfigsUpdateBody = /* @__PURE__ */ zod.object({@@ -1442,7 +1447,12 @@ export const SignalsSourceConfigsUpdateBody = /* @__PURE__ */ zod.object({'\* `session_analysis_cluster` - Session analysis cluster\n\* `evaluation_report` - Evaluation report\n\* `issue` - Issue\n\* `ticket` - Ticket\n\* `issue_created` - Issue created\n\* `issue_reopened` - Issue reopened\n\* `issue_spiking` - Issue spiking\n\* `cross_source_issue` - Cross source issue\n\* `alert_state_change` - Alert state change\n\* `health_issue` - Health issue\n\* `endpoint_execution_failed` - Endpoint execution failed\n\* `endpoint_breakdown_limit_exceeded` - Endpoint breakdown limit exceeded\n\* `scanner_finding` - Scanner finding\n\* `anomaly_investigation` - Anomaly investigation\n\* `ci_flaky_check` - CI flaky check\n\* `ci_broken_default_branch` - CI broken default branch\n\* `ci_duration_regression` - CI duration regression'),enabled: zod.boolean().optional(),- config: zod.unknown().optional(),+ config: zod+ .record(zod.string(), zod.unknown())+ .optional()+ .describe(+ "Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis."+ ),})export const SignalsSourceConfigsPartialUpdateBody = /* @__PURE__ */ zod.object({@@ -1527,7 +1537,12 @@ export const SignalsSourceConfigsPartialUpdateBody = /* @__PURE__ */ zod.object('\* `session_analysis_cluster` - Session analysis cluster\n\* `evaluation_report` - Evaluation report\n\* `issue` - Issue\n\* `ticket` - Ticket\n\* `issue_created` - Issue created\n\* `issue_reopened` - Issue reopened\n\* `issue_spiking` - Issue spiking\n\* `cross_source_issue` - Cross source issue\n\* `alert_state_change` - Alert state change\n\* `health_issue` - Health issue\n\* `endpoint_execution_failed` - Endpoint execution failed\n\* `endpoint_breakdown_limit_exceeded` - Endpoint breakdown limit exceeded\n\* `scanner_finding` - Scanner finding\n\* `anomaly_investigation` - Anomaly investigation\n\* `ci_flaky_check` - CI flaky check\n\* `ci_broken_default_branch` - CI broken default branch\n\* `ci_duration_regression` - CI duration regression'),enabled: zod.boolean().optional(),- config: zod.unknown().optional(),+ config: zod+ .record(zod.string(), zod.unknown())+ .optional()+ .describe(+ "Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis."+ ),})/**diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex dbedd187968d..000276209d0d 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -51579,12 +51579,18 @@ export namespace Schemas {CiDurationRegression: 'ci_duration_regression',} as const;+ /**+ * Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis.+ */+ export type SignalSourceConfigConfig = { [key: string]: unknown };+export interface SignalSourceConfig {readonly id: string;source_product: SignalSourceConfigSourceProductEnum;source_type: SignalSourceConfigSourceTypeEnum;enabled?: boolean;- config?: unknown;+ /** Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis. */+ config?: SignalSourceConfigConfig;readonly created_at: string;readonly updated_at: string;/** @nullable */@@ -60213,12 +60219,18 @@ export namespace Schemas {mcp_gateway_server_ids?: string[];}+ /**+ * Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis.+ */+ export type PatchedSignalSourceConfigConfig = { [key: string]: unknown };+export interface PatchedSignalSourceConfig {readonly id?: string;source_product?: SignalSourceConfigSourceProductEnum;source_type?: SignalSourceConfigSourceTypeEnum;enabled?: boolean;- config?: unknown;+ /** Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis. */+ config?: PatchedSignalSourceConfigConfig;readonly created_at?: string;readonly updated_at?: string;/** @nullable */diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex 7d9b97a2c1b4..f20a1fd0dbb6 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -1877,7 +1877,12 @@ export const SignalsSourceConfigsCreateBody = /* @__PURE__ */ zod.object({'\* `session_analysis_cluster` - Session analysis cluster\n\* `evaluation_report` - Evaluation report\n\* `issue` - Issue\n\* `ticket` - Ticket\n\* `issue_created` - Issue created\n\* `issue_reopened` - Issue reopened\n\* `issue_spiking` - Issue spiking\n\* `cross_source_issue` - Cross source issue\n\* `alert_state_change` - Alert state change\n\* `health_issue` - Health issue\n\* `endpoint_execution_failed` - Endpoint execution failed\n\* `endpoint_breakdown_limit_exceeded` - Endpoint breakdown limit exceeded\n\* `scanner_finding` - Scanner finding\n\* `anomaly_investigation` - Anomaly investigation\n\* `ci_flaky_check` - CI flaky check\n\* `ci_broken_default_branch` - CI broken default branch\n\* `ci_duration_regression` - CI duration regression'),enabled: zod.boolean().optional(),- config: zod.unknown().optional(),+ config: zod+ .record(zod.string(), zod.unknown())+ .optional()+ .describe(+ "Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis."+ ),})export const SignalsSourceConfigsRetrieveParams = /* @__PURE__ */ zod.object({@@ -1978,7 +1983,12 @@ export const SignalsSourceConfigsUpdateBody = /* @__PURE__ */ zod.object({'\* `session_analysis_cluster` - Session analysis cluster\n\* `evaluation_report` - Evaluation report\n\* `issue` - Issue\n\* `ticket` - Ticket\n\* `issue_created` - Issue created\n\* `issue_reopened` - Issue reopened\n\* `issue_spiking` - Issue spiking\n\* `cross_source_issue` - Cross source issue\n\* `alert_state_change` - Alert state change\n\* `health_issue` - Health issue\n\* `endpoint_execution_failed` - Endpoint execution failed\n\* `endpoint_breakdown_limit_exceeded` - Endpoint breakdown limit exceeded\n\* `scanner_finding` - Scanner finding\n\* `anomaly_investigation` - Anomaly investigation\n\* `ci_flaky_check` - CI flaky check\n\* `ci_broken_default_branch` - CI broken default branch\n\* `ci_duration_regression` - CI duration regression'),enabled: zod.boolean().optional(),- config: zod.unknown().optional(),+ config: zod+ .record(zod.string(), zod.unknown())+ .optional()+ .describe(+ "Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis."+ ),})export const SignalsSourceConfigsPartialUpdateParams = /* @__PURE__ */ zod.object({@@ -2072,5 +2082,10 @@ export const SignalsSourceConfigsPartialUpdateBody = /* @__PURE__ */ zod.object('\* `session_analysis_cluster` - Session analysis cluster\n\* `evaluation_report` - Evaluation report\n\* `issue` - Issue\n\* `ticket` - Ticket\n\* `issue_created` - Issue created\n\* `issue_reopened` - Issue reopened\n\* `issue_spiking` - Issue spiking\n\* `cross_source_issue` - Cross source issue\n\* `alert_state_change` - Alert state change\n\* `health_issue` - Health issue\n\* `endpoint_execution_failed` - Endpoint execution failed\n\* `endpoint_breakdown_limit_exceeded` - Endpoint breakdown limit exceeded\n\* `scanner_finding` - Scanner finding\n\* `anomaly_investigation` - Anomaly investigation\n\* `ci_flaky_check` - CI flaky check\n\* `ci_broken_default_branch` - CI broken default branch\n\* `ci_duration_regression` - CI duration regression'),enabled: zod.boolean().optional(),- config: zod.unknown().optional(),+ config: zod+ .record(zod.string(), zod.unknown())+ .optional()+ .describe(+ "Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis."+ ),})diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-source-configs-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-source-configs-create.jsonindex 41983a750d9b..dc289256f67f 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-source-configs-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-source-configs-create.json@@ -1,7 +1,14 @@{"$schema": "https://json-schema.org/draft/2020-12/schema","properties": {- "config": {},+ "config": {+ "additionalProperties": {},+ "description": "Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },"enabled": {"type": "boolean"},diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-source-configs-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-source-configs-partial-update.jsonindex 009bb4745f02..4cd534465f1d 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-source-configs-partial-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-source-configs-partial-update.json@@ -1,7 +1,14 @@{"$schema": "https://json-schema.org/draft/2020-12/schema","properties": {- "config": {},+ "config": {+ "additionalProperties": {},+ "description": "Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },"enabled": {"type": "boolean"},diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-source-configs-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-source-configs-update.jsonindex 2a9e6d78a544..65009e8e463e 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-source-configs-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-source-configs-update.json@@ -1,7 +1,14 @@{"$schema": "https://json-schema.org/draft/2020-12/schema","properties": {- "config": {},+ "config": {+ "additionalProperties": {},+ "description": "Per-source settings as a JSON object. Keys read by the emission actionability gate on sources that define one (most data warehouse imports, and Conversations): `steering` (string, max 2000 characters) holds the team's preferences about this source's records in plain language: what matters, what to skip, what's out of scope. The emission actionability gate applies it when deciding which records become signals; rules apply from the next sync and nothing already emitted is retracted. `default_not_actionable` (boolean, default false) flips the gate's default: instead of keeping every record the steering rules don't exclude, only records that clearly match the team's preferences are kept. Other sources store these keys without reading them yet; future pipeline stages will consume the same steering text. Some sources read additional keys, for example `recording_filters` and `sample_rate` for session analysis.",+ "propertyNames": {+ "type": "string"+ },+ "type": "object"+ },"enabled": {"type": "boolean"},