:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(signals): let members manage their own reviewer exclusions (#122444)
posthog[bot]19e6673ac9cb
diff --git a/posthog/test/repo_invariants/test_pagination_contract.py b/posthog/test/repo_invariants/test_pagination_contract.pyindex 1a108150c51d..f1d300ebe1a2 100644--- a/posthog/test/repo_invariants/test_pagination_contract.py+++ b/posthog/test/repo_invariants/test_pagination_contract.py@@ -232,6 +232,8 @@ EXISTING_CUSTOM_LIST_VIEWSETS = {"products.signals.backend.presentation.inbox_summary.InboxSummaryViewSet",# Returns one team's onboarding state as a single document, so there is nothing to paginate."products.signals.backend.presentation.onboarding.InboxOnboardingViewSet",+ # Lists only the requesting member's own exclusions, a short list, so `pagination_class` is None.+ "products.signals.backend.presentation.reviewer_exclusions.SignalReviewerExclusionViewSet","products.signals.backend.scout_harness.views.SignalScoutConfigViewSet","products.signals.backend.scout_harness.views.SignalScoutMembersViewSet","products.signals.backend.scout_harness.views.SignalScoutNoteViewSet",diff --git a/products/signals/backend/facade/reviewer_exclusions.py b/products/signals/backend/facade/reviewer_exclusions.pynew file mode 100644index 000000000000..4d2aa163f736--- /dev/null+++ b/products/signals/backend/facade/reviewer_exclusions.py@@ -0,0 +1,147 @@+"""A member's own standing instructions to stay off automatic reviewer selection, as DTOs.++Every function scopes to the instructions that name the given member, so a member never reads+or changes another member's instruction.+"""++from datetime import datetime+from uuid import UUID++from django.db import transaction+from django.db.models import QuerySet++from posthog.dataclasses import frozen+from posthog.models import Team, User++from products.signals.backend.models import SignalReviewerExclusion+from products.signals.backend.repo_corrections import sanitized_repository as sanitized_repository+from products.signals.backend.reviewer_exclusions import (+ DuplicateExclusion as DuplicateExclusion,+ create_exclusion,+ revise_exclusion,+ revoke_exclusion,+)+from products.signals.backend.reviewer_rules import ReviewerWriteError as ReviewerWriteError+from products.signals.backend.views import remove_suggested_reviewer++ReviewerExclusionStatus = SignalReviewerExclusion.Status+++class ReviewerExclusionNotFound(Exception):+ pass+++class RevokedExclusion(ValueError):+ pass+++class PathWithoutRepository(ValueError):+ pass+++@frozen+class ReviewerExclusion:+ id: UUID+ repository: str+ path_prefix: str+ instruction: str+ status: str+ revision: int+ created_at: datetime+ updated_at: datetime+++def _to_dto(row: SignalReviewerExclusion) -> ReviewerExclusion:+ return ReviewerExclusion(+ id=row.id,+ repository=row.repository,+ path_prefix=row.path_prefix,+ instruction=row.instruction,+ status=row.status,+ revision=row.revision,+ created_at=row.created_at,+ updated_at=row.updated_at,+ )+++def _own(team_id: int, user: User) -> QuerySet[SignalReviewerExclusion]:+ return SignalReviewerExclusion.objects.for_team(team_id).filter(subject_user_uuid=user.uuid)+++def list_own_exclusions(*, team_id: int, user: User) -> list[ReviewerExclusion]:+ return [_to_dto(row) for row in _own(team_id, user).order_by("-created_at", "-id")]+++def get_own_exclusion(*, team_id: int, user: User, exclusion_id: UUID) -> ReviewerExclusion:+ row = _own(team_id, user).filter(id=exclusion_id).first()+ if row is None:+ raise ReviewerExclusionNotFound()+ return _to_dto(row)+++def create_own_exclusion(+ *, team_id: int, user: User, instruction: str, repository: str, path_prefix: str+) -> tuple[ReviewerExclusion, bool]:+ """Create the member's instruction, or return the active one for the same area and whether it is new."""+ row, created = create_exclusion(+ team_id=team_id,+ actor_id=user.id,+ instruction=instruction,+ subject_user_uuid=user.uuid,+ subject_github_login=user.get_github_login(include_team_fallback=False),+ repository=repository,+ path_prefix=path_prefix,+ )+ return _to_dto(row), created+++def revise_own_exclusion(+ *,+ team_id: int,+ user: User,+ exclusion_id: UUID,+ instruction: str | None,+ repository: str | None,+ path_prefix: str | None,+) -> ReviewerExclusion:+ with transaction.atomic():+ # Check the merged area against the locked row, so a concurrent amend cannot break the constraint.+ locked = _own(team_id, user).select_for_update().filter(id=exclusion_id).first()+ if locked is None:+ raise ReviewerExclusionNotFound()+ if locked.status != ReviewerExclusionStatus.ACTIVE:+ raise RevokedExclusion("A revoked instruction cannot change.")+ if (path_prefix if path_prefix is not None else locked.path_prefix) and not (+ repository if repository is not None else locked.repository+ ):+ raise PathWithoutRepository("Give a repository for a path.")+ row = revise_exclusion(+ team_id=team_id,+ exclusion_id=locked.id,+ actor_id=user.id,+ instruction=instruction,+ repository=repository,+ path_prefix=path_prefix,+ )+ return _to_dto(row)+++def revoke_own_exclusion(*, team_id: int, user: User, exclusion_id: UUID) -> ReviewerExclusion:+ with transaction.atomic():+ if not _own(team_id, user).filter(id=exclusion_id).exists():+ raise ReviewerExclusionNotFound()+ row = revoke_exclusion(team_id=team_id, exclusion_id=exclusion_id, actor_id=user.id)+ return _to_dto(row)+++def remove_report_reviewer(+ *, team: Team, report_id: str, user: User, scoped_team_ids: tuple[int, ...] | None, was_impersonated: bool+) -> bool:+ """Take the member off one report's suggested reviewers. Returns whether they were on it."""+ return remove_suggested_reviewer(+ team=team,+ report_id=report_id,+ user=user,+ scoped_team_ids=scoped_team_ids,+ was_impersonated=was_impersonated,+ )diff --git a/products/signals/backend/presentation/reviewer_exclusions.py b/products/signals/backend/presentation/reviewer_exclusions.pynew file mode 100644index 000000000000..080cfce63745--- /dev/null+++ b/products/signals/backend/presentation/reviewer_exclusions.py@@ -0,0 +1,311 @@+"""A member's own standing instructions to stay off automatic reviewer selection in one area.++A member manages only the instructions that name them. The `task` scope applies, and the member+needs access to the canonical project, where the instructions live. No scout-edit permission is+necessary.+"""++from __future__ import annotations++from typing import Any, cast+from uuid import UUID++import structlog+from drf_spectacular.types import OpenApiTypes+from drf_spectacular.utils import OpenApiParameter, OpenApiResponse, extend_schema+from rest_framework import serializers, status, viewsets+from rest_framework.decorators import action+from rest_framework.exceptions import NotFound+from rest_framework.permissions import IsAuthenticated+from rest_framework.request import Request+from rest_framework.response import Response++from posthog.api.routing import TeamAndOrgViewSetMixin+from posthog.auth import OAuthAccessTokenAuthentication, PersonalAPIKeyAuthentication, SessionAuthentication+from posthog.exceptions_capture import capture_exception+from posthog.models import User+from posthog.models.activity_logging.model_activity import is_impersonated_session+from posthog.permissions import APIScopePermission, get_authenticator_scoped_team_ids++from products.signals.backend.facade.reviewer_exclusions import (+ DuplicateExclusion,+ PathWithoutRepository,+ ReviewerExclusion,+ ReviewerExclusionNotFound,+ ReviewerExclusionStatus,+ ReviewerWriteError,+ RevokedExclusion,+ create_own_exclusion,+ get_own_exclusion,+ list_own_exclusions,+ remove_report_reviewer,+ revise_own_exclusion,+ revoke_own_exclusion,+ sanitized_repository,+)+from products.signals.backend.presentation.scout_permissions import ScoutCanonicalTeamAccessPermission++logger = structlog.get_logger(__name__)++MAX_INSTRUCTION_LENGTH = 2000+++class ReviewerExclusionSerializer(serializers.Serializer):+ id = serializers.UUIDField(read_only=True, help_text="Identifier of the instruction.")+ repository = serializers.CharField(+ read_only=True, help_text="Repository in `owner/name` form that the instruction covers. Empty covers every one."+ )+ path_prefix = serializers.CharField(+ read_only=True, help_text="Path inside the repository that the instruction covers. Empty covers the repository."+ )+ instruction = serializers.CharField(read_only=True, help_text="Why the member stays off this area.")+ status = serializers.ChoiceField(+ choices=ReviewerExclusionStatus.choices,+ read_only=True,+ help_text="`active` instructions apply to automatic reviewer selection. `revoked` instructions do not.",+ )+ revision = serializers.IntegerField(read_only=True, help_text="Increases by one at each change.")+ created_at = serializers.DateTimeField(read_only=True, help_text="When the member saved the instruction.")+ updated_at = serializers.DateTimeField(read_only=True, help_text="When the instruction last changed.")+++class ReviewerExclusionAreaSerializer(serializers.Serializer):+ repository = serializers.CharField(+ required=False,+ allow_blank=True,+ max_length=200,+ help_text="Repository in `owner/name` form. Leave empty to cover every repository.",+ )+ path_prefix = serializers.CharField(+ required=False,+ allow_blank=True,+ max_length=500,+ help_text="Path inside the repository, such as `src/billing`. Needs a repository.",+ )++ def validate_repository(self, value: str) -> str:+ # Matching compares the stored value to a report's `owner/name` exactly, so a URL never matches.+ if value and sanitized_repository(value) is None:+ raise serializers.ValidationError("Use the `owner/name` form, such as `posthog/posthog`.")+ return value++ def validate_path_prefix(self, value: str) -> str:+ # Matching compares whole path segments, so `.`, `..` or an empty segment never matches.+ if value and any(segment in {"", ".", ".."} for segment in value.split("/")):+ raise serializers.ValidationError(+ "Use a relative path such as `src/billing`, with no leading or trailing slash and no `.` or `..` parts."+ )+ return value+++class ReviewerExclusionCreateSerializer(ReviewerExclusionAreaSerializer):+ instruction = serializers.CharField(+ max_length=MAX_INSTRUCTION_LENGTH, help_text="Why you stay off this area, for the people who read it later."+ )+ report_id = serializers.UUIDField(+ required=False,+ help_text=(+ "Optional report to take you off first. The report removal and the instruction save are separate steps."+ ),+ )++ def validate(self, attrs: dict[str, Any]) -> dict[str, Any]:+ if attrs.get("path_prefix") and not attrs.get("repository"):+ raise serializers.ValidationError({"path_prefix": "Give a repository for a path."})+ return attrs+++class ReviewerExclusionUpdateSerializer(ReviewerExclusionAreaSerializer):+ instruction = serializers.CharField(+ required=False, max_length=MAX_INSTRUCTION_LENGTH, help_text="New text for the instruction."+ )+++class ReviewerExclusionCreateResultSerializer(serializers.Serializer):+ instruction_saved = serializers.BooleanField(+ help_text="True only when the instruction is saved. Only then does it keep you off automatic selection."+ )+ report_removed = serializers.BooleanField(+ allow_null=True, help_text="True when the report removal succeeded. Null when no report was given."+ )+ exclusion = ReviewerExclusionSerializer(allow_null=True, help_text="The saved instruction, or null.")+ detail = serializers.CharField(help_text="What happened, and what to do next.")+++class ReviewerExclusionErrorSerializer(serializers.Serializer):+ detail = serializers.CharField(help_text="Why the request failed.")+++def _create_result(+ *, exclusion: ReviewerExclusion | None, report_removed: bool | None, detail: str, response_status: int+) -> Response:+ payload = {+ "instruction_saved": exclusion is not None,+ "report_removed": report_removed,+ "exclusion": exclusion,+ "detail": detail,+ }+ return Response(ReviewerExclusionCreateResultSerializer(payload).data, status=response_status)+++_EXCLUSION_ID = OpenApiParameter(+ "id",+ OpenApiTypes.UUID,+ OpenApiParameter.PATH,+ description="A UUID string identifying this signal reviewer exclusion.",+)+++class SignalReviewerExclusionViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):+ serializer_class = ReviewerExclusionSerializer+ authentication_classes = [SessionAuthentication, PersonalAPIKeyAuthentication, OAuthAccessTokenAuthentication]+ permission_classes = [IsAuthenticated, APIScopePermission, ScoutCanonicalTeamAccessPermission]+ scope_object = "task"+ pagination_class = None++ def _exclusion_id(self) -> UUID:+ try:+ return UUID(str(self.kwargs["pk"]))+ except ValueError:+ raise NotFound()++ @extend_schema(+ summary="List your reviewer exclusions",+ description="List the standing instructions that keep you off automatic reviewer selection, active and revoked.",+ responses={200: ReviewerExclusionSerializer(many=True)},+ )+ def list(self, request: Request, *args: Any, **kwargs: Any) -> Response:+ exclusions = list_own_exclusions(team_id=self.team_id, user=cast(User, request.user))+ return Response(ReviewerExclusionSerializer(exclusions, many=True).data)++ @extend_schema(+ summary="Get one of your reviewer exclusions",+ parameters=[_EXCLUSION_ID],+ responses={200: ReviewerExclusionSerializer},+ )+ def retrieve(self, request: Request, *args: Any, **kwargs: Any) -> Response:+ try:+ exclusion = get_own_exclusion(+ team_id=self.team_id, user=cast(User, request.user), exclusion_id=self._exclusion_id()+ )+ except ReviewerExclusionNotFound:+ raise NotFound()+ return Response(ReviewerExclusionSerializer(exclusion).data)++ @extend_schema(+ summary="Stay off automatic reviewer selection in an area",+ request=ReviewerExclusionCreateSerializer,+ responses={+ 200: OpenApiResponse(+ response=ReviewerExclusionCreateResultSerializer,+ description="An active instruction already covers this area, so nothing new is saved.",+ ),+ 201: ReviewerExclusionCreateResultSerializer,+ 207: OpenApiResponse(+ response=ReviewerExclusionCreateResultSerializer,+ description="The report removal succeeded but the instruction is not saved. Send the request again.",+ ),+ 400: ReviewerExclusionErrorSerializer,+ 404: ReviewerExclusionErrorSerializer,+ },+ )+ def create(self, request: Request, *args: Any, **kwargs: Any) -> Response:+ payload = ReviewerExclusionCreateSerializer(data=request.data)+ payload.is_valid(raise_exception=True)+ data = payload.validated_data+ user = cast(User, request.user)++ report_removed: bool | None = None+ if report_id := data.get("report_id"):+ scoped_team_ids = get_authenticator_scoped_team_ids(request.successful_authenticator)+ try:+ remove_report_reviewer(+ team=self.team,+ report_id=str(report_id),+ user=user,+ scoped_team_ids=tuple(scoped_team_ids) if scoped_team_ids is not None else None,+ was_impersonated=is_impersonated_session(request),+ )+ except ReviewerWriteError as e:+ return Response({"detail": str(e)}, status=status.HTTP_400_BAD_REQUEST)+ report_removed = True++ try:+ exclusion, created = create_own_exclusion(+ team_id=self.team_id,+ user=user,+ instruction=data["instruction"],+ repository=data.get("repository", ""),+ path_prefix=data.get("path_prefix", ""),+ )+ except Exception as e:+ if report_removed is None:+ raise+ capture_exception(e)+ logger.exception("signals.reviewer_exclusion.save_failed", team_id=self.team_id, report_id=str(report_id))+ return _create_result(+ exclusion=None,+ report_removed=True,+ detail=(+ "You are off this report, but the instruction is not saved, so automatic selection can still "+ "pick you. Send the request again."+ ),+ response_status=status.HTTP_207_MULTI_STATUS,+ )++ return _create_result(+ exclusion=exclusion,+ report_removed=report_removed,+ detail="Saved. Automatic reviewer selection no longer picks you in this area."+ if created+ else "Already saved. Automatic reviewer selection does not pick you in this area.",+ response_status=status.HTTP_201_CREATED if created else status.HTTP_200_OK,+ )++ @extend_schema(+ summary="Change one of your reviewer exclusions",+ parameters=[_EXCLUSION_ID],+ request=ReviewerExclusionUpdateSerializer,+ responses={200: ReviewerExclusionSerializer, 400: ReviewerExclusionErrorSerializer},+ )+ def partial_update(self, request: Request, *args: Any, **kwargs: Any) -> Response:+ exclusion_id = self._exclusion_id()+ payload = ReviewerExclusionUpdateSerializer(data=request.data)+ payload.is_valid(raise_exception=True)+ data = payload.validated_data+ try:+ revised = revise_own_exclusion(+ team_id=self.team_id,+ user=cast(User, request.user),+ exclusion_id=exclusion_id,+ instruction=data.get("instruction"),+ repository=data.get("repository"),+ path_prefix=data.get("path_prefix"),+ )+ except ReviewerExclusionNotFound:+ raise NotFound()+ except PathWithoutRepository as e:+ raise serializers.ValidationError({"path_prefix": str(e)})+ except (DuplicateExclusion, RevokedExclusion) as e:+ return Response({"detail": str(e)}, status=status.HTTP_400_BAD_REQUEST)+ return Response(ReviewerExclusionSerializer(revised).data)++ @extend_schema(+ summary="Revoke one of your reviewer exclusions",+ description=(+ "Make you eligible for automatic reviewer selection in this area again. Revoking does not add you to "+ "any report, and it does not change old reports."+ ),+ parameters=[_EXCLUSION_ID],+ request=None,+ responses={200: ReviewerExclusionSerializer},+ )+ @action(detail=True, methods=["post"], url_path="revoke", required_scopes=["task:write"])+ def revoke(self, request: Request, *args: Any, **kwargs: Any) -> Response:+ try:+ revoked = revoke_own_exclusion(+ team_id=self.team_id, user=cast(User, request.user), exclusion_id=self._exclusion_id()+ )+ except ReviewerExclusionNotFound:+ raise NotFound()+ return Response(ReviewerExclusionSerializer(revoked).data)diff --git a/products/signals/backend/routes.py b/products/signals/backend/routes.pyindex 9f5bde2a552b..68c16fa6bdf1 100644--- a/products/signals/backend/routes.py+++ b/products/signals/backend/routes.py@@ -5,6 +5,7 @@ from products.signals.backend.presentation.activity_summary import ActivitySummafrom products.signals.backend.presentation.anomalies import AnomalyViewSetfrom products.signals.backend.presentation.inbox_summary import InboxSummaryViewSetfrom products.signals.backend.presentation.onboarding import InboxOnboardingViewSet+from products.signals.backend.presentation.reviewer_exclusions import SignalReviewerExclusionViewSetfrom products.signals.backend.presentation.scout_rubrics import SignalScoutRubricViewSetfrom products.signals.backend.scout_chat import SignalScoutChatTaskViewSetfrom products.signals.backend.scout_harness.views import (@@ -33,6 +34,12 @@ def register_routes(routers: RouterRegistry) -> None:routers.projects.register(r"signals/scout/rubrics", SignalScoutRubricViewSet, "project_signals_scout_rubrics", ["team_id"])+ routers.projects.register(+ r"signals/reviewer_exclusions",+ SignalReviewerExclusionViewSet,+ "project_signals_reviewer_exclusions",+ ["team_id"],+ )routers.projects.register(r"signals", SignalViewSet, "project_signals", ["team_id"])signal_reports_router = routers.projects.register(r"signals/reports", signals.SignalReportViewSet, "project_signal_reports", ["team_id"]diff --git a/products/signals/backend/test/test_reviewer_exclusions_api.py b/products/signals/backend/test/test_reviewer_exclusions_api.pynew file mode 100644index 000000000000..1d0040c5feff--- /dev/null+++ b/products/signals/backend/test/test_reviewer_exclusions_api.py@@ -0,0 +1,234 @@+import json++from posthog.test.base import APIBaseTest+from unittest.mock import patch++from parameterized import parameterized+from rest_framework import status+from social_django.models import UserSocialAuth++from posthog.models import OrganizationMembership, Team, User+from posthog.models.personal_api_key import PersonalAPIKey+from posthog.models.utils import generate_random_token_personal, hash_key_value++from products.signals.backend.models import (+ SignalReport,+ SignalReportArtefact,+ SignalReviewerExclusion,+ SignalReviewerExclusionRevision,+)+from products.signals.backend.reviewer_exclusions import create_exclusion+from products.signals.backend.reviewer_rules import ReviewerWriteError+++class TestReviewerExclusionAPI(APIBaseTest):+ def setUp(self) -> None:+ super().setUp()+ self.url = f"/api/projects/{self.team.id}/signals/reviewer_exclusions/"+ self.teammate = User.objects.create(email="[email protected]")+ OrganizationMembership.objects.create(user=self.teammate, organization=self.organization)++ def _report_with_reviewers(self, *users: User) -> SignalReport:+ report = SignalReport.objects.create(team=self.team, status="ready", title="A report")+ SignalReportArtefact.objects.create(+ team=self.team,+ report=report,+ type=SignalReportArtefact.ArtefactType.SUGGESTED_REVIEWERS,+ content=json.dumps([{"user_uuid": str(user.uuid)} for user in users]),+ )+ return report++ def _reviewer_uuids(self, report: SignalReport) -> list[str]:+ latest = (+ SignalReportArtefact.objects.filter(+ report=report, type=SignalReportArtefact.ArtefactType.SUGGESTED_REVIEWERS+ )+ .order_by("-created_at", "-id")+ .first()+ )+ assert latest is not None+ return [entry["user_uuid"] for entry in json.loads(latest.content)]++ @parameterized.expand(+ [+ ("retrieve", "get", ""),+ ("amend", "patch", ""),+ ("revoke", "post", "revoke/"),+ ]+ )+ def test_member_cannot_reach_another_members_instruction(self, _name: str, method: str, suffix: str) -> None:+ theirs, _ = create_exclusion(+ team_id=self.team.id, actor_id=self.teammate.id, instruction="Off.", subject_user_uuid=self.teammate.uuid+ )++ response = getattr(self.client, method)(f"{self.url}{theirs.id}/{suffix}", {"instruction": "x"}, format="json")++ assert response.status_code == status.HTTP_404_NOT_FOUND+ assert self.client.get(self.url).json() == []+ theirs.refresh_from_db()+ assert (theirs.status, theirs.instruction) == (SignalReviewerExclusion.Status.ACTIVE, "Off.")++ @parameterized.expand(+ [+ ("list", "get", ""),+ ("amend", "patch", "{id}/"),+ ("revoke", "post", "{id}/revoke/"),+ ]+ )+ def test_child_scoped_key_cannot_reach_parent_project_instructions(+ self, _name: str, method: str, suffix: str+ ) -> None:+ mine, _ = create_exclusion(+ team_id=self.team.id, actor_id=self.user.id, instruction="Off.", subject_user_uuid=self.user.uuid+ )+ environment = Team.objects.create(+ organization=self.organization, project=self.team.project, parent_team=self.team, name="Child"+ )+ raw_key = generate_random_token_personal()+ PersonalAPIKey.objects.create(+ label="Child-scoped key",+ user=self.user,+ secure_value=hash_key_value(raw_key),+ scopes=["task:read", "task:write"],+ scoped_teams=[environment.id],+ )+ self.client.logout()+ self.client.credentials(HTTP_AUTHORIZATION=f"Bearer {raw_key}")+ url = f"/api/projects/{environment.id}/signals/reviewer_exclusions/{suffix.format(id=mine.id)}"++ response = getattr(self.client, method)(url, {"instruction": "Changed."}, format="json")++ assert response.status_code == status.HTTP_403_FORBIDDEN+ mine.refresh_from_db()+ assert (mine.status, mine.instruction) == (SignalReviewerExclusion.Status.ACTIVE, "Off.")++ def test_create_with_report_removes_the_member_then_saves_the_instruction(self) -> None:+ report = self._report_with_reviewers(self.user, self.teammate)++ response = self.client.post(+ self.url,+ {"instruction": "I moved teams.", "repository": "Org/App", "report_id": str(report.id)},+ format="json",+ )++ assert response.status_code == status.HTTP_201_CREATED, response.json()+ body = response.json()+ assert (body["instruction_saved"], body["report_removed"]) == (True, True)+ assert body["exclusion"]["repository"] == "org/app"+ assert self._reviewer_uuids(report) == [str(self.teammate.uuid)]+ exclusion = SignalReviewerExclusion.objects.for_team(self.team.id).get(id=body["exclusion"]["id"])+ assert (exclusion.subject_user_uuid, exclusion.created_by_id) == (self.user.uuid, self.user.id)++ def test_failed_save_after_report_removal_is_partial_success_and_retry_saves(self) -> None:+ report = self._report_with_reviewers(self.user, self.teammate)+ payload = {"instruction": "I moved teams.", "report_id": str(report.id)}++ with patch(+ "products.signals.backend.facade.reviewer_exclusions.create_exclusion",+ side_effect=RuntimeError("database unavailable"),+ ):+ failed = self.client.post(self.url, payload, format="json")++ assert failed.status_code == status.HTTP_207_MULTI_STATUS+ body = failed.json()+ assert (body["instruction_saved"], body["report_removed"], body["exclusion"]) == (False, True, None)+ assert self._reviewer_uuids(report) == [str(self.teammate.uuid)]+ assert not SignalReviewerExclusion.objects.for_team(self.team.id).exists()++ retried = self.client.post(self.url, payload, format="json")++ assert retried.status_code == status.HTTP_201_CREATED+ assert retried.json()["instruction_saved"] is True++ repeated = self.client.post(self.url, payload, format="json")++ assert repeated.status_code == status.HTTP_200_OK+ assert repeated.json()["exclusion"]["id"] == retried.json()["exclusion"]["id"]+ assert SignalReviewerExclusion.objects.for_team(self.team.id).count() == 1++ def test_repeat_after_linking_github_returns_the_same_instruction(self) -> None:+ payload = {"instruction": "I moved teams.", "repository": "org/app"}+ created = self.client.post(self.url, payload, format="json")+ UserSocialAuth.objects.create(user=self.user, provider="github", uid="1", extra_data={"login": "Member-GH"})++ repeated = self.client.post(self.url, payload, format="json")++ assert (created.status_code, repeated.status_code) == (status.HTTP_201_CREATED, status.HTTP_200_OK)+ assert repeated.json()["exclusion"]["id"] == created.json()["exclusion"]["id"]+ assert (+ SignalReviewerExclusion.objects.for_team(self.team.id)+ .filter(status=SignalReviewerExclusion.Status.ACTIVE)+ .count()+ == 1+ )++ def test_failed_save_without_a_report_is_an_error(self) -> None:+ with patch(+ "products.signals.backend.facade.reviewer_exclusions.create_exclusion",+ side_effect=RuntimeError("database unavailable"),+ ):+ response = self.client.post(self.url, {"instruction": "I moved teams."}, format="json")++ assert response.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR++ def test_rejected_report_removal_saves_no_instruction(self) -> None:+ report = self._report_with_reviewers(self.user)++ with patch(+ "products.signals.backend.facade.reviewer_exclusions.remove_suggested_reviewer",+ side_effect=ReviewerWriteError("Stored reviewer data is invalid."),+ ):+ response = self.client.post(+ self.url, {"instruction": "I moved teams.", "report_id": str(report.id)}, format="json"+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST+ assert not SignalReviewerExclusion.objects.for_team(self.team.id).exists()++ def test_amend_then_revoke_keeps_history_and_leaves_reports_alone(self) -> None:+ created = self.client.post(self.url, {"instruction": "Off billing."}, format="json").json()["exclusion"]+ detail = f"{self.url}{created['id']}/"+ report = self._report_with_reviewers(self.teammate)++ amended = self.client.patch(detail, {"repository": "org/app", "path_prefix": "src/billing"}, format="json")+ assert amended.status_code == status.HTTP_200_OK+ assert (amended.json()["path_prefix"], amended.json()["revision"]) == ("src/billing", 2)+ unchanged = self.client.patch(detail, {"repository": "Org/App", "path_prefix": "src/billing"}, format="json")+ assert unchanged.json()["revision"] == 2++ revoked = self.client.post(f"{detail}revoke/")+ assert revoked.status_code == status.HTTP_200_OK+ assert revoked.json()["status"] == SignalReviewerExclusion.Status.REVOKED++ assert self.client.patch(detail, {"instruction": "Back."}, format="json").status_code == 400+ assert self._reviewer_uuids(report) == [str(self.teammate.uuid)]+ assert list(+ SignalReviewerExclusionRevision.objects.for_team(self.team.id)+ .filter(exclusion_id=created["id"])+ .order_by("revision")+ .values_list("action", flat=True)+ ) == ["created", "revised", "revoked"]++ @parameterized.expand(+ [+ (f"{method}_{name}", method, area)+ for method in ("post", "patch")+ for name, area in [+ ("path_without_repository", {"path_prefix": "src"}),+ ("repository_url", {"repository": "https://github.com/org/app"}),+ ("repository_trailing_slash", {"repository": "org/app/"}),+ ("path_leading_slash", {"repository": "org/app", "path_prefix": "/src"}),+ ("path_dot_segment", {"repository": "org/app", "path_prefix": "src/./billing"}),+ ("path_empty_segment", {"repository": "org/app", "path_prefix": "src//billing"}),+ ]+ ]+ )+ def test_area_that_can_never_match_is_rejected(self, _name: str, method: str, area: dict[str, str]) -> None:+ url = self.url+ if method == "patch":+ created = self.client.post(self.url, {"instruction": "Off."}, format="json").json()["exclusion"]+ url = f"{self.url}{created['id']}/"++ response = getattr(self.client, method)(url, {"instruction": "Off.", **area}, format="json")++ assert response.status_code == status.HTTP_400_BAD_REQUESTdiff --git a/products/signals/backend/views.py b/products/signals/backend/views.pyindex 1cb0f3073372..b717a5740cd8 100644--- a/products/signals/backend/views.py+++ b/products/signals/backend/views.py@@ -3073,9 +3073,14 @@ class SignalReportViewSet(@action(detail=True, methods=["delete"], url_path="reviewers/me", required_scopes=["task:write"])def leave_reviewers(self, request, **kwargs):report = cast(SignalReport, self.get_object())+ scoped_team_ids = get_authenticator_scoped_team_ids(request.successful_authenticator)try:remove_suggested_reviewer(- team=self.team, report_id=str(report.id), user=cast(User, request.user), request=request+ team=self.team,+ report_id=str(report.id),+ user=cast(User, request.user),+ scoped_team_ids=tuple(scoped_team_ids) if scoped_team_ids is not None else None,+ was_impersonated=is_impersonated_session(request),)except StaleReviewerProposal as e:return Response({"detail": str(e)}, status=status.HTTP_409_CONFLICT)@@ -5491,7 +5496,9 @@ def _stored_reviewer_entry(entry: dict) -> dict:}-def remove_suggested_reviewer(*, team: Team, report_id: str, user: User, request: Request) -> bool:+def remove_suggested_reviewer(+ *, team: Team, report_id: str, user: User, scoped_team_ids: tuple[int, ...] | None, was_impersonated: bool+) -> bool:"""Take one person off a report's suggested reviewers and leave everyone else as they are.Returns whether the person was on the list. This is deliberately not routed through@@ -5506,14 +5513,10 @@ def remove_suggested_reviewer(*, team: Team, report_id: str, user: User, requestimplementation task as the user a reviewers edit is attributed to. Stepping off a report mustnever start work, least of all under the credentials of the person who just declined it."""- user_id = request.user.id+ user_id = user.idif user_id is None: # unreachable behind authentication, but keeps attribution honestraise serializers.ValidationError("Cannot attribute a reviewer edit to an anonymous user.")attribution = ArtefactAttribution.from_user(user_id)- # Read off the request here: scout note forwarding runs after commit, where there is no request.- scoped_team_ids = get_authenticator_scoped_team_ids(request.successful_authenticator)- scoped_team_id_tuple = tuple(scoped_team_ids) if scoped_team_ids is not None else None- was_impersonated = is_impersonated_session(request)github_login = user.get_github_login()github_login = github_login.lower() if github_login else None@@ -5565,7 +5568,7 @@ def remove_suggested_reviewer(*, team: Team, report_id: str, user: User, requestlog_activity(organization_id=None,team_id=team.id,- user=cast(User, request.user),+ user=user,was_impersonated=was_impersonated,item_id=report_id,scope="SignalReport",@@ -5591,7 +5594,7 @@ def remove_suggested_reviewer(*, team: Team, report_id: str, user: User, requestadded_reviewers=(),removed_reviewers=(github_login or str(user.uuid),),actor_user_id=user_id,- scoped_team_ids=scoped_team_id_tuple,+ scoped_team_ids=scoped_team_ids,))# on_commit so a rolled-back edit steers nothing. No notification: a removal adds nodiff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex 657caceef24a..95a341e50e2f 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -5795,6 +5795,97 @@ export interface SignalReportSourceMetadataResponseApi {readonly reports: readonly SignalReportSourceMetadataApi[]}+/**+ * * `active` - Active+ * * `revoked` - Revoked+ */+export type SignalReviewerExclusionStatusEnumApi =+ (typeof SignalReviewerExclusionStatusEnumApi)[keyof typeof SignalReviewerExclusionStatusEnumApi]++export const SignalReviewerExclusionStatusEnumApi = {+ Active: 'active',+ Revoked: 'revoked',+} as const++export interface ReviewerExclusionApi {+ /** Identifier of the instruction. */+ readonly id: string+ /** Repository in `owner/name` form that the instruction covers. Empty covers every one. */+ readonly repository: string+ /** Path inside the repository that the instruction covers. Empty covers the repository. */+ readonly path_prefix: string+ /** Why the member stays off this area. */+ readonly instruction: string+ /** `active` instructions apply to automatic reviewer selection. `revoked` instructions do not.+ *+ * * `active` - Active+ * * `revoked` - Revoked */+ readonly status: SignalReviewerExclusionStatusEnumApi+ /** Increases by one at each change. */+ readonly revision: number+ /** When the member saved the instruction. */+ readonly created_at: string+ /** When the instruction last changed. */+ readonly updated_at: string+}++export interface ReviewerExclusionCreateApi {+ /**+ * Repository in `owner/name` form. Leave empty to cover every repository.+ * @maxLength 200+ */+ repository?: string+ /**+ * Path inside the repository, such as `src/billing`. Needs a repository.+ * @maxLength 500+ */+ path_prefix?: string+ /**+ * Why you stay off this area, for the people who read it later.+ * @maxLength 2000+ */+ instruction: string+ /** Optional report to take you off first. The report removal and the instruction save are separate steps. */+ report_id?: string+}++export interface ReviewerExclusionCreateResultApi {+ /** True only when the instruction is saved. Only then does it keep you off automatic selection. */+ instruction_saved: boolean+ /**+ * True when the report removal succeeded. Null when no report was given.+ * @nullable+ */+ report_removed: boolean | null+ /** The saved instruction, or null. */+ exclusion: ReviewerExclusionApi | null+ /** What happened, and what to do next. */+ detail: string+}++export interface ReviewerExclusionErrorApi {+ /** Why the request failed. */+ detail: string+}++export interface PatchedReviewerExclusionUpdateApi {+ /**+ * Repository in `owner/name` form. Leave empty to cover every repository.+ * @maxLength 200+ */+ repository?: string+ /**+ * Path inside the repository, such as `src/billing`. Needs a repository.+ * @maxLength 500+ */+ path_prefix?: string+ /**+ * New text for the instruction.+ * @maxLength 2000+ */+ instruction?: string+}+export interface LLMSkillFileInputApi {/*** File path relative to skill root, e.g. 'scripts/setup.sh' or 'references/guide.md'.diff --git a/products/signals/frontend/generated/api.ts b/products/signals/frontend/generated/api.tsindex bb779f93498c..778975bca043 100644--- a/products/signals/frontend/generated/api.ts+++ b/products/signals/frontend/generated/api.ts@@ -37,6 +37,7 @@ import type {PaginatedSignalReportListListApi,PaginatedSignalSourceConfigListApi,PatchedPullRequestReviewCommentUpdateApi,+ PatchedReviewerExclusionUpdateApi,PatchedSignalReportArtefactLogUpdateApi,PatchedSignalReportContentUpdateApi,PatchedSignalScoutConfigUpdateApi,@@ -60,6 +61,9 @@ import type {ReportReadStateRequestApi,ReportReadStateResponseApi,ReportSignalsResponseApi,+ ReviewerExclusionApi,+ ReviewerExclusionCreateApi,+ ReviewerExclusionCreateResultApi,ScoutChatTaskApi,ScoutChatTaskCreateApi,ScoutCheckSummaryApi,@@ -1632,6 +1636,102 @@ export const signalsReportsSourceMetadataCreate = async (})}+export const getSignalsReviewerExclusionsListUrl = (projectId: string) => {+ return `/api/projects/${projectId}/signals/reviewer_exclusions/`+}++/**+ * List the standing instructions that keep you off automatic reviewer selection, active and revoked.+ * @summary List your reviewer exclusions+ */+export const signalsReviewerExclusionsList = async (+ projectId: string,+ options?: RequestInit+): Promise<ReviewerExclusionApi[]> => {+ return apiMutator<ReviewerExclusionApi[]>(getSignalsReviewerExclusionsListUrl(projectId), {+ ...options,+ method: 'GET',+ })+}++export const getSignalsReviewerExclusionsCreateUrl = (projectId: string) => {+ return `/api/projects/${projectId}/signals/reviewer_exclusions/`+}++/**+ * @summary Stay off automatic reviewer selection in an area+ */+export const signalsReviewerExclusionsCreate = async (+ projectId: string,+ reviewerExclusionCreateApi: ReviewerExclusionCreateApi,+ options?: RequestInit+): Promise<ReviewerExclusionCreateResultApi> => {+ return apiMutator<ReviewerExclusionCreateResultApi>(getSignalsReviewerExclusionsCreateUrl(projectId), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(reviewerExclusionCreateApi),+ })+}++export const getSignalsReviewerExclusionsRetrieveUrl = (projectId: string, id: string) => {+ return `/api/projects/${projectId}/signals/reviewer_exclusions/${id}/`+}++/**+ * @summary Get one of your reviewer exclusions+ */+export const signalsReviewerExclusionsRetrieve = async (+ projectId: string,+ id: string,+ options?: RequestInit+): Promise<ReviewerExclusionApi> => {+ return apiMutator<ReviewerExclusionApi>(getSignalsReviewerExclusionsRetrieveUrl(projectId, id), {+ ...options,+ method: 'GET',+ })+}++export const getSignalsReviewerExclusionsPartialUpdateUrl = (projectId: string, id: string) => {+ return `/api/projects/${projectId}/signals/reviewer_exclusions/${id}/`+}++/**+ * @summary Change one of your reviewer exclusions+ */+export const signalsReviewerExclusionsPartialUpdate = async (+ projectId: string,+ id: string,+ patchedReviewerExclusionUpdateApi?: PatchedReviewerExclusionUpdateApi,+ options?: RequestInit+): Promise<ReviewerExclusionApi> => {+ return apiMutator<ReviewerExclusionApi>(getSignalsReviewerExclusionsPartialUpdateUrl(projectId, id), {+ ...options,+ method: 'PATCH',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(patchedReviewerExclusionUpdateApi),+ })+}++export const getSignalsReviewerExclusionsRevokeCreateUrl = (projectId: string, id: string) => {+ return `/api/projects/${projectId}/signals/reviewer_exclusions/${id}/revoke/`+}++/**+ * Make you eligible for automatic reviewer selection in this area again. Revoking does not add you to any report, and it does not change old reports.+ * @summary Revoke one of your reviewer exclusions+ */+export const signalsReviewerExclusionsRevokeCreate = async (+ projectId: string,+ id: string,+ options?: RequestInit+): Promise<ReviewerExclusionApi> => {+ return apiMutator<ReviewerExclusionApi>(getSignalsReviewerExclusionsRevokeCreateUrl(projectId, id), {+ ...options,+ method: 'POST',+ })+}+export const getSignalsScoutCreateUrl = (projectId: string) => {return `/api/projects/${projectId}/signals/scout/`}diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.tsindex 3d58e1b182fe..58fd14866a57 100644--- a/products/signals/frontend/generated/api.zod.ts+++ b/products/signals/frontend/generated/api.zod.ts@@ -1387,6 +1387,65 @@ export const SignalsReportsSourceMetadataCreateBody = /* @__PURE__ */ zod.object.describe('Reports to describe. At most 100 ids per call.'),})+/**+ * @summary Stay off automatic reviewer selection in an area+ */+export const signalsReviewerExclusionsCreateBodyRepositoryMax = 200++export const signalsReviewerExclusionsCreateBodyPathPrefixMax = 500++export const signalsReviewerExclusionsCreateBodyInstructionMax = 2000++export const SignalsReviewerExclusionsCreateBody = /* @__PURE__ */ zod.object({+ repository: zod+ .string()+ .max(signalsReviewerExclusionsCreateBodyRepositoryMax)+ .optional()+ .describe('Repository in `owner\/name` form. Leave empty to cover every repository.'),+ path_prefix: zod+ .string()+ .max(signalsReviewerExclusionsCreateBodyPathPrefixMax)+ .optional()+ .describe('Path inside the repository, such as `src\/billing`. Needs a repository.'),+ instruction: zod+ .string()+ .max(signalsReviewerExclusionsCreateBodyInstructionMax)+ .describe('Why you stay off this area, for the people who read it later.'),+ report_id: zod+ .uuid()+ .optional()+ .describe(+ 'Optional report to take you off first. The report removal and the instruction save are separate steps.'+ ),+})++/**+ * @summary Change one of your reviewer exclusions+ */+export const signalsReviewerExclusionsPartialUpdateBodyRepositoryMax = 200++export const signalsReviewerExclusionsPartialUpdateBodyPathPrefixMax = 500++export const signalsReviewerExclusionsPartialUpdateBodyInstructionMax = 2000++export const SignalsReviewerExclusionsPartialUpdateBody = /* @__PURE__ */ zod.object({+ repository: zod+ .string()+ .max(signalsReviewerExclusionsPartialUpdateBodyRepositoryMax)+ .optional()+ .describe('Repository in `owner\/name` form. Leave empty to cover every repository.'),+ path_prefix: zod+ .string()+ .max(signalsReviewerExclusionsPartialUpdateBodyPathPrefixMax)+ .optional()+ .describe('Path inside the repository, such as `src\/billing`. Needs a repository.'),+ instruction: zod+ .string()+ .max(signalsReviewerExclusionsPartialUpdateBodyInstructionMax)+ .optional()+ .describe('New text for the instruction.'),+})+/*** Create a scout skill and its runnable config atomically. Give it a `display_name` — the label people read, kept exactly as written — and the scout's permanent skill name is generated from it, with a numeric suffix when that name is taken, so two scouts may share a label without sharing an identity. Pass `name` instead to pick that identifier yourself; any valid skill name works, since the config row is what makes a skill a scout. The skill always receives the report-channel tools. The optional config controls schedule, enablement, dry-run posture, network access, and typed destinations such as Slack. Repeating the same definition is safe and applies any supplied config fields; reusing an explicit `name` for a different definition returns 409.* @summary Create a scoutdiff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yamlindex f3b4cd9defef..a4b156addc93 100644--- a/products/signals/mcp/tools.yaml+++ b/products/signals/mcp/tools.yaml@@ -651,6 +651,65 @@ tools:auto-generated text does. Every other field (status, weights, priority/actionability judgments) is managedby the signals pipeline and cannot be set here — change a report's state with inbox-reports-set-state andits judgments by appending artefacts with inbox-report-artefacts-create. Returns the full updated report.+ inbox-reviewer-exclusions-create:+ operation: signals_reviewer_exclusions_create+ enabled: true+ annotations:+ readOnly: false+ destructive: false+ idempotent: false+ title: Stay off automatic reviewer selection in an area+ description: >+ Save a standing instruction that keeps the authenticated user off automatic reviewer selection in an area,+ for example after they moved off a codebase. Leave `repository` empty to cover every repository, and add+ `path_prefix` to cover one subtree. Pass `report_id` to also take the user off that report first.+ `instruction_saved: true` is the only confirmation that the instruction applies. A 207 response means the+ report removal succeeded but the instruction is not saved: send the same request again. Sending an area that+ an active instruction already covers returns that instruction with a 200. The instruction does not change+ other existing reports.+ feature_flag: signals-reviewer-exclusions-mcp+ inbox-reviewer-exclusions-get:+ operation: signals_reviewer_exclusions_retrieve+ enabled: true+ title: Get one of your reviewer exclusions+ description: >+ Get one of the authenticated user's standing reviewer exclusions by id. Another member's instruction returns+ 404.+ feature_flag: signals-reviewer-exclusions-mcp+ inbox-reviewer-exclusions-list:+ operation: signals_reviewer_exclusions_list+ enabled: true+ title: List your reviewer exclusions+ description: >+ List the authenticated user's standing instructions that keep them off automatic reviewer selection, active+ and revoked. Each instruction covers every repository, one repository, or one path in a repository. Only the+ user's own instructions come back.+ feature_flag: signals-reviewer-exclusions-mcp+ inbox-reviewer-exclusions-revoke:+ operation: signals_reviewer_exclusions_revoke_create+ enabled: true+ annotations:+ readOnly: false+ destructive: false+ idempotent: true+ title: Revoke one of your reviewer exclusions+ description: >+ Revoke one of the authenticated user's reviewer exclusions, so automatic reviewer selection can pick them in+ that area again. Revoking does not add the user to any report and does not change old reports.+ feature_flag: signals-reviewer-exclusions-mcp+ inbox-reviewer-exclusions-update:+ operation: signals_reviewer_exclusions_partial_update+ enabled: true+ annotations:+ readOnly: false+ destructive: false+ idempotent: true+ title: Change one of your reviewer exclusions+ description: >+ Change the text or the area of one of the authenticated user's active reviewer exclusions. Each change keeps+ the earlier version in the history, and a request that changes nothing records no new version. A revoked+ instruction cannot change: create a new one instead.+ feature_flag: signals-reviewer-exclusions-mcpinbox-source-configs-create:operation: signals_source_configs_createenabled: truediff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex ff8f729bf26b..806b3e6266a4 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -7976,6 +7976,86 @@"readOnlyHint": false}},+ "inbox-reviewer-exclusions-create": {+ "description": "Save a standing instruction that keeps the authenticated user off automatic reviewer selection in an area, for example after they moved off a codebase. Leave `repository` empty to cover every repository, and add `path_prefix` to cover one subtree. Pass `report_id` to also take the user off that report first. `instruction_saved: true` is the only confirmation that the instruction applies. A 207 response means the report removal succeeded but the instruction is not saved: send the same request again. Sending an area that an active instruction already covers returns that instruction with a 200. The instruction does not change other existing reports.",+ "category": "Signals",+ "feature": "signals",+ "summary": "Stay off automatic reviewer selection in an area",+ "title": "Stay off automatic reviewer selection in an area",+ "required_scopes": ["task:write"],+ "api_operations": ["POST /api/projects/{project_id}/signals/reviewer_exclusions/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "signals-reviewer-exclusions-mcp"+ },+ "inbox-reviewer-exclusions-get": {+ "description": "Get one of the authenticated user's standing reviewer exclusions by id. Another member's instruction returns 404.",+ "category": "Signals",+ "feature": "signals",+ "summary": "Get one of your reviewer exclusions",+ "title": "Get one of your reviewer exclusions",+ "required_scopes": ["task:read"],+ "api_operations": ["GET /api/projects/{project_id}/signals/reviewer_exclusions/{id}/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "signals-reviewer-exclusions-mcp"+ },+ "inbox-reviewer-exclusions-list": {+ "description": "List the authenticated user's standing instructions that keep them off automatic reviewer selection, active and revoked. Each instruction covers every repository, one repository, or one path in a repository. Only the user's own instructions come back.",+ "category": "Signals",+ "feature": "signals",+ "summary": "List your reviewer exclusions",+ "title": "List your reviewer exclusions",+ "required_scopes": ["task:read"],+ "api_operations": ["GET /api/projects/{project_id}/signals/reviewer_exclusions/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "signals-reviewer-exclusions-mcp"+ },+ "inbox-reviewer-exclusions-revoke": {+ "description": "Revoke one of the authenticated user's reviewer exclusions, so automatic reviewer selection can pick them in that area again. Revoking does not add the user to any report and does not change old reports.",+ "category": "Signals",+ "feature": "signals",+ "summary": "Revoke one of your reviewer exclusions",+ "title": "Revoke one of your reviewer exclusions",+ "required_scopes": ["task:write"],+ "api_operations": ["POST /api/projects/{project_id}/signals/reviewer_exclusions/{id}/revoke/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "signals-reviewer-exclusions-mcp"+ },+ "inbox-reviewer-exclusions-update": {+ "description": "Change the text or the area of one of the authenticated user's active reviewer exclusions. Each change keeps the earlier version in the history, and a request that changes nothing records no new version. A revoked instruction cannot change: create a new one instead.",+ "category": "Signals",+ "feature": "signals",+ "summary": "Change one of your reviewer exclusions",+ "title": "Change one of your reviewer exclusions",+ "required_scopes": ["task:write"],+ "api_operations": ["PATCH /api/projects/{project_id}/signals/reviewer_exclusions/{id}/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "signals-reviewer-exclusions-mcp"+ },"inbox-source-configs-create": {"description": "Create a signal source config for the current project, switching an inbox signal source on. A source ties a `source_product` to a `source_type` and an `enabled` flag. Valid `source_product` values: llm_analytics, github, linear, zendesk, conversations, error_tracking, pganalyze, signals_scout, logs. Valid `source_type` values: evaluation_report, issue, ticket, issue_created, issue_reopened, issue_spiking, cross_source_issue, alert_state_change. To surface AI observability evaluation report findings in the inbox, create `source_product=llm_analytics`, `source_type=evaluation_report` — there is no per-evaluation-run source. The Signals scout source is ON BY DEFAULT — scout findings reach the inbox with no config row needed. The only reason to create a `source_product=signals_scout`, `source_type=cross_source_issue` row is to OPT OUT: create it with `enabled=false` (the per-scout `emit` flag is set separately via `scout-config-update`). There is at most one config per (source_product, source_type) per project; if one already exists, update it instead. For `source_product=linear`, `source_type=issue`, pass `config.linear_team_ids` (a list of Linear team ids from `integrations-linear-teams-retrieve`) so only issues from those Linear teams become signals; the warehouse still syncs the whole workspace. Omit it to use every team.","category": "Signals",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex f8cf424d1771..f8b53cd0872d 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -8178,6 +8178,86 @@"readOnlyHint": false}},+ "inbox-reviewer-exclusions-create": {+ "description": "Save a standing instruction that keeps the authenticated user off automatic reviewer selection in an area, for example after they moved off a codebase. Leave `repository` empty to cover every repository, and add `path_prefix` to cover one subtree. Pass `report_id` to also take the user off that report first. `instruction_saved: true` is the only confirmation that the instruction applies. A 207 response means the report removal succeeded but the instruction is not saved: send the same request again. Sending an area that an active instruction already covers returns that instruction with a 200. The instruction does not change other existing reports.",+ "category": "Signals",+ "feature": "signals",+ "summary": "Stay off automatic reviewer selection in an area",+ "title": "Stay off automatic reviewer selection in an area",+ "required_scopes": ["task:write"],+ "api_operations": ["POST /api/projects/{project_id}/signals/reviewer_exclusions/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "signals-reviewer-exclusions-mcp"+ },+ "inbox-reviewer-exclusions-get": {+ "description": "Get one of the authenticated user's standing reviewer exclusions by id. Another member's instruction returns 404.",+ "category": "Signals",+ "feature": "signals",+ "summary": "Get one of your reviewer exclusions",+ "title": "Get one of your reviewer exclusions",+ "required_scopes": ["task:read"],+ "api_operations": ["GET /api/projects/{project_id}/signals/reviewer_exclusions/{id}/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "signals-reviewer-exclusions-mcp"+ },+ "inbox-reviewer-exclusions-list": {+ "description": "List the authenticated user's standing instructions that keep them off automatic reviewer selection, active and revoked. Each instruction covers every repository, one repository, or one path in a repository. Only the user's own instructions come back.",+ "category": "Signals",+ "feature": "signals",+ "summary": "List your reviewer exclusions",+ "title": "List your reviewer exclusions",+ "required_scopes": ["task:read"],+ "api_operations": ["GET /api/projects/{project_id}/signals/reviewer_exclusions/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "signals-reviewer-exclusions-mcp"+ },+ "inbox-reviewer-exclusions-revoke": {+ "description": "Revoke one of the authenticated user's reviewer exclusions, so automatic reviewer selection can pick them in that area again. Revoking does not add the user to any report and does not change old reports.",+ "category": "Signals",+ "feature": "signals",+ "summary": "Revoke one of your reviewer exclusions",+ "title": "Revoke one of your reviewer exclusions",+ "required_scopes": ["task:write"],+ "api_operations": ["POST /api/projects/{project_id}/signals/reviewer_exclusions/{id}/revoke/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "signals-reviewer-exclusions-mcp"+ },+ "inbox-reviewer-exclusions-update": {+ "description": "Change the text or the area of one of the authenticated user's active reviewer exclusions. Each change keeps the earlier version in the history, and a request that changes nothing records no new version. A revoked instruction cannot change: create a new one instead.",+ "category": "Signals",+ "feature": "signals",+ "summary": "Change one of your reviewer exclusions",+ "title": "Change one of your reviewer exclusions",+ "required_scopes": ["task:write"],+ "api_operations": ["PATCH /api/projects/{project_id}/signals/reviewer_exclusions/{id}/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "signals-reviewer-exclusions-mcp"+ },"inbox-source-configs-create": {"description": "Create a signal source config for the current project, switching an inbox signal source on. A source ties a `source_product` to a `source_type` and an `enabled` flag. Valid `source_product` values: llm_analytics, github, linear, zendesk, conversations, error_tracking, pganalyze, signals_scout, logs. Valid `source_type` values: evaluation_report, issue, ticket, issue_created, issue_reopened, issue_spiking, cross_source_issue, alert_state_change. To surface AI observability evaluation report findings in the inbox, create `source_product=llm_analytics`, `source_type=evaluation_report` — there is no per-evaluation-run source. The Signals scout source is ON BY DEFAULT — scout findings reach the inbox with no config row needed. The only reason to create a `source_product=signals_scout`, `source_type=cross_source_issue` row is to OPT OUT: create it with `enabled=false` (the per-scout `emit` flag is set separately via `scout-config-update`). There is at most one config per (source_product, source_type) per project; if one already exists, update it instead. For `source_product=linear`, `source_type=issue`, pass `config.linear_team_ids` (a list of Linear team ids from `integrations-linear-teams-retrieve`) so only issues from those Linear teams become signals; the warehouse still syncs the whole workspace. Omit it to use every team.","category": "Signals",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 1d2820c6d20f..e9b9e9f6b419 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -90504,6 +90504,24 @@ export namespace Schemas {active?: boolean;}+ export interface PatchedReviewerExclusionUpdate {+ /**+ * Repository in `owner/name` form. Leave empty to cover every repository.+ * @maxLength 200+ */+ repository?: string;+ /**+ * Path inside the repository, such as `src/billing`. Needs a repository.+ * @maxLength 500+ */+ path_prefix?: string;+ /**+ * New text for the instruction.+ * @maxLength 2000+ */+ instruction?: string;+ }+export type PatchedRoleMembersItem = { [key: string]: unknown };export interface PatchedRole {@@ -104715,6 +104733,79 @@ export namespace Schemas {Confirm: 'confirm',} as const;+ /**+ * * `active` - Active+ * * `revoked` - Revoked+ */+ export type SignalReviewerExclusionStatusEnum = typeof SignalReviewerExclusionStatusEnum[keyof typeof SignalReviewerExclusionStatusEnum];+++ export const SignalReviewerExclusionStatusEnum = {+ Active: 'active',+ Revoked: 'revoked',+ } as const;++ export interface ReviewerExclusion {+ /** Identifier of the instruction. */+ readonly id: string;+ /** Repository in `owner/name` form that the instruction covers. Empty covers every one. */+ readonly repository: string;+ /** Path inside the repository that the instruction covers. Empty covers the repository. */+ readonly path_prefix: string;+ /** Why the member stays off this area. */+ readonly instruction: string;+ /** `active` instructions apply to automatic reviewer selection. `revoked` instructions do not.+ *+ * * `active` - Active+ * * `revoked` - Revoked */+ readonly status: SignalReviewerExclusionStatusEnum;+ /** Increases by one at each change. */+ readonly revision: number;+ /** When the member saved the instruction. */+ readonly created_at: string;+ /** When the instruction last changed. */+ readonly updated_at: string;+ }++ export interface ReviewerExclusionCreate {+ /**+ * Repository in `owner/name` form. Leave empty to cover every repository.+ * @maxLength 200+ */+ repository?: string;+ /**+ * Path inside the repository, such as `src/billing`. Needs a repository.+ * @maxLength 500+ */+ path_prefix?: string;+ /**+ * Why you stay off this area, for the people who read it later.+ * @maxLength 2000+ */+ instruction: string;+ /** Optional report to take you off first. The report removal and the instruction save are separate steps. */+ report_id?: string;+ }++ export interface ReviewerExclusionCreateResult {+ /** True only when the instruction is saved. Only then does it keep you off automatic selection. */+ instruction_saved: boolean;+ /**+ * True when the report removal succeeded. Null when no report was given.+ * @nullable+ */+ report_removed: boolean | null;+ /** The saved instruction, or null. */+ exclusion: ReviewerExclusion | null;+ /** What happened, and what to do next. */+ detail: string;+ }++ export interface ReviewerExclusionError {+ /** Why the request failed. */+ detail: string;+ }+export interface RevokeOtherSessionsResponse {/** Number of other login sessions that were revoked. */revoked_count: number;diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex b1de033cef00..b0a7676bbeb1 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -3,7 +3,7 @@* MCP service uses these Zod schemas for generated tool handlers.* To regenerate: hogli build:openapi*- * PostHog API - MCP 74 enabled ops+ * PostHog API - MCP 79 enabled ops* OpenAPI spec version: 1.0.0*/import * as zod from 'zod'@@ -1357,6 +1357,119 @@ export const SignalsReportsRankingOutcomesListParams = () => zod.object({),})+/**+ * List the standing instructions that keep you off automatic reviewer selection, active and revoked.+ * @summary List your reviewer exclusions+ */+export const SignalsReviewerExclusionsListParams = () => zod.object({+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."+ ),+})++/**+ * @summary Stay off automatic reviewer selection in an area+ */+export const SignalsReviewerExclusionsCreateParams = () => zod.object({+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."+ ),+})++export const signalsReviewerExclusionsCreateBodyRepositoryMax = 200++export const signalsReviewerExclusionsCreateBodyPathPrefixMax = 500++export const signalsReviewerExclusionsCreateBodyInstructionMax = 2000++export const SignalsReviewerExclusionsCreateBody = () => zod.object({+ repository: zod+ .string()+ .max(signalsReviewerExclusionsCreateBodyRepositoryMax)+ .optional()+ .describe('Repository in `owner\/name` form. Leave empty to cover every repository.'),+ path_prefix: zod+ .string()+ .max(signalsReviewerExclusionsCreateBodyPathPrefixMax)+ .optional()+ .describe('Path inside the repository, such as `src\/billing`. Needs a repository.'),+ instruction: zod+ .string()+ .max(signalsReviewerExclusionsCreateBodyInstructionMax)+ .describe('Why you stay off this area, for the people who read it later.'),+ report_id: zod+ .string()+ .optional()+ .describe(+ 'Optional report to take you off first. The report removal and the instruction save are separate steps.'+ ),+})++/**+ * @summary Get one of your reviewer exclusions+ */+export const SignalsReviewerExclusionsRetrieveParams = () => zod.object({+ id: zod.string().describe('A UUID string identifying this signal reviewer exclusion.'),+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."+ ),+})++/**+ * @summary Change one of your reviewer exclusions+ */+export const SignalsReviewerExclusionsPartialUpdateParams = () => zod.object({+ id: zod.string().describe('A UUID string identifying this signal reviewer exclusion.'),+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."+ ),+})++export const signalsReviewerExclusionsPartialUpdateBodyRepositoryMax = 200++export const signalsReviewerExclusionsPartialUpdateBodyPathPrefixMax = 500++export const signalsReviewerExclusionsPartialUpdateBodyInstructionMax = 2000++export const SignalsReviewerExclusionsPartialUpdateBody = () => zod.object({+ repository: zod+ .string()+ .max(signalsReviewerExclusionsPartialUpdateBodyRepositoryMax)+ .optional()+ .describe('Repository in `owner\/name` form. Leave empty to cover every repository.'),+ path_prefix: zod+ .string()+ .max(signalsReviewerExclusionsPartialUpdateBodyPathPrefixMax)+ .optional()+ .describe('Path inside the repository, such as `src\/billing`. Needs a repository.'),+ instruction: zod+ .string()+ .max(signalsReviewerExclusionsPartialUpdateBodyInstructionMax)+ .optional()+ .describe('New text for the instruction.'),+})++/**+ * Make you eligible for automatic reviewer selection in this area again. Revoking does not add you to any report, and it does not change old reports.+ * @summary Revoke one of your reviewer exclusions+ */+export const SignalsReviewerExclusionsRevokeCreateParams = () => zod.object({+ id: zod.string().describe('A UUID string identifying this signal reviewer exclusion.'),+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."+ ),+})+/*** Create a scout skill and its runnable config atomically. Give it a `display_name` — the label people read, kept exactly as written — and the scout's permanent skill name is generated from it, with a numeric suffix when that name is taken, so two scouts may share a label without sharing an identity. Pass `name` instead to pick that identifier yourself; any valid skill name works, since the config row is what makes a skill a scout. The skill always receives the report-channel tools. The optional config controls schedule, enablement, dry-run posture, network access, and typed destinations such as Slack. Repeating the same definition is safe and applies any supplied config fields; reusing an explicit `name` for a different definition returns 409.* @summary Create a scoutdiff --git a/services/mcp/src/lib/instructions.ts b/services/mcp/src/lib/instructions.tsindex 4a22152b1a32..2dd9201b09b3 100644--- a/services/mcp/src/lib/instructions.ts+++ b/services/mcp/src/lib/instructions.ts@@ -237,6 +237,7 @@ export class ToolDomainExtractor {'reset','restore','resume',+ 'revoke','ship','show','start',diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.tsindex 22310af8f594..1b43458ebe91 100644--- a/services/mcp/src/tools/generated/signals.ts+++ b/services/mcp/src/tools/generated/signals.ts@@ -876,6 +876,136 @@ const inboxReportsUpdate = (): ToolBase<},})+const InboxReviewerExclusionsCreateSchema = () => {+ const SignalsReviewerExclusionsCreateBody = orvalSchemas.SignalsReviewerExclusionsCreateBody()+ return SignalsReviewerExclusionsCreateBody+}++const inboxReviewerExclusionsCreate = (): ToolBase<+ ReturnType<typeof InboxReviewerExclusionsCreateSchema>,+ Schemas.ReviewerExclusionCreateResult+> => ({+ name: 'inbox-reviewer-exclusions-create',+ schema: InboxReviewerExclusionsCreateSchema(),+ handler: async (context: Context, params: z.infer<ReturnType<typeof InboxReviewerExclusionsCreateSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.repository !== undefined) {+ body['repository'] = params.repository+ }+ if (params.path_prefix !== undefined) {+ body['path_prefix'] = params.path_prefix+ }+ if (params.instruction !== undefined) {+ body['instruction'] = params.instruction+ }+ if (params.report_id !== undefined) {+ body['report_id'] = params.report_id+ }+ const result = await context.api.request<Schemas.ReviewerExclusionCreateResult>({+ method: 'POST',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/reviewer_exclusions/`,+ body,+ })+ return result+ },+})++const InboxReviewerExclusionsGetSchema = () => {+ const SignalsReviewerExclusionsRetrieveParams = orvalSchemas.SignalsReviewerExclusionsRetrieveParams()+ return SignalsReviewerExclusionsRetrieveParams.omit({ project_id: true })+}++const inboxReviewerExclusionsGet = (): ToolBase<+ ReturnType<typeof InboxReviewerExclusionsGetSchema>,+ Schemas.ReviewerExclusion+> => ({+ name: 'inbox-reviewer-exclusions-get',+ schema: InboxReviewerExclusionsGetSchema(),+ handler: async (context: Context, params: z.infer<ReturnType<typeof InboxReviewerExclusionsGetSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.ReviewerExclusion>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/reviewer_exclusions/${encodeURIComponent(String(params.id))}/`,+ })+ return result+ },+})++const InboxReviewerExclusionsListSchema = () => z.object({})++const inboxReviewerExclusionsList = (): ToolBase<+ ReturnType<typeof InboxReviewerExclusionsListSchema>,+ Schemas.ReviewerExclusion[]+> => ({+ name: 'inbox-reviewer-exclusions-list',+ schema: InboxReviewerExclusionsListSchema(),+ handler: async (context: Context, _params: z.infer<ReturnType<typeof InboxReviewerExclusionsListSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.ReviewerExclusion[]>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/reviewer_exclusions/`,+ })+ return result+ },+})++const InboxReviewerExclusionsRevokeSchema = () => {+ const SignalsReviewerExclusionsRevokeCreateParams = orvalSchemas.SignalsReviewerExclusionsRevokeCreateParams()+ return SignalsReviewerExclusionsRevokeCreateParams.omit({ project_id: true })+}++const inboxReviewerExclusionsRevoke = (): ToolBase<+ ReturnType<typeof InboxReviewerExclusionsRevokeSchema>,+ Schemas.ReviewerExclusion+> => ({+ name: 'inbox-reviewer-exclusions-revoke',+ schema: InboxReviewerExclusionsRevokeSchema(),+ handler: async (context: Context, params: z.infer<ReturnType<typeof InboxReviewerExclusionsRevokeSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.ReviewerExclusion>({+ method: 'POST',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/reviewer_exclusions/${encodeURIComponent(String(params.id))}/revoke/`,+ })+ return result+ },+})++const InboxReviewerExclusionsUpdateSchema = () => {+ const SignalsReviewerExclusionsPartialUpdateBody = orvalSchemas.SignalsReviewerExclusionsPartialUpdateBody()+ const SignalsReviewerExclusionsPartialUpdateParams = orvalSchemas.SignalsReviewerExclusionsPartialUpdateParams()+ return SignalsReviewerExclusionsPartialUpdateParams.omit({ project_id: true }).extend(+ SignalsReviewerExclusionsPartialUpdateBody.shape+ )+}++const inboxReviewerExclusionsUpdate = (): ToolBase<+ ReturnType<typeof InboxReviewerExclusionsUpdateSchema>,+ Schemas.ReviewerExclusion+> => ({+ name: 'inbox-reviewer-exclusions-update',+ schema: InboxReviewerExclusionsUpdateSchema(),+ handler: async (context: Context, params: z.infer<ReturnType<typeof InboxReviewerExclusionsUpdateSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.repository !== undefined) {+ body['repository'] = params.repository+ }+ if (params.path_prefix !== undefined) {+ body['path_prefix'] = params.path_prefix+ }+ if (params.instruction !== undefined) {+ body['instruction'] = params.instruction+ }+ const result = await context.api.request<Schemas.ReviewerExclusion>({+ method: 'PATCH',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/reviewer_exclusions/${encodeURIComponent(String(params.id))}/`,+ body,+ })+ return result+ },+})+const InboxSourceConfigsCreateSchema = () => {const SignalsSourceConfigsCreateBody = orvalSchemas.SignalsSourceConfigsCreateBody()return SignalsSourceConfigsCreateBody@@ -3423,6 +3553,11 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {'inbox-reports-retrieve': inboxReportsRetrieve,'inbox-reports-set-state': inboxReportsSetState,'inbox-reports-update': inboxReportsUpdate,+ 'inbox-reviewer-exclusions-create': inboxReviewerExclusionsCreate,+ 'inbox-reviewer-exclusions-get': inboxReviewerExclusionsGet,+ 'inbox-reviewer-exclusions-list': inboxReviewerExclusionsList,+ 'inbox-reviewer-exclusions-revoke': inboxReviewerExclusionsRevoke,+ 'inbox-reviewer-exclusions-update': inboxReviewerExclusionsUpdate,'inbox-source-configs-create': inboxSourceConfigsCreate,'inbox-source-configs-list': inboxSourceConfigsList,'inbox-source-configs-partial-update': inboxSourceConfigsPartialUpdate,diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-create.jsonnew file mode 100644index 000000000000..4e511fd88ebe--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-create.json@@ -0,0 +1,26 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "instruction": {+ "description": "Why you stay off this area, for the people who read it later.",+ "maxLength": 2000,+ "type": "string"+ },+ "path_prefix": {+ "description": "Path inside the repository, such as `src/billing`. Needs a repository.",+ "maxLength": 500,+ "type": "string"+ },+ "report_id": {+ "description": "Optional report to take you off first. The report removal and the instruction save are separate steps.",+ "type": "string"+ },+ "repository": {+ "description": "Repository in `owner/name` form. Leave empty to cover every repository.",+ "maxLength": 200,+ "type": "string"+ }+ },+ "required": ["instruction"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-get.jsonnew file mode 100644index 000000000000..1c0b7d092943--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-get.json@@ -0,0 +1,11 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "id": {+ "description": "A UUID string identifying this signal reviewer exclusion.",+ "type": "string"+ }+ },+ "required": ["id"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-list.jsonnew file mode 100644index 000000000000..7b7ea9186078--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-list.json@@ -0,0 +1,5 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {},+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-revoke.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-revoke.jsonnew file mode 100644index 000000000000..1c0b7d092943--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-revoke.json@@ -0,0 +1,11 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "id": {+ "description": "A UUID string identifying this signal reviewer exclusion.",+ "type": "string"+ }+ },+ "required": ["id"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-update.jsonnew file mode 100644index 000000000000..0757f9478ab6--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reviewer-exclusions-update.json@@ -0,0 +1,26 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "id": {+ "description": "A UUID string identifying this signal reviewer exclusion.",+ "type": "string"+ },+ "instruction": {+ "description": "New text for the instruction.",+ "maxLength": 2000,+ "type": "string"+ },+ "path_prefix": {+ "description": "Path inside the repository, such as `src/billing`. Needs a repository.",+ "maxLength": 500,+ "type": "string"+ },+ "repository": {+ "description": "Repository in `owner/name` form. Leave empty to cover every repository.",+ "maxLength": 200,+ "type": "string"+ }+ },+ "required": ["id"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/instructions.test.ts b/services/mcp/tests/unit/instructions.test.tsindex 222d6a229e62..d102123719ae 100644--- a/services/mcp/tests/unit/instructions.test.ts+++ b/services/mcp/tests/unit/instructions.test.ts@@ -152,6 +152,7 @@ describe('buildToolDomainsBlock', () => {'reset','restore','resume',+ 'revoke','ship','show','start',diff --git a/services/mcp/tests/unit/tool-filtering.test.ts b/services/mcp/tests/unit/tool-filtering.test.tsindex a3f7be815200..e70fa77271a3 100644--- a/services/mcp/tests/unit/tool-filtering.test.ts+++ b/services/mcp/tests/unit/tool-filtering.test.ts@@ -1100,6 +1100,7 @@ describe('Tool Filtering - Feature Flags', () => {'business-knowledge-github-repos','signals-report-checks-replace','inbox-report-actions-mcp',+ 'signals-reviewer-exclusions-mcp','cross-project-dashboards','warehouse-suggestions','scouts-tool-access',diff --git a/services/mcp/tests/unit/tool-schema-snapshots.test.ts b/services/mcp/tests/unit/tool-schema-snapshots.test.tsindex c2d0e2ef9809..e34fe437c221 100644--- a/services/mcp/tests/unit/tool-schema-snapshots.test.ts+++ b/services/mcp/tests/unit/tool-schema-snapshots.test.ts@@ -100,6 +100,7 @@ async function loadSnapshotTools(): Promise<Tool<ZodObjectAny>[]> {'scout-trials': true,'signals-report-checks-replace': true,'inbox-report-actions-mcp': true,+ 'signals-reviewer-exclusions-mcp': true,'ai-observability-offline-evaluations': true,'warehouse-suggestions': true,'scouts-tool-access': true,