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(signals): thread optional remediation field through the pipeline (#61954)

Rafael Audibert4fb2e5d4abc5
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index fecc743c4f80..102e3ee53b62 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -11775,6 +11775,9 @@
"extra": {
"$ref": "#/definitions/ConversationsTicketSignalExtra"
},
+ "remediation": {
+ "$ref": "#/definitions/SignalRemediation"
+ },
"source_id": {
"type": "string"
},
@@ -11790,7 +11793,7 @@
"type": "number"
}
},
- "required": ["source_type", "source_product", "source_id", "description", "weight", "extra"],
+ "required": ["description", "extra", "source_id", "source_product", "source_type", "weight"],
"type": "object"
},
"ConversionGoalFilter": {
@@ -15921,6 +15924,9 @@
"extra": {
"$ref": "#/definitions/EndpointExecutionFailedSignalExtra"
},
+ "remediation": {
+ "$ref": "#/definitions/SignalRemediation"
+ },
"source_id": {
"type": "string"
},
@@ -15936,7 +15942,7 @@
"type": "number"
}
},
- "required": ["source_type", "source_product", "source_id", "description", "weight", "extra"],
+ "required": ["description", "extra", "source_id", "source_product", "source_type", "weight"],
"type": "object"
},
"EndpointLastExecutionTimesRequest": {
@@ -17479,6 +17485,9 @@
"extra": {
"$ref": "#/definitions/ErrorTrackingSignalExtra"
},
+ "remediation": {
+ "$ref": "#/definitions/SignalRemediation"
+ },
"source_id": {
"type": "string"
},
@@ -17494,7 +17503,7 @@
"type": "number"
}
},
- "required": ["source_type", "source_product", "source_id", "description", "weight", "extra"],
+ "required": ["description", "extra", "source_id", "source_product", "source_type", "weight"],
"type": "object"
},
"ErrorTrackingSimilarIssuesQuery": {
@@ -21840,6 +21849,9 @@
"extra": {
"$ref": "#/definitions/GithubIssueSignalExtra"
},
+ "remediation": {
+ "$ref": "#/definitions/SignalRemediation"
+ },
"source_id": {
"type": "string"
},
@@ -21855,7 +21867,7 @@
"type": "number"
}
},
- "required": ["source_type", "source_product", "source_id", "description", "weight", "extra"],
+ "required": ["description", "extra", "source_id", "source_product", "source_type", "weight"],
"type": "object"
},
"GoalLine": {
@@ -24492,6 +24504,9 @@
"extra": {
"$ref": "#/definitions/LinearIssueSignalExtra"
},
+ "remediation": {
+ "$ref": "#/definitions/SignalRemediation"
+ },
"source_id": {
"type": "string"
},
@@ -24507,7 +24522,7 @@
"type": "number"
}
},
- "required": ["source_type", "source_product", "source_id", "description", "weight", "extra"],
+ "required": ["description", "extra", "source_id", "source_product", "source_type", "weight"],
"type": "object"
},
"LinkedinAdsDefaultSources": {
@@ -24592,6 +24607,9 @@
"extra": {
"$ref": "#/definitions/LlmEvalReportSignalExtra"
},
+ "remediation": {
+ "$ref": "#/definitions/SignalRemediation"
+ },
"source_id": {
"type": "string"
},
@@ -24607,7 +24625,7 @@
"type": "number"
}
},
- "required": ["source_type", "source_product", "source_id", "description", "weight", "extra"],
+ "required": ["description", "extra", "source_id", "source_product", "source_type", "weight"],
"type": "object"
},
"LlmEvaluationSignalInput": {
@@ -24619,6 +24637,9 @@
"extra": {
"$ref": "#/definitions/LlmEvalSignalExtra"
},
+ "remediation": {
+ "$ref": "#/definitions/SignalRemediation"
+ },
"source_id": {
"type": "string"
},
@@ -24634,7 +24655,7 @@
"type": "number"
}
},
- "required": ["source_type", "source_product", "source_id", "description", "weight", "extra"],
+ "required": ["description", "extra", "source_id", "source_product", "source_type", "weight"],
"type": "object"
},
"LoadingBlock": {
@@ -25112,6 +25133,9 @@
"extra": {
"$ref": "#/definitions/LogsAlertStateChangeSignalExtra"
},
+ "remediation": {
+ "$ref": "#/definitions/SignalRemediation"
+ },
"source_id": {
"type": "string"
},
@@ -25127,7 +25151,7 @@
"type": "number"
}
},
- "required": ["source_type", "source_product", "source_id", "description", "weight", "extra"],
+ "required": ["description", "extra", "source_id", "source_product", "source_type", "weight"],
"type": "object"
},
"LogsOrderBy": {
@@ -29137,6 +29161,9 @@
"extra": {
"$ref": "#/definitions/PgAnalyzeIssueSignalExtra"
},
+ "remediation": {
+ "$ref": "#/definitions/SignalRemediation"
+ },
"source_id": {
"type": "string"
},
@@ -29152,7 +29179,7 @@
"type": "number"
}
},
- "required": ["source_type", "source_product", "source_id", "description", "weight", "extra"],
+ "required": ["description", "extra", "source_id", "source_product", "source_type", "weight"],
"type": "object"
},
"PinterestAdsDefaultSources": {
@@ -38548,6 +38575,9 @@
"extra": {
"$ref": "#/definitions/SessionProblemSignalExtra"
},
+ "remediation": {
+ "$ref": "#/definitions/SignalRemediation"
+ },
"source_id": {
"type": "string"
},
@@ -38563,7 +38593,7 @@
"type": "number"
}
},
- "required": ["source_type", "source_product", "source_id", "description", "weight", "extra"],
+ "required": ["description", "extra", "source_id", "source_product", "source_type", "weight"],
"type": "object"
},
"SessionPropertyFilter": {
@@ -39166,6 +39196,10 @@
},
"type": "object"
},
+ "SignalExtraBase": {
+ "additionalProperties": false,
+ "type": "object"
+ },
"SignalInput": {
"anyOf": [
{
@@ -39206,6 +39240,54 @@
}
]
},
+ "SignalInputBase": {
+ "additionalProperties": false,
+ "properties": {
+ "description": {
+ "type": "string"
+ },
+ "extra": {
+ "$ref": "#/definitions/SignalExtraBase"
+ },
+ "remediation": {
+ "$ref": "#/definitions/SignalRemediation"
+ },
+ "source_id": {
+ "type": "string"
+ },
+ "source_product": {
+ "type": "string"
+ },
+ "source_type": {
+ "type": "string"
+ },
+ "weight": {
+ "type": "number"
+ }
+ },
+ "required": ["source_type", "source_product", "source_id", "description", "weight", "extra"],
+ "type": "object"
+ },
+ "SignalRemediation": {
+ "additionalProperties": false,
+ "properties": {
+ "agent": {
+ "description": "Agent-facing guidance: how to investigate (which MCP tools to call) and, where the fix lives in the user's codebase, how to apply it. The research agent treats this as authoritative — it still investigates and produces findings, but follows this instead of starting cold.",
+ "type": "string"
+ },
+ "human": {
+ "description": "Human-facing fix steps (PostHog UI / alert destinations). Surfaced in the report for the reader.",
+ "type": "string"
+ },
+ "priority": {
+ "description": "Suggested report priority; advisory, the research agent may override.",
+ "enum": ["P0", "P1", "P2", "P3", "P4"],
+ "type": "string"
+ }
+ },
+ "required": ["human", "agent"],
+ "type": "object"
+ },
"SignalReviewerUserInfo": {
"additionalProperties": false,
"properties": {
@@ -39362,6 +39444,9 @@
"extra": {
"$ref": "#/definitions/SignalsScoutSignalExtra"
},
+ "remediation": {
+ "$ref": "#/definitions/SignalRemediation"
+ },
"source_id": {
"type": "string"
},
@@ -39377,7 +39462,7 @@
"type": "number"
}
},
- "required": ["source_type", "source_product", "source_id", "description", "weight", "extra"],
+ "required": ["description", "extra", "source_id", "source_product", "source_type", "weight"],
"type": "object"
},
"SimilarIssue": {
@@ -44650,6 +44735,9 @@
"extra": {
"$ref": "#/definitions/ZendeskTicketSignalExtra"
},
+ "remediation": {
+ "$ref": "#/definitions/SignalRemediation"
+ },
"source_id": {
"type": "string"
},
@@ -44665,7 +44753,7 @@
"type": "number"
}
},
- "required": ["source_type", "source_product", "source_id", "description", "weight", "extra"],
+ "required": ["description", "extra", "source_id", "source_product", "source_type", "weight"],
"type": "object"
},
"getEffectiveExcludedColumns": {
diff --git a/frontend/src/queries/schema/schema-signals.ts b/frontend/src/queries/schema/schema-signals.ts
index 44027cb4512f..f6db6aa6e309 100644
--- a/frontend/src/queries/schema/schema-signals.ts
+++ b/frontend/src/queries/schema/schema-signals.ts
@@ -31,6 +31,43 @@ export enum SignalSourceType {
ALERT_STATE_CHANGE = 'alert_state_change',
}
+// ── Shared optional remediation ──────────────────────────────────────────────────
+// A known fix attached to a signal. Optional and separate from `extra`: `extra` is product-specific
+// evidence; `remediation` is the fix guidance. Mirrors the health-checks `Remediation(human, agent)`
+// constant so a check's remediation maps straight onto a signal. When present, the signal is treated
+// as actionable: the research agent follows the `agent` guidance rather than investigating from
+// scratch — it still runs, produces findings, and writes the human-facing report. Every variant may
+// carry it.
+
+export interface SignalRemediation {
+ /** Human-facing fix steps (PostHog UI / alert destinations). Surfaced in the report for the reader. */
+ human: string
+ /** Agent-facing guidance: how to investigate (which MCP tools to call) and, where the fix lives
+ * in the user's codebase, how to apply it. The research agent treats this as authoritative — it
+ * still investigates and produces findings, but follows this instead of starting cold. */
+ agent: string
+ /** Suggested report priority; advisory, the research agent may override. */
+ priority?: 'P0' | 'P1' | 'P2' | 'P3' | 'P4'
+}
+
+// ── Shared signal extra & input base ───────────────────────────────────────────────
+// Marker base every per-source `extra` payload extends. Empty today: it gives the input base a
+// single `extra` type to reference and is where any future cross-source extra field would live.
+export interface SignalExtraBase {}
+
+// Top-level fields every variant carries. Concrete variants narrow `source_type`, `source_product`,
+// and `extra` to their specific literal/payload types (those narrowings discriminate the union).
+// `remediation` is source-agnostic: any signal may carry it, even though only some sources emit it today.
+export interface SignalInputBase {
+ source_type: string
+ source_product: string
+ source_id: string
+ description: string
+ weight: number
+ extra: SignalExtraBase
+ remediation?: SignalRemediation
+}
+
// ── Per-product signal extras & inputs ──────────────────────────────────────────
// Session replay problem (emitted per-session for problem-indicating segments)
@@ -43,7 +80,7 @@ export interface SessionProblemEventEntry {
interaction_text?: string
}
-export interface SessionProblemSignalExtra {
+export interface SessionProblemSignalExtra extends SignalExtraBase {
session_id: string
segment_title: string
start_time: string
@@ -58,12 +95,9 @@ export interface SessionProblemSignalExtra {
event_history?: SessionProblemEventEntry[]
}
-export interface SessionProblemSignalInput {
+export interface SessionProblemSignalInput extends SignalInputBase {
source_type: 'session_problem'
source_product: 'session_replay'
- source_id: string
- description: string
- weight: number
extra: SessionProblemSignalExtra
}
@@ -84,7 +118,7 @@ export interface SessionSegmentClusterMetrics {
}
/** @deprecated No longer emitted. */
-export interface SessionSegmentClusterSignalExtra {
+export interface SessionSegmentClusterSignalExtra extends SignalExtraBase {
label_title: string
actionable: boolean
segments: SessionReplaySegment[]
@@ -103,7 +137,7 @@ export interface SessionSegmentClusterSignalInput {
// LLM evaluation
-export interface LlmEvalSignalExtra {
+export interface LlmEvalSignalExtra extends SignalExtraBase {
evaluation_id: string
target_event_id?: string
target_event_type?: string
@@ -112,18 +146,15 @@ export interface LlmEvalSignalExtra {
provider?: string
}
-export interface LlmEvaluationSignalInput {
+export interface LlmEvaluationSignalInput extends SignalInputBase {
source_type: 'evaluation'
source_product: 'llm_analytics'
- source_id: string
- description: string
- weight: number
extra: LlmEvalSignalExtra
}
// LLM evaluation report (one signal per report run, distilled from many results)
-export interface LlmEvalReportSignalExtra {
+export interface LlmEvalReportSignalExtra extends SignalExtraBase {
evaluation_id: string
evaluation_name: string
evaluation_description: string
@@ -133,18 +164,15 @@ export interface LlmEvalReportSignalExtra {
period_end: string
}
-export interface LlmEvaluationReportSignalInput {
+export interface LlmEvaluationReportSignalInput extends SignalInputBase {
source_type: 'evaluation_report'
source_product: 'llm_analytics'
- source_id: string
- description: string
- weight: number
extra: LlmEvalReportSignalExtra
}
// Zendesk ticket
-export interface ZendeskTicketSignalExtra {
+export interface ZendeskTicketSignalExtra extends SignalExtraBase {
url: string
type: string | null
tags: string[]
@@ -153,18 +181,15 @@ export interface ZendeskTicketSignalExtra {
status: string
}
-export interface ZendeskTicketSignalInput {
+export interface ZendeskTicketSignalInput extends SignalInputBase {
source_type: 'ticket'
source_product: 'zendesk'
- source_id: string
- description: string
- weight: number
extra: ZendeskTicketSignalExtra
}
// GitHub issue
-export interface GithubIssueSignalExtra {
+export interface GithubIssueSignalExtra extends SignalExtraBase {
html_url: string
number: number
labels: string[]
@@ -174,18 +199,15 @@ export interface GithubIssueSignalExtra {
state: string
}
-export interface GithubIssueSignalInput {
+export interface GithubIssueSignalInput extends SignalInputBase {
source_type: 'issue'
source_product: 'github'
- source_id: string
- description: string
- weight: number
extra: GithubIssueSignalExtra
}
// Linear issue
-export interface LinearIssueSignalExtra {
+export interface LinearIssueSignalExtra extends SignalExtraBase {
url: string
identifier: string
number: number
@@ -199,18 +221,15 @@ export interface LinearIssueSignalExtra {
updated_at: string
}
-export interface LinearIssueSignalInput {
+export interface LinearIssueSignalInput extends SignalInputBase {
source_type: 'issue'
source_product: 'linear'
- source_id: string
- description: string
- weight: number
extra: LinearIssueSignalExtra
}
// Conversations ticket
-export interface ConversationsTicketSignalExtra {
+export interface ConversationsTicketSignalExtra extends SignalExtraBase {
ticket_number: number
channel_source: string
channel_detail: string | null
@@ -220,27 +239,21 @@ export interface ConversationsTicketSignalExtra {
email_subject: string | null
}
-export interface ConversationsTicketSignalInput {
+export interface ConversationsTicketSignalInput extends SignalInputBase {
source_type: 'ticket'
source_product: 'conversations'
- source_id: string
- description: string
- weight: number
extra: ConversationsTicketSignalExtra
}
// Error tracking
-export interface ErrorTrackingSignalExtra {
+export interface ErrorTrackingSignalExtra extends SignalExtraBase {
fingerprint: string
}
-export interface ErrorTrackingSignalInput {
+export interface ErrorTrackingSignalInput extends SignalInputBase {
source_type: 'issue_created' | 'issue_reopened' | 'issue_spiking'
source_product: 'error_tracking'
- source_id: string
- description: string
- weight: number
extra: ErrorTrackingSignalExtra
}
@@ -253,7 +266,7 @@ export interface PgAnalyzeIssueReference {
queryText: string | null
}
-export interface PgAnalyzeIssueSignalExtra {
+export interface PgAnalyzeIssueSignalExtra extends SignalExtraBase {
severity: string | null
references: PgAnalyzeIssueReference[]
database_id: string | null
@@ -262,18 +275,15 @@ export interface PgAnalyzeIssueSignalExtra {
synced_at: string
}
-export interface PgAnalyzeIssueSignalInput {
+export interface PgAnalyzeIssueSignalInput extends SignalInputBase {
source_type: 'issue'
source_product: 'pganalyze'
- source_id: string
- description: string
- weight: number
extra: PgAnalyzeIssueSignalExtra
}
// Endpoint execution failure
-export interface EndpointExecutionFailedSignalExtra {
+export interface EndpointExecutionFailedSignalExtra extends SignalExtraBase {
endpoint_name: string
endpoint_version: number | null
materialized: boolean
@@ -282,12 +292,9 @@ export interface EndpointExecutionFailedSignalExtra {
error_message: string
}
-export interface EndpointExecutionFailedSignalInput {
+export interface EndpointExecutionFailedSignalInput extends SignalInputBase {
source_type: 'endpoint_execution_failed'
source_product: 'endpoints'
- source_id: string
- description: string
- weight: number
extra: EndpointExecutionFailedSignalExtra
}
@@ -302,7 +309,7 @@ export interface SignalsScoutEvidenceEntry {
summary: string
}
-export interface SignalsScoutSignalExtra {
+export interface SignalsScoutSignalExtra extends SignalExtraBase {
scout_run_id: string
/** The `tasks.TaskRun` id the scout span ran inside. Join key into the `signals_scouts_runs`
* LLM-analytics view, which is keyed on `task_run_id` (the `scout_run_id` bridge row is not). */
@@ -326,18 +333,15 @@ export interface SignalsScoutSignalExtra {
mcp_trace_id?: string
}
-export interface SignalsScoutSignalInput {
+export interface SignalsScoutSignalInput extends SignalInputBase {
source_type: 'cross_source_issue'
source_product: 'signals_scout'
- source_id: string
- description: string
- weight: number
extra: SignalsScoutSignalExtra
}
// Logs alert notification (firing / broken)
-export interface LogsAlertStateChangeSignalExtra {
+export interface LogsAlertStateChangeSignalExtra extends SignalExtraBase {
alert_id: string
alert_name: string
action: 'firing' | 'broken'
@@ -350,12 +354,9 @@ export interface LogsAlertStateChangeSignalExtra {
url: string
}
-export interface LogsAlertStateChangeSignalInput {
+export interface LogsAlertStateChangeSignalInput extends SignalInputBase {
source_type: 'alert_state_change'
source_product: 'logs'
- source_id: string
- description: string
- weight: number
extra: LogsAlertStateChangeSignalExtra
}
diff --git a/posthog/schema.py b/posthog/schema.py
index 597190e76a94..69e0e9b4734b 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -1144,18 +1144,6 @@ class ConversationsTicketSignalExtra(BaseModel):
ticket_number: float
-class ConversationsTicketSignalInput(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- description: str
- extra: ConversationsTicketSignalExtra
- source_id: str
- source_product: Literal["conversations"] = "conversations"
- source_type: Literal["ticket"] = "ticket"
- weight: float
-
-
class CoreEventCategory(StrEnum):
ACQUISITION = "acquisition"
ACTIVATION = "activation"
@@ -1671,18 +1659,6 @@ class EndpointExecutionFailedSignalExtra(BaseModel):
saved_query_id: str | None = None
-class EndpointExecutionFailedSignalInput(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- description: str
- extra: EndpointExecutionFailedSignalExtra
- source_id: str
- source_product: Literal["endpoints"] = "endpoints"
- source_type: Literal["endpoint_execution_failed"] = "endpoint_execution_failed"
- weight: float
-
-
class EndpointLastExecutionTimesRequest(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -1869,18 +1845,6 @@ class SourceType(StrEnum):
ISSUE_SPIKING = "issue_spiking"
-class ErrorTrackingSignalInput(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- description: str
- extra: ErrorTrackingSignalExtra
- source_id: str
- source_product: Literal["error_tracking"] = "error_tracking"
- source_type: SourceType
- weight: float
-
-
class EventDefinition(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -2534,18 +2498,6 @@ class GithubIssueSignalExtra(BaseModel):
updated_at: str
-class GithubIssueSignalInput(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- description: str
- extra: GithubIssueSignalExtra
- source_id: str
- source_product: Literal["github"] = "github"
- source_type: Literal["issue"] = "issue"
- weight: float
-
-
class Position(StrEnum):
START = "start"
END = "end"
@@ -2900,18 +2852,6 @@ class LinearIssueSignalExtra(BaseModel):
url: str
-class LinearIssueSignalInput(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- description: str
- extra: LinearIssueSignalExtra
- source_id: str
- source_product: Literal["linear"] = "linear"
- source_type: Literal["issue"] = "issue"
- weight: float
-
-
class LinkedinAdsDefaultSources(StrEnum):
LINKEDIN = "linkedin"
LI = "li"
@@ -2950,30 +2890,6 @@ class LlmEvalSignalExtra(BaseModel):
trace_id: str
-class LlmEvaluationReportSignalInput(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- description: str
- extra: LlmEvalReportSignalExtra
- source_id: str
- source_product: Literal["llm_analytics"] = "llm_analytics"
- source_type: Literal["evaluation_report"] = "evaluation_report"
- weight: float
-
-
-class LlmEvaluationSignalInput(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- description: str
- extra: LlmEvalSignalExtra
- source_id: str
- source_product: Literal["llm_analytics"] = "llm_analytics"
- source_type: Literal["evaluation"] = "evaluation"
- weight: float
-
-
class LoadingBlock(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -3052,18 +2968,6 @@ class LogsAlertStateChangeSignalExtra(BaseModel):
window_minutes: float
-class LogsAlertStateChangeSignalInput(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- description: str
- extra: LogsAlertStateChangeSignalExtra
- source_id: str
- source_product: Literal["logs"] = "logs"
- source_type: Literal["alert_state_change"] = "alert_state_change"
- weight: float
-
-
class LogsOrderBy(StrEnum):
LATEST = "latest"
EARLIEST = "earliest"
@@ -3880,18 +3784,6 @@ class PgAnalyzeIssueSignalExtra(BaseModel):
synced_at: str
-class PgAnalyzeIssueSignalInput(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- description: str
- extra: PgAnalyzeIssueSignalExtra
- source_id: str
- source_product: Literal["pganalyze"] = "pganalyze"
- source_type: Literal["issue"] = "issue"
- weight: float
-
-
class PinterestAdsDefaultSources(StrEnum):
PINTEREST = "pinterest"
@@ -4566,18 +4458,6 @@ class SessionProblemSignalExtra(BaseModel):
start_time: str
-class SessionProblemSignalInput(BaseModel):
- model_config = ConfigDict(
- extra="forbid",
- )
- description: str
- extra: SessionProblemSignalExtra
- source_id: str
- source_product: Literal["session_replay"] = "session_replay"
- source_type: Literal["session_problem"] = "session_problem"
- weight: float
-
-
class SessionPropertyFilter(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -4695,6 +4575,46 @@ class SharingConfigurationSettings(BaseModel):
whitelabel: bool | None = None
+class SignalExtraBase(BaseModel):
+ pass
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+
+
+class Priority(StrEnum):
+ P0 = "P0"
+ P1 = "P1"
+ P2 = "P2"
+ P3 = "P3"
+ P4 = "P4"
+
+
+class SignalRemediation(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ agent: str = Field(
+ ...,
+ description=(
+ "Agent-facing guidance: how to investigate (which MCP tools to call) and,"
+ " where the fix lives in the user's codebase, how to apply it. The research"
+ " agent treats this as authoritative — it still investigates and produces"
+ " findings, but follows this instead of starting cold."
+ ),
+ )
+ human: str = Field(
+ ...,
+ description=(
+ "Human-facing fix steps (PostHog UI / alert destinations). Surfaced in the report for the reader."
+ ),
+ )
+ priority: Priority | None = Field(
+ default=None,
+ description=("Suggested report priority; advisory, the research agent may override."),
+ )
+
+
class SignalReviewerUserInfo(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -4806,6 +4726,7 @@ class SignalsScoutSignalInput(BaseModel):
)
description: str
extra: SignalsScoutSignalExtra
+ remediation: SignalRemediation | None = None
source_id: str
source_product: Literal["signals_scout"] = "signals_scout"
source_type: Literal["cross_source_issue"] = "cross_source_issue"
@@ -5515,6 +5436,7 @@ class ZendeskTicketSignalInput(BaseModel):
)
description: str
extra: ZendeskTicketSignalExtra
+ remediation: SignalRemediation | None = None
source_id: str
source_product: Literal["zendesk"] = "zendesk"
source_type: Literal["ticket"] = "ticket"
@@ -6861,6 +6783,19 @@ class CohortPropertyFilter(BaseModel):
value: int
+class ConversationsTicketSignalInput(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ description: str
+ extra: ConversationsTicketSignalExtra
+ remediation: SignalRemediation | None = None
+ source_id: str
+ source_product: Literal["conversations"] = "conversations"
+ source_type: Literal["ticket"] = "ticket"
+ weight: float
+
+
class CustomChannelCondition(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -7006,6 +6941,19 @@ class EmbeddingDistance(BaseModel):
result: EmbeddingRecord
+class EndpointExecutionFailedSignalInput(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ description: str
+ extra: EndpointExecutionFailedSignalExtra
+ remediation: SignalRemediation | None = None
+ source_id: str
+ source_product: Literal["endpoints"] = "endpoints"
+ source_type: Literal["endpoint_execution_failed"] = "endpoint_execution_failed"
+ weight: float
+
+
class EndpointsUsageOverviewItem(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -7073,6 +7021,19 @@ class ErrorTrackingPendingFingerprintIssueStateUpdate(BaseModel):
)
+class ErrorTrackingSignalInput(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ description: str
+ extra: ErrorTrackingSignalExtra
+ remediation: SignalRemediation | None = None
+ source_id: str
+ source_product: Literal["error_tracking"] = "error_tracking"
+ source_type: SourceType
+ weight: float
+
+
class EventMetadataPropertyFilter(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -7559,6 +7520,19 @@ class FunnelsFilterLegacy(BaseModel):
layout: FunnelLayout | None = None
+class GithubIssueSignalInput(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ description: str
+ extra: GithubIssueSignalExtra
+ remediation: SignalRemediation | None = None
+ source_id: str
+ source_product: Literal["github"] = "github"
+ source_type: Literal["issue"] = "issue"
+ weight: float
+
+
class GroupPropertyFilter(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -7768,6 +7742,45 @@ class LifecycleFilterLegacy(BaseModel):
toggledLifecycles: list[LifecycleToggle] | None = None
+class LinearIssueSignalInput(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ description: str
+ extra: LinearIssueSignalExtra
+ remediation: SignalRemediation | None = None
+ source_id: str
+ source_product: Literal["linear"] = "linear"
+ source_type: Literal["issue"] = "issue"
+ weight: float
+
+
+class LlmEvaluationReportSignalInput(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ description: str
+ extra: LlmEvalReportSignalExtra
+ remediation: SignalRemediation | None = None
+ source_id: str
+ source_product: Literal["llm_analytics"] = "llm_analytics"
+ source_type: Literal["evaluation_report"] = "evaluation_report"
+ weight: float
+
+
+class LlmEvaluationSignalInput(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ description: str
+ extra: LlmEvalSignalExtra
+ remediation: SignalRemediation | None = None
+ source_id: str
+ source_product: Literal["llm_analytics"] = "llm_analytics"
+ source_type: Literal["evaluation"] = "evaluation"
+ weight: float
+
+
class LogEntryPropertyFilter(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -7811,6 +7824,19 @@ class LogPropertyFilter(BaseModel):
value: list[str | float | bool] | str | float | bool | None = None
+class LogsAlertStateChangeSignalInput(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ description: str
+ extra: LogsAlertStateChangeSignalExtra
+ remediation: SignalRemediation | None = None
+ source_id: str
+ source_product: Literal["logs"] = "logs"
+ source_type: Literal["alert_state_change"] = "alert_state_change"
+ weight: float
+
+
class MarketingAnalyticsItem(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -8032,6 +8058,19 @@ class PersonPropertyFilter(BaseModel):
value: list[str | float | bool] | str | float | bool | None = None
+class PgAnalyzeIssueSignalInput(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ description: str
+ extra: PgAnalyzeIssueSignalExtra
+ remediation: SignalRemediation | None = None
+ source_id: str
+ source_product: Literal["pganalyze"] = "pganalyze"
+ source_type: Literal["issue"] = "issue"
+ weight: float
+
+
class PlanningStep(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -8821,6 +8860,19 @@ class SessionBatchEventsQueryResponse(BaseModel):
)
+class SessionProblemSignalInput(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ description: str
+ extra: SessionProblemSignalExtra
+ remediation: SignalRemediation | None = None
+ source_id: str
+ source_product: Literal["session_replay"] = "session_replay"
+ source_type: Literal["session_problem"] = "session_problem"
+ weight: float
+
+
class SessionRecordingType(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -8994,6 +9046,19 @@ class SignalInput(
)
+class SignalInputBase(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ description: str
+ extra: SignalExtraBase
+ remediation: SignalRemediation | None = None
+ source_id: str
+ source_product: str
+ source_type: str
+ weight: float
+
+
class SourceFieldFileUploadConfig(BaseModel):
model_config = ConfigDict(
extra="forbid",
diff --git a/products/signals/backend/facade/api.py b/products/signals/backend/facade/api.py
index d8cabfc1e1a7..df14568267ef 100644
--- a/products/signals/backend/facade/api.py
+++ b/products/signals/backend/facade/api.py
@@ -9,7 +9,7 @@ import structlog
import temporalio
import posthoganalytics
-from posthog.schema import SignalInput
+from posthog.schema import SignalInput, SignalRemediation
from posthog.event_usage import groups
from posthog.helpers.tiktoken_encoding import LLM_TOKEN_COUNT_PROXY_MODEL, get_tiktoken_encoding_for_model
@@ -22,6 +22,11 @@ from products.signals.backend.models import SignalSourceConfig
logger = structlog.get_logger(__name__)
MAX_SIGNAL_DESCRIPTION_TOKENS = 8000
+MAX_SIGNAL_REMEDIATION_TOKENS = 16000
+
+
+def _token_count(text: str) -> int:
+ return len(get_tiktoken_encoding_for_model(LLM_TOKEN_COUNT_PROXY_MODEL).encode(text))
def dismiss_report_from_slack(team_id: int, report_id: str, *, slack_user_id: str | None = None) -> bool:
@@ -87,6 +92,7 @@ async def emit_signal(
description: str,
weight: float = 0.5,
extra: dict | None = None,
+ remediation: SignalRemediation | None = None,
) -> None:
"""
Emit a signal for grouping and potential report generation, fire-and-forget.
@@ -107,6 +113,11 @@ async def emit_signal(
`_telemetry_props_from_extra` — so per-source attribution (e.g. the scout harness's
`scout_run_id` / `skill_name`) is queryable downstream without a schema change.
Nested lists/dicts are never forwarded.
+ remediation: Optional fix guidance (separate from extra), validated against the
+ `SignalRemediation` schema and capped at MAX_SIGNAL_REMEDIATION_TOKENS tokens
+ (`human` + `agent` combined). When set, the signal is treated as actionable: the guidance
+ is surfaced to the research agent as authoritative direction, which it follows instead of
+ investigating from scratch. Not required by any existing source.
Example:
await emit_signal(
@@ -136,13 +147,21 @@ async def emit_signal(
if not is_enabled:
return
- token_count = len(get_tiktoken_encoding_for_model(LLM_TOKEN_COUNT_PROXY_MODEL).encode(description))
- if token_count > MAX_SIGNAL_DESCRIPTION_TOKENS:
+ description_tokens = _token_count(description)
+ if description_tokens > MAX_SIGNAL_DESCRIPTION_TOKENS:
raise ValueError(
- f"Signal description exceeds {MAX_SIGNAL_DESCRIPTION_TOKENS} tokens ({token_count} tokens). "
+ f"Signal description exceeds {MAX_SIGNAL_DESCRIPTION_TOKENS} tokens ({description_tokens} tokens). "
f"Truncate the description before calling emit_signal."
)
+ if remediation is not None:
+ remediation_tokens = _token_count(f"{remediation.human}\n{remediation.agent}")
+ if remediation_tokens > MAX_SIGNAL_REMEDIATION_TOKENS:
+ raise ValueError(
+ f"Signal remediation exceeds {MAX_SIGNAL_REMEDIATION_TOKENS} tokens ({remediation_tokens} tokens). "
+ f"Trim the remediation guidance before calling emit_signal."
+ )
+
# Validate the signal against the matching schema variant
variant_model = _SIGNAL_VARIANT_LOOKUP.get((source_product, source_type))
if variant_model is None:
@@ -157,16 +176,20 @@ async def emit_signal(
}
],
)
- variant_model.model_validate(
- {
- "source_product": source_product,
- "source_type": source_type,
- "source_id": source_id,
- "description": description,
- "weight": weight,
- "extra": extra or {},
- }
- )
+ # Carry the remediation as a plain dict from here on (like `extra`) so it survives the
+ # Temporal/S3 JSON round-trip; `model_validate` below re-checks it against the variant's
+ # declared `remediation: SignalRemediation | None` field.
+ remediation_dict = remediation.model_dump(mode="json", exclude_none=True) if remediation is not None else None
+ payload_to_validate: dict = {
+ "source_product": source_product,
+ "source_type": source_type,
+ "source_id": source_id,
+ "description": description,
+ "weight": weight,
+ "extra": extra or {},
+ "remediation": remediation_dict,
+ }
+ variant_model.model_validate(payload_to_validate)
# Fire a "started" marker so direct callers (error tracking, AI observability evals, etc.)
# that don't go through the data-source pipeline still have a top-of-funnel event. The
@@ -202,6 +225,7 @@ async def emit_signal(
description=description,
weight=weight,
extra=extra or {},
+ remediation=remediation_dict,
)
# Ensure the buffer workflow is running (idempotent)
diff --git a/products/signals/backend/report_generation/research.py b/products/signals/backend/report_generation/research.py
index 33b0b35fae2b..4bfb3f7e5e25 100644
--- a/products/signals/backend/report_generation/research.py
+++ b/products/signals/backend/report_generation/research.py
@@ -260,6 +260,12 @@ def _render_signal_for_research(signal: SignalData, index: int, total: int) -> s
lines.append(f"- **Weight:** {signal.weight}")
lines.append(f"- **Timestamp:** {signal.timestamp}")
lines.append(f"- **Description:** {signal.content}")
+ if signal.remediation:
+ lines.append("- **Remediation (authoritative guidance — follow it, then verify):**")
+ if agent := signal.remediation.get("agent"):
+ lines.append(f" - **Guidance:** {agent}")
+ if priority := signal.remediation.get("priority"):
+ lines.append(f" - **Suggested priority:** {priority}")
if signal.extra:
lines.append("#### Extras")
lines.extend(_render_extra_to_text(signal.extra))
@@ -281,7 +287,9 @@ You have two investigation tools:
1. **The codebase** — the full PostHog repository is available on disk. Use file search, grep, and code reading.
2. **PostHog MCP** — you can query PostHog analytics data via MCP tools like `execute-sql`, `query-run`, `read-data-schema`, `insights-get-all`, `experiment-get`, `list-errors`, `feature-flag-get-all`, etc.
-When a signal includes **Attached images**, the URLs are publicly reachable — fetch them directly to inspect screenshots, UI issues, or other visual evidence."""
+When a signal includes **Attached images**, the URLs are publicly reachable — fetch them directly to inspect screenshots, UI issues, or other visual evidence.
+
+When a signal includes a **`remediation`** field, treat its guidance as authoritative — it tells you exactly how to fix the issue (which MCP tools to call and, where the fix lives in the user's codebase, how to apply it). Do not re-derive the fix from scratch: follow the guidance, then still do the work a good report needs — locate the relevant code, identify the causative commits, confirm the problem via the PostHog MCP, and verify the fix (e.g. query whether the expected events now arrive)."""
_RESEARCH_PROTOCOL = """## Research protocol
diff --git a/products/signals/backend/temporal/grouping.py b/products/signals/backend/temporal/grouping.py
index 3718994c3809..f1d5b53f13d6 100644
--- a/products/signals/backend/temporal/grouping.py
+++ b/products/signals/backend/temporal/grouping.py
@@ -654,6 +654,7 @@ class AssignAndEmitSignalInput:
match_result: MatchResult
timestamp: Optional[datetime] = None
updated_title: Optional[str] = None
+ remediation: Optional[dict] = None
@dataclass
@@ -696,6 +697,7 @@ async def assign_and_emit_signal_activity(input: AssignAndEmitSignalInput) -> As
"weight": input.weight,
"report_id": report_id,
"extra": input.extra,
+ "remediation": input.remediation,
"deleted": True,
}
metadata["match_metadata"] = asdict(match_result.match_metadata)
@@ -760,6 +762,7 @@ async def assign_and_emit_signal_activity(input: AssignAndEmitSignalInput) -> As
"weight": input.weight,
"report_id": report_id,
"extra": input.extra,
+ "remediation": input.remediation,
}
metadata["match_metadata"] = asdict(match_result.match_metadata)
@@ -1149,6 +1152,7 @@ async def _process_signal_batch(
embedding=signal_embeddings[i].embedding,
match_result=match_result,
updated_title=updated_title,
+ remediation=signal.remediation,
),
start_to_close_timeout=timedelta(minutes=5),
retry_policy=RetryPolicy(maximum_attempts=3),
diff --git a/products/signals/backend/temporal/parallel_grouping.py b/products/signals/backend/temporal/parallel_grouping.py
index 7f8d338727de..d22196f7cf93 100644
--- a/products/signals/backend/temporal/parallel_grouping.py
+++ b/products/signals/backend/temporal/parallel_grouping.py
@@ -240,6 +240,7 @@ async def _process_signal(
embedding=signal_embedding,
match_result=match_result,
updated_title=updated_title,
+ remediation=signal.remediation,
),
start_to_close_timeout=timedelta(minutes=5),
retry_policy=RetryPolicy(maximum_attempts=3),
diff --git a/products/signals/backend/temporal/reingestion.py b/products/signals/backend/temporal/reingestion.py
index e226c8249c63..4bb5917b94a4 100644
--- a/products/signals/backend/temporal/reingestion.py
+++ b/products/signals/backend/temporal/reingestion.py
@@ -199,6 +199,7 @@ async def process_team_signals_batch_activity(input: ProcessTeamSignalsBatchInpu
weight=metadata.get("weight", 0.0),
timestamp=_ensure_tz_aware(timestamp_raw),
extra=metadata.get("extra", {}),
+ remediation=metadata.get("remediation"),
metadata=dict(metadata),
)
)
diff --git a/products/signals/backend/temporal/signal_queries.py b/products/signals/backend/temporal/signal_queries.py
index b5c4ca235992..ae3c47b8bdb6 100644
--- a/products/signals/backend/temporal/signal_queries.py
+++ b/products/signals/backend/temporal/signal_queries.py
@@ -117,6 +117,7 @@ def _parse_signal_row(row: tuple) -> SignalData:
weight=metadata.get("weight", 0.0),
timestamp=timestamp_raw,
extra=metadata.get("extra", {}),
+ remediation=metadata.get("remediation"),
)
diff --git a/products/signals/backend/temporal/types.py b/products/signals/backend/temporal/types.py
index 6f7e42e7e29b..8f8bcc112305 100644
--- a/products/signals/backend/temporal/types.py
+++ b/products/signals/backend/temporal/types.py
@@ -12,6 +12,11 @@ class EmitSignalInputs:
description: str
weight: float = 0.5
extra: dict = field(default_factory=dict)
+ # Optional fix guidance (separate from `extra`), shaped by the `SignalRemediation` schema and
+ # validated against it at the emit boundary. Carried as a plain dict like `extra` so it survives
+ # the Temporal/S3 JSON round-trip. Surfaced to the research agent as authoritative direction when
+ # present; not required by any source.
+ remediation: Optional[dict] = None
@dataclass
@@ -178,6 +183,8 @@ class SignalData:
timestamp: datetime
extra: dict = field(default_factory=dict)
metadata: dict[str, Any] = field(default_factory=dict)
+ # Optional fix guidance (separate from `extra`); see EmitSignalInputs.remediation.
+ remediation: Optional[dict] = None
def _render_extra_to_text(extra: dict) -> list[str]:
@@ -194,6 +201,16 @@ def _render_extra_to_text(extra: dict) -> list[str]:
return lines
+def _render_remediation_to_text(remediation: dict) -> list[str]:
+ """Render a remediation (SignalRemediation shape) to text lines for LLM consumption."""
+ lines = ["- Remediation (authoritative guidance — follow it, then verify via the PostHog MCP):"]
+ if agent := remediation.get("agent"):
+ lines.append(f" - Guidance: {agent}")
+ if priority := remediation.get("priority"):
+ lines.append(f" - Suggested priority: {priority}")
+ return lines
+
+
def render_signal_to_text(
signal: SignalData,
index: Optional[int] = None,
@@ -204,6 +221,8 @@ def render_signal_to_text(
lines.append(f"- Weight: {signal.weight}")
lines.append(f"- Timestamp: {signal.timestamp.isoformat()}")
lines.append(f"- Description: {signal.content}")
+ if signal.remediation:
+ lines.extend(_render_remediation_to_text(signal.remediation))
if signal.extra:
lines.extend(_render_extra_to_text(signal.extra))
return "\n".join(lines)
diff --git a/products/signals/backend/test/test_api.py b/products/signals/backend/test/test_api.py
index 4188d8b113d9..411a1678fcd1 100644
--- a/products/signals/backend/test/test_api.py
+++ b/products/signals/backend/test/test_api.py
@@ -6,7 +6,14 @@ from unittest.mock import AsyncMock, MagicMock, patch
import pydantic
import temporalio.exceptions
-from products.signals.backend.facade.api import _MAX_TELEMETRY_STR_LEN, _telemetry_props_from_extra, emit_signal
+from posthog.schema import SignalRemediation
+
+from products.signals.backend.facade.api import (
+ _MAX_TELEMETRY_STR_LEN,
+ MAX_SIGNAL_REMEDIATION_TOKENS,
+ _telemetry_props_from_extra,
+ emit_signal,
+)
from products.signals.backend.models import SignalSourceConfig
from products.signals.backend.temporal.buffer import BufferSignalsWorkflow
from products.signals.backend.temporal.emitter import SignalEmitterWorkflow
@@ -132,6 +139,49 @@ class TestEmitSignalValidation:
client.start_workflow.assert_not_awaited()
+ async def test_emit_signal_rejects_oversized_remediation(self, team_stub):
+ client = AsyncMock()
+
+ with (
+ patch("products.signals.backend.facade.api.async_connect", return_value=client),
+ patch.object(SignalSourceConfig, "is_source_enabled", return_value=True),
+ ):
+ with pytest.raises(ValueError, match="remediation exceeds"):
+ await emit_signal(
+ team=team_stub,
+ source_product="github",
+ source_type="issue",
+ source_id="test-id-1",
+ description="A valid signal",
+ extra=GITHUB_ISSUE_EXTRA,
+ remediation=SignalRemediation(human="fix it", agent="step " * (MAX_SIGNAL_REMEDIATION_TOKENS + 1)),
+ )
+
+ client.start_workflow.assert_not_awaited()
+
+ async def test_emit_signal_accepts_remediation_within_limit(self, team_stub):
+ client = AsyncMock()
+ client.start_workflow.side_effect = [
+ temporalio.exceptions.WorkflowAlreadyStartedError("already started", "buffer-signals-1"),
+ AsyncMock(),
+ ]
+
+ with (
+ patch("products.signals.backend.facade.api.async_connect", return_value=client),
+ patch.object(SignalSourceConfig, "is_source_enabled", return_value=True),
+ ):
+ await emit_signal(
+ team=team_stub,
+ source_product="github",
+ source_type="issue",
+ source_id="test-id-1",
+ description="A valid signal",
+ extra=GITHUB_ISSUE_EXTRA,
+ remediation=SignalRemediation(human="Re-run the materialization.", agent="Open the model and retry."),
+ )
+
+ assert client.start_workflow.await_count == 2
+
@pytest.mark.asyncio
class TestEmitSignalAnalytics: