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.

fix(replay-vision): honor observation naming conventions in titles (#74361)

Arno Hillenfdb84cc27772
diff --git a/products/replay_vision/backend/temporal/scanners/prompts/summarizer_summary_step.jinja b/products/replay_vision/backend/temporal/scanners/prompts/summarizer_summary_step.jinja
index 41ded86f9758..1c79646070cb 100644
--- a/products/replay_vision/backend/temporal/scanners/prompts/summarizer_summary_step.jinja
+++ b/products/replay_vision/backend/temporal/scanners/prompts/summarizer_summary_step.jinja
@@ -3,6 +3,6 @@
Additional context from the team operating the product being recorded:
{{ user_prompt }}{% endif %}
-`title` is a short, plain-text headline, up to 120 characters (citations go in `summary`, not the title). `summary` should be {{ length_guidance }}.
+`title` is a short, plain-text headline, up to 120 characters (citations go in `summary`, not the title).{% if user_prompt %} If the context above specifies a naming convention or format for observations, `title` must follow it exactly (an observation's name is its title).{% endif %} `summary` should be {{ length_guidance }}.
{{ cite_in('summary') }}
diff --git a/products/replay_vision/backend/temporal/scanners/summarizer.py b/products/replay_vision/backend/temporal/scanners/summarizer.py
index 842a8ce9ceda..ac1a7be9ddce 100644
--- a/products/replay_vision/backend/temporal/scanners/summarizer.py
+++ b/products/replay_vision/backend/temporal/scanners/summarizer.py
@@ -27,7 +27,13 @@ _LENGTH_GUIDANCE: dict[SummaryLength, str] = {
class SummarizerSummaryResponse(BaseModel, frozen=True):
"""First turn: the title + body summary. Field order is load-bearing — `confidence` last, after the content."""
- title: str = Field(max_length=120, description="Short title for the session (~80 chars). Plain text, no quotes.")
+ title: str = Field(
+ max_length=120,
+ description=(
+ "Short title for the session (~80 chars). Plain text, no quotes. If the team's context specifies "
+ "a naming convention or format for observations, the title must follow it exactly."
+ ),
+ )
summary: str = Field(description="Body text whose length follows the scanner's configured length.")
confidence: float = confidence_field()
diff --git a/products/replay_vision/backend/tests/test_scanners.py b/products/replay_vision/backend/tests/test_scanners.py
index ce952ffe0a63..8958f3a2af4e 100644
--- a/products/replay_vision/backend/tests/test_scanners.py
+++ b/products/replay_vision/backend/tests/test_scanners.py
@@ -587,6 +587,12 @@ class TestSummarizerScannerSteps:
# Facets are best-effort: a failed facet turn must not lose the summary it follows.
assert steps[1].required is False
+ def test_summary_step_makes_title_follow_operator_naming_convention(self) -> None:
+ scanner = scanner_from_db(
+ _build_replay_scanner(scanner_type=ScannerType.SUMMARIZER, scanner_config={"prompt": "p"})
+ )
+ assert "naming convention" in scanner.core_steps()[0].instruction
+
def test_summary_step_opts_into_citations_facets_step_forbids_them(self) -> None:
scanner = scanner_from_db(
_build_replay_scanner(scanner_type=ScannerType.SUMMARIZER, scanner_config={"prompt": "p"})