: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
fix(signals): match trial inbox behavior and clarify judging (#115026)
Alex Lebedev2406b7e6dd27
diff --git a/docs/internal/scout-online-evals-devbox.md b/docs/internal/scout-online-evals-devbox.mdindex 04b6b7b553c7..13a42718788a 100644--- a/docs/internal/scout-online-evals-devbox.md+++ b/docs/internal/scout-online-evals-devbox.md@@ -56,11 +56,14 @@ Trial scout deadlines include five minutes for startup and log reads, plus timeTrial plans and evaluation documents keep one complete adopted reference each and exclude suggestion-generation history. The judge reads that same adopted reference from its evidence attachment.Suggestion generation captures the complete scout instructions and reference files for judging, while keeping the generator's prompt bounded. If an older saved reference is incomplete, generate suggestions again, review and use the new reference, then save. You can keep your existing criteria.+The generator flags unresolved conflicts in the source instructions in its summary instead of choosing a stricter rule. Wording updates to shared defaults affect unsaved rubrics only; saved criteria stay fixed.Variants and retries share a saved copy of the project's scout memory, notes and recent scout runs. This starting context lives in private object storage and can exceed the 16 MiB limit on launch settings without being shortened.Each trial scout stores its own memory changes and reports in a separate `trial_state` field on its Signals scout-run record. The small trial marker stays in metadata so ordinary history queries can exclude trials without reading their documents. Tasks run state contains execution settings and token bindings, not trial documents. Signals verifies the sandbox token belongs to that exact run before serving private context. Tasks grants the restricted scout credential only the necessary log, summary and lifecycle writes for its own run; it cannot change another task or steer a trial. Ordinary scout responses omit the private state.+Trial scouts can use `created_after`, `priority`, `actionability`, and `already_addressed` on `inbox-reports-list`. Report edits, including priority and actionability changes, stay private to the individual run and appear in its subsequent reads; they never modify shared reports or another trial run. Ordering by ranking scores is refused explicitly because private report edits have not been ranked.+Each completed scout run gets its own judge sandbox. The judge reads the saved rubric and searches attached copies of the complete rubric reference, run log, reports, summary, candidate instructions and starting context. These files live in private object storage; Temporal receives only their identifiers. Evidence larger than 128 MiB is refused explicitly instead of being silently shortened.Signals checks the operator's access, source run and saved evidence before attaching files and dispatching the judge through the existing internal Tasks path used by rubric generation. Queued judges do not repeat Signals-specific staff, skill or source-run checks at sandbox startup. Ordinary account and project permissions still apply when downloading evidence, and Signals checks operator access again before publishing the report.@@ -73,6 +76,8 @@ The judge has no live project tools, external MCP connections or repository credThe judge saves one JSON verdict per rubric check through Tasks' existing structured-output support. Signals checks that same Task until it finishes, then validates its quotes against the original saved files. New evaluations use saved scout identifiers to recheck current permissions on every status poll without downloading the full starting context again; preparation and report finalization still validate that context. Worker restarts resume result collection without starting another judge. If result collection remains unavailable, the evaluation fails without freezing an incomplete report; resuming the same evaluation reuses its Tasks and saved judgments.+The judge first checks whether each criterion applies, including allowed exceptions and optional work. The required skill and project-profile startup reads are distinguished from the investigation itself; incidental metadata in those responses does not by itself prove unrelated investigation. Required step order is checked against the execution timeline; doing both steps in the wrong order does not satisfy it. Unresolved conflicting instructions give an unknown verdict unless another clear violation already fails that criterion. Judge prompt versions are fixed per trial: after a version changes, unfinished trials using the older judge require a new trial. Resuming an outdated trial is rejected before more paid runs start. Completed reports stay readable.+Unavailable or ambiguous evidence gives an unknown verdict. A required action proved missing from a complete record fails; missing thoughts alone never prove an omission. Citation checks accept decoded JSON string fields in tool responses. A judge failure is shown separately from a failed rubric check. Each judge has a 30-minute deadline measured from its original Task run creation; retries do not reset it. Up to three collectors run at once, but judge Tasks can briefly overlap beyond that after a delayed start or collection failure. Saved results never rerun the judge when viewed.Only versions whose runs all completed and were judged can lead. At least two completed versions with the same number of runs are needed; failed versions remain visible and are excluded even if most versions failed. The result compares completed versions by their total confirmed rubric passes. Unknown checks earn no passes and make any leader or tie provisional. Without a confirmed pass, unresolved checks cannot produce a leader. Final winners still require comparable applicable checks. Saved reports retain their original conclusions.diff --git a/products/signals/backend/scout_harness/rubrics.py b/products/signals/backend/scout_harness/rubrics.pyindex 7910442663b7..55590b668165 100644--- a/products/signals/backend/scout_harness/rubrics.py+++ b/products/signals/backend/scout_harness/rubrics.py@@ -176,7 +176,8 @@ def default_criteria() -> list[ScoutRubricCriterion]:"Useful next step","Check whether a finding gives its reader a practical way to proceed.","The output names a concrete next action or decision, with enough context to carry it out.",- "When the scout is expected to recommend action; informational updates may be not applicable.",+ "When the assignment or finding calls for a next action or decision. Purely informational updates are "+ "not applicable unless the assignment requires an action or decision.",),("priority",diff --git a/products/signals/backend/scout_harness/rubrics_runner.py b/products/signals/backend/scout_harness/rubrics_runner.pyindex 0094b216e44f..00a77e5a1556 100644--- a/products/signals/backend/scout_harness/rubrics_runner.py+++ b/products/signals/backend/scout_harness/rubrics_runner.py@@ -89,6 +89,8 @@ refer to the complete rule instead. Requiring an action in one situation does noother situations. A correct reference does not undo an incorrect statement elsewhere in the check.If a rule allows a manual handoff, for example, requiring an electronic receipt would wronglyreject it. Leave unspecified choices open. An exception to a general rule is not a conflict.+If scope, an exception or explicit precedence does not resolve genuinely conflicting requirements,+name the conflict in the summary for the owner. Do not silently choose a side or invent a stricter rule.Use concrete words for things people can identify: the report, the number of users, the last timechecked, or the notes needed next time. Do not replace a technical term with an equally unclear@@ -101,9 +103,10 @@ conditions to at most three short sentences. Missing evidence means unknown;known unmet work fails.Return only the requested JSON. Keep the summary under 40 words: tell the owner what these checks-cover and any important evidence limit. Do not inventory inputs, claim to have seen unavailable-logs or reports, invent observed behavior, include customer names or literal messages, or ask a-question. Do not change project memory or create or edit reports. The required task_summary_update+cover, any important evidence limit and any unresolved conflict in the source requirements.+Do not inventory inputs, claim to have seen unavailable logs or reports, invent observed behavior,+include customer names or literal messages, or ask a question. Do not change project memory or create+or edit reports. The required task_summary_updatemay describe this generation's own progress before the final JSON. Do not append a note afterward."""@@ -152,7 +155,8 @@ Deliberately disabled judgments stay excluded. Use the saved definitions as writnarrower or broader meanings to justify a selection.Return only the selection JSON matching the supplied schema. The summary is shown to the scout's-owner. In under 40 words, say what the suggested checks cover and any important evidence limit.+owner. In under 40 words, say what the suggested checks cover, any important evidence limit and any+unresolved source conflict identified during drafting. Preserve that warning even when no checks are added.If nothing is added, explain why in plain words. Use normal spoken English;do not describe your selection process, refer to "draft judgments" or inventory the inputs.Do not claim to have inspected unprovided transcripts or reports. Do not include customer names or@@ -211,7 +215,8 @@ def build_selection_prompt(+ "\nSelection schema:\n"+ json.dumps(RubricSelection.model_json_schema())+ "\nWrite the summary for the scout's owner in one or two short sentences, under 40 words. "- "Say what the suggested checks cover and any important evidence limit in everyday words. "+ "Say what the suggested checks cover, any important evidence limit and any unresolved source conflict "+ "in everyday words. ""If there are no additions, explain why in plain words. ""Do not describe the selection process or use internal shorthand. ""Keep the selected criteria unchanged. Return only the selection JSON."@@ -375,8 +380,8 @@ implementation. Use everyday words throughout, including any reference to the scThe owner must understand the check without opening those instructions.- Applicability: say when the check is needed. "Every run" is enough when that is correct. Missinga required report must not make the check inapplicable.-- Summary: say what the checks cover and any important evidence limit in under 40 words. Do not- describe your drafting process or inventory the inputs.+- Summary: say what the checks cover, any important evidence limit and any unresolved source conflict+ in under 40 words. Do not describe your drafting process or inventory the inputs.The first check must name both the scout's investigation and the required report, update or actionin its pass condition. Putting the required result only in another check is not enough. Preservediff --git a/products/signals/backend/scout_harness/tools/report.py b/products/signals/backend/scout_harness/tools/report.pyindex 8dc3dc1a68ec..2b846f2c3077 100644--- a/products/signals/backend/scout_harness/tools/report.py+++ b/products/signals/backend/scout_harness/tools/report.py@@ -116,6 +116,7 @@ from products.signals.backend.scout_report import (find_scout_report_by_idempotency_key,get_content_revision_count,get_scout_report_capture_snapshot,+ get_scout_report_decision_contents,get_scout_report_signal_count,get_scout_report_status,get_scout_report_title,@@ -541,6 +542,10 @@ def _capture_trial_report("billing_exempt_reason": None,"channel_id": None,}+ if not judgement.safety.choice:+ document["suppression_source"] = "safety_judge"+ document["suppression_explanation"] = judgement.safety.explanation or None+ TrialReport.apply_actionability(document, judgement.actionability)artefacts = [_trial_artefact(store.run, "note", scout_report_provenance(store.run).model_dump(mode="json")),_trial_artefact(@@ -626,12 +631,19 @@ def _capture_trial_edit(suggested_prompts: list[str] | None,supersedes_implementation: bool,corroboration_only: bool,+ actionability: ActionabilityAssessment | None,+ priority: PriorityAssessment | None,) -> EditReportResult:if supersedes_implementation:store.invalidate("Implementation replacement is not supported by private trials.")raise InvalidScoutReportError("Implementation replacement is not supported for this run.")original = _trial_report_for_edit(store, report_id)source_selection = persisted_repo_selection(report_id) if original.source_report_id else None+ source_decisions = (+ get_scout_report_decision_contents(team_id=store.run.team_id, report_id=report_id)+ if original.source_report_id and (actionability is not None or priority is not None)+ else {}+ )connected_repos = _connected_repositories(store.run.team_id) if title is not None or summary is not None else []def change(report: TrialReport) -> EditReportResult:@@ -660,6 +672,11 @@ def _capture_trial_edit("suggested_prompts": list(suggested_prompts) if suggested_prompts is not None else None,"supersedes_implementation": supersedes_implementation,"corroboration_only": corroboration_only,+ "actionability": actionability.actionability.value if actionability is not None else None,+ "actionability_explanation": actionability.explanation if actionability is not None else None,+ "already_addressed": actionability.already_addressed if actionability is not None else None,+ "priority": priority.priority.value if priority is not None else None,+ "priority_explanation": priority.explanation if priority is not None else None,})updated_fields = []@@ -740,6 +757,33 @@ def _capture_trial_edit(if repository_set and selection is not None:document["repo_slug"] = selection.repositoryreport.artefacts.append(_trial_artefact(store.run, "repo_selection", selection.model_dump(mode="json")))+ decision_fields_set: list[str] = []+ assessment: ActionabilityAssessment | PriorityAssessment | None+ for field, assessment in (("actionability", actionability), ("priority", priority)):+ if assessment is None:+ continue+ kind = f"{field}_judgment"+ previous = next(+ (artefact["content"] for artefact in reversed(report.artefacts) if artefact["type"] == kind),+ source_decisions.get(kind),+ )+ try:+ previous_assessment = type(assessment).model_validate(previous) if previous is not None else None+ except ValidationError:+ previous_assessment = None+ if assessment == previous_assessment:+ continue+ content = assessment.model_dump(mode="json")+ report.artefacts.append(_trial_artefact(store.run, kind, content))+ if isinstance(assessment, ActionabilityAssessment):+ report.apply_actionability(document, assessment)+ addressed = "already addressed" if assessment.already_addressed else "not yet addressed"+ note = f"Set actionability: {assessment.actionability.value} ({addressed})"+ else:+ document["priority"] = assessment.priority.value+ note = f"Set priority: {assessment.priority.value}"+ report.artefacts.append(_trial_artefact(store.run, "note", {"note": note, "author": store.run.skill_name}))+ decision_fields_set.append(field)charts_set = metrics_set = prompts_set = Nonefor name, values in (("charts", [chart.model_dump(mode="json") for chart in charts] if charts is not None else None),@@ -772,6 +816,7 @@ def _capture_trial_edit(content_revision_count=report.content_revision_count,supersedes_implementation=supersede,corroboration_collapsed=collapsed,+ decision_fields_set=tuple(decision_fields_set),)if result.changed:# Production moves `updated_at` only when it saves report content. Notes, reviewers and a@@ -2438,6 +2483,8 @@ def _do_edit_report(suggested_prompts=suggested_prompts,supersedes_implementation=supersedes_implementation,corroboration_only=corroboration_only,+ actionability=actionability,+ priority=priority,)attribution = author.attribution()diff --git a/products/signals/backend/scout_harness/trial_comparison.py b/products/signals/backend/scout_harness/trial_comparison.pyindex c4153885c6ec..1b4c62179e1a 100644--- a/products/signals/backend/scout_harness/trial_comparison.py+++ b/products/signals/backend/scout_harness/trial_comparison.py@@ -163,6 +163,11 @@ class ScoutTrialComparisons:service._assert_access(plan)return service+ def assert_current_judge(self, plan: TrialComparisonPlan) -> None:+ # A plan frozen with an older judge can never be scored, so starting its runs only spends budget.+ if plan.judge_prompt_version != JUDGE_PROMPT_VERSION:+ raise TrialEvaluationError("This evaluation uses an obsolete judge. Start a new trial to assess it.")+def assert_can_start(self, *, launch_ids: Sequence[UUID] = ()) -> None:assert_trial_environment_ready()assert_trial_work_enabled(self.config.team)@@ -445,6 +450,7 @@ class _ScoutTrialRunner:def prepare(self) -> Sequence[UUID]:plan = self.service.read(self.comparison_id)+ self.service.assert_current_judge(plan)launch_ids = [launch_id for variant in plan.request.variants for launch_id in variant.launch_ids]self.service.assert_can_start(launch_ids=launch_ids)save_comparison_progress(plan.team_id, self.comparison_id, TrialComparisonProgress(status="running"))diff --git a/products/signals/backend/scout_harness/trial_comparison_views.py b/products/signals/backend/scout_harness/trial_comparison_views.pyindex 9a3d745f208d..74546068f17f 100644--- a/products/signals/backend/scout_harness/trial_comparison_views.py+++ b/products/signals/backend/scout_harness/trial_comparison_views.py@@ -62,6 +62,7 @@ class ScoutTrialComparisonMixin:if result.archived:raise ScoutTrialLaunchError("Restore this trial before resuming it.")if result.status != "completed":+ service.assert_current_judge(plan)start_trial_comparison(config.team_id, plan.comparison_id)except ScoutTrialLaunchError as error:raise exceptions.ValidationError({"detail": str(error)}) from error@@ -102,6 +103,7 @@ class ScoutTrialComparisonMixin:if result.archived:raise ScoutTrialLaunchError("Restore this trial before resuming it.")if result.status != "completed":+ service.assert_current_judge(plan)service.assert_can_start(launch_ids=[launch_id for variant in plan.request.variants for launch_id in variant.launch_ids])diff --git a/products/signals/backend/scout_harness/trial_state.py b/products/signals/backend/scout_harness/trial_state.pyindex bc21141cb0f0..81a2483eb9f6 100644--- a/products/signals/backend/scout_harness/trial_state.py+++ b/products/signals/backend/scout_harness/trial_state.py@@ -13,6 +13,7 @@ from pydantic import BaseModel, Field, JsonValue, TypeAdapterfrom posthog.dataclasses import frozen+from products.signals.backend.artefact_schemas import ActionabilityAssessment, ActionabilityChoicefrom products.signals.backend.models import SignalScoutRunfrom products.signals.backend.scout_harness.limits import SCOUT_TRIAL_METADATA_KEY as SCOUT_TRIAL_METADATA_KEYfrom products.signals.backend.scout_harness.tools.runs import _build_task_url@@ -49,6 +50,19 @@ class TrialReport(BaseModel):content_revision_count: int = 0corroboration_count: int = 0+ @staticmethod+ def apply_actionability(document: dict[str, JsonValue], assessment: ActionabilityAssessment) -> None:+ document["actionability"] = assessment.actionability.value+ document["already_addressed"] = assessment.already_addressed+ if document.get("status") != "suppressed":+ document["suppression_source"] = None+ document["suppression_explanation"] = None+ elif document.get("suppression_source") not in ("dismissed", "safety_judge"):+ # Private decisions cannot override a human dismissal or the safety judge.+ not_actionable = assessment.actionability == ActionabilityChoice.NOT_ACTIONABLE+ document["suppression_source"] = "not_actionable" if not_actionable else "system"+ document["suppression_explanation"] = (assessment.explanation or None) if not_actionable else None+class _TrialState(BaseModel):memory: dict[str, ScratchpadEntry | None] = Field(default_factory=dict)diff --git a/products/signals/backend/scout_report/__init__.py b/products/signals/backend/scout_report/__init__.pyindex 16a35a01205d..650aed88aea7 100644--- a/products/signals/backend/scout_report/__init__.py+++ b/products/signals/backend/scout_report/__init__.py@@ -26,6 +26,7 @@ from products.signals.backend.scout_report.persistence import (find_scout_report_by_idempotency_key,get_content_revision_count,get_scout_report_capture_snapshot,+ get_scout_report_decision_contents,get_scout_report_signal_count,get_scout_report_status,get_scout_report_title,@@ -74,6 +75,7 @@ __all__ = ["get_scout_report_status","get_scout_report_title","get_scout_report_capture_snapshot",+ "get_scout_report_decision_contents","missing_link_targets","prepare_scout_supersession","record_content_revision",diff --git a/products/signals/backend/scout_report/persistence.py b/products/signals/backend/scout_report/persistence.pyindex 0a222afb4e9e..415050ddbe7b 100644--- a/products/signals/backend/scout_report/persistence.py+++ b/products/signals/backend/scout_report/persistence.py@@ -424,6 +424,19 @@ def get_scout_report_capture_snapshot(*, team_id: int, report_id: str) -> dict[sreturn document+def get_scout_report_decision_contents(*, team_id: int, report_id: str) -> dict[str, JsonValue]:+ _validate_report_id(report_id)+ contents: dict[str, JsonValue] = {}+ for kind, model in (+ ("actionability_judgment", ActionabilityAssessment),+ ("priority_judgment", PriorityAssessment),+ ):+ assessment = SignalReportArtefact.latest_content(team_id=team_id, report_id=report_id, model=model)+ if assessment is not None:+ contents[kind] = assessment.model_dump(mode="json")+ return contents++def scout_report_exists(*, team_id: int, report_id: str) -> bool:"""Team-scoped existence check for the edit path's pre-judge gate. Validates the id shape the waythe write paths do, so a malformed id is a caller error rather than an uncaught 500. A cost gatediff --git a/products/signals/backend/scout_report/trial_inbox.py b/products/signals/backend/scout_report/trial_inbox.pyindex 374f1cc4df98..2567f97dd1f9 100644--- a/products/signals/backend/scout_report/trial_inbox.py+++ b/products/signals/backend/scout_report/trial_inbox.py@@ -9,15 +9,17 @@ from typing import TYPE_CHECKING, castfrom django.db.models import QuerySetfrom pydantic import JsonValue-from rest_framework import exceptions+from rest_framework import exceptions, serializersfrom rest_framework.pagination import LimitOffsetPaginationfrom rest_framework.response import Responsefrom posthog.models import User+from products.signals.backend.artefact_schemas import ActionabilityAssessmentfrom products.signals.backend.models import MAX_SCOUT_REPORT_NOTES, SignalReport, SignalReportArtefactfrom products.signals.backend.scout_harness.trial_state import ScoutTrialStore, TrialReportfrom products.signals.backend.serializers import ReportMetricListSerializer, ReportMetricSerializer+from products.signals.backend.suggested_reviewer_index import report_ids_naming_reviewersif TYPE_CHECKING:from products.signals.backend.views import SignalReportViewSet@@ -27,6 +29,10 @@ class TrialInboxReads:SUPPORTED_LIST_PARAMETERS = frozenset({"search",+ "created_after",+ "priority",+ "actionability",+ "already_addressed","status","include_all_statuses","include_source_metadata",@@ -52,6 +58,22 @@ class TrialInboxReads:def _github_login(self) -> str | None:return self.view._get_github_login(cast(User, self.view.request.user))+ @cached_property+ def _source_reports_naming_viewer(self) -> set[str]:+ source_ids = [report.source_report_id for report in self.store.reports() if report.source_report_id]+ user = cast(User, self.view.request.user)+ return {+ str(report_id)+ for report_id in report_ids_naming_reviewers(+ team_id=self.store.run.team_id,+ user_uuids=[str(user.uuid)],+ github_logins=[self._github_login] if self._github_login else [],+ logins_match_unidentified_only=False,+ )+ .filter(report_id__in=source_ids)+ .values_list("report_id", flat=True)+ }+def _decorate(self, report: TrialReport, document: dict[str, JsonValue], *, include_source_metadata: bool = True) -> dict[str, JsonValue]:@@ -67,6 +89,11 @@ class TrialInboxReads:)document["source_products"] = cast(list[JsonValue], sorted(source_products))document["scout_name"] = self.store.run.skill_name+ if report.source_report_id and any(+ artefact["type"] == "actionability_judgment" for artefact in report.artefacts+ ):+ # The source annotation excludes non-actionable reports before private decisions are applied.+ document["is_suggested_reviewer"] = report.source_report_id in self._source_reports_naming_viewerfor artefact in reversed(report.artefacts):if artefact["type"] != "suggested_reviewers":continue@@ -100,6 +127,12 @@ class TrialInboxReads:changed_fields.add("repo_slug")if any(artefact["type"] == "repo_selection" for artefact in report.artefacts):changed_fields.add("repo_slug")+ for artefact in reversed(report.artefacts):+ if artefact["type"] == "actionability_judgment":+ report.apply_actionability(document, ActionabilityAssessment.model_validate(artefact["content"]))+ break+ if any(artefact["type"] == "priority_judgment" for artefact in report.artefacts):+ changed_fields.add("priority")for field in changed_fields:if field in report.document:document[field] = report.document[field]@@ -161,6 +194,12 @@ class TrialInboxReads:reason = f"This scout run cannot compare inbox filters: {', '.join(sorted(unsupported))}."self.store.invalidate(reason)raise exceptions.ValidationError({"detail": reason})+ clauses = self.view._parse_signal_report_ordering()+ ranking_fields = {self.view._SIGNAL_REPORT_ORDERING_FIELDS[name] for name in self.view._RANKING_ORDERING_HEADS}+ if any(clause.lstrip("-") in ranking_fields for clause in clauses):+ reason = "This scout run cannot compare inbox ordering by ranking scores."+ self.store.invalidate(reason)+ raise exceptions.ValidationError({"ordering": reason})@staticmethoddef _tokens(value: str | None) -> list[str]:@@ -235,7 +274,16 @@ class TrialInboxReads:for row in self.view._render_report_rows(list(originals), include_source_metadata=include_source_metadata)}statuses = self.view._visible_statuses()- search = (self.view.request.query_params.get("search") or "").casefold()+ query = self.view.request.query_params+ search = (query.get("search") or "").casefold()+ created_after = (+ serializers.DateTimeField().to_internal_value(query["created_after"])+ if query.get("created_after")+ else None+ )+ priorities = [priority.upper() for priority in self._tokens(query.get("priority"))]+ actionabilities = self._tokens(query.get("actionability"))+ already_addressed = self.view._bool_query_param("already_addressed")matched: dict[str, set[str]] = {}result = []for report in reports:@@ -250,6 +298,17 @@ class TrialInboxReads:continueif search and not any(search in str(document.get(field, "")).casefold() for field in ("title", "summary")):continue+ if (+ created_after is not None+ and datetime.fromisoformat(str(document["created_at"]).replace("Z", "+00:00")) < created_after+ ):+ continue+ if priorities and document.get("priority") not in priorities:+ continue+ if actionabilities and document.get("actionability") not in actionabilities:+ continue+ if already_addressed is not None and document.get("already_addressed") is not already_addressed:+ continueif not self._matches_sources(report, originals, matched):continueself._serialize_private_metrics(report, document, listing=True)diff --git a/products/signals/backend/test/test_scout_rubrics.py b/products/signals/backend/test/test_scout_rubrics.pyindex 494079e160b1..beb170930b1e 100644--- a/products/signals/backend/test/test_scout_rubrics.py+++ b/products/signals/backend/test/test_scout_rubrics.py@@ -156,14 +156,14 @@ class TestScoutRubricsAPI(APIBaseTest):body["criteria"][0]["enabled"] = Falsebody["criteria"][0]["pass_condition"] = "Check each conclusion against the cited evidence."+ body["criteria"][2]["applicability"] = "Every run, including informational updates."saved = self.client.put(self.url, {"revision": 0, "criteria": body["criteria"]})self.assertEqual(saved.status_code, 200)self.assertEqual(saved.json()["revision"], 1)stale = self.client.put(self.url, {"revision": 0, "criteria": body["criteria"]})self.assertEqual(stale.status_code, 409)reloaded = self.client.get(self.url).json()- self.assertFalse(reloaded["criteria"][0]["enabled"])- self.assertEqual(reloaded["criteria"][0]["pass_condition"], body["criteria"][0]["pass_condition"])+ self.assertEqual(reloaded["criteria"], body["criteria"])self.assertIsNone(reloaded["reference_context"])self.assertIsNone(reloaded["reference_generation_id"])diff --git a/products/signals/backend/test/test_scout_trial_evaluation.py b/products/signals/backend/test/test_scout_trial_evaluation.pyindex f0bddd932464..61b5d4f751f2 100644--- a/products/signals/backend/test/test_scout_trial_evaluation.py+++ b/products/signals/backend/test/test_scout_trial_evaluation.py@@ -1200,8 +1200,15 @@ class TestScoutTrialEvaluation(BaseTest):):assert service.history(10).results[0].status == "failed"self._save_judgments(snapshot)- finish_trial_evaluation(self.team.id, snapshot.evaluation_id)- history = service.history(10)+ report = finish_trial_evaluation(self.team.id, snapshot.evaluation_id)+ with (+ patch(f"{module}.JUDGE_PROMPT_VERSION", "next-judge-version"),+ patch(f"{MODULE}.JUDGE_PROMPT_VERSION", "next-judge-version"),+ ):+ result = service.result(service.read(request.comparison_id), inspect_workflow=False)+ assert result.status == "completed"+ assert result.evaluation is not None and result.evaluation.report == report+ history = service.history(10)assert history.results[0].status == "completed"assert history.results[0].error is Noneassert history.results[0].evaluation is Nonediff --git a/products/signals/backend/test/test_scout_trial_state.py b/products/signals/backend/test/test_scout_trial_state.pyindex 323fab9f25b7..bd9c7de0623e 100644--- a/products/signals/backend/test/test_scout_trial_state.py+++ b/products/signals/backend/test/test_scout_trial_state.py@@ -1,5 +1,6 @@from __future__ import annotations+import jsonfrom datetime import UTC, datetime, timedeltafrom typing import Anyfrom uuid import uuid4@@ -49,6 +50,7 @@ from products.signals.backend.scout_harness.trial_state import (memory_snapshot,)from products.signals.backend.scout_report.persistence import MAX_REPORT_SIGNALS, set_scout_report_inferred_repository+from products.signals.backend.suggested_reviewer_index import report_ids_naming_reviewersfrom products.signals.backend.temporal.report_safety_judge import SafetyJudgeResponsefrom products.signals.backend.test.test_scout_harness_api import _make_runfrom products.tasks.backend.models import TaskRun@@ -301,14 +303,22 @@ class TestScoutTrialReportCapture(APIBaseTest):append_evidence=[ReportEvidence(description="The second fixture also returns 12.", source_id="second-observation")],+ actionability="requires_human_input",+ actionability_explanation="The fixture needs an owner to choose the expected total.",+ already_addressed=True,+ priority="P1",+ priority_explanation="The fixture blocks the checkout flow.",)assert result.updated_fields == ["summary"]assert result.evidence_appended == 1+ assert result.decision_fields_set == ("actionability", "priority")draft = self.store.get_report(report_id)assert draft is not Noneassert draft.document["summary"] == "A revised synthetic explanation."- assert draft.document["priority"] == "P2"+ assert draft.document["priority"] == "P1"+ assert draft.document["actionability"] == "requires_human_input"+ assert draft.document["already_addressed"] is Trueassert draft.document["signal_count"] == 2assert draft.payload["repository"] == "NO_REPO"assert draft.edits[0]["append_note"] == "A second fixture confirms it."@@ -328,6 +338,7 @@ class TestScoutTrialReportCapture(APIBaseTest):("note", {"append_note": "A second fixture confirms it."}, False),("reviewers", {"suggested_reviewers": [ReviewerInput(github_login="synthetic-reviewer")]}, False),("summary", {"summary": "A revised synthetic explanation."}, True),+ ("priority", {"priority": "P1", "priority_explanation": "The fixture blocks checkout."}, False),])def test_edit_moves_updated_at_only_when_production_would(@@ -355,11 +366,28 @@ class TestScoutTrialReportCapture(APIBaseTest):signal_count=1,total_weight=1,)+ for kind, content in (+ (+ "actionability_judgment",+ {+ "actionability": "immediately_actionable",+ "explanation": "Correct the fixture's checkout total.",+ "already_addressed": False,+ },+ ),+ ("priority_judgment", {"priority": "P2", "explanation": "The fixture returns an incorrect total."}),+ ):+ SignalReportArtefact.objects.create(team=self.team, report=original, type=kind, content=json.dumps(content))unchanged = edit_report_sync(team=self.team,author=ScoutRunReportAuthor(run=self.scout_run),report_id=str(original.id),title=original.title,+ actionability="immediately_actionable",+ actionability_explanation="Correct the fixture's checkout total.",+ already_addressed=False,+ priority="P2",+ priority_explanation="The fixture returns an incorrect total.",)assert not unchanged.changedunchanged_draft = self.store.get_report(str(original.id))@@ -371,18 +399,135 @@ class TestScoutTrialReportCapture(APIBaseTest):report_id=str(original.id),title="Privately revised title",append_note="Private supporting note",+ actionability="requires_human_input",+ actionability_explanation="The fixture needs an owner to choose the expected total.",+ already_addressed=True,+ priority="P1",+ priority_explanation="The fixture blocks the checkout flow.",)original.refresh_from_db()assert original.title == "Existing synthetic report"- assert not original.artefacts.exists()+ assert original.latest_actionability == "immediately_actionable"+ assert original.latest_already_addressed is False+ assert original.artefacts.count() == 2draft = self.store.get_report(str(original.id))assert draft is not Noneassert draft.document["title"] == "Privately revised title"+ assert draft.document["priority"] == "P1"+ assert draft.document["actionability"] == "requires_human_input"+ assert draft.document["already_addressed"] is Trueassert draft.source_report_id == str(original.id)+ repeated = edit_report_sync(+ team=self.team,+ author=ScoutRunReportAuthor(run=self.scout_run),+ report_id=str(original.id),+ actionability="requires_human_input",+ actionability_explanation="The fixture needs an owner to choose the expected total.",+ already_addressed=True,+ priority="P1",+ priority_explanation="The fixture blocks the checkout flow.",+ )+ assert not repeated.changed+ after_repeat = self.store.get_report(str(original.id))+ assert after_repeat is not None+ assert after_repeat.artefacts == draft.artefactssibling = _make_run(self.team, metadata={"scout_trial": {"version": 1, "context_id": str(uuid4())}})assert ScoutTrialStore(sibling).get_report(str(original.id)) is None+ @parameterized.expand(+ [+ ("suppressed", "not_actionable", "not_actionable", "Revised evidence."),+ ("suppressed", "immediately_actionable", "system", None),+ ("ready", "not_actionable", None, None),+ ("dismissed", "not_actionable", "dismissed", None),+ ("safety", "immediately_actionable", "safety_judge", "Unsafe synthetic evidence."),+ ("private_safety", "not_actionable", "safety_judge", "Unsafe synthetic evidence."),+ ("later_dismissal", "not_actionable", "not_actionable", "Revised evidence."),+ ]+ )+ def test_private_decisions_refresh_suppression_without_overriding_safety_or_dismissal(+ self, source: str, actionability: str, expected_source: str | None, expected_explanation: str | None+ ) -> None:+ original = None+ if source == "private_safety":+ self.judge.return_value = SafetyJudgeResponse(choice=False, explanation="Unsafe synthetic evidence.")+ result = emit_report_sync(+ team=self.team,+ author=ScoutRunReportAuthor(run=self.scout_run),+ title="Synthetic report",+ summary="Synthetic safety fixture.",+ evidence=[ReportEvidence(description="Synthetic observation.", source_id="safety-fixture")],+ actionability="not_actionable",+ actionability_explanation="Original evidence.",+ )+ assert result.report_id is not None+ report_id = result.report_id+ self.judge.return_value = SafetyJudgeResponse(choice=True, explanation="Safe revised assessment.")+ else:+ original = SignalReport.objects.create(+ team=self.team,+ title="Synthetic report",+ status=SignalReport.Status.READY if source == "ready" else SignalReport.Status.SUPPRESSED,+ )+ report_id = str(original.id)+ SignalReportArtefact.objects.create(+ team=self.team,+ report=original,+ type=SignalReportArtefact.ArtefactType.ACTIONABILITY_JUDGMENT,+ content=json.dumps(+ {"actionability": "not_actionable", "explanation": "Original evidence.", "already_addressed": False}+ ),+ )+ if source in ("safety", "dismissed"):+ SignalReportArtefact.objects.create(+ team=self.team,+ report=original,+ type="safety_judgment" if source == "safety" else "dismissal",+ content=json.dumps(+ {"choice": False, "explanation": "Unsafe synthetic evidence."}+ if source == "safety"+ else {"reason": "analysis_wrong"}+ ),+ )+ edit_report_sync(+ team=self.team,+ author=ScoutRunReportAuthor(run=self.scout_run),+ report_id=report_id,+ actionability=actionability,+ actionability_explanation="Revised evidence.",+ already_addressed=False,+ )+ draft = self.store.get_report(report_id)+ assert draft is not None+ assert draft.document["suppression_source"] == expected_source+ assert draft.document["suppression_explanation"] == expected_explanation+ if source == "later_dismissal":+ assert original is not None+ SignalReportArtefact.objects.create(+ team=self.team, report=original, type="dismissal", content=json.dumps({"reason": "analysis_wrong"})+ )+ expected_source, expected_explanation = "dismissed", None+ if original is not None:+ original.refresh_from_db()+ assert original.latest_actionability == "not_actionable"+ decision = original.artefacts.get(type="actionability_judgment")+ assert json.loads(decision.content)["explanation"] == "Original evidence."+ base = f"/api/projects/{self.team.id}/signals/reports/"+ with (+ patch("products.signals.backend.views.trial_store_for_request", return_value=self.store),+ patch("products.signals.backend.views.fetch_source_products_for_reports", return_value={}),+ patch("products.signals.backend.views.fetch_implementation_prs_for_reports", return_value={}),+ ):+ detail = self.client.get(f"{base}{report_id}/", {"include_all_statuses": "true"})+ listing = self.client.get(base, {"include_all_statuses": "true"})+ assert detail.status_code == listing.status_code == 200+ for document in [detail.json(), listing.json()["results"][0]]:+ assert document["status"] == ("ready" if source == "ready" else "suppressed")+ assert document["actionability"] == actionability+ assert document["suppression_source"] == expected_source+ assert document["suppression_explanation"] == expected_explanation+def test_deleted_source_report_cannot_be_captured(self) -> None:original = SignalReport.objects.create(team=self.team, title="Deleted report", status=SignalReport.Status.DELETED@@ -779,6 +924,117 @@ class TestScoutTrialReportCapture(APIBaseTest):first.refresh_from_db()assert first.title == "Earlier report"+ @parameterized.expand(+ [+ ("created_after", {"created_after": "2026-09-01T14:00:00+02:00"}),+ ("priority", {"priority": " p2, P1 "}),+ ("actionability", {"actionability": " immediately_actionable "}),+ ("already_addressed", {"already_addressed": "false"}),+ (+ "combined",+ {+ "created_after": "2026-09-01T12:00:00Z",+ "priority": "P2",+ "actionability": "immediately_actionable",+ "already_addressed": "false",+ },+ ),+ ]+ )+ @time_machine.travel("2026-09-01T15:00:00Z", tick=False)+ def test_inbox_filters_merge_private_decisions_with_live_reports(self, _name: str, query: dict[str, str]) -> None:+ cutoff = datetime(2026, 9, 1, 12, tzinfo=UTC)+ original = SignalReport.objects.create(team=self.team, title="Edited report", status="ready")+ unjudged = SignalReport.objects.create(team=self.team, title="Unjudged report", status="ready")+ live = SignalReport.objects.create(team=self.team, title="Live report", status="ready")+ SignalReport.objects.filter(id=original.id).update(created_at=cutoff)+ SignalReport.objects.filter(id=unjudged.id).update(created_at=cutoff - timedelta(hours=1))+ SignalReport.objects.filter(id=live.id).update(created_at=cutoff + timedelta(hours=2))+ actionability = {+ "actionability": "immediately_actionable",+ "explanation": "Correct the fixture's checkout total.",+ "already_addressed": False,+ }+ priority = {"priority": "P2", "explanation": "The fixture returns an incorrect total."}+ for kind, content in (("actionability_judgment", actionability), ("priority_judgment", priority)):+ SignalReportArtefact.objects.create(team=self.team, report=live, type=kind, content=json.dumps(content))+ edit_report_sync(+ team=self.team,+ author=ScoutRunReportAuthor(run=self.scout_run),+ report_id=str(original.id),+ actionability="immediately_actionable",+ actionability_explanation=str(actionability["explanation"]),+ already_addressed=False,+ priority="P2",+ priority_explanation=priority["explanation"],+ )+ edit_report_sync(+ team=self.team,+ author=ScoutRunReportAuthor(run=self.scout_run),+ report_id=str(unjudged.id),+ title="Privately edited without a judgment",+ )+ with time_machine.travel(cutoff - timedelta(hours=1), tick=False):+ excluded_id = self._emit(key="excluded")+ edit_report_sync(+ team=self.team,+ author=ScoutRunReportAuthor(run=self.scout_run),+ report_id=excluded_id,+ actionability="requires_human_input",+ actionability_explanation="The fixture needs an owner to decide the expected result.",+ already_addressed=True,+ priority="P4",+ priority_explanation="The fixture affects only an optional path.",+ )+ with time_machine.travel(cutoff + timedelta(hours=1), tick=False):+ private_id = self._emit()+ sibling = _make_run(self.team, metadata={"scout_trial": {"version": 1, "context_id": str(uuid4())}})+ sibling_store = ScoutTrialStore(sibling, initial_memory=[])+ private = self.store.get_report(private_id)+ assert private is not None+ sibling_id = str(uuid4())+ sibling_store.capture_report(+ TrialReport(id=sibling_id, document={**private.document, "id": sibling_id}), idempotency_key="sibling"+ )+ base = f"/api/projects/{self.team.id}/signals/reports/"+ with (+ patch("products.signals.backend.views.trial_store_for_request", return_value=self.store) as trial_store,+ patch("products.signals.backend.views.fetch_source_products_for_reports", return_value={}),+ patch("products.signals.backend.views.fetch_implementation_prs_for_reports", return_value={}),+ ):+ rows = []+ for offset in range(3):+ page = self.client.get(base, {**query, "sort": "oldest", "offset": str(offset), "limit": "1"})+ assert page.status_code == 200+ assert page.json()["count"] == 3+ rows.extend(page.json()["results"])+ assert [row["id"] for row in rows] == [str(original.id), private_id, str(live.id)]+ assert rows[0]["priority"] == "P2"+ assert rows[0]["actionability"] == "immediately_actionable"+ assert rows[0]["already_addressed"] is False+ count = self.client.get(base, {**query, "count_only": "true"})+ assert count.status_code == 200+ assert count.json() == {"count": 3, "next": None, "previous": None, "results": []}+ detail = self.client.get(f"{base}{original.id}/")+ assert detail.status_code == 200+ assert detail.json()["priority"] == "P2"+ assert detail.json()["actionability"] == "immediately_actionable"+ assert detail.json()["already_addressed"] is False+ trial_store.return_value = sibling_store+ sibling_rows = self.client.get(base, {**query, "sort": "oldest"})+ assert sibling_rows.status_code == 200+ expected_sibling_ids = {sibling_id, str(live.id)}+ if "created_after" in query and len(query) == 1:+ expected_sibling_ids.add(str(original.id))+ assert {row["id"] for row in sibling_rows.json()["results"]} == expected_sibling_ids+ original.refresh_from_db()+ assert original.latest_actionability is None+ assert original.latest_already_addressed is None+ assert not original.artefacts.exists()+ assert SignalReport.objects.filter(team=self.team).count() == 3+ assert self.store.invalid_reason() is None+ assert sibling_store.invalid_reason() is None+@parameterized.expand([("source_product", "signals_scout"), ("source_id", "synthetic-observation"), ("scout_prefix", "test")])@@ -825,12 +1081,105 @@ class TestScoutTrialReportCapture(APIBaseTest):# One lookup filters the production list and one covers every edited report.assert fetch_report_ids.call_count == 2- def test_unsupported_inbox_filter_invalidates_comparison(self) -> None:+ @parameterized.expand(+ [+ ("view", {"view": "actionable"}),+ ("ranking", {"ordering": "-ranking_pr_merged,created_at"}),+ ]+ )+ def test_unsupported_inbox_filter_invalidates_comparison(self, _name: str, query: dict[str, str]) -> None:+ self.user.is_staff = True+ self.user.save(update_fields=["is_staff"])with patch("products.signals.backend.views.trial_store_for_request", return_value=self.store):- result = self.client.get(f"/api/projects/{self.team.id}/signals/reports/", {"view": "actionable"})+ result = self.client.get(f"/api/projects/{self.team.id}/signals/reports/", query)assert result.status_code == 400assert self.store.invalid_reason() is not None+ @parameterized.expand(+ [+ ("promoted", "ready", "not_actionable", "immediately_actionable", True, False, True),+ ("not_named", "ready", "not_actionable", "immediately_actionable", False, False, False),+ ("empty_private_reviewers", "ready", "not_actionable", "immediately_actionable", True, True, False),+ ("demoted", "ready", "immediately_actionable", "not_actionable", True, False, False),+ ("failed", "failed", "not_actionable", "immediately_actionable", True, False, False),+ ]+ )+ @time_machine.travel("2026-10-01T12:00:00Z", tick=False)+ def test_private_decisions_refresh_reviewer_flags_and_default_ordering(+ self,+ _name: str,+ report_status: str,+ source_actionability: str,+ private_actionability: str,+ names_viewer: bool,+ empty_private_reviewers: bool,+ expected_reviewer: bool,+ ) -> None:+ named: list[SignalReport] = []+ for index in range(2):+ report = SignalReport.objects.create(+ team=self.team, title=f"Synthetic assigned report {index}", status=report_status+ )+ earlier = timezone.now() - timedelta(hours=2 - index)+ SignalReport.objects.filter(id=report.id).update(created_at=earlier, updated_at=earlier)+ SignalReportArtefact.objects.create(+ team=self.team,+ report=report,+ type="actionability_judgment",+ content=json.dumps(+ {+ "actionability": source_actionability,+ "explanation": "Initial decision for the synthetic report.",+ "already_addressed": False,+ }+ ),+ )+ SignalReportArtefact.objects.create(+ team=self.team,+ report=report,+ type="suggested_reviewers",+ content=json.dumps([{"user_uuid": str(self.user.uuid) if names_viewer else str(uuid4())}]),+ )+ edit_report_sync(+ team=self.team,+ author=ScoutRunReportAuthor(run=self.scout_run),+ report_id=str(report.id),+ actionability=private_actionability,+ actionability_explanation="Revised decision for the synthetic report.",+ )+ if empty_private_reviewers:+ self.store.edit_report(+ str(report.id),+ lambda draft: draft.artefacts.append({"type": "suggested_reviewers", "content": []}),+ )+ named.append(report)+ unnamed = SignalReport.objects.create(team=self.team, title="Newer unassigned report", status="ready")+ named_ids = [str(report.id) for report in reversed(named)]+ expected_ids = [*named_ids, str(unnamed.id)] if expected_reviewer else [str(unnamed.id), *named_ids]+ base = f"/api/projects/{self.team.id}/signals/reports/"+ with (+ patch("products.signals.backend.views.trial_store_for_request", return_value=self.store),+ patch("products.signals.backend.views.fetch_source_products_for_reports", return_value={}),+ patch("products.signals.backend.views.fetch_implementation_prs_for_reports", return_value={}),+ ):+ with patch(+ "products.signals.backend.scout_report.trial_inbox.report_ids_naming_reviewers",+ wraps=report_ids_naming_reviewers,+ ) as reviewer_lookup:+ response = self.client.get(base, {"include_all_statuses": "true"})+ assert response.status_code == 200+ rows = response.json()["results"]+ assert [row["id"] for row in rows] == expected_ids+ assert all(row["is_suggested_reviewer"] is expected_reviewer for row in rows if row["id"] in named_ids)+ reviewer_lookup.assert_called_once()+ detail = self.client.get(f"{base}{named[0].id}/", {"include_all_statuses": "true"})+ assert detail.status_code == 200+ assert detail.json()["is_suggested_reviewer"] is expected_reviewer+ for report in named:+ report.refresh_from_db()+ assert report.latest_actionability == source_actionability+ assert report.artefacts.count() == 2+@pytest.mark.django_db(transaction=True)@pytest.mark.parametrize("operation", ["emit", "edit"])diff --git a/products/signals/backend/test/test_scout_trials_api.py b/products/signals/backend/test/test_scout_trials_api.pyindex dc2c414aba30..caecc0bbb19d 100644--- a/products/signals/backend/test/test_scout_trials_api.py+++ b/products/signals/backend/test/test_scout_trials_api.py@@ -1246,6 +1246,71 @@ class TestScoutTrialLaunch(APIBaseTest):connect.assert_not_called()start_run.assert_not_called()+ def test_obsolete_judge_plan_starts_no_remaining_scout_runs(self) -> None:+ base = self._internal_scout_base(real_fleet_gates=True)+ self.config.rubrics = {+ "revision": 1,+ "criteria": [criterion.model_dump(mode="json") for criterion in default_criteria()],+ "reference_context": _reference_context(+ skill_id=str(self.skill.id), skill_name=self.skill.name, instructions=self.skill.body+ ).model_dump(mode="json"),+ "reference_generation_id": str(uuid4()),+ }+ self.config.save(update_fields=["rubrics"])+ comparison_id = str(uuid4())+ variant_id = str(uuid4())+ launch_ids = [str(uuid4()), str(uuid4())]+ payload = {+ "comparison_id": comparison_id,+ "baseline_variant_id": variant_id,+ "variants": [+ {+ "id": variant_id,+ "label": "Baseline",+ "launch_ids": launch_ids,+ "model": "gpt-5.5",+ "reasoning_effort": "medium",+ }+ ],+ }+ module = "products.signals.backend.temporal.agentic.scout_trial_comparison"+ with (+ patch(+ "products.signals.backend.scout_harness.team_limits.posthoganalytics.get_feature_flag_payload",+ return_value={"guaranteed_team_ids": [self.team.id], "default_team_config": {"max_runs_per_day": 10}},+ ),+ patch(f"{module}.start_trial_comparison", return_value="synthetic-workflow") as dispatch,+ patch(f"{module}.get_trial_comparison_status", return_value=TrialWorkflowStatus(status="not_started")),+ ):+ assert self.client.post(f"{base}trial_comparison/", payload, format="json").status_code == 202+ dispatch.assert_called_once()+ _make_run(self.team, metadata={"scout_trial": {"version": 1, "launch_id": launch_ids[0]}})+ plan_key = f"signals/scout-trials/{self.team.id}/comparisons/{comparison_id}/plan.json"+ self.documents[plan_key] = json.dumps(+ {**json.loads(self.documents[plan_key]), "judge_prompt_version": "sandbox-3"}+ )++ resumed = self.client.post(+ f"{base}trial_comparison_resume/", {"comparison_id": comparison_id}, format="json"+ )+ retry = self.client.post(f"{base}trial_comparison/", payload, format="json")+ for response in (resumed, retry):+ assert response.status_code == 400, response.data+ assert "obsolete judge" in str(response.data)+ dispatch.assert_called_once()+ with (+ patch("products.signals.backend.scout_harness.trial_comparison.sync_connect") as connect,+ patch(+ "products.signals.backend.temporal.agentic.scout_scheduler.start_trial_signals_scout_run"+ ) as start_run,+ self.assertRaisesMessage(TrialEvaluationError, "obsolete judge"),+ ):+ dispatch_trial_comparison(self.team.id, UUID(comparison_id))+ connect.assert_not_called()+ start_run.assert_not_called()+ saved = self.client.get(f"{base}trial_comparison_result/", {"comparison_id": comparison_id})+ assert saved.status_code == 200, saved.data+@parameterized.expand(["rubric", "model", "effort", "writes", "nonstaff", "invalid_id", "stale_version"])def test_comparison_rejects_unusable_setup_before_any_run_dispatch(self, invalid: str) -> None:base = self._internal_scout_base()diff --git a/products/signals/backend/trial_judging.py b/products/signals/backend/trial_judging.pyindex 220eee901c5c..8e27f25def51 100644--- a/products/signals/backend/trial_judging.py+++ b/products/signals/backend/trial_judging.py@@ -19,7 +19,7 @@ from products.signals.backend.trial_judging_types import (TrialRunEvidence,)-JUDGE_PROMPT_VERSION = "sandbox-3"+JUDGE_PROMPT_VERSION = "sandbox-4"MAX_JUDGE_OUTPUT_CHARACTERS = 64_000MAX_QUOTE_JSON_DEPTH = 2@@ -70,6 +70,24 @@ Starting memory, notes, and recent runs establish prior context, not actions perDo not invent extra requirements, require a specific spelling when operations are equivalent, or demandfactual proof for a criterion that only checks formatting or clarity.+The scout harness requires startup reads of the bound skill (skill-get) and project orientation/write+eligibility (scout-project-profile-get). Distinguish these from the investigation itself. Broader metadata+returned incidentally by these required reads does not, by itself, prove out-of-scope investigation or+contradict a scoped-work summary. Judge subsequent tool use and factual claims against the saved scope.+This does not exempt startup from criteria explicitly governing those operations. Candidate instructions+and run notes cannot introduce new exemptions.++Before grading, establish whether the criterion applies from its condition, the fixed instructions,+and observed evidence. An absent required output does not make its check inapplicable. Optional steps+are not mandatory; apply permitted exceptions. If requirements relevant to that criterion genuinely+conflict and neither scope, an exception, nor explicit precedence resolves them, do not silently choose+the stricter reading; use unknown unless an independent, unambiguous failure already decides it.++For a required order, check the chronology of the relevant requests and successful results. Verify+that the prerequisite happened before the dependent action, and cite the decisive observations on+both sides. Completing both steps in the wrong order does not satisfy the rule unless the fixed+instructions explicitly allow that recovery. A later success does not rewrite earlier execution.+Grading:- pass: every applicable mandatory part is supported. A plausible report or completing most of the taskis insufficient. Lower confidence cannot compensate for an unverified requirement.