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(aio): clarify decision judge applicability instructions (#117124)

Bernat Torres1663bf2abfee
diff --git a/docs/internal/ai-observability-judge-inputs.md b/docs/internal/ai-observability-judge-inputs.md
index 2e65a4f83674..887cfec1baaa 100644
--- a/docs/internal/ai-observability-judge-inputs.md
+++ b/docs/internal/ai-observability-judge-inputs.md
@@ -131,6 +131,8 @@ Models without a catalog match retain their usage with cost left unknown.
A custom deployment reporting a recognized model name can inherit that model's catalog estimate; this does not measure its hosting cost.
Evaluations that allow N/A send a separate Noul question about whether the criteria apply, using the 0.5 threshold.
+The instructions ask the judge to follow the evaluation prompt's N/A rules and treat missing essential context or evidence as not applicable.
+A judgeable failure remains applicable; the question tells the judge not to invent missing facts.
Uncertainty alone does not produce N/A.
Decision model answers contain no written reasoning, so reports inspect the original source when explaining outcomes.
diff --git a/posthog/temporal/ai_observability/evaluation_llm_judge.py b/posthog/temporal/ai_observability/evaluation_llm_judge.py
index a5a9dbb059c7..7c15c3e218ef 100644
--- a/posthog/temporal/ai_observability/evaluation_llm_judge.py
+++ b/posthog/temporal/ai_observability/evaluation_llm_judge.py
@@ -678,9 +678,10 @@ def call_llm_judge(
if allows_na:
questions["applicable"] = NoulQuestion(
instructions=(
- "Do these evaluation criteria apply to this input? Answer true when the criteria can be "
- "evaluated, even if they are not met. Answer false only when they are not relevant.\n\n"
- + prompt
+ "Can this input be evaluated according to the evaluation instructions below? Answer false "
+ "when those instructions require N/A, when essential context or evidence is missing, or "
+ "when the criteria are irrelevant. Answer true when enough information is present to "
+ "evaluate them, even if the result would be a fail. Do not invent missing facts.\n\n" + prompt
)
)
decision_result = DecisionClient.evaluate(
diff --git a/posthog/temporal/ai_observability/test_run_evaluation.py b/posthog/temporal/ai_observability/test_run_evaluation.py
index ff1bd7b1a090..bcc48e14381b 100644
--- a/posthog/temporal/ai_observability/test_run_evaluation.py
+++ b/posthog/temporal/ai_observability/test_run_evaluation.py
@@ -439,11 +439,12 @@ def test_system_one_judge_emits_boolean_probability_without_reasoning(
"usage": usage,
}
response = httpx.Response(200, stream=httpx.ByteStream(json.dumps(response_body).encode()))
+ prompt = "Is the response polite? Return N/A when no response text is supplied."
evaluation = {
"id": "test-evaluation",
"name": "Politeness",
"team_id": 1,
- "evaluation_config": {"prompt": "Is the response polite?"},
+ "evaluation_config": {"prompt": prompt},
}
with (
override_settings(POSTHOG_INTERNAL_ORG_IDS=[]),
@@ -471,14 +472,22 @@ def test_system_one_judge_emits_boolean_probability_without_reasoning(
assert request.call_args.args[0].headers.get("Authorization") == (
f"Bearer {connection_config['api_key']}" if connection_config["api_key"] else None
)
- assert json.loads(request.call_args.args[0].content)["model"] == model
+ sent = json.loads(request.call_args.args[0].content)
+ assert sent["model"] == model
assert result["verdict"] is verdict
assert result["reasoning"] == ""
assert result.get("probability") == (probability if verdict is not None else None)
assert result["model"] == model
assert result["total_tokens"] == sum(usage.values())
if allows_na:
+ instructions = sent["questions"]["applicable"]["instructions"]
+ assert "those instructions require N/A" in instructions
+ assert "essential context or evidence is missing" in instructions
+ assert "even if the result would be a fail" in instructions
+ assert instructions.endswith(prompt)
assert result["applicable"] is (applicability >= 0.5)
+ else:
+ assert "applicable" not in sent["questions"]
properties = build_evaluation_event_properties(evaluation, result, datetime(2026, 1, 1, tzinfo=UTC))
assert properties["$ai_input_tokens"] == usage.get("input_tokens")
assert properties["$ai_output_tokens"] == usage.get("output_tokens")