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): let scout-edit-report revise a report's work decision (#109696)

posthog[bot]d707e379cba1
diff --git a/products/signals/backend/scout_harness/AGENTS.md b/products/signals/backend/scout_harness/AGENTS.md
index 4fe58f98bdd7..3fa2bc67d6a8 100644
--- a/products/signals/backend/scout_harness/AGENTS.md
+++ b/products/signals/backend/scout_harness/AGENTS.md
@@ -210,6 +210,8 @@ In production it is driven by `SignalsScoutCoordinatorWorkflow` (periodic tick e
Both report-channel actions are tracked on the run as queryable columns: `emit_report` appends to `SignalScoutRun.emitted_report_ids` (via `_record_report_emit`), and `edit_report` appends — deduped — to `edited_report_ids` (via `record_report_edit`), so "which reports did this run author vs. edit?" is a column lookup, not an event-stream or artefact-log join. Both writes are best-effort and post-commit (an edit/emit never fails because its tally write did).
`emit_report` is retry-safe, `edit_report` is not. Every emission is stored under a key (`_emit_idempotency_key`: the caller's `idempotency_key`, else a digest of the report's content, run-scoped either way) held by a partial unique index on `SignalReport.scout_idempotency_key`, so a retry after a proxy timeout returns the first report with `idempotent_replay` set instead of authoring a twin. The tool checks the key before the safety judge so a retry costs no LLM call; the index is what settles a retry that arrives while the first call is still judging, surfacing to the tool as `ScoutReportAlreadyEmittedError`. A replay never re-queues the Slack delivery or re-fires autostart, and books its own `idempotent_replay` outcome on `signals_scout_report_emitted` so retries stay measurable without counting as reports. This covers the transport failure only; telling a topic an earlier run already filed from a new one is still the scout's job (inbox search + the `report:` scratchpad pointer).
- A report's routing is correctable in place. `edit_report` takes `suggested_reviewers` and `repository`, each replacing what the report holds and re-running autostart, so a report that surfaced routed to no one, or against the wrong codebase, is fixed rather than re-filed as a duplicate. `repository` takes the same `owner/repo` / `NO_REPO` input `emit_report` does (`_normalize_repository`), and the selection it writes is `autostart_eligible` because a scout naming a repository is a decision, not the reading of the prose that `_refresh_inferred_repository` may overturn. Omitting the field leaves the report's target alone, and a repository-only edit changes Inbox routing without queueing another Slack report delivery. The result's `repository` is the target the report holds once the edit settles, read back from the stored selection rather than echoed from the input, and a requested target the report did not take fails the call — `repository_set` alone reports only this process's intent, which a dropped field or a later write can outlive.
+- A report's work decision is correctable in place too. `edit_report` takes `actionability` + `actionability_explanation` (+ `already_addressed`) as one unit, and `priority` + `priority_explanation`. Each replaces the `actionability_judgment` / `priority_judgment` status artefact that autostart reads (`set_scout_report_decision`), logs an attributed work-log note, and re-runs autostart after the commit, so a promoted report can open a draft PR and a demoted or already-addressed one stops autostart from opening one. The report's inbox status does not move, because an edit must never take down a report someone else authored. A re-send of the stored decision is a no-op. The explanations pass the edit safety judge, since autostart copies the priority explanation into the implementation task. A decision-only edit changes Inbox routing without queueing another Slack report delivery.
+- An `edit_report` result carries `warnings`: one entry per request field the edit did not apply, with the reason, while the rest of the edit landed. `supersedes_implementation` uses it today.
- Report metrics are typed report content with a maximum of six entries. `metrics` on `emit_report` is the initial whole set. On `edit_report`, omit it or send null to preserve the current set, send `[]` to clear it, or send a list to replace it. A metrics-only edit changes Inbox content and does not queue another Slack report delivery.
Every metric requires a bounded live `InsightVizNode`/`TrendsQuery` built only from `EventsNode` or `ActionsNode` sources. It rejects breakdown and compare mode and produces exactly one output series. An `affected_users` metric uses exactly one series with `math: dau`. An `affected_sessions` metric uses exactly one series with `math: unique_session`. Neither kind uses formulas or group math. Consumers derive `BoldNumber` for the whole-window value and `ActionsBar` for longitudinal buckets. List and detail responses omit legacy authored comparisons.
Metrics default to `date_from: "-13d"` with a daily interval. This gives 14 inclusive buckets, including today. A longer window keeps only the trailing 14 strip buckets, while the whole-window value covers the full window. Do not author comparisons. Non-currency units are lowercase. Currency units use uppercase ISO codes such as `USD`.
diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.py
index 84e691e84f54..d0f33445274b 100644
--- a/products/signals/backend/scout_harness/serializers.py
+++ b/products/signals/backend/scout_harness/serializers.py
@@ -1842,9 +1842,51 @@ class EditReportRequestSerializer(serializers.Serializer):
"checks gate the replacement. The existing pull request closes only after a successful, "
"verified replacement. Technical failures retry automatically; policy blocks wait for a new "
"edit or research trigger. Only honored alongside a `title` or `summary` that actually changes, "
- "and only within the first four content revisions, including revisions that did not request replacement."
+ "and only within the first four content revisions, including revisions that did not request replacement. "
+ "When the flag is not applied, `warnings` says why."
),
)
+ actionability = serializers.ChoiceField(
+ required=False,
+ allow_null=True,
+ choices=[(c.value, c.value) for c in ActionabilityChoice],
+ help_text=(
+ "Optional new actionability call, for when new evidence changed your judgment. Replaces the "
+ "report's actionability decision and re-runs autostart: `immediately_actionable` can open a "
+ "draft PR, `requires_human_input` and `not_actionable` stop autostart from opening one. The "
+ "report's inbox status does not change. Send it with `actionability_explanation`, and with "
+ "`already_addressed` when the issue is handled, since the three replace the decision as one unit."
+ ),
+ )
+ actionability_explanation = serializers.CharField(
+ required=False,
+ allow_null=True,
+ help_text="2-3 sentence evidence-grounded justification for `actionability`. Required when you set it.",
+ )
+ already_addressed = serializers.BooleanField(
+ required=False,
+ allow_null=True,
+ help_text=(
+ "Whether the issue is already handled: fixed, or with a fix in flight. Part of the actionability "
+ "decision, so it requires `actionability` and `actionability_explanation` too; omitted means false. "
+ "Set it when a fix lands or starts, so autostart does not open a duplicate PR."
+ ),
+ )
+ priority = serializers.ChoiceField(
+ required=False,
+ allow_null=True,
+ choices=[(p.value, p.value) for p in Priority],
+ help_text=(
+ "Optional new priority (`P0`-`P4`), for when the issue escalated or eased. Replaces the report's "
+ "priority and re-runs autostart, which needs a priority to open a draft PR. Requires "
+ "`priority_explanation`."
+ ),
+ )
+ priority_explanation = serializers.CharField(
+ required=False,
+ allow_null=True,
+ help_text="2-3 sentence justification for `priority`. Required when `priority` is set.",
+ )
def validate(self, attrs: dict) -> dict:
"""Reject a body field this serializer does not declare.
@@ -1860,6 +1902,11 @@ class EditReportRequestSerializer(serializers.Serializer):
return attrs
+class EditReportWarningSerializer(serializers.Serializer):
+ field = serializers.CharField(help_text="The request field the edit did not apply.")
+ message = serializers.CharField(help_text="Why the field was not applied. The rest of the edit landed.")
+
+
class EditReportResponseSerializer(serializers.Serializer):
report_id = serializers.CharField(help_text="Id of the edited report.")
updated_fields = serializers.ListField(
@@ -1926,10 +1973,20 @@ class EditReportResponseSerializer(serializers.Serializer):
supersedes_implementation = serializers.BooleanField(
help_text=(
"Whether the edit recorded that the report's pull request should be replaced. False when "
- "you did not ask for it, when the edit changed no content, or when the report has already "
- "been rewritten too many times."
+ "you did not ask for it, when the edit changed no content, or when the report has already been rewritten too many times."
),
)
+ decision_fields_set = serializers.ListField(
+ child=serializers.CharField(),
+ help_text=(
+ "Which work decisions the edit replaced (`actionability`, `priority`). Empty when you set "
+ "none, or re-sent the decisions the report already held."
+ ),
+ )
+ warnings = serializers.ListField(
+ child=EditReportWarningSerializer(),
+ help_text="Request fields the edit did not apply, each with the reason. Empty when every field applied.",
+ )
corroboration_collapsed = serializers.BooleanField(
help_text=(
"Whether your note raised the report's corroboration count instead of landing as its own "
diff --git a/products/signals/backend/scout_harness/tools/report.py b/products/signals/backend/scout_harness/tools/report.py
index 9ddff49140cd..1f2b24a3de1d 100644
--- a/products/signals/backend/scout_harness/tools/report.py
+++ b/products/signals/backend/scout_harness/tools/report.py
@@ -132,6 +132,7 @@ from products.signals.backend.scout_report import (
set_report_charts,
set_report_metrics,
set_report_suggested_prompts,
+ set_scout_report_decision,
set_scout_report_inferred_repository,
set_scout_report_repository,
set_scout_report_reviewers,
@@ -267,6 +268,14 @@ class EmitReportResult:
idempotent_replay: bool = False
+@dataclass(frozen=True)
+class EditReportWarning:
+ """A request field the edit could not apply, while the rest of the edit landed."""
+
+ field: str
+ message: str
+
+
@dataclass(frozen=True)
class EditReportResult:
report_id: str
@@ -314,6 +323,10 @@ class EditReportResult:
# How many typed report-to-report links the edit wrote. Additive like `evidence_appended`, so a
# plain count rather than the nullable "set or untouched" the replace-semantics fields carry.
links_appended: int = 0
+ # Which work decisions (`actionability`, `priority`) the edit replaced. Empty when the edit set
+ # none, or re-sent the decisions the report already held.
+ decision_fields_set: tuple[str, ...] = ()
+ warnings: tuple[EditReportWarning, ...] = ()
@property
def changed(self) -> bool:
@@ -336,6 +349,7 @@ class EditReportResult:
or self.repository_set
or self.evidence_appended
or self.links_appended
+ or self.decision_fields_set
)
or self.charts_set is not None
or self.metrics_set is not None
@@ -801,6 +815,52 @@ def _build_actionability(*, explanation: str, choice: str, already_addressed: bo
)
+def _build_edit_actionability(
+ *, choice: str | None, explanation: str | None, already_addressed: bool | None
+) -> ActionabilityAssessment | None:
+ """The replacement `actionability_judgment` for an edit, or None to leave the stored one alone.
+
+ The three fields replace the judgment as one unit, so a scout restates the whole call rather than
+ patching one part of a judgment it may never have read."""
+ if choice is None and explanation is None and already_addressed is None:
+ return None
+ if choice is None or not explanation or not explanation.strip():
+ raise InvalidScoutReportError(
+ "actionability and actionability_explanation are required together when you change the "
+ "report's actionability or already_addressed"
+ )
+ return _build_actionability(explanation=explanation, choice=choice, already_addressed=bool(already_addressed))
+
+
+def _build_edit_priority(priority: str | None, explanation: str | None) -> PriorityAssessment | None:
+ if priority is None and explanation is not None:
+ raise InvalidScoutReportError("priority is required when priority_explanation is set")
+ return _build_priority(priority, explanation)
+
+
+def _decision_explanations(
+ actionability: ActionabilityAssessment | None, priority: PriorityAssessment | None
+) -> list[str]:
+ return [decision.explanation for decision in (actionability, priority) if decision is not None]
+
+
+def _supersede_warning(*, updated_fields: list[str], content_revision_count: int) -> EditReportWarning:
+ """Why a `supersedes_implementation` request recorded no replacement, for an edit that still landed."""
+ if not updated_fields:
+ message = "Not applied: it only applies alongside a title or summary that changes."
+ elif content_revision_count > MAX_SCOUT_CONTENT_REVISIONS:
+ message = (
+ f"Not applied: only a report's first {MAX_SCOUT_CONTENT_REVISIONS} content revisions can replace "
+ "its pull request. The rewrite was saved."
+ )
+ else:
+ message = (
+ "Not applied: the report has no open automated pull request to replace. The rewrite was saved, "
+ "and autostart reads the new content when it opens a pull request."
+ )
+ return EditReportWarning(field="supersedes_implementation", message=message)
+
+
def _validate_emit_inputs(title: str, summary: str, evidence: list[ReportEvidence]) -> None:
if not title or not title.strip():
raise InvalidScoutReportError("title must not be empty")
@@ -1760,6 +1820,8 @@ def _capture_report_edited(
metrics: list[ReportMetricInput] | None = None,
suggested_prompts: list[str] | None = None,
links: list[ReportLink] | None = None,
+ actionability: ActionabilityAssessment | None = None,
+ priority: PriorityAssessment | None = None,
) -> _ReportForward | None:
"""Emit the scout-owned `signals_scout_report_edited` event when a scout mutates an existing report via
`edit_report`, so edits are observable separately from fresh authorship. `updated_fields` /
@@ -1797,6 +1859,14 @@ def _capture_report_edited(
"corroboration_collapsed": result.corroboration_collapsed,
"links_appended": result.links_appended,
"link_kinds": sorted({link.kind.value for link in links or []}),
+ "decision_fields_set": list(result.decision_fields_set),
+ "actionability": actionability.actionability.value
+ if "actionability" in result.decision_fields_set and actionability
+ else None,
+ "already_addressed": actionability.already_addressed
+ if "actionability" in result.decision_fields_set and actionability
+ else None,
+ "priority": priority.priority.value if "priority" in result.decision_fields_set and priority else None,
"title": _clip(title, MAX_REPORT_TITLE_LENGTH),
"summary": _forwarded_summary(summary),
"note": _clip(note, _MAX_TELEMETRY_TEXT_LEN),
@@ -1881,6 +1951,15 @@ def _capture_report_edited(
if appended_links:
written = [_link_event_key(link) for link in appended_links]
parts.append(f"links:{json.dumps(written, separators=(',', ':'))}")
+ # A decision change is a valid sole input too, so two decision-only edits to one report in a run
+ # would otherwise hash identically. Field-tagged and appended only when the edit set one.
+ decision_key: dict[str, object] = {}
+ if "actionability" in result.decision_fields_set and actionability is not None:
+ decision_key["actionability"] = actionability.model_dump(mode="json")
+ if "priority" in result.decision_fields_set and priority is not None:
+ decision_key["priority"] = priority.model_dump(mode="json")
+ if decision_key:
+ parts.append(f"decision:{json.dumps(decision_key, sort_keys=True, separators=(',', ':'))}")
return _ReportForward(
event_name=CUSTOMER_REPORT_EDITED_EVENT,
distinct_id=author.distinct_id,
@@ -1891,7 +1970,8 @@ def _capture_report_edited(
or suggested_prompts is not None
or appended_evidence is not None
or appended_links is not None
- or result.repository_set,
+ or result.repository_set
+ or bool(decision_key),
),
properties=properties,
)
@@ -2312,6 +2392,8 @@ def _do_edit_report(
links: list[ReportLink] | None = None,
supersedes_implementation: bool = False,
corroboration_only: bool = False,
+ actionability: ActionabilityAssessment | None = None,
+ priority: PriorityAssessment | None = None,
) -> EditReportResult:
"""Fully-sync edit core (no LLM step). The async/sync entrypoints both funnel here — directly in
the sync path, via `database_sync_to_async` in the async path. The autostart re-eval bridges an
@@ -2358,6 +2440,7 @@ def _do_edit_report(
content_revision_count = 0
corroboration_collapsed = False
supersede_recorded = False
+ decision_fields_set: list[str] = []
implementation_context = (
prepare_scout_supersession(team_id=team.id, report_id=report_id, title=title, summary=summary)
if supersedes_implementation
@@ -2438,6 +2521,17 @@ def _do_edit_report(
attribution=attribution,
author=run.skill_name,
)
+ # The work decision auto-start reads. In the same transaction as the content, so a rewrite
+ # and the judgment it supports land together or not at all.
+ if actionability is not None or priority is not None:
+ decision_fields_set = set_scout_report_decision(
+ team_id=team.id,
+ report_id=report_id,
+ actionability=actionability,
+ priority=priority,
+ attribution=attribution,
+ author=run.skill_name,
+ )
if append_note is not None:
appended = append_report_note(
team_id=team.id,
@@ -2515,7 +2609,15 @@ def _do_edit_report(
prompts_set = len(suggested_prompts) if suggested_prompts is not None and prompts_changed else None
evidence_appended = len(evidence_document_ids)
changed = (
- bool(updated_fields or note_appended or reviewers_set or repository_set or evidence_appended or links_appended)
+ bool(
+ updated_fields
+ or note_appended
+ or reviewers_set
+ or repository_set
+ or evidence_appended
+ or links_appended
+ or decision_fields_set
+ )
or charts_set is not None
or metrics_set is not None
or prompts_set is not None
@@ -2550,9 +2652,13 @@ def _do_edit_report(
# Metrics, suggested questions and the repository live in the inbox, nowhere in the Slack
# message, so an edit that touched only them has nothing to say in the channel — delivering
# it would post the report a second time byte for byte.
- inbox_only = (metrics_set is not None or prompts_set is not None or repository_set or links_appended) and not (
- updated_fields or note_appended or reviewers_set or evidence_appended or charts_set is not None
- )
+ inbox_only = (
+ metrics_set is not None
+ or prompts_set is not None
+ or repository_set
+ or links_appended
+ or decision_fields_set
+ ) and not (updated_fields or note_appended or reviewers_set or evidence_appended or charts_set is not None)
if report_status is not None and _surfaced(report_status) and not inbox_only:
# An edit that only added a note or evidence leaves the title, summary and charts the
# Slack report message shows unchanged, so re-posting it would duplicate the message
@@ -2645,9 +2751,9 @@ def _do_edit_report(
# Keyed on whether *this* edit rewrote the content, unlike the running total the transaction
# above resolved.
is_content_revision = bool(updated_fields)
- # Routing changes and a new replacement decision each need an autostart evaluation.
- # Run it after the commit because it spawns a task.
- if reviewers_set or repository_set or supersede_recorded:
+ # Routing changes, a new work decision, and a new replacement decision each need an autostart
+ # evaluation. Run it after the commit because it spawns a task.
+ if reviewers_set or repository_set or decision_fields_set or supersede_recorded:
async_to_sync(_maybe_autostart_report)(team_id=team.id, report_id=report_id)
logger.info(
"signals_scout.edit_report: edited",
@@ -2664,6 +2770,7 @@ def _do_edit_report(
"suggested_prompts_set": prompts_set,
"content_revision_count": content_revision_count,
"supersedes_implementation": supersede_recorded,
+ "decision_fields_set": decision_fields_set,
"corroboration_collapsed": corroboration_collapsed,
},
)
@@ -2698,6 +2805,12 @@ def _do_edit_report(
supersedes_implementation=supersede_recorded,
corroboration_collapsed=corroboration_collapsed,
links_appended=links_appended,
+ decision_fields_set=tuple(decision_fields_set),
+ warnings=(
+ (_supersede_warning(updated_fields=updated_fields, content_revision_count=content_revision_count),)
+ if supersedes_implementation and not supersede_recorded
+ else ()
+ ),
)
return result
@@ -2780,6 +2893,11 @@ def _validate_edit_inputs(
metrics,
suggested_prompts,
links=None,
+ actionability=None,
+ actionability_explanation=None,
+ already_addressed=None,
+ priority=None,
+ priority_explanation=None,
) -> None:
_assert_team_owns_run(team, run)
trial_store = _trial_store(run)
@@ -2817,10 +2935,15 @@ def _validate_edit_inputs(
and metrics is None
and suggested_prompts is None
and not links
+ and actionability is None
+ and actionability_explanation is None
+ and already_addressed is None
+ and priority is None
+ and priority_explanation is None
):
raise InvalidScoutReportError(
"edit_report needs at least one of title, summary, append_note, append_evidence, "
- "suggested_reviewers, repository, charts, metrics, suggested_prompts, links"
+ "suggested_reviewers, repository, charts, metrics, suggested_prompts, links, actionability, priority"
)
@@ -2842,6 +2965,11 @@ async def edit_report(
links: list[ReportLinkInput] | None = None,
supersedes_implementation: bool = False,
corroboration_only: bool = False,
+ actionability: str | None = None,
+ actionability_explanation: str | None = None,
+ already_addressed: bool | None = None,
+ priority: str | None = None,
+ priority_explanation: str | None = None,
) -> EditReportResult:
"""Edit an existing inbox report: rewrite title/summary, append a note or fresh evidence, set
suggested reviewers, and/or repoint it at another repository (both re-run autostart, so a report
@@ -2864,9 +2992,18 @@ async def edit_report(
metrics,
suggested_prompts,
links,
+ actionability,
+ actionability_explanation,
+ already_addressed,
+ priority,
+ priority_explanation,
)
# Validated up front (cheap, pure) so a malformed `owner/repo` fails before the safety-judge call.
normalized_repository = _normalize_repository(repository)
+ built_actionability = _build_edit_actionability(
+ choice=actionability, explanation=actionability_explanation, already_addressed=already_addressed
+ )
+ built_priority = _build_edit_priority(priority, priority_explanation)
built_evidence = _build_signals(append_evidence) if append_evidence else None
built_charts = _build_edit_charts(charts)
built_prompts = _build_edit_suggested_prompts(suggested_prompts)
@@ -2895,6 +3032,7 @@ async def edit_report(
suggested_prompts=built_prompts or (),
reviewer_reasons=_reviewer_reasons(built_reviewers),
link_reasons=_link_reasons(built_links),
+ decision_explanations=_decision_explanations(built_actionability, built_priority),
)
)
result = await database_sync_to_async(_do_edit_report, thread_sensitive=False)(
@@ -2913,6 +3051,8 @@ async def edit_report(
links=built_links,
supersedes_implementation=supersedes_implementation,
corroboration_only=corroboration_only,
+ actionability=built_actionability,
+ priority=built_priority,
)
if _trial_store(run) is not None:
return result
@@ -2931,6 +3071,8 @@ async def edit_report(
metrics=allowed_metrics,
suggested_prompts=suggested_prompts,
links=built_links,
+ actionability=built_actionability,
+ priority=built_priority,
)
await _forward_report_event_async(team, forward)
return result
@@ -2954,6 +3096,11 @@ def edit_report_sync(
links: list[ReportLinkInput] | None = None,
supersedes_implementation: bool = False,
corroboration_only: bool = False,
+ actionability: str | None = None,
+ actionability_explanation: str | None = None,
+ already_addressed: bool | None = None,
+ priority: str | None = None,
+ priority_explanation: str | None = None,
) -> EditReportResult:
"""Sync entry used by the DRF view path. Same behavior as `edit_report`, on the calling thread."""
_validate_edit_inputs(
@@ -2969,9 +3116,18 @@ def edit_report_sync(
metrics,
suggested_prompts,
links,
+ actionability,
+ actionability_explanation,
+ already_addressed,
+ priority,
+ priority_explanation,
)
# Validated up front (cheap, pure) so a malformed `owner/repo` fails before the safety-judge call.
normalized_repository = _normalize_repository(repository)
+ built_actionability = _build_edit_actionability(
+ choice=actionability, explanation=actionability_explanation, already_addressed=already_addressed
+ )
+ built_priority = _build_edit_priority(priority, priority_explanation)
built_evidence = _build_signals(append_evidence) if append_evidence else None
built_charts = _build_edit_charts(charts)
built_prompts = _build_edit_suggested_prompts(suggested_prompts)
@@ -2995,6 +3151,7 @@ def edit_report_sync(
suggested_prompts=built_prompts or (),
reviewer_reasons=_reviewer_reasons(built_reviewers),
link_reasons=_link_reasons(built_links),
+ decision_explanations=_decision_explanations(built_actionability, built_priority),
)
)
result = _do_edit_report(
@@ -3013,6 +3170,8 @@ def edit_report_sync(
links=built_links,
supersedes_implementation=supersedes_implementation,
corroboration_only=corroboration_only,
+ actionability=built_actionability,
+ priority=built_priority,
)
if _trial_store(run) is not None:
return result
@@ -3031,6 +3190,8 @@ def edit_report_sync(
metrics=allowed_metrics,
suggested_prompts=suggested_prompts,
links=built_links,
+ actionability=built_actionability,
+ priority=built_priority,
)
if forward is not None:
_forward_report_event_to_team(team=team, forward=forward)
diff --git a/products/signals/backend/scout_harness/views.py b/products/signals/backend/scout_harness/views.py
index 4ae6e6a3e3d0..1b8f18ebc95b 100644
--- a/products/signals/backend/scout_harness/views.py
+++ b/products/signals/backend/scout_harness/views.py
@@ -1369,6 +1369,9 @@ class SignalScoutRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
"report that was missing a qualifying reviewer or a repository can open a draft PR. The response "
"carries the repository the report holds after the edit, and the call fails when a repository it "
"named did not land. "
+ "Set `actionability` and/or `priority` (each with its explanation) when new evidence changed "
+ "your judgment: each replaces the report's decision and re-runs autostart, without changing "
+ "the report's inbox status. "
"Title/summary edits are best-effort: the pipeline may later re-research them. "
"Set `supersedes_implementation` alongside a rewrite when the fix changed. Verified automated "
"predecessor PRs close only after the replacement completes with verified open PRs."
@@ -1404,6 +1407,11 @@ class SignalScoutRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
links=_to_report_links(data.get("links")),
supersedes_implementation=bool(data.get("supersedes_implementation")),
corroboration_only=bool(data.get("corroboration_only")),
+ actionability=data.get("actionability"),
+ actionability_explanation=data.get("actionability_explanation"),
+ already_addressed=data.get("already_addressed"),
+ priority=data.get("priority"),
+ priority_explanation=data.get("priority_explanation"),
)
except InvalidScoutReportError as exc:
raise exceptions.ValidationError({"detail": str(exc)})
@@ -1425,6 +1433,8 @@ class SignalScoutRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
"content_revision_count": result.content_revision_count,
"supersedes_implementation": result.supersedes_implementation,
"corroboration_collapsed": result.corroboration_collapsed,
+ "decision_fields_set": list(result.decision_fields_set),
+ "warnings": [{"field": w.field, "message": w.message} for w in result.warnings],
}
).data,
status=status.HTTP_200_OK,
diff --git a/products/signals/backend/scout_report/__init__.py b/products/signals/backend/scout_report/__init__.py
index 70db7b03aa7e..16a35a01205d 100644
--- a/products/signals/backend/scout_report/__init__.py
+++ b/products/signals/backend/scout_report/__init__.py
@@ -41,6 +41,7 @@ from products.signals.backend.scout_report.persistence import (
set_report_charts,
set_report_metrics,
set_report_suggested_prompts,
+ set_scout_report_decision,
set_scout_report_inferred_repository,
set_scout_report_repository,
set_scout_report_reviewers,
@@ -86,6 +87,7 @@ __all__ = [
"set_report_metrics",
"set_report_suggested_prompts",
"set_scout_report_inferred_repository",
+ "set_scout_report_decision",
"set_scout_report_repository",
"set_scout_report_reviewers",
"soft_delete_scout_signal",
diff --git a/products/signals/backend/scout_report/judge.py b/products/signals/backend/scout_report/judge.py
index 886090f646b4..1a0bd9ce1ba9 100644
--- a/products/signals/backend/scout_report/judge.py
+++ b/products/signals/backend/scout_report/judge.py
@@ -212,6 +212,27 @@ def _to_signal_data(signals: list[ScoutReportSignal]) -> list[SignalData]:
]
+def _decision_explanations_signal(decision_explanations: Sequence[str]) -> SignalData | None:
+ """Wrap the scout-authored actionability and priority explanations as one `SignalData` for the judge.
+
+ Auto-start copies the priority explanation into the implementation task it opens, so an edit
+ that rewrites it reaches an action-capable run. Returns None when the edit sets no decision, so
+ every other edit produces a judge prompt byte-identical to before."""
+ if not decision_explanations:
+ return None
+ return SignalData(
+ signal_id=str(uuid.uuid4()),
+ content="Report decision explanations (why the report is or is not actionable, and its priority):\n\n"
+ + "\n\n".join(decision_explanations),
+ source_product=SOURCE_PRODUCT,
+ source_type=SOURCE_TYPE,
+ source_id="report_decision_explanations",
+ weight=0.0,
+ timestamp=timezone.now(),
+ extra={},
+ )
+
+
async def judge_scout_report(
*,
team_id: int,
@@ -268,6 +289,7 @@ async def judge_edited_report_content(
suggested_prompts: Sequence[str] = (),
reviewer_reasons: Sequence[str] = (),
link_reasons: Sequence[str] = (),
+ decision_explanations: Sequence[str] = (),
) -> SafetyJudgment:
"""Run the safety judge over the content an `edit_report` call supplies, before it is written.
@@ -303,6 +325,9 @@ async def judge_edited_report_content(
link_signal = _link_reasons_signal(link_reasons)
if link_signal is not None:
safety_input.append(link_signal)
+ decision_signal = _decision_explanations_signal(decision_explanations)
+ if decision_signal is not None:
+ safety_input.append(decision_signal)
if not safety_input:
return SafetyJudgment(choice=True, explanation=None)
safety_response = await judge_report_safety(team_id=team_id, signals=safety_input)
diff --git a/products/signals/backend/scout_report/persistence.py b/products/signals/backend/scout_report/persistence.py
index 10c9ffb9576f..fa4c21477d52 100644
--- a/products/signals/backend/scout_report/persistence.py
+++ b/products/signals/backend/scout_report/persistence.py
@@ -1283,6 +1283,88 @@ def set_scout_report_repository(
return True
+def _latest_status_artefact_content(
+ report_id: str, artefact_type: str, model: type[ActionabilityAssessment] | type[PriorityAssessment]
+) -> ActionabilityAssessment | PriorityAssessment | None:
+ row = (
+ SignalReportArtefact.objects.filter(report_id=report_id, type=artefact_type)
+ .order_by("-created_at", "-id")
+ .first()
+ )
+ if row is None:
+ return None
+ try:
+ return model.model_validate_json(row.content)
+ except ValidationError:
+ return None
+
+
+def set_scout_report_decision(
+ *,
+ team_id: int,
+ report_id: str,
+ actionability: ActionabilityAssessment | None,
+ priority: PriorityAssessment | None,
+ attribution: ArtefactAttribution,
+ author: str | None = None,
+) -> list[str]:
+ """Replace an existing report's `actionability_judgment` and/or `priority_judgment` status
+ artefacts (latest-wins) — the `edit_report` work-decision path. Returns the names of the
+ decisions that changed (`actionability`, `priority`).
+
+ These are the artefacts auto-start reads to decide whether a report opens a draft PR, so a scout
+ whose judgment changed (new evidence, an escalated incident, a fix that landed) corrects them in
+ place instead of leaving the report routed on a stale call. The report's status does not move:
+ an edit must never be a way to take down a report someone else authored.
+
+ Team-scoped fail-closed: a `report_id` the team doesn't own raises. Each change is attributed to
+ the scout's task and logged as a work-log note, so the decision stays auditable. The appends opt
+ out of the model's autostart re-eval hook; the caller fires auto-start after the edit commits.
+ """
+ _validate_report_id(report_id)
+ changed: list[str] = []
+ with transaction.atomic():
+ # The lock is the team-scoped gate and serializes this against a concurrent decision write.
+ if not SignalReport.objects.select_for_update().filter(team_id=team_id, id=report_id).exists():
+ raise InvalidScoutReportError(f"report {report_id} not found for team {team_id}")
+ # Compared under the lock: `edit_report` is non-idempotent, and a re-send must not log a
+ # second note or re-run auto-start for a decision that did not move.
+ if actionability is not None and actionability != _latest_status_artefact_content(
+ report_id, SignalReportArtefact.ArtefactType.ACTIONABILITY_JUDGMENT, ActionabilityAssessment
+ ):
+ SignalReportArtefact.append_status(
+ team_id=team_id, report_id=report_id, content=actionability, attribution=attribution
+ )
+ addressed = "already addressed" if actionability.already_addressed else "not yet addressed"
+ SignalReportArtefact.add_log(
+ team_id=team_id,
+ report_id=report_id,
+ content=NoteArtefact(
+ note=f"Set actionability: {actionability.actionability.value} ({addressed})", author=author
+ ),
+ attribution=attribution,
+ )
+ changed.append("actionability")
+ if priority is not None and priority != _latest_status_artefact_content(
+ report_id, SignalReportArtefact.ArtefactType.PRIORITY_JUDGMENT, PriorityAssessment
+ ):
+ SignalReportArtefact.append_status(
+ team_id=team_id, report_id=report_id, content=priority, attribution=attribution
+ )
+ SignalReportArtefact.add_log(
+ team_id=team_id,
+ report_id=report_id,
+ content=NoteArtefact(note=f"Set priority: {priority.priority.value}", author=author),
+ attribution=attribution,
+ )
+ changed.append("priority")
+ logger.info(
+ "signals_scout.edit_report: decision set",
+ extra={"team_id": team_id, "report_id": report_id, "fields": changed},
+ )
+ return changed
+
+
def set_scout_report_inferred_repository(
*,
team_id: int,
diff --git a/products/signals/backend/test/test_scout_report_api.py b/products/signals/backend/test/test_scout_report_api.py
index cf5a204c47f6..816da077e14a 100644
--- a/products/signals/backend/test/test_scout_report_api.py
+++ b/products/signals/backend/test/test_scout_report_api.py
@@ -915,6 +915,7 @@ class TestScoutReportAPI(APIBaseTest):
)
assert response.status_code == status.HTTP_200_OK, response.json()
assert response.json()["supersedes_implementation"] is False
+ assert [warning["field"] for warning in response.json()["warnings"]] == ["supersedes_implementation"]
assert (
self._latest_artefact(created["report_id"], SignalReportArtefact.ArtefactType.IMPLEMENTATION_DECISION)
is None
@@ -1038,6 +1039,101 @@ class TestScoutReportAPI(APIBaseTest):
assert len(content["targets"]) == 1
assert "summary" in content["reason"] and "updated_at" not in content["reason"]
+ @parameterized.expand(
+ [
+ # A scout first judged the report blocked on a person; new evidence makes it fixable.
+ (
+ "promotion",
+ {"actionability": "requires_human_input"},
+ {
+ "actionability": "immediately_actionable",
+ "actionability_explanation": "The failing handler is now identified.",
+ "priority": "P1",
+ "priority_explanation": "Checkout errors doubled after the incident escalated.",
+ },
+ ["actionability", "priority"],
+ ("immediately_actionable", False, "P1"),
+ ),
+ # A fix landed elsewhere, so autostart must not open a competing pull request.
+ (
+ "demotion",
+ {"priority": "P2", "priority_explanation": "Moderate impact."},
+ {
+ "actionability": "immediately_actionable",
+ "actionability_explanation": "A merged change fixed the handler.",
+ "already_addressed": True,
+ },
+ ["actionability"],
+ ("immediately_actionable", True, "P2"),
+ ),
+ # Raising priority on a report that never had a pull request.
+ (
+ "priority_only",
+ {},
+ {"priority": "P0", "priority_explanation": "The incident now blocks every checkout."},
+ ["priority"],
+ ("immediately_actionable", False, "P0"),
+ ),
+ # A re-send of the stored decision changes nothing and must not re-run autostart.
+ (
+ "unchanged",
+ {"priority": "P2", "priority_explanation": "Moderate impact."},
+ {"priority": "P2", "priority_explanation": "Moderate impact."},
+ [],
+ ("immediately_actionable", False, "P2"),
+ ),
+ ]
+ )
+ def test_edit_replaces_the_work_decision_and_reruns_autostart(
+ self, _name: str, emitted: dict, edit: dict, expected_fields: list[str], expected: tuple
+ ) -> None:
+ run = _make_run(self.team)
+ with _safe_judge(), patch(EMBED_PATH), patch(AUTOSTART_PATH, new=AsyncMock()):
+ created = self.client.post(self._emit_url(str(run.id)), data=self._payload(**emitted), format="json").json()
+ report_id = created["report_id"]
+ status_before = SignalReport.objects.get(id=report_id).status
+ with _safe_judge(), patch(AUTOSTART_PATH, new=AsyncMock()) as autostart:
+ response = self.client.post(
+ self._edit_url(str(run.id)), data={"report_id": report_id, **edit}, format="json"
+ )
+ assert response.status_code == status.HTTP_200_OK, response.json()
+ assert response.json()["decision_fields_set"] == expected_fields
+ assert autostart.await_count == (1 if expected_fields else 0)
+ actionability = self._latest_artefact(report_id, SignalReportArtefact.ArtefactType.ACTIONABILITY_JUDGMENT)
+ priority = self._latest_artefact(report_id, SignalReportArtefact.ArtefactType.PRIORITY_JUDGMENT)
+ assert actionability is not None and priority is not None
+ actionability_content = json.loads(actionability.content)
+ assert (
+ actionability_content["actionability"],
+ actionability_content["already_addressed"],
+ json.loads(priority.content)["priority"],
+ ) == expected
+ assert SignalReport.objects.get(id=report_id).status == status_before
+ notes = SignalReportArtefact.objects.filter(report_id=report_id, type="note", content__contains="Set ")
+ assert notes.count() == len(expected_fields)
+
+ @parameterized.expand(
+ [
+ ("actionability_without_explanation", {"actionability": "not_actionable"}),
+ ("already_addressed_alone", {"already_addressed": True}),
+ ("priority_without_explanation", {"priority": "P1"}),
+ ("explanation_without_priority", {"priority_explanation": "Escalated."}),
+ ]
+ )
+ def test_incomplete_work_decision_is_rejected_before_any_write(self, _name: str, edit: dict) -> None:
+ run = _make_run(self.team)
+ with _safe_judge(), patch(EMBED_PATH), patch(AUTOSTART_PATH, new=AsyncMock()):
+ created = self.client.post(self._emit_url(str(run.id)), data=self._payload(), format="json").json()
+ with _safe_judge() as judge:
+ response = self.client.post(
+ self._edit_url(str(run.id)),
+ data={"report_id": created["report_id"], "summary": "A rewrite riding along.", **edit},
+ format="json",
+ )
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ judge.assert_not_awaited()
+ assert SignalReport.objects.get(id=created["report_id"]).summary == self._payload()["summary"]
+
@parameterized.expand([("note",), ("unchanged",), ("over_cap",)])
def test_ineligible_supersede_does_not_query_github(self, shape: str) -> None:
run = _make_run(self.team)
diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.ts
index bb19544fe8d3..ceac1e13945e 100644
--- a/products/signals/frontend/generated/api.schemas.ts
+++ b/products/signals/frontend/generated/api.schemas.ts
@@ -6238,6 +6238,19 @@ export interface ReportLinkWriteApi {
reason?: string
}
+/**
+ * * `immediately_actionable` - immediately_actionable
+ * * `requires_human_input` - requires_human_input
+ * * `not_actionable` - not_actionable
+ */
+export type ActionabilityEnumApi = (typeof ActionabilityEnumApi)[keyof typeof ActionabilityEnumApi]
+
+export const ActionabilityEnumApi = {
+ ImmediatelyActionable: 'immediately_actionable',
+ RequiresHumanInput: 'requires_human_input',
+ NotActionable: 'not_actionable',
+} as const
+
/**
* Request body for `edit-report`. Can target ANY of the team's inbox reports, not just scout-authored ones.
*/
@@ -6304,8 +6317,44 @@ export interface EditReportRequestApi {
* @maxItems 10
*/
links?: ReportLinkWriteApi[]
- /** Set this only when your rewrite changes what the fix should be: a different root cause, a different file or layer, a materially wider or narrower scope. More evidence for the same fix is not a reason, because the report's open pull request already implements it. Setting it true records a replacement decision for a ready report. Policy and eligibility checks gate the replacement. The existing pull request closes only after a successful, verified replacement. Technical failures retry automatically; policy blocks wait for a new edit or research trigger. Only honored alongside a `title` or `summary` that actually changes, and only within the first four content revisions, including revisions that did not request replacement. */
+ /** Set this only when your rewrite changes what the fix should be: a different root cause, a different file or layer, a materially wider or narrower scope. More evidence for the same fix is not a reason, because the report's open pull request already implements it. Setting it true records a replacement decision for a ready report. Policy and eligibility checks gate the replacement. The existing pull request closes only after a successful, verified replacement. Technical failures retry automatically; policy blocks wait for a new edit or research trigger. Only honored alongside a `title` or `summary` that actually changes, and only within the first four content revisions, including revisions that did not request replacement. When the flag is not applied, `warnings` says why. */
supersedes_implementation?: boolean
+ /** Optional new actionability call, for when new evidence changed your judgment. Replaces the report's actionability decision and re-runs autostart: `immediately_actionable` can open a draft PR, `requires_human_input` and `not_actionable` stop autostart from opening one. The report's inbox status does not change. Send it with `actionability_explanation`, and with `already_addressed` when the issue is handled, since the three replace the decision as one unit.
+ *
+ * * `immediately_actionable` - immediately_actionable
+ * * `requires_human_input` - requires_human_input
+ * * `not_actionable` - not_actionable */
+ actionability?: ActionabilityEnumApi | null
+ /**
+ * 2-3 sentence evidence-grounded justification for `actionability`. Required when you set it.
+ * @nullable
+ */
+ actionability_explanation?: string | null
+ /**
+ * Whether the issue is already handled: fixed, or with a fix in flight. Part of the actionability decision, so it requires `actionability` and `actionability_explanation` too; omitted means false. Set it when a fix lands or starts, so autostart does not open a duplicate PR.
+ * @nullable
+ */
+ already_addressed?: boolean | null
+ /** Optional new priority (`P0`-`P4`), for when the issue escalated or eased. Replaces the report's priority and re-runs autostart, which needs a priority to open a draft PR. Requires `priority_explanation`.
+ *
+ * * `P0` - P0
+ * * `P1` - P1
+ * * `P2` - P2
+ * * `P3` - P3
+ * * `P4` - P4 */
+ priority?: AutonomyPriorityEnumApi | null
+ /**
+ * 2-3 sentence justification for `priority`. Required when `priority` is set.
+ * @nullable
+ */
+ priority_explanation?: string | null
+}
+
+export interface EditReportWarningApi {
+ /** The request field the edit did not apply. */
+ field: string
+ /** Why the field was not applied. The rest of the edit landed. */
+ message: string
}
export interface EditReportResponseApi {
@@ -6349,6 +6398,10 @@ export interface EditReportResponseApi {
content_revision_count: number
/** Whether the edit recorded that the report's pull request should be replaced. False when you did not ask for it, when the edit changed no content, or when the report has already been rewritten too many times. */
supersedes_implementation: boolean
+ /** Which work decisions the edit replaced (`actionability`, `priority`). Empty when you set none, or re-sent the decisions the report already held. */
+ decision_fields_set: string[]
+ /** Request fields the edit did not apply, each with the reason. Empty when every field applied. */
+ warnings: EditReportWarningApi[]
/** Whether your note raised the report's corroboration count instead of landing as its own entry. Only notes marked corroboration_only can collapse; free-form notes remain in the work log. */
corroboration_collapsed: boolean
}
@@ -6415,19 +6468,6 @@ export interface ScoutEmissionReportLinkApi {
report: LinkedSignalReportApi | null
}
-/**
- * * `immediately_actionable` - immediately_actionable
- * * `requires_human_input` - requires_human_input
- * * `not_actionable` - not_actionable
- */
-export type ActionabilityEnumApi = (typeof ActionabilityEnumApi)[keyof typeof ActionabilityEnumApi]
-
-export const ActionabilityEnumApi = {
- ImmediatelyActionable: 'immediately_actionable',
- RequiresHumanInput: 'requires_human_input',
- NotActionable: 'not_actionable',
-} as const
-
/**
* Request body for `emit-report`. Run attribution is taken from the URL path.
*/
diff --git a/products/signals/frontend/generated/api.ts b/products/signals/frontend/generated/api.ts
index 16b400eb19b2..9dbc4300ba48 100644
--- a/products/signals/frontend/generated/api.ts
+++ b/products/signals/frontend/generated/api.ts
@@ -2113,7 +2113,7 @@ export const getSignalsScoutEditReportUrl = (projectId: string, runId: string) =
}
/**
- * Rewrite a report's title/summary, append a note or fresh evidence, set its suggested reviewers, and/or point it at another repository. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Reviewers and repository are how you rescue a report that surfaced routed to no one or against the wrong codebase: each replaces what the report holds and re-runs autostart, so a report that was missing a qualifying reviewer or a repository can open a draft PR. The response carries the repository the report holds after the edit, and the call fails when a repository it named did not land. Title/summary edits are best-effort: the pipeline may later re-research them. Set `supersedes_implementation` alongside a rewrite when the fix changed. Verified automated predecessor PRs close only after the replacement completes with verified open PRs.
+ * Rewrite a report's title/summary, append a note or fresh evidence, set its suggested reviewers, and/or point it at another repository. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Reviewers and repository are how you rescue a report that surfaced routed to no one or against the wrong codebase: each replaces what the report holds and re-runs autostart, so a report that was missing a qualifying reviewer or a repository can open a draft PR. The response carries the repository the report holds after the edit, and the call fails when a repository it named did not land. Set `actionability` and/or `priority` (each with its explanation) when new evidence changed your judgment: each replaces the report's decision and re-runs autostart, without changing the report's inbox status. Title/summary edits are best-effort: the pipeline may later re-research them. Set `supersedes_implementation` alongside a rewrite when the fix changed. Verified automated predecessor PRs close only after the replacement completes with verified open PRs.
* @summary Edit an existing report for a run
*/
export const signalsScoutEditReport = async (
diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.ts
index 39d778115c12..2ebe3a2cc985 100644
--- a/products/signals/frontend/generated/api.zod.ts
+++ b/products/signals/frontend/generated/api.zod.ts
@@ -1669,7 +1669,7 @@ export const SignalsScoutRecordCheckResultBody = /* @__PURE__ */ zod
.describe('Request body for `scout-check-record-result`: the verdict on one dispatched report check.')
/**
- * Rewrite a report's title/summary, append a note or fresh evidence, set its suggested reviewers, and/or point it at another repository. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Reviewers and repository are how you rescue a report that surfaced routed to no one or against the wrong codebase: each replaces what the report holds and re-runs autostart, so a report that was missing a qualifying reviewer or a repository can open a draft PR. The response carries the repository the report holds after the edit, and the call fails when a repository it named did not land. Title/summary edits are best-effort: the pipeline may later re-research them. Set `supersedes_implementation` alongside a rewrite when the fix changed. Verified automated predecessor PRs close only after the replacement completes with verified open PRs.
+ * Rewrite a report's title/summary, append a note or fresh evidence, set its suggested reviewers, and/or point it at another repository. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Reviewers and repository are how you rescue a report that surfaced routed to no one or against the wrong codebase: each replaces what the report holds and re-runs autostart, so a report that was missing a qualifying reviewer or a repository can open a draft PR. The response carries the repository the report holds after the edit, and the call fails when a repository it named did not land. Set `actionability` and/or `priority` (each with its explanation) when new evidence changed your judgment: each replaces the report's decision and re-runs autostart, without changing the report's inbox status. Title/summary edits are best-effort: the pipeline may later re-research them. Set `supersedes_implementation` alongside a rewrite when the fix changed. Verified automated predecessor PRs close only after the replacement completes with verified open PRs.
* @summary Edit an existing report for a run
*/
export const signalsScoutEditReportBodyTitleMax = 300
@@ -1999,8 +1999,46 @@ export const SignalsScoutEditReportBody = /* @__PURE__ */ zod
.boolean()
.optional()
.describe(
- "Set this only when your rewrite changes what the fix should be: a different root cause, a different file or layer, a materially wider or narrower scope. More evidence for the same fix is not a reason, because the report's open pull request already implements it. Setting it true records a replacement decision for a ready report. Policy and eligibility checks gate the replacement. The existing pull request closes only after a successful, verified replacement. Technical failures retry automatically; policy blocks wait for a new edit or research trigger. Only honored alongside a `title` or `summary` that actually changes, and only within the first four content revisions, including revisions that did not request replacement."
+ "Set this only when your rewrite changes what the fix should be: a different root cause, a different file or layer, a materially wider or narrower scope. More evidence for the same fix is not a reason, because the report's open pull request already implements it. Setting it true records a replacement decision for a ready report. Policy and eligibility checks gate the replacement. The existing pull request closes only after a successful, verified replacement. Technical failures retry automatically; policy blocks wait for a new edit or research trigger. Only honored alongside a `title` or `summary` that actually changes, and only within the first four content revisions, including revisions that did not request replacement. When the flag is not applied, `warnings` says why."
),
+ actionability: zod
+ .union([
+ zod
+ .enum(['immediately_actionable', 'requires_human_input', 'not_actionable'])
+ .describe(
+ '\* `immediately_actionable` - immediately_actionable\n\* `requires_human_input` - requires_human_input\n\* `not_actionable` - not_actionable'
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Optional new actionability call, for when new evidence changed your judgment. Replaces the report's actionability decision and re-runs autostart: `immediately_actionable` can open a draft PR, `requires_human_input` and `not_actionable` stop autostart from opening one. The report's inbox status does not change. Send it with `actionability_explanation`, and with `already_addressed` when the issue is handled, since the three replace the decision as one unit.\n\n\* `immediately_actionable` - immediately_actionable\n\* `requires_human_input` - requires_human_input\n\* `not_actionable` - not_actionable"
+ ),
+ actionability_explanation: zod
+ .string()
+ .nullish()
+ .describe('2-3 sentence evidence-grounded justification for `actionability`. Required when you set it.'),
+ already_addressed: zod
+ .boolean()
+ .nullish()
+ .describe(
+ 'Whether the issue is already handled: fixed, or with a fix in flight. Part of the actionability decision, so it requires `actionability` and `actionability_explanation` too; omitted means false. Set it when a fix lands or starts, so autostart does not open a duplicate PR.'
+ ),
+ priority: zod
+ .union([
+ zod
+ .enum(['P0', 'P1', 'P2', 'P3', 'P4'])
+ .describe('\* `P0` - P0\n\* `P1` - P1\n\* `P2` - P2\n\* `P3` - P3\n\* `P4` - P4'),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Optional new priority (`P0`-`P4`), for when the issue escalated or eased. Replaces the report's priority and re-runs autostart, which needs a priority to open a draft PR. Requires `priority_explanation`.\n\n\* `P0` - P0\n\* `P1` - P1\n\* `P2` - P2\n\* `P3` - P3\n\* `P4` - P4"
+ ),
+ priority_explanation: zod
+ .string()
+ .nullish()
+ .describe('2-3 sentence justification for `priority`. Required when `priority` is set.'),
})
.describe(
"Request body for `edit-report`. Can target ANY of the team's inbox reports, not just scout-authored ones."
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index b5e36dd356e0..d1a80263133e 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -36904,8 +36904,44 @@ export namespace Schemas {
* @maxItems 10
*/
links?: ReportLinkWrite[];
- /** Set this only when your rewrite changes what the fix should be: a different root cause, a different file or layer, a materially wider or narrower scope. More evidence for the same fix is not a reason, because the report's open pull request already implements it. Setting it true records a replacement decision for a ready report. Policy and eligibility checks gate the replacement. The existing pull request closes only after a successful, verified replacement. Technical failures retry automatically; policy blocks wait for a new edit or research trigger. Only honored alongside a `title` or `summary` that actually changes, and only within the first four content revisions, including revisions that did not request replacement. */
+ /** Set this only when your rewrite changes what the fix should be: a different root cause, a different file or layer, a materially wider or narrower scope. More evidence for the same fix is not a reason, because the report's open pull request already implements it. Setting it true records a replacement decision for a ready report. Policy and eligibility checks gate the replacement. The existing pull request closes only after a successful, verified replacement. Technical failures retry automatically; policy blocks wait for a new edit or research trigger. Only honored alongside a `title` or `summary` that actually changes, and only within the first four content revisions, including revisions that did not request replacement. When the flag is not applied, `warnings` says why. */
supersedes_implementation?: boolean;
+ /** Optional new actionability call, for when new evidence changed your judgment. Replaces the report's actionability decision and re-runs autostart: `immediately_actionable` can open a draft PR, `requires_human_input` and `not_actionable` stop autostart from opening one. The report's inbox status does not change. Send it with `actionability_explanation`, and with `already_addressed` when the issue is handled, since the three replace the decision as one unit.
+ *
+ * * `immediately_actionable` - immediately_actionable
+ * * `requires_human_input` - requires_human_input
+ * * `not_actionable` - not_actionable */
+ actionability?: ActionabilityEnum | null;
+ /**
+ * 2-3 sentence evidence-grounded justification for `actionability`. Required when you set it.
+ * @nullable
+ */
+ actionability_explanation?: string | null;
+ /**
+ * Whether the issue is already handled: fixed, or with a fix in flight. Part of the actionability decision, so it requires `actionability` and `actionability_explanation` too; omitted means false. Set it when a fix lands or starts, so autostart does not open a duplicate PR.
+ * @nullable
+ */
+ already_addressed?: boolean | null;
+ /** Optional new priority (`P0`-`P4`), for when the issue escalated or eased. Replaces the report's priority and re-runs autostart, which needs a priority to open a draft PR. Requires `priority_explanation`.
+ *
+ * * `P0` - P0
+ * * `P1` - P1
+ * * `P2` - P2
+ * * `P3` - P3
+ * * `P4` - P4 */
+ priority?: AutonomyPriorityEnum | null;
+ /**
+ * 2-3 sentence justification for `priority`. Required when `priority` is set.
+ * @nullable
+ */
+ priority_explanation?: string | null;
+ }
+
+ export interface EditReportWarning {
+ /** The request field the edit did not apply. */
+ field: string;
+ /** Why the field was not applied. The rest of the edit landed. */
+ message: string;
}
export interface EditReportResponse {
@@ -36949,6 +36985,10 @@ export namespace Schemas {
content_revision_count: number;
/** Whether the edit recorded that the report's pull request should be replaced. False when you did not ask for it, when the edit changed no content, or when the report has already been rewritten too many times. */
supersedes_implementation: boolean;
+ /** Which work decisions the edit replaced (`actionability`, `priority`). Empty when you set none, or re-sent the decisions the report already held. */
+ decision_fields_set: string[];
+ /** Request fields the edit did not apply, each with the reason. Empty when every field applied. */
+ warnings: EditReportWarning[];
/** Whether your note raised the report's corroboration count instead of landing as its own entry. Only notes marked corroboration_only can collapse; free-form notes remain in the work log. */
corroboration_collapsed: boolean;
}
diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.ts
index 1936ba18c661..14e156f65908 100644
--- a/services/mcp/src/generated/signals/api.ts
+++ b/services/mcp/src/generated/signals/api.ts
@@ -1865,7 +1865,7 @@ export const SignalsScoutRecordCheckResultBody = () => zod
.describe('Request body for `scout-check-record-result`: the verdict on one dispatched report check.')
/**
- * Rewrite a report's title/summary, append a note or fresh evidence, set its suggested reviewers, and/or point it at another repository. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Reviewers and repository are how you rescue a report that surfaced routed to no one or against the wrong codebase: each replaces what the report holds and re-runs autostart, so a report that was missing a qualifying reviewer or a repository can open a draft PR. The response carries the repository the report holds after the edit, and the call fails when a repository it named did not land. Title/summary edits are best-effort: the pipeline may later re-research them. Set `supersedes_implementation` alongside a rewrite when the fix changed. Verified automated predecessor PRs close only after the replacement completes with verified open PRs.
+ * Rewrite a report's title/summary, append a note or fresh evidence, set its suggested reviewers, and/or point it at another repository. Can target ANY of the project's inbox reports, not just scout-authored ones — so the edit is attributed to this scout. Reviewers and repository are how you rescue a report that surfaced routed to no one or against the wrong codebase: each replaces what the report holds and re-runs autostart, so a report that was missing a qualifying reviewer or a repository can open a draft PR. The response carries the repository the report holds after the edit, and the call fails when a repository it named did not land. Set `actionability` and/or `priority` (each with its explanation) when new evidence changed your judgment: each replaces the report's decision and re-runs autostart, without changing the report's inbox status. Title/summary edits are best-effort: the pipeline may later re-research them. Set `supersedes_implementation` alongside a rewrite when the fix changed. Verified automated predecessor PRs close only after the replacement completes with verified open PRs.
* @summary Edit an existing report for a run
*/
export const SignalsScoutEditReportParams = () => zod.object({
@@ -2204,8 +2204,46 @@ export const SignalsScoutEditReportBody = () => zod
.boolean()
.optional()
.describe(
- "Set this only when your rewrite changes what the fix should be: a different root cause, a different file or layer, a materially wider or narrower scope. More evidence for the same fix is not a reason, because the report's open pull request already implements it. Setting it true records a replacement decision for a ready report. Policy and eligibility checks gate the replacement. The existing pull request closes only after a successful, verified replacement. Technical failures retry automatically; policy blocks wait for a new edit or research trigger. Only honored alongside a `title` or `summary` that actually changes, and only within the first four content revisions, including revisions that did not request replacement."
+ "Set this only when your rewrite changes what the fix should be: a different root cause, a different file or layer, a materially wider or narrower scope. More evidence for the same fix is not a reason, because the report's open pull request already implements it. Setting it true records a replacement decision for a ready report. Policy and eligibility checks gate the replacement. The existing pull request closes only after a successful, verified replacement. Technical failures retry automatically; policy blocks wait for a new edit or research trigger. Only honored alongside a `title` or `summary` that actually changes, and only within the first four content revisions, including revisions that did not request replacement. When the flag is not applied, `warnings` says why."
),
+ actionability: zod
+ .union([
+ zod
+ .enum(['immediately_actionable', 'requires_human_input', 'not_actionable'])
+ .describe(
+ '\* `immediately_actionable` - immediately_actionable\n\* `requires_human_input` - requires_human_input\n\* `not_actionable` - not_actionable'
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Optional new actionability call, for when new evidence changed your judgment. Replaces the report's actionability decision and re-runs autostart: `immediately_actionable` can open a draft PR, `requires_human_input` and `not_actionable` stop autostart from opening one. The report's inbox status does not change. Send it with `actionability_explanation`, and with `already_addressed` when the issue is handled, since the three replace the decision as one unit.\n\n\* `immediately_actionable` - immediately_actionable\n\* `requires_human_input` - requires_human_input\n\* `not_actionable` - not_actionable"
+ ),
+ actionability_explanation: zod
+ .string()
+ .nullish()
+ .describe('2-3 sentence evidence-grounded justification for `actionability`. Required when you set it.'),
+ already_addressed: zod
+ .boolean()
+ .nullish()
+ .describe(
+ 'Whether the issue is already handled: fixed, or with a fix in flight. Part of the actionability decision, so it requires `actionability` and `actionability_explanation` too; omitted means false. Set it when a fix lands or starts, so autostart does not open a duplicate PR.'
+ ),
+ priority: zod
+ .union([
+ zod
+ .enum(['P0', 'P1', 'P2', 'P3', 'P4'])
+ .describe('\* `P0` - P0\n\* `P1` - P1\n\* `P2` - P2\n\* `P3` - P3\n\* `P4` - P4'),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Optional new priority (`P0`-`P4`), for when the issue escalated or eased. Replaces the report's priority and re-runs autostart, which needs a priority to open a draft PR. Requires `priority_explanation`.\n\n\* `P0` - P0\n\* `P1` - P1\n\* `P2` - P2\n\* `P3` - P3\n\* `P4` - P4"
+ ),
+ priority_explanation: zod
+ .string()
+ .nullish()
+ .describe('2-3 sentence justification for `priority`. Required when `priority` is set.'),
})
.describe(
"Request body for `edit-report`. Can target ANY of the team's inbox reports, not just scout-authored ones."
diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.ts
index 51f1e41682dd..28d2f9080ef2 100644
--- a/services/mcp/src/tools/generated/signals.ts
+++ b/services/mcp/src/tools/generated/signals.ts
@@ -1090,6 +1090,21 @@ const scoutEditReport = (): ToolBase<ReturnType<typeof ScoutEditReportSchema>, S
if (params.supersedes_implementation !== undefined) {
body['supersedes_implementation'] = params.supersedes_implementation
}
+ if (params.actionability !== undefined) {
+ body['actionability'] = params.actionability
+ }
+ if (params.actionability_explanation !== undefined) {
+ body['actionability_explanation'] = params.actionability_explanation
+ }
+ if (params.already_addressed !== undefined) {
+ body['already_addressed'] = params.already_addressed
+ }
+ if (params.priority !== undefined) {
+ body['priority'] = params.priority
+ }
+ if (params.priority_explanation !== undefined) {
+ body['priority_explanation'] = params.priority_explanation
+ }
const result = await context.api.request<Schemas.EditReportResponse>({
method: 'POST',
path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/runs/${encodeURIComponent(String(params.run_id))}/edit-report/`,
@@ -2104,6 +2119,21 @@ const signalsScoutEditReport = (): ToolBase<
if (params.supersedes_implementation !== undefined) {
body['supersedes_implementation'] = params.supersedes_implementation
}
+ if (params.actionability !== undefined) {
+ body['actionability'] = params.actionability
+ }
+ if (params.actionability_explanation !== undefined) {
+ body['actionability_explanation'] = params.actionability_explanation
+ }
+ if (params.already_addressed !== undefined) {
+ body['already_addressed'] = params.already_addressed
+ }
+ if (params.priority !== undefined) {
+ body['priority'] = params.priority
+ }
+ if (params.priority_explanation !== undefined) {
+ body['priority_explanation'] = params.priority_explanation
+ }
const result = await context.api.request<Schemas.EditReportResponse>({
method: 'POST',
path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/runs/${encodeURIComponent(String(params.run_id))}/edit-report/`,