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): forward report feedback notes to the authoring scout (#76974)

Andrew Maguire9c0b33d4a08d
diff --git a/frontend/src/scenes/inbox/components/detail/ReportFeedbackFooter.tsx b/frontend/src/scenes/inbox/components/detail/ReportFeedbackFooter.tsx
index 39d4a08b9641..fed293350952 100644
--- a/frontend/src/scenes/inbox/components/detail/ReportFeedbackFooter.tsx
+++ b/frontend/src/scenes/inbox/components/detail/ReportFeedbackFooter.tsx
@@ -22,7 +22,8 @@ const FEEDBACK_NOTE_MAX_LENGTH = 4000
*/
export function ReportFeedbackFooter({ report }: { report: SignalReport }): JSX.Element {
const logic = inboxReportDetailLogic({ reportId: report.id, report })
- const { feedbackSentiment, feedbackNoteOpen, feedbackNoteDraft, feedbackNoteSent } = useValues(logic)
+ const { feedbackSentiment, feedbackNoteOpen, feedbackNoteDraft, feedbackNoteSent, feedbackNoteSubmitting } =
+ useValues(logic)
const { rateReport, openFeedbackNote, setFeedbackNoteDraft, submitFeedbackNote } = useActions(logic)
// Focus the note only when *this* instance opened it. `feedbackNoteOpen` is report-keyed state
@@ -101,6 +102,7 @@ export function ReportFeedbackFooter({ report }: { report: SignalReport }): JSX.
<LemonButton
size="xsmall"
type="primary"
+ loading={feedbackNoteSubmitting}
disabledReason={feedbackNoteDraft.trim() ? undefined : 'Write a note first'}
onClick={() => submitFeedbackNote(feedbackNoteDraft)}
data-attr="inbox-report-feedback-note-send"
diff --git a/frontend/src/scenes/inbox/logics/inboxReportDetailLogic.test.ts b/frontend/src/scenes/inbox/logics/inboxReportDetailLogic.test.ts
new file mode 100644
index 000000000000..f7afe3ecd3d7
--- /dev/null
+++ b/frontend/src/scenes/inbox/logics/inboxReportDetailLogic.test.ts
@@ -0,0 +1,56 @@
+import { expectLogic } from 'kea-test-utils'
+
+import { useMocks } from '~/mocks/jest'
+import { initKeaTests } from '~/test/init'
+
+import { SignalReport } from '../types'
+import { inboxReportDetailLogic } from './inboxReportDetailLogic'
+
+const REPORT = { id: 'report-1', status: 'ready', title: 'Checkout errors spiked' } as unknown as SignalReport
+
+describe('inboxReportDetailLogic feedback note submission', () => {
+ let logic: ReturnType<typeof inboxReportDetailLogic.build>
+ let feedbackPosts: number
+
+ beforeEach(() => {
+ feedbackPosts = 0
+ useMocks({
+ get: {
+ '/api/projects/:team_id/signals/reports/:id/artefacts/': { results: [] },
+ '/api/projects/:team_id/signals/reports/:id/signals/': [],
+ '/api/projects/:team_id/signals/reports/available_reviewers/': [],
+ },
+ post: {
+ '/api/projects/:team_id/signals/reports/:id/feedback/': () => {
+ feedbackPosts += 1
+ return [200, { forwarded: true }]
+ },
+ },
+ })
+ initKeaTests()
+ logic = inboxReportDetailLogic({ reportId: REPORT.id, report: REPORT })
+ logic.mount()
+ })
+
+ afterEach(() => {
+ logic.unmount()
+ })
+
+ it('posts once on a double-click and lets a revised note through after re-rating', async () => {
+ logic.actions.rateReport('positive')
+ // A double-click dispatches submit twice before the first request settles.
+ logic.actions.submitFeedbackNote('the repro steps were right')
+ logic.actions.submitFeedbackNote('the repro steps were right')
+ await expectLogic(logic).toFinishAllListeners()
+
+ expect(feedbackPosts).toBe(1)
+ expect(logic.values.feedbackNoteSubmitting).toBe(false)
+
+ // Re-rating reopens the note flow; the guard must have reset or this submit is silently dropped.
+ logic.actions.rateReport('negative')
+ logic.actions.submitFeedbackNote('actually this was stale')
+ await expectLogic(logic).toFinishAllListeners()
+
+ expect(feedbackPosts).toBe(2)
+ })
+})
diff --git a/frontend/src/scenes/inbox/logics/inboxReportDetailLogic.ts b/frontend/src/scenes/inbox/logics/inboxReportDetailLogic.ts
index fa7820f70bc9..7c105382e214 100644
--- a/frontend/src/scenes/inbox/logics/inboxReportDetailLogic.ts
+++ b/frontend/src/scenes/inbox/logics/inboxReportDetailLogic.ts
@@ -32,6 +32,7 @@ import {
signalsReportPrReviewCommentReactionsCreate,
signalsReportPrReviewCommentsCreate,
signalsReportPrReviewCommentUpdate,
+ signalsReportsFeedbackCreate,
signalsReportsSignalsRetrieve,
} from 'products/signals/frontend/generated/api'
import type {
@@ -198,6 +199,7 @@ export interface inboxReportDetailLogicValues {
feedbackNoteDraft: string
feedbackNoteOpen: boolean
feedbackNoteSent: boolean
+ feedbackNoteSubmitting: boolean
feedbackSentiment: InboxReportFeedbackSentiment | null
hasImplementationPr: boolean
hasPersonalGithub: boolean
@@ -414,6 +416,9 @@ export interface inboxReportDetailLogicActions {
setFeedbackNoteDraft: (draft: string) => {
draft: string
}
+ setFeedbackNoteSubmitting: (submitting: boolean) => {
+ submitting: boolean
+ }
setOptimisticReviewers: (reviewers: EnrichedReviewer[] | null) => {
reviewers: EnrichedReviewer[] | null
}
@@ -551,6 +556,9 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([
setFeedbackNoteDraft: (draft: string) => ({ draft }),
// The note rides on the payload: the reducers below clear the draft, and listeners run after them.
submitFeedbackNote: (note: string) => ({ note }),
+ // Driven by the submit listener only, so the re-entrancy guard and the Send button's
+ // loading state read the same flag.
+ setFeedbackNoteSubmitting: (submitting: boolean) => ({ submitting }),
}),
loaders(({ props, values }) => ({
@@ -759,6 +767,12 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([
rateReport: () => false,
},
],
+ feedbackNoteSubmitting: [
+ false,
+ {
+ setFeedbackNoteSubmitting: (_, { submitting }) => submitting,
+ },
+ ],
// Human-readable diff-load failure (kea-loaders only exposes a boolean loading flag). A failed
// compare usually means the branch was merged, deleted, or force-rewritten away.
reportDiffError: [
@@ -1071,17 +1085,42 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([
captureInboxReportFeedback({ report: values.report, sentiment, surface: 'detail_footer' })
},
// Fires on its own event so the rating stays exactly one `Inbox report feedback` per click.
- submitFeedbackNote: ({ note }) => {
+ submitFeedbackNote: async ({ note }) => {
const trimmed = note.trim()
if (!values.report || !values.feedbackSentiment || !trimmed) {
return
}
- captureInboxReportFeedbackNote({
- report: values.report,
- sentiment: values.feedbackSentiment,
- note: trimmed,
- surface: 'detail_footer',
- })
+ // Re-entrancy guard: the send button hides on submit, but a double-click within the same
+ // frame can dispatch this twice before React unmounts it. `leave_note` mints a new row per
+ // call, so bail before a second POST leaves the scout a duplicate steering note. The flag
+ // resets in `finally` so a revised note (after re-rating) can still submit, and the Send
+ // button shows it as a loading state in the meantime.
+ if (values.feedbackNoteSubmitting) {
+ return
+ }
+ actions.setFeedbackNoteSubmitting(true)
+ const sentiment = values.feedbackSentiment
+ try {
+ captureInboxReportFeedbackNote({
+ report: values.report,
+ sentiment,
+ note: trimmed,
+ surface: 'detail_footer',
+ })
+ // Best-effort: also carry the note into the scout steering channel so the scout that filed
+ // the report reads it next run. The analytics event above is the durable record, so a
+ // failure here is swallowed rather than surfaced — the note is already captured.
+ try {
+ await signalsReportsFeedbackCreate(String(teamLogic.values.currentTeamId), values.report.id, {
+ sentiment,
+ note: trimmed,
+ })
+ } catch {
+ // no-op: forwarding is a convenience on top of the recorded feedback
+ }
+ } finally {
+ actions.setFeedbackNoteSubmitting(false)
+ }
},
searchAvailableReviewers: async ({ query }, breakpoint) => {
await breakpoint(300)
diff --git a/products/signals/backend/feedback_notes.py b/products/signals/backend/feedback_notes.py
new file mode 100644
index 000000000000..d69c3e212a6c
--- /dev/null
+++ b/products/signals/backend/feedback_notes.py
@@ -0,0 +1,182 @@
+"""Forwarding of inbox report feedback into the scout steering channel.
+
+The report body ends with a thumbs rating ("Was this report useful?"). Someone who rates a report
+can also leave a note saying what was useful or off. That note is high-signal — a human telling the
+scout that filed the report whether the thing it surfaced landed, and why — but until now it only
+became a product-analytics event, which no scout ever reads. This module closes that gap the same
+way `dismissal_notes.py` and `discussion_notes.py` do: it also leaves the note as a `SignalScoutNote`,
+which every run reads by name at cold start (`scout-notes-list`).
+
+Only forwarded when the report has a resolvable authoring scout (`resolve_report_scout_skill` returns
+a live skill): feedback is a verdict on one scout's own report, so a note with no scout to address
+would be fleet-wide noise. The bare thumb never forwards — only a rating carrying a note does, since
+the note is the part a scout can act on.
+
+Authorization mirrors `discussion_notes`, not `dismissal_notes`: the feedback text has no second path
+to a run (a dismissal's does, through the `dismissal_note` field on the reports API), so this note is
+its sole carrier and the full notes-write gate applies — `principal_may_steer_scouts` (canonical-project
+access, the `llm_skill` editor bar, and the token's `scoped_teams`) plus the `signal_scout:write` /
+`llm_skill:write` key scopes. Forwarding runs against the canonical project whose scouts read the row,
+and only when the feedback landed on the canonical team itself, so a child environment's note never
+reaches the parent project's readers. Best-effort by contract: the rating and its note already exist as
+an analytics event, so a failure here must never surface to the user.
+"""
+
+from __future__ import annotations
+
+import logging
+from collections.abc import Sequence
+
+from django.utils import timezone
+
+from posthog.models import Team, User
+
+from products.signals.backend.dismissal_notes import (
+ DERIVED_NOTE_TTL,
+ principal_may_steer_scouts,
+ resolve_report_scout_skill,
+)
+from products.signals.backend.models import SignalReport, SignalScoutNote
+from products.signals.backend.scout_harness.tools.notes import leave_note
+
+logger = logging.getLogger(__name__)
+
+# Report titles are unbounded TextFields; a note references them for recognition only.
+_MAX_TITLE_CHARS = 200
+# The note is quoted into a scout note capped at MAX_NOTE_CONTENT_LENGTH. The feedback box caps input
+# well below this, so the truncation only bites on a hand-crafted request — where losing the tail of a
+# note beats losing the whole note to an oversize rejection.
+_MAX_NOTE_CHARS = 4_000
+
+# The scopes the notes API demands of a token writing a note by hand, which this path forwards under.
+_REQUIRED_NOTE_SCOPES = ("signal_scout:write", "llm_skill:write")
+
+# How each rating reads in the note. Kept to the two the thumbs can produce; an unknown sentiment
+# drops the report rather than guess a verdict.
+_SENTIMENT_VERBS = {
+ "positive": "found useful",
+ "negative": "did not find useful",
+}
+
+
+def forward_feedback_note(
+ *,
+ team: Team,
+ report_id: str,
+ sentiment: str,
+ note: str,
+ user_id: int | None,
+ scoped_team_ids: Sequence[int] | None,
+ api_scopes: Sequence[str] | None,
+) -> str | None:
+ """Leave a report's feedback note as a scout note. Returns the created note id, or None if
+ nothing was forwarded.
+
+ `scoped_team_ids` and `api_scopes` describe the calling credential (both None for session auth);
+ the caller reads them off the request so this stays independent of HTTP.
+
+ Best-effort by contract: the rating and note already exist as an analytics event, so nothing here
+ may turn a successful feedback submission into a 5xx. Every step past this point runs inside one
+ failure boundary, because authorization and target resolution both read the database.
+ """
+ if not note or not note.strip():
+ return None
+ try:
+ return _forward(
+ team=team,
+ report_id=str(report_id),
+ sentiment=sentiment,
+ note=note.strip(),
+ user_id=user_id,
+ scoped_team_ids=scoped_team_ids,
+ api_scopes=api_scopes,
+ )
+ except Exception:
+ logger.exception(
+ "Failed to forward report feedback to a scout note",
+ extra={"team_id": team.id, "report_id": report_id},
+ )
+ return None
+
+
+def _forward(
+ *,
+ team: Team,
+ report_id: str,
+ sentiment: str,
+ note: str,
+ user_id: int | None,
+ scoped_team_ids: Sequence[int] | None,
+ api_scopes: Sequence[str] | None,
+) -> str | None:
+ verb = _SENTIMENT_VERBS.get(sentiment)
+ if verb is None:
+ return None
+
+ # Scout rows and their notes live under the canonical parent team; forwarding a child
+ # environment's feedback would hand its report id, title, and note to an audience that may
+ # have no access to that environment. Those stay on the analytics event only.
+ canonical_team = team.parent_team or team
+ if team.id != canonical_team.id:
+ return None
+
+ if not _may_write_note(
+ user_id=user_id, scoped_team_ids=scoped_team_ids, api_scopes=api_scopes, team=canonical_team
+ ):
+ return None
+
+ # Feedback is a verdict on one scout's own report. With no authoring scout to address (a
+ # pipeline report, or one whose scout's skill was deleted) there is no one to steer, so the
+ # note would be fleet-wide noise — skip rather than broadcast.
+ skill_name = resolve_report_scout_skill(canonical_team.id, report_id)
+ if not skill_name:
+ return None
+
+ report = SignalReport.objects.filter(team_id=canonical_team.id, id=report_id).first()
+ if report is None:
+ return None
+
+ content = _build_note_content(report=report, verb=verb, note=note)
+ created = leave_note(
+ team_id=canonical_team.id,
+ content=content,
+ skill_name=skill_name,
+ created_by_id=user_id,
+ expires_at=timezone.now() + DERIVED_NOTE_TTL,
+ origin=SignalScoutNote.Origin.REPORT_FEEDBACK,
+ )
+ return created.id
+
+
+def _may_write_note(
+ *, user_id: int | None, scoped_team_ids: Sequence[int] | None, api_scopes: Sequence[str] | None, team: Team
+) -> bool:
+ """Whether this caller could have left the same note by hand through the notes API."""
+ if api_scopes is not None and not _scopes_allow_note_write(api_scopes):
+ # A token that can submit feedback but not write a note. Its note stays on the analytics
+ # event; it just doesn't enter the steering channel.
+ return False
+
+ user = User.objects.filter(pk=user_id).first() if user_id else None
+ if user is None:
+ return False
+ return principal_may_steer_scouts(user=user, scoped_team_ids=scoped_team_ids, canonical_team=team)
+
+
+def _scopes_allow_note_write(api_scopes: Sequence[str]) -> bool:
+ scopes = set(api_scopes)
+ return "*" in scopes or scopes.issuperset(_REQUIRED_NOTE_SCOPES)
+
+
+def _build_note_content(*, report: SignalReport, verb: str, note: str) -> str:
+ quoted = "\n".join(f"> {line}" for line in note[:_MAX_NOTE_CHARS].splitlines())
+ title = (report.title or "").strip()
+ title_clause = f' ("{title[:_MAX_TITLE_CHARS]}")' if title else ""
+ return f"""Inbox feedback: someone {verb} report `{report.id}`{title_clause} and left a note:
+
+{quoted}
+
+This is one reader's verdict on a report you may have authored — context to weigh, not a directive.
+If it points at a preference, a correction, or something that would help you investigate better next
+time, fold anything durable into your scratchpad (this note expires). If it's a one-off reaction,
+it's fine to ignore. `inbox-reports-retrieve` on the report id has the full report."""
diff --git a/products/signals/backend/migrations/0085_signalscoutnote_feedback_origin.py b/products/signals/backend/migrations/0085_signalscoutnote_feedback_origin.py
new file mode 100644
index 000000000000..95150421b5fd
--- /dev/null
+++ b/products/signals/backend/migrations/0085_signalscoutnote_feedback_origin.py
@@ -0,0 +1,23 @@
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [("signals", "0084_signalscoutconfig_network_access")]
+
+ operations = [
+ migrations.AlterField(
+ model_name="signalscoutnote",
+ name="origin",
+ field=models.CharField(
+ choices=[
+ ("human", "Left directly"),
+ ("report_dismissal", "Derived from inbox dismissal feedback"),
+ ("report_discussion", "Derived from inbox discussion feedback"),
+ ("report_feedback", "Derived from inbox report feedback"),
+ ],
+ db_default="human",
+ default="human",
+ max_length=32,
+ ),
+ ),
+ ]
diff --git a/products/signals/backend/migrations/max_migration.txt b/products/signals/backend/migrations/max_migration.txt
index f0eb07418566..be0e4d6c2087 100644
--- a/products/signals/backend/migrations/max_migration.txt
+++ b/products/signals/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0084_signalscoutconfig_network_access
+0085_signalscoutnote_feedback_origin
diff --git a/products/signals/backend/models.py b/products/signals/backend/models.py
index abbcb5479676..fb2e933fef3a 100644
--- a/products/signals/backend/models.py
+++ b/products/signals/backend/models.py
@@ -1744,14 +1744,20 @@ class SignalScoutNote(TeamScopedRootMixin, UUIDModel):
`discussion_notes.py`. The question otherwise lives only on the ephemeral discussion task, which
is in no scout's run context, so this note is its sole carrier and the full gate applies —
`llm_skill:write` and `signal_scout:write` included.
+ - `REPORT_FEEDBACK` — rating a report useful/not useful with a note, see `feedback_notes.py`. Like
+ a discussion the note is the only path the text takes to a scout (the rating otherwise lands only
+ on a product-analytics event), so the full gate applies too. Forwarded only for a report with a
+ resolvable authoring scout, since the feedback is a verdict on that scout's own report.
`origin` keeps the kinds apart so the run prompt can frame a dismissal as one reviewer's verdict
- on one report, and a discussion as a question to weigh rather than fleet-level steering.
+ on one report, a discussion as a question to weigh, and feedback as a reader's rating — rather than
+ fleet-level steering.
"""
class Origin(models.TextChoices):
HUMAN = "human", "Left directly"
REPORT_DISMISSAL = "report_dismissal", "Derived from inbox dismissal feedback"
REPORT_DISCUSSION = "report_discussion", "Derived from inbox discussion feedback"
+ REPORT_FEEDBACK = "report_feedback", "Derived from inbox report feedback"
# See SignalScoutConfig.all_teams for rationale.
all_teams = models.Manager() # noqa: DJ012
diff --git a/products/signals/backend/scout_harness/AGENTS.md b/products/signals/backend/scout_harness/AGENTS.md
index eb051a2ddb79..55ffac4b9d51 100644
--- a/products/signals/backend/scout_harness/AGENTS.md
+++ b/products/signals/backend/scout_harness/AGENTS.md
@@ -29,7 +29,7 @@ In production it is driven by `SignalsScoutCoordinatorWorkflow` (periodic tick e
The effective toolset for a run is the intersection of the skill's `allowed_tools` list with what `tools/__init__.py` re-exports — there is no separate registry module today.
- `emit.py` — `emit_signal_*` tools that push findings as `cross_source_issue` signals into the standard ingestion pipeline.
- `scratchpad.py` — `remember`, `forget`, and `search_scratchpad` tools backed by the `SignalScratchpad` model.
- - `notes.py` — `list_notes` / `leave_note` / `delete_note` backed by the `SignalScoutNote` model: steering notes humans (or other agents) leave for the fleet over the public MCP surface (`scout-notes-*` tools), the inbound counterpart to the scratchpad. A note targets one scout by `skill_name` or the whole fleet (blank), optionally expiring via `expires_at`; the run prompt's _Notes left for you_ section directs every scout to `scout-notes-list` its own notes in step 1 and treat them as advisory steering. Unlike the scratchpad there is no sandbox-only write gate, but writes still demand skill-authoring-level authorization (keys need `llm_skill:write` on top of `signal_scout:write`, and every writer must clear the `llm_skill` RBAC editor bar) — so a note-writer could already steer the fleet by editing its skills, and notes add no new steering power. Two more writers derive rows from inbox activity. `../dismissal_notes.py`: judging an inbox report with a note (dismiss, snooze, or restore) also leaves it here as an `origin=report_dismissal` note, targeted at the scout that authored the report, so a reviewer's verdict reaches the scout without it having to re-find the report. Resolving does not, since that says the report did its job rather than that filing it was wrong. `../discussion_notes.py`: opening a discussion on a report (the inbox "Discuss" action, which kicks off a Q&A task) also leaves the user's question here as an `origin=report_discussion` note, targeted at the authoring scout — framed as context to weigh or ignore, not a verdict, so the scout can fold a durable preference/correction into its scratchpad or dismiss it as noise. Both paths re-check the same steering gate (token `scoped_teams`, canonical-project access, and the `llm_skill` editor bar) since the dismiss and discuss actions need only `task:write`, and both forward only on the canonical team. The discuss path additionally demands the `signal_scout:write` / `llm_skill:write` key scopes: a dismissal's text reaches runs anyway through the reports API, whereas the note is the only path a discussion question takes to a scout, so a `task:write` credential must not open it alone. It is triggered from the tasks viewset (which holds the request the gate reads) through `facade/api.py:forward_report_discussion_note`, never from the tasks facade. The derived rows are context with a TTL; the `dismissal` artefact / discussion task stays the record of truth.
+ - `notes.py` — `list_notes` / `leave_note` / `delete_note` backed by the `SignalScoutNote` model: steering notes humans (or other agents) leave for the fleet over the public MCP surface (`scout-notes-*` tools), the inbound counterpart to the scratchpad. A note targets one scout by `skill_name` or the whole fleet (blank), optionally expiring via `expires_at`; the run prompt's _Notes left for you_ section directs every scout to `scout-notes-list` its own notes in step 1 and treat them as advisory steering. Unlike the scratchpad there is no sandbox-only write gate, but writes still demand skill-authoring-level authorization (keys need `llm_skill:write` on top of `signal_scout:write`, and every writer must clear the `llm_skill` RBAC editor bar) — so a note-writer could already steer the fleet by editing its skills, and notes add no new steering power. Three more writers derive rows from inbox activity. `../dismissal_notes.py`: judging an inbox report with a note (dismiss, snooze, or restore) also leaves it here as an `origin=report_dismissal` note, targeted at the scout that authored the report, so a reviewer's verdict reaches the scout without it having to re-find the report. Resolving does not, since that says the report did its job rather than that filing it was wrong. `../discussion_notes.py`: opening a discussion on a report (the inbox "Discuss" action, which kicks off a Q&A task) also leaves the user's question here as an `origin=report_discussion` note, targeted at the authoring scout — framed as context to weigh or ignore, not a verdict, so the scout can fold a durable preference/correction into its scratchpad or dismiss it as noise. `../feedback_notes.py`: the thumbs rating at the end of a report body ("Was this report useful?") carries its optional note here as an `origin=report_feedback` note, targeted at the authoring scout. Unlike a dismissal it never falls back to a fleet-wide note — feedback is a verdict on one scout's own report, so with no resolvable authoring scout nothing is forwarded and the call is a no-op — and it never changes the report's state; the analytics event the client fires stays the durable record of the rating. All three paths re-check the same steering gate (token `scoped_teams`, canonical-project access, and the `llm_skill` editor bar) since the dismiss, discuss, and feedback actions need only `task:write`, and all forward only on the canonical team. The discuss and feedback paths additionally demand the `signal_scout:write` / `llm_skill:write` key scopes: a dismissal's text reaches runs anyway through the reports API, whereas the note is the only path a discussion question or feedback note takes to a scout, so a `task:write` credential must not open it alone. The discuss path is triggered from the tasks viewset (which holds the request the gate reads) through `facade/api.py:forward_report_discussion_note`, never from the tasks facade. On the read side, all three derived origins quote report content (report id, title, the note text), so `SignalScoutNoteViewSet.list` withholds them from any caller failing the reports read gate (`_may_read_reports`). The derived rows are context with a TTL; the `dismissal` artefact / discussion task / feedback analytics event stays the record of truth.
- `profile.py` — `project_profile_*` tools that read the deterministic `SignalProjectProfile` snapshot.
- `runs.py` — `runs_*` tools that read past `SignalScoutRun` rows for dedupe and cross-skill awareness.
- `profile/`
diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.py
index 5e31b6e6b9ab..bdde385eeb29 100644
--- a/products/signals/backend/scout_harness/serializers.py
+++ b/products/signals/backend/scout_harness/serializers.py
@@ -632,7 +632,8 @@ class ScoutNoteSerializer(serializers.Serializer):
"its content names, so weigh it as evidence about those reports rather than as "
"fleet-level steering. `report_discussion` for the question someone asked when they "
"opened a discussion on a report: context to weigh, neither a verdict on the report nor "
- "a directive."
+ "a directive. `report_feedback` for the note someone left when rating a report useful or "
+ "not: one reader's rating of the named report, context to weigh rather than a directive."
),
)
diff --git a/products/signals/backend/scout_harness/tools/notes.py b/products/signals/backend/scout_harness/tools/notes.py
index 90ca737e75c2..35f0d4354ae8 100644
--- a/products/signals/backend/scout_harness/tools/notes.py
+++ b/products/signals/backend/scout_harness/tools/notes.py
@@ -6,11 +6,13 @@ fleet to know (authored over the public MCP surface via `signal_scout:write`).
A note targets one scout by `skill_name`, or the whole fleet when `skill_name`
is blank; `list_notes` is what a run calls to pick up the notes addressed to it.
-Most notes are left by hand through that surface. Two `origin`s are derived from
+Most notes are left by hand through that surface. Three `origin`s are derived from
inbox activity instead: `report_dismissal`, forwarded from the feedback someone
typed when they dismissed, snoozed, or restored an inbox report (see
-`dismissal_notes.py`), and `report_discussion`, forwarded from the question someone
-asked when they opened a discussion on a report (see `discussion_notes.py`).
+`dismissal_notes.py`); `report_discussion`, forwarded from the question someone
+asked when they opened a discussion on a report (see `discussion_notes.py`); and
+`report_feedback`, forwarded from the note someone left when rating a report useful
+or not (see `feedback_notes.py`).
"""
from __future__ import annotations
@@ -88,8 +90,8 @@ def list_notes(
`exclude_origins` drops whole classes of note before the cap is applied, so a caller
who may not see one class still gets a full page of what it may see. The read surface
- uses it to withhold the report-derived origins (`report_dismissal` / `report_discussion`,
- which quote report content) from callers without report read access.
+ uses it to withhold the report-derived origins (`report_dismissal` / `report_discussion` /
+ `report_feedback`, which quote report content) from callers without report read access.
"""
clamped_limit = min(max(limit, 1), MAX_NOTES_LIST_LIMIT)
qs = SignalScoutNote.objects.filter(team_id=team_id).select_related("created_by")
@@ -122,8 +124,9 @@ def leave_note(
"""Create a note. Not an upsert — every call mints a new row; delete retires one.
`origin` is server-owned and never caller-supplied over the API: the notes endpoint always
- writes `HUMAN`. `REPORT_DISMISSAL` belongs to `dismissal_notes.forward_dismissal_note` and
- `REPORT_DISCUSSION` to `discussion_notes.forward_discussion_note`.
+ writes `HUMAN`. `REPORT_DISMISSAL` belongs to `dismissal_notes.forward_dismissal_note`,
+ `REPORT_DISCUSSION` to `discussion_notes.forward_discussion_note`, and `REPORT_FEEDBACK` to
+ `feedback_notes.forward_feedback_note`.
"""
_validate_note(team_id=team_id, skill_name=skill_name, content=content)
row = SignalScoutNote.objects.create(
diff --git a/products/signals/backend/scout_harness/views.py b/products/signals/backend/scout_harness/views.py
index 545a617af616..03a509bfb687 100644
--- a/products/signals/backend/scout_harness/views.py
+++ b/products/signals/backend/scout_harness/views.py
@@ -1269,9 +1269,13 @@ class SignalScoutNoteViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
exclude_origins=(
()
if _may_read_reports(request, self.team.parent_team or self.team)
- # Both derived origins quote report content (id, title, and the reviewer's / user's
- # text), so a caller without report read access must not see either.
- else (SignalScoutNote.Origin.REPORT_DISMISSAL, SignalScoutNote.Origin.REPORT_DISCUSSION)
+ # Every derived origin quotes report content (id, title, and the reviewer's / user's
+ # text), so a caller without report read access must not see any of them.
+ else (
+ SignalScoutNote.Origin.REPORT_DISMISSAL,
+ SignalScoutNote.Origin.REPORT_DISCUSSION,
+ SignalScoutNote.Origin.REPORT_FEEDBACK,
+ )
),
)
return Response(ScoutNoteSerializer([row.as_dict() for row in rows], many=True).data)
diff --git a/products/signals/backend/test/test_feedback_scout_notes.py b/products/signals/backend/test/test_feedback_scout_notes.py
new file mode 100644
index 000000000000..0281255fc5ee
--- /dev/null
+++ b/products/signals/backend/test/test_feedback_scout_notes.py
@@ -0,0 +1,242 @@
+from __future__ import annotations
+
+import json
+from collections.abc import Callable, Iterator
+from contextlib import contextmanager
+
+from posthog.test.base import APIBaseTest
+from unittest.mock import patch
+
+from django.apps import apps
+
+from parameterized import parameterized
+from rest_framework import status
+
+from posthog.models.personal_api_key import PersonalAPIKey
+from posthog.models.team.team import Team
+from posthog.models.utils import generate_random_token_personal, hash_key_value
+from posthog.rbac.user_access_control import AccessControlLevel, UserAccessControl
+from posthog.scopes import APIScopeObject
+
+from products.signals.backend.models import SignalReport, SignalScoutConfig, SignalScoutNote, SignalScoutRun
+from products.skills.backend.models.skills import LLMSkill
+
+SCOUT_SKILL = "signals-scout-error-tracking"
+
+
+class TestFeedbackScoutNotes(APIBaseTest):
+ def _feedback_url(self, report_id: str, team_id: int | None = None) -> str:
+ return f"/api/projects/{team_id or self.team.id}/signals/reports/{report_id}/feedback/"
+
+ def _create_report(self, title: str = "Checkout errors spiked") -> SignalReport:
+ return SignalReport.objects.create(
+ team=self.team,
+ status=SignalReport.Status.READY,
+ title=title,
+ summary="Test summary",
+ )
+
+ def _create_scout_skill(self, name: str = SCOUT_SKILL) -> LLMSkill:
+ return LLMSkill.objects.create(team=self.team, name=name, description="test scout", body="# test scout")
+
+ def _create_run(self, *, skill_name: str = SCOUT_SKILL, **overrides) -> SignalScoutRun:
+ Task = apps.get_model("tasks", "Task")
+ TaskRun = apps.get_model("tasks", "TaskRun")
+ task = Task.objects.create(
+ team=self.team,
+ title="scout run",
+ description="scout run",
+ origin_product=Task.OriginProduct.SIGNALS_SCOUT,
+ )
+ config, _ = SignalScoutConfig.objects.get_or_create(team=self.team, skill_name=skill_name)
+ return SignalScoutRun.objects.create(
+ team=self.team,
+ task_run=TaskRun.objects.create(task=task, team=self.team),
+ scout_config=config,
+ skill_name=skill_name,
+ skill_version=1,
+ **overrides,
+ )
+
+ def _feedback(self, report: SignalReport, *, team_id: int | None = None, **body) -> dict:
+ response = self.client.post(
+ self._feedback_url(str(report.id), team_id=team_id),
+ data=json.dumps(body),
+ content_type="application/json",
+ )
+ assert response.status_code == status.HTTP_200_OK, response.json()
+ return response.json()
+
+ def _notes(self) -> list[SignalScoutNote]:
+ return list(SignalScoutNote.objects.filter(team=self.team).order_by("created_at"))
+
+ def test_feedback_note_reaches_the_authoring_scout(self) -> None:
+ self._create_scout_skill()
+ report = self._create_report()
+ self._create_run(emitted_report_ids=[str(report.id)])
+
+ body = self._feedback(report, sentiment="positive", note="the repro steps were exactly right")
+
+ assert body["forwarded"] is True
+ note = self._notes()[0]
+ assert note.skill_name == SCOUT_SKILL
+ assert note.origin == SignalScoutNote.Origin.REPORT_FEEDBACK
+ assert note.created_by_id == self.user.id
+ assert "the repro steps were exactly right" in note.content
+ assert "found useful" in note.content
+ assert str(report.id) in note.content
+ assert note.expires_at is not None
+ # Feedback never changes the report's state — it only carries the note to the scout.
+ report.refresh_from_db()
+ assert report.status == SignalReport.Status.READY
+
+ def test_negative_sentiment_reads_as_not_useful(self) -> None:
+ self._create_scout_skill()
+ report = self._create_report()
+ self._create_run(emitted_report_ids=[str(report.id)])
+
+ self._feedback(report, sentiment="negative", note="this was already fixed weeks ago")
+
+ assert "did not find useful" in self._notes()[0].content
+
+ def test_note_is_addressed_to_the_scout_that_edited_a_pipeline_report(self) -> None:
+ self._create_scout_skill()
+ report = self._create_report()
+ self._create_run(edited_report_ids=[str(report.id)])
+
+ self._feedback(report, sentiment="positive", note="good catch on the follow-up")
+
+ assert [note.skill_name for note in self._notes()] == [SCOUT_SKILL]
+
+ def test_feedback_reaches_a_suppressed_report(self) -> None:
+ # The Dismissed tab renders the same detail view, thumbs rating included, so feedback must
+ # resolve a suppressed report by ID instead of 404ing like mutating-by-ID actions do.
+ self._create_scout_skill()
+ report = self._create_report()
+ report.status = SignalReport.Status.SUPPRESSED
+ report.save()
+ self._create_run(emitted_report_ids=[str(report.id)])
+
+ body = self._feedback(report, sentiment="negative", note="dismissed because it was stale on arrival")
+
+ assert body["forwarded"] is True
+ report.refresh_from_db()
+ assert report.status == SignalReport.Status.SUPPRESSED
+
+ @parameterized.expand(
+ [
+ ("no_authoring_run", False, False),
+ ("authoring_scout_skill_no_longer_exists", True, False),
+ ]
+ )
+ def test_no_note_for_a_report_with_no_authoring_scout(self, _name: str, with_run: bool, with_skill: bool) -> None:
+ # Unlike a dismissal, feedback is not fleet-broadcast: with no scout to address, the verdict
+ # would be noise, so nothing is forwarded (but the request still succeeds).
+ report = self._create_report()
+ if with_skill:
+ self._create_scout_skill()
+ if with_run:
+ self._create_run(emitted_report_ids=[str(report.id)])
+
+ body = self._feedback(report, sentiment="negative", note="not useful, but no scout owns this")
+
+ assert body["forwarded"] is False
+ assert self._notes() == []
+
+ @parameterized.expand([("blank", " "), ("missing", None)])
+ def test_a_note_is_required(self, _name: str, note: str | None) -> None:
+ # The bare thumb never calls this endpoint — only a rating carrying a note does — so a blank
+ # or absent note is a bad request rather than a silent no-op.
+ report = self._create_report()
+ body = {"sentiment": "positive"}
+ if note is not None:
+ body["note"] = note
+
+ response = self.client.post(
+ self._feedback_url(str(report.id)),
+ data=json.dumps(body),
+ content_type="application/json",
+ )
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+
+ def test_feedback_still_succeeds_when_the_note_cannot_be_written(self) -> None:
+ self._create_scout_skill()
+ report = self._create_report()
+ self._create_run(emitted_report_ids=[str(report.id)])
+
+ with patch("products.signals.backend.feedback_notes.leave_note", side_effect=RuntimeError("boom")):
+ body = self._feedback(report, sentiment="positive", note="the analytics event still recorded this")
+
+ assert body["forwarded"] is False
+ assert self._notes() == []
+ report.refresh_from_db()
+ assert report.status == SignalReport.Status.READY
+
+ def test_no_note_for_a_child_environment_report(self) -> None:
+ # Notes canonicalize to the parent project, so a child environment's feedback must not reach
+ # the parent's scouts.
+ environment = Team.objects.create(
+ organization=self.organization, parent_team=self.team, name="Child environment"
+ )
+ self._create_scout_skill()
+ report = SignalReport.objects.create(
+ team=environment, status=SignalReport.Status.READY, title="Child report", summary="Test summary"
+ )
+ self._create_run(emitted_report_ids=[str(report.id)])
+
+ body = self._feedback(report, team_id=environment.id, sentiment="positive", note="steering the parent fleet")
+
+ assert body["forwarded"] is False
+ assert not SignalScoutNote.all_teams.exists()
+
+ def test_no_note_when_the_token_lacks_the_note_scopes(self) -> None:
+ # The feedback text has no second path to a run, so — like a discussion — forwarding demands
+ # the note-write key scopes on top of the `task:write` the action itself needs.
+ self._create_scout_skill()
+ report = self._create_report()
+ self._create_run(emitted_report_ids=[str(report.id)])
+ raw_key = generate_random_token_personal()
+ PersonalAPIKey.objects.create(
+ label="Task-only key",
+ user=self.user,
+ secure_value=hash_key_value(raw_key),
+ scopes=["task:write", "task:read"],
+ )
+ self.client.logout()
+ self.client.credentials(HTTP_AUTHORIZATION=f"Bearer {raw_key}")
+
+ body = self._feedback(report, sentiment="negative", note="a task token should not steer the fleet")
+
+ assert body["forwarded"] is False
+ assert not SignalScoutNote.all_teams.exists()
+
+ def test_no_note_when_the_rater_may_not_steer_scouts(self) -> None:
+ # Forwarding re-checks the `llm_skill` editor bar the notes API requires, so a member barred
+ # from skill editing can't reach the steering channel through feedback.
+ self._create_scout_skill()
+ report = self._create_report()
+ self._create_run(emitted_report_ids=[str(report.id)])
+
+ with self._llm_skill_access(lambda: False):
+ body = self._feedback(report, sentiment="positive", note="not allowed to steer")
+
+ assert body["forwarded"] is False
+ assert self._notes() == []
+
+ @contextmanager
+ def _llm_skill_access(self, outcome: Callable[[], bool]) -> Iterator[None]:
+ """Replace only the `llm_skill` leg of the access check.
+
+ Scoped to one resource because DRF's permission pass runs through this same method first,
+ so replacing it wholesale fails the request before the view runs.
+ """
+ real_check = UserAccessControl.check_access_level_for_resource
+
+ def replacement(self_: UserAccessControl, resource: APIScopeObject, required_level: AccessControlLevel) -> bool:
+ if resource == "llm_skill":
+ return outcome()
+ return real_check(self_, resource, required_level)
+
+ with patch.object(UserAccessControl, "check_access_level_for_resource", autospec=True, side_effect=replacement):
+ yield
diff --git a/products/signals/backend/test/test_scout_harness_api.py b/products/signals/backend/test/test_scout_harness_api.py
index b3e366397d5f..4aef2949dfb5 100644
--- a/products/signals/backend/test/test_scout_harness_api.py
+++ b/products/signals/backend/test/test_scout_harness_api.py
@@ -1035,13 +1035,18 @@ class TestScoutHarnessNotesAPI(APIBaseTest):
@parameterized.expand(
[
- # A derived note quotes a report's id, title, and dismissal text, all of which the
- # report API gates on `task:read`. A scout-only token must not read around that.
+ # Every report-derived note quotes a report's id, title, and reviewer/reader text, all of
+ # which the report API gates on `task:read`. A scout-only token must not read around that,
+ # so all derived origins are withheld together — a new one must not reopen the gap.
("without_report_read", ["signal_scout:read"], {"steering"}),
- ("with_report_read", ["signal_scout:read", "task:read"], {"steering", "derived from a dismissal"}),
+ (
+ "with_report_read",
+ ["signal_scout:read", "task:read"],
+ {"steering", "derived from a dismissal", "derived from feedback"},
+ ),
]
)
- def test_list_withholds_dismissal_notes_from_callers_without_report_read(
+ def test_list_withholds_derived_notes_from_callers_without_report_read(
self, _name: str, scopes: list[str], expected: set[str]
) -> None:
from posthog.models.personal_api_key import PersonalAPIKey
@@ -1053,6 +1058,11 @@ class TestScoutHarnessNotesAPI(APIBaseTest):
content="derived from a dismissal",
origin=SignalScoutNote.Origin.REPORT_DISMISSAL,
)
+ SignalScoutNote.objects.create(
+ team=self.team,
+ content="derived from feedback",
+ origin=SignalScoutNote.Origin.REPORT_FEEDBACK,
+ )
raw = generate_random_token_personal()
PersonalAPIKey.objects.create(label="k", user=self.user, secure_value=hash_key_value(raw), scopes=scopes)
self.client.logout()
diff --git a/products/signals/backend/views.py b/products/signals/backend/views.py
index 97dddb30c6ed..ac439328db2e 100644
--- a/products/signals/backend/views.py
+++ b/products/signals/backend/views.py
@@ -60,7 +60,7 @@ from posthog.models.github_integration_base import GitHubIntegrationBase
from posthog.models.integration import GitHubIntegration, Integration
from posthog.models.team.extensions import get_or_create_team_extension
from posthog.models.user_integration import ReauthorizationRequired, UserGitHubIntegration, UserIntegration
-from posthog.permissions import APIScopePermission
+from posthog.permissions import APIScopePermission, get_authenticator_scoped_team_ids, get_authenticator_scopes
from posthog.temporal.common.client import sync_connect
from posthog.user_permissions import UserPermissions
@@ -88,6 +88,7 @@ from products.signals.backend.billing import (
)
from products.signals.backend.dismissal_notes import forward_dismissal_note
from products.signals.backend.facade.api import emit_signal
+from products.signals.backend.feedback_notes import forward_feedback_note
from products.signals.backend.implementation_pr import (
fetch_implementation_pr_state_for_reports,
fetch_implementation_pr_urls_for_reports,
@@ -583,6 +584,36 @@ class SignalReportBulkStateResponseSerializer(serializers.Serializer):
not_found_count = serializers.IntegerField(help_text="Number of requested ids not visible to the caller.")
+# The thumbs rating at the end of the report body carries an optional note, capped in the UI at the
+# same length as the dismissal note.
+SIGNAL_REPORT_FEEDBACK_NOTE_MAX_LENGTH = SIGNAL_REPORT_DISMISSAL_NOTE_MAX_LENGTH
+
+
+class SignalReportFeedbackRequestSerializer(serializers.Serializer):
+ sentiment = serializers.ChoiceField(
+ choices=[("positive", "positive"), ("negative", "negative")],
+ help_text="The rating left on the report: 'positive' (thumbs up) or 'negative' (thumbs down).",
+ )
+ note = serializers.CharField(
+ max_length=SIGNAL_REPORT_FEEDBACK_NOTE_MAX_LENGTH,
+ help_text=(
+ "Free-form note explaining the rating. Capped at "
+ f"{SIGNAL_REPORT_FEEDBACK_NOTE_MAX_LENGTH} characters. Only submitted alongside a note — a "
+ "bare thumb carries none — and, for a report authored by a scout, forwarded to that scout "
+ "as a steering note."
+ ),
+ )
+
+
+class SignalReportFeedbackResponseSerializer(serializers.Serializer):
+ forwarded = serializers.BooleanField(
+ help_text=(
+ "Whether the note was forwarded to the report's authoring scout as a steering note. False "
+ "when the report has no resolvable authoring scout, or the caller lacks scout-steering access."
+ ),
+ )
+
+
# Whole PR-refund feature gate. Checked server-side (not just in the UI) and keyed on the
# organization, matching the refund window (the org's billing period).
SIGNALS_PR_REFUNDS_FEATURE_FLAG = "signals-pr-refunds"
@@ -781,10 +812,12 @@ class SignalReportViewSet(
# `state` reopens a dismissed report, `retrieve` loads its detail, and `signals`
# loads its evidence. `bulk_state` is included so a bulk restore (state='potential')
# can reach suppressed reports too. `refund` is included so an already-archived but
- # billed report can still be refunded. Mutating-by-ID actions (delete, reingest) are
+ # billed report can still be refunded, and `feedback` because the detail view the
+ # Dismissed tab renders ends in the thumbs rating, which must be able to forward its
+ # note for the report it is displayed on. Mutating-by-ID actions (delete, reingest) are
# deliberately NOT here, so a suppressed report stays unreachable for those and keeps
# returning 404 — matching the existing contract.
- _SUPPRESSED_VISIBLE_ACTIONS = frozenset({"state", "bulk_state", "retrieve", "signals", "refund"})
+ _SUPPRESSED_VISIBLE_ACTIONS = frozenset({"state", "bulk_state", "retrieve", "signals", "refund", "feedback"})
# Human-readable explanation per bulk outcome, surfaced in each result's `detail` field
# (transitioned needs none — its `status` already says where the report landed).
@@ -1680,6 +1713,43 @@ class SignalReportViewSet(
return Response(SignalReportSerializer(report, context=self._enriched_report_context(report)).data)
+ @extend_schema(
+ summary="Leave feedback on a report",
+ description=(
+ "Record a note left with the thumbs rating at the end of a report. The rating itself is a "
+ "product-analytics event; this endpoint exists to carry the note into the scout steering "
+ "channel. For a report authored by a scout, the note is forwarded to that scout as a "
+ "steering note it reads on its next run; for any other report there is nothing to steer and "
+ "the call is a no-op success. The report's state is never changed."
+ ),
+ request=SignalReportFeedbackRequestSerializer,
+ responses={200: SignalReportFeedbackResponseSerializer},
+ )
+ @action(detail=True, methods=["post"], url_path="feedback", required_scopes=["task:write"])
+ def feedback(self, request, pk=None, **kwargs):
+ """Forward a report's feedback note to the scout that authored it.
+
+ Feedback-only: unlike `state`, this never transitions the report. The note is a derived
+ convenience — the durable record of the rating is the analytics event the client fires —
+ so forwarding is best-effort and never fails the request.
+ """
+ report = cast(SignalReport, self.get_object())
+
+ serializer = SignalReportFeedbackRequestSerializer(data=request.data)
+ serializer.is_valid(raise_exception=True)
+ data = serializer.validated_data
+
+ note_id = forward_feedback_note(
+ team=self.team,
+ report_id=str(report.id),
+ sentiment=data["sentiment"],
+ note=data["note"],
+ user_id=request.user.id if isinstance(request.user, User) else None,
+ scoped_team_ids=get_authenticator_scoped_team_ids(request.successful_authenticator),
+ api_scopes=get_authenticator_scopes(request.successful_authenticator),
+ )
+ return Response(SignalReportFeedbackResponseSerializer({"forwarded": note_id is not None}).data)
+
def _forward_dismissal_note(
self,
*,
diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.ts
index 5834351325a1..e1cf198c950f 100644
--- a/products/signals/frontend/generated/api.schemas.ts
+++ b/products/signals/frontend/generated/api.schemas.ts
@@ -286,6 +286,35 @@ export interface PatchedSignalReportContentUpdateApi {
summary?: string
}
+/**
+ * * `positive` - positive
+ * * `negative` - negative
+ */
+export type SentimentEnumApi = (typeof SentimentEnumApi)[keyof typeof SentimentEnumApi]
+
+export const SentimentEnumApi = {
+ Positive: 'positive',
+ Negative: 'negative',
+} as const
+
+export interface SignalReportFeedbackRequestApi {
+ /** The rating left on the report: 'positive' (thumbs up) or 'negative' (thumbs down).
+ *
+ * * `positive` - positive
+ * * `negative` - negative */
+ sentiment: SentimentEnumApi
+ /**
+ * Free-form note explaining the rating. Capped at 4000 characters. Only submitted alongside a note — a bare thumb carries none — and, for a report authored by a scout, forwarded to that scout as a steering note.
+ * @maxLength 4000
+ */
+ note: string
+}
+
+export interface SignalReportFeedbackResponseApi {
+ /** Whether the note was forwarded to the report's authoring scout as a steering note. False when the report has no resolvable authoring scout, or the caller lacks scout-steering access. */
+ forwarded: boolean
+}
+
/**
* One CI check on a pull request's head commit — a GitHub Actions check run or a legacy commit
* status, normalized to a common shape.
@@ -2164,7 +2193,7 @@ export interface ScoutNoteApi {
* @nullable
*/
created_by_name: string | null
- /** Where the note came from. `human` for one left directly through this API. `report_dismissal` for one forwarded from the note someone typed when they dismissed, snoozed, or restored one or more inbox reports: one reviewer's verdict on the reports its content names, so weigh it as evidence about those reports rather than as fleet-level steering. `report_discussion` for the question someone asked when they opened a discussion on a report: context to weigh, neither a verdict on the report nor a directive. */
+ /** Where the note came from. `human` for one left directly through this API. `report_dismissal` for one forwarded from the note someone typed when they dismissed, snoozed, or restored one or more inbox reports: one reviewer's verdict on the reports its content names, so weigh it as evidence about those reports rather than as fleet-level steering. `report_discussion` for the question someone asked when they opened a discussion on a report: context to weigh, neither a verdict on the report nor a directive. `report_feedback` for the note someone left when rating a report useful or not: one reader's rating of the named report, context to weigh rather than a directive. */
origin: string
}
diff --git a/products/signals/frontend/generated/api.ts b/products/signals/frontend/generated/api.ts
index adea829897a3..a1e074c10270 100644
--- a/products/signals/frontend/generated/api.ts
+++ b/products/signals/frontend/generated/api.ts
@@ -52,6 +52,8 @@ import type {
SignalReportArtefactWriteResponseApi,
SignalReportBulkStateRequestApi,
SignalReportBulkStateResponseApi,
+ SignalReportFeedbackRequestApi,
+ SignalReportFeedbackResponseApi,
SignalReportRefundRequestApi,
SignalReportRefundResponseApi,
SignalReportRefundSummaryResponseApi,
@@ -227,6 +229,28 @@ export const signalsReportsPartialUpdate = async (
})
}
+export const getSignalsReportsFeedbackCreateUrl = (projectId: string, id: string) => {
+ return `/api/projects/${projectId}/signals/reports/${id}/feedback/`
+}
+
+/**
+ * Record a note left with the thumbs rating at the end of a report. The rating itself is a product-analytics event; this endpoint exists to carry the note into the scout steering channel. For a report authored by a scout, the note is forwarded to that scout as a steering note it reads on its next run; for any other report there is nothing to steer and the call is a no-op success. The report's state is never changed.
+ * @summary Leave feedback on a report
+ */
+export const signalsReportsFeedbackCreate = async (
+ projectId: string,
+ id: string,
+ signalReportFeedbackRequestApi: SignalReportFeedbackRequestApi,
+ options?: RequestInit
+): Promise<SignalReportFeedbackResponseApi> => {
+ return apiMutator<SignalReportFeedbackResponseApi>(getSignalsReportsFeedbackCreateUrl(projectId, id), {
+ ...options,
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
+ body: JSON.stringify(signalReportFeedbackRequestApi),
+ })
+}
+
export const getSignalsReportPrChecksUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/signals/reports/${id}/pr_checks/`
}
diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.ts
index ab5a66e596e2..2ce60ba011fb 100644
--- a/products/signals/frontend/generated/api.zod.ts
+++ b/products/signals/frontend/generated/api.zod.ts
@@ -47,6 +47,27 @@ export const SignalsReportsPartialUpdateBody = /* @__PURE__ */ zod
'Editable human-facing fields on a signal report (PATCH).\n\nBoth fields are optional so a caller can change either independently, but at least one\nmust be supplied. Every other report field — status, weights, judgments — is owned by the\nsignals pipeline and is deliberately not writable here.'
)
+/**
+ * Record a note left with the thumbs rating at the end of a report. The rating itself is a product-analytics event; this endpoint exists to carry the note into the scout steering channel. For a report authored by a scout, the note is forwarded to that scout as a steering note it reads on its next run; for any other report there is nothing to steer and the call is a no-op success. The report's state is never changed.
+ * @summary Leave feedback on a report
+ */
+export const signalsReportsFeedbackCreateBodyNoteMax = 4000
+
+export const SignalsReportsFeedbackCreateBody = /* @__PURE__ */ zod.object({
+ sentiment: zod
+ .enum(['positive', 'negative'])
+ .describe('\* `positive` - positive\n\* `negative` - negative')
+ .describe(
+ "The rating left on the report: 'positive' (thumbs up) or 'negative' (thumbs down).\n\n\* `positive` - positive\n\* `negative` - negative"
+ ),
+ note: zod
+ .string()
+ .max(signalsReportsFeedbackCreateBodyNoteMax)
+ .describe(
+ 'Free-form note explaining the rating. Capped at 4000 characters. Only submitted alongside a note — a bare thumb carries none — and, for a report authored by a scout, forwarded to that scout as a steering note.'
+ ),
+})
+
/**
* Post an inline review comment on the report's implementation pull request, attributed to the requesting user's own GitHub identity via their personal GitHub connection. Either replies to an existing thread (`in_reply_to`) or starts a new thread on a diff line (`path` + `line`).
* @summary Post an inline review comment on a report's implementation PR
diff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yaml
index 013337d52bdb..54c9261eb365 100644
--- a/products/signals/mcp/tools.yaml
+++ b/products/signals/mcp/tools.yaml
@@ -840,6 +840,9 @@ tools:
signals-report-pr-review-comments-create:
operation: signals_report_pr_review_comments_create
enabled: false
+ signals-reports-feedback-create:
+ operation: signals_reports_feedback_create
+ enabled: false
signals-reports-refund-create:
operation: signals_reports_refund_create
enabled: false
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index bc75cf799e1a..7ed8c54db1f7 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -65150,7 +65150,7 @@ export namespace Schemas {
* @nullable
*/
created_by_name: string | null;
- /** Where the note came from. `human` for one left directly through this API. `report_dismissal` for one forwarded from the note someone typed when they dismissed, snoozed, or restored one or more inbox reports: one reviewer's verdict on the reports its content names, so weigh it as evidence about those reports rather than as fleet-level steering. `report_discussion` for the question someone asked when they opened a discussion on a report: context to weigh, neither a verdict on the report nor a directive. */
+ /** Where the note came from. `human` for one left directly through this API. `report_dismissal` for one forwarded from the note someone typed when they dismissed, snoozed, or restored one or more inbox reports: one reviewer's verdict on the reports its content names, so weigh it as evidence about those reports rather than as fleet-level steering. `report_discussion` for the question someone asked when they opened a discussion on a report: context to weigh, neither a verdict on the report nor a directive. `report_feedback` for the note someone left when rating a report useful or not: one reader's rating of the named report, context to weigh rather than a directive. */
origin: string;
}
@@ -65376,6 +65376,18 @@ export namespace Schemas {
send_async?: boolean;
}
+ /**
+ * * `positive` - positive
+ * * `negative` - negative
+ */
+ export type SentimentEnum = typeof SentimentEnum[keyof typeof SentimentEnum];
+
+
+ export const SentimentEnum = {
+ Positive: 'positive',
+ Negative: 'negative',
+ } as const;
+
export interface ServiceAccountAccessUpdate {
/** Gateway server to grant or revoke. */
gateway_server_id: string;
@@ -65705,6 +65717,24 @@ export namespace Schemas {
not_found_count: number;
}
+ export interface SignalReportFeedbackRequest {
+ /** The rating left on the report: 'positive' (thumbs up) or 'negative' (thumbs down).
+ *
+ * * `positive` - positive
+ * * `negative` - negative */
+ sentiment: SentimentEnum;
+ /**
+ * Free-form note explaining the rating. Capped at 4000 characters. Only submitted alongside a note — a bare thumb carries none — and, for a report authored by a scout, forwarded to that scout as a steering note.
+ * @maxLength 4000
+ */
+ note: string;
+ }
+
+ export interface SignalReportFeedbackResponse {
+ /** Whether the note was forwarded to the report's authoring scout as a steering note. False when the report has no resolvable authoring scout, or the caller lacks scout-steering access. */
+ forwarded: boolean;
+ }
+
export interface SignalReportRefundRequest {
/** Why this PR is being refunded. One of: pr_incorrect (the PR doesn't address what the report promised), pr_not_useful (technically fine but not worth paying for), duplicate (covers work already charged elsewhere), other. Required — refund reviews key on it.
*