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(devex): set stamphog fork labels through the repo config api (#130733)

Julian Bezb73c62833b67
diff --git a/products/stamphog/README.md b/products/stamphog/README.md
index b49f415712f3..4d4e332dc722 100644
--- a/products/stamphog/README.md
+++ b/products/stamphog/README.md
@@ -197,7 +197,7 @@ A comment names the cut owners and why.
`routing_mode` is set under "Reviewer requests" in the repository's row on the Stamphog page, or with `routing_mode` on the repo config API. Both directions take the `manager` level, like `review_mode`. A placeholder row resets it to `off` when it binds to an installation, like the other review policy fields.
The page offers the setting only when the default branch has a root `owners.yaml` (`GET repo_configs/{id}/owners_file/`, at most one GitHub call per repository every 10 minutes, at a priority the egress limiter can shed), and keeps it in view while it is on, so it can be turned off.
-`routing_fork_labels` has no API yet. Set it with a manual DB write, for example `StamphogRepoConfig.objects.for_team(team_id).filter(repository="acme/widgets").update(routing_fork_labels={"team-alpha": "team/alpha"})`.
+Set `routing_fork_labels` with `routing_fork_labels` on the repo config API, for example `PATCH repo_configs/{id}/` with `{"routing_fork_labels": {"team-alpha": "team/alpha"}}`. The value replaces the whole map, and `{}` removes every label. It takes the `manager` level like `routing_mode`, because it decides who gets asked on a fork PR, and a placeholder row resets it to `{}` when it binds.
Routing only adds review requests, so a second assigner that requests every owner leaves the cut nothing to remove.
In PostHog/posthog, `.github/workflows/auto-assign-reviewers.yml` stops when the repository variable `AUTO_ASSIGN_REVIEWERS_PAUSED` is `true`.
diff --git a/products/stamphog/backend/facade/api.py b/products/stamphog/backend/facade/api.py
index c0d76183725f..4330458ec788 100644
--- a/products/stamphog/backend/facade/api.py
+++ b/products/stamphog/backend/facade/api.py
@@ -24,6 +24,7 @@ from ..logic.installations import reset_unverified_review_policy
from ..logic.review_trigger import derive_review_trigger
from ..logic.reviewer import parse_reviewer_output
from ..logic.routing.claims import is_stale_claim
+from ..logic.routing.fork_labels import fork_labels
from ..logic.routing.owners_file import owners_file_status
from ..logic.scrubbing import neutralize_active_markdown, scrub_credentials
from ..models import (
@@ -104,6 +105,7 @@ def _repo_config_to_dto(obj: StamphogRepoConfig) -> contracts.RepoConfigDTO:
review_mode=obj.review_mode,
trigger_label=obj.trigger_label,
routing_mode=obj.routing_mode,
+ routing_fork_labels=fork_labels(obj),
created_at=obj.created_at,
updated_at=obj.updated_at,
)
@@ -420,6 +422,7 @@ def create_repo_config(
review_mode: str | None = None,
trigger_label: str | None = None,
routing_mode: str | None = None,
+ routing_fork_labels: dict[str, str] | None = None,
) -> contracts.RepoConfigDTO:
"""Create a repo config, refusing a repository another team already owns.
@@ -436,6 +439,8 @@ def create_repo_config(
fields["trigger_label"] = trigger_label
if routing_mode is not None:
fields["routing_mode"] = routing_mode
+ if routing_fork_labels is not None:
+ fields["routing_fork_labels"] = routing_fork_labels
# unique_stamphog_installation_repo backs this at the DB level, so a race that slips past the
# read still fails closed on the create below and surfaces as the same domain error.
try:
diff --git a/products/stamphog/backend/facade/contracts.py b/products/stamphog/backend/facade/contracts.py
index 54caccafb584..27098f8be890 100644
--- a/products/stamphog/backend/facade/contracts.py
+++ b/products/stamphog/backend/facade/contracts.py
@@ -48,6 +48,7 @@ class RepoConfigDTO:
review_mode: str = ""
trigger_label: str = ""
routing_mode: str = ""
+ routing_fork_labels: dict[str, str] = Field(default_factory=dict)
created_at: datetime | None = None
updated_at: datetime | None = None
diff --git a/products/stamphog/backend/logic/installations.py b/products/stamphog/backend/logic/installations.py
index fe1a21dbbba8..acfbbc5b216d 100644
--- a/products/stamphog/backend/logic/installations.py
+++ b/products/stamphog/backend/logic/installations.py
@@ -27,7 +27,8 @@ def reset_unverified_review_policy(config: StamphogRepoConfig) -> list[str]:
config.review_mode = StamphogRepoConfig._meta.get_field("review_mode").get_default()
config.trigger_label = StamphogRepoConfig._meta.get_field("trigger_label").get_default()
config.routing_mode = StamphogRepoConfig._meta.get_field("routing_mode").get_default()
- return ["review_mode", "trigger_label", "routing_mode"]
+ config.routing_fork_labels = StamphogRepoConfig._meta.get_field("routing_fork_labels").get_default()
+ return ["review_mode", "trigger_label", "routing_mode", "routing_fork_labels"]
def _write_db() -> str:
diff --git a/products/stamphog/backend/logic/routing/fork_labels.py b/products/stamphog/backend/logic/routing/fork_labels.py
new file mode 100644
index 000000000000..6c4e1865d4cb
--- /dev/null
+++ b/products/stamphog/backend/logic/routing/fork_labels.py
@@ -0,0 +1,16 @@
+"""The team slug -> label map that replaces a team's review request on fork pull requests."""
+
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from products.stamphog.backend.models import StamphogRepoConfig
+
+
+def fork_labels(repo_config: StamphogRepoConfig) -> dict[str, str]:
+ """The repo's team slug -> label map. Entries that are not a string pair are ignored."""
+ configured = repo_config.routing_fork_labels
+ if not isinstance(configured, dict):
+ return {}
+ return {slug: label for slug, label in configured.items() if isinstance(slug, str) and isinstance(label, str)}
diff --git a/products/stamphog/backend/logic/routing/service.py b/products/stamphog/backend/logic/routing/service.py
index 309631c51ae7..ca9c9318d3db 100644
--- a/products/stamphog/backend/logic/routing/service.py
+++ b/products/stamphog/backend/logic/routing/service.py
@@ -52,6 +52,7 @@ from products.stamphog.backend.logic.routing.comment import (
render_routing_comment,
)
from products.stamphog.backend.logic.routing.cut import CUT_MODEL, RoutingDecision, decide_cuts, keep_pinned
+from products.stamphog.backend.logic.routing.fork_labels import fork_labels
from products.stamphog.backend.logic.routing.model import GatewayCutModel
from products.stamphog.backend.logic.routing.run_log import record_routing_run
from products.stamphog.backend.logic.scrubbing import neutralize_active_markdown, scrub_credentials
@@ -116,14 +117,6 @@ def is_fork(pr: Mapping[str, Any], repository: str) -> bool:
return head_repo.casefold() != repository.casefold()
-def fork_labels(repo_config: StamphogRepoConfig) -> dict[str, str]:
- """The repo's team slug -> label map. Entries that are not a string pair are ignored."""
- configured = repo_config.routing_fork_labels
- if not isinstance(configured, dict):
- return {}
- return {slug: label for slug, label in configured.items() if isinstance(slug, str) and isinstance(label, str)}
-
-
def stored_routing(repo_config: StamphogRepoConfig, pr_number: int) -> dict[str, Any] | None:
"""The latest routing record of the pull request. Writer-pinned, because it decides a GitHub write."""
record = (
diff --git a/products/stamphog/backend/presentation/serializers.py b/products/stamphog/backend/presentation/serializers.py
index fc84a8199a3a..46aeb5c9dce9 100644
--- a/products/stamphog/backend/presentation/serializers.py
+++ b/products/stamphog/backend/presentation/serializers.py
@@ -31,6 +31,10 @@ from ..facade.enums import (
RoutingStatus,
)
+# GitHub refuses a label name longer than this.
+GITHUB_LABEL_MAX_LENGTH = 50
+FORK_LABELS_MAX_ENTRIES = 100
+
class _GateResultSummarySerializer(serializers.Serializer):
"""Allowlisted, content-free slice of ``ReviewRun.gate_result``.
@@ -80,7 +84,7 @@ class StamphogRepoConfigSerializer(DataclassSerializer):
help_text=(
"The caller's access level on the stamphog resource, resolved for the team that owns this "
"row. 'editor' can turn reviews on. 'manager' is required to turn them off or to change "
- "review_mode, trigger_label or routing_mode."
+ "review_mode, trigger_label, routing_mode or routing_fork_labels."
),
)
@@ -124,6 +128,15 @@ class StamphogRepoConfigSerializer(DataclassSerializer):
"new paths."
),
)
+ routing_fork_labels = serializers.DictField(
+ child=serializers.CharField(),
+ read_only=True,
+ help_text=(
+ "On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an "
+ "outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are "
+ "GitHub label names. A team with no entry gets a review request as usual."
+ ),
+ )
class Meta:
dataclass = contracts.RepoConfigDTO
@@ -137,6 +150,7 @@ class StamphogRepoConfigSerializer(DataclassSerializer):
"review_mode",
"trigger_label",
"routing_mode",
+ "routing_fork_labels",
"user_access_level",
"created_at",
"updated_at",
@@ -867,6 +881,16 @@ class StamphogRepoConfigWriteSerializer(serializers.Serializer):
"new paths."
),
)
+ routing_fork_labels = serializers.DictField(
+ child=serializers.CharField(max_length=GITHUB_LABEL_MAX_LENGTH),
+ required=False,
+ help_text=(
+ "On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an "
+ "outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are "
+ "GitHub label names. A team with no entry gets a review request as usual. Sending the field replaces "
+ "the whole map, and an empty object removes every label."
+ ),
+ )
def __init__(
self,
@@ -887,6 +911,19 @@ class StamphogRepoConfigWriteSerializer(serializers.Serializer):
self.fields.pop("provider")
self.fields.pop("repository")
+ def validate_routing_fork_labels(self, value: dict[str, str]) -> dict[str, str]:
+ if len(value) > FORK_LABELS_MAX_ENTRIES:
+ raise serializers.ValidationError(f"Map at most {FORK_LABELS_MAX_ENTRIES} teams to a label.")
+ labels: dict[str, str] = {}
+ for slug, label in value.items():
+ slug, label = slug.strip(), label.strip()
+ if not slug or slug.startswith("@"):
+ raise serializers.ValidationError("Each key must be an owners.yaml team slug, not a person.")
+ if not label:
+ raise serializers.ValidationError(f"The label for {slug} cannot be blank.")
+ labels[slug] = label
+ return labels
+
def validate_trigger_label(self, value: str) -> str:
value = value.strip()
if not value:
diff --git a/products/stamphog/backend/presentation/views.py b/products/stamphog/backend/presentation/views.py
index 7206131eed1c..6d0bc52ab965 100644
--- a/products/stamphog/backend/presentation/views.py
+++ b/products/stamphog/backend/presentation/views.py
@@ -84,8 +84,9 @@ _INSTALL_STATE_MAX_AGE_SECONDS = 60 * 60
# `enabled` is split by direction: turning reviews on takes editor, turning them off takes manager.
REVIEW_POLICY_FIELDS = ("review_mode", "trigger_label")
# Reviewer requests decide which teams get asked on every pull request, and turning them off can leave
-# pull requests with no reviewer at all, so both directions take manager.
-MANAGER_FIELDS = (*REVIEW_POLICY_FIELDS, "routing_mode")
+# pull requests with no reviewer at all, so both directions take manager. A fork label replaces a
+# team's review request on fork pull requests, so it decides who gets asked too.
+MANAGER_FIELDS = (*REVIEW_POLICY_FIELDS, "routing_mode", "routing_fork_labels")
ReviewLevel = Literal["editor", "manager"]
diff --git a/products/stamphog/backend/tests/test_api.py b/products/stamphog/backend/tests/test_api.py
index 329db957f0c4..5ebb12b38f9e 100644
--- a/products/stamphog/backend/tests/test_api.py
+++ b/products/stamphog/backend/tests/test_api.py
@@ -96,6 +96,7 @@ class TestStamphogRepoConfigAPI(StamphogTeamScopedTestMixin, APIBaseTest):
("review_mode", {"review_mode": ReviewMode.ALL}),
("trigger_label", {"trigger_label": "review-me"}),
("routing_mode", {"routing_mode": RoutingMode.FALLBACK}),
+ ("routing_fork_labels", {"routing_fork_labels": {"team-alpha": "area: alpha"}}),
]
)
def test_member_cannot_change_a_review_gating_field(self, _name: str, payload: dict) -> None:
@@ -173,6 +174,7 @@ class TestStamphogRepoConfigAPI(StamphogTeamScopedTestMixin, APIBaseTest):
[
("turns_reviews_off", {"enabled": False}),
("turns_reviewer_requests_on", {"routing_mode": RoutingMode.FALLBACK}),
+ ("sets_fork_labels", {"routing_fork_labels": {"team-alpha": "area: alpha"}}),
]
)
def test_member_granted_manager_can_change_a_review_gating_field(self, _name: str, payload: dict) -> None:
@@ -656,6 +658,27 @@ class TestStamphogRepoConfigSerializerValidation(SimpleTestCase):
assert serializer.is_valid(), serializer.errors
assert serializer.validated_data["digest_enabled"] is False
+ @parameterized.expand(
+ [
+ ("person_key", {"@alice": "area: alice"}, False),
+ ("blank_label", {"team-alpha": " "}, False),
+ ("label_too_long_for_github", {"team-alpha": "x" * 51}, False),
+ ("too_many_teams", {f"team-{index}": "area" for index in range(101)}, False),
+ ("clears_every_label", {}, True),
+ ]
+ )
+ def test_fork_labels_take_only_team_slugs_and_github_label_names(
+ self, _name: str, labels: dict[str, str], valid: bool
+ ) -> None:
+ serializer = StamphogRepoConfigWriteSerializer(
+ data={"routing_fork_labels": labels},
+ partial=True,
+ partial_update=True,
+ current=_repo_config_dto(enabled=True, digest_enabled=False),
+ )
+
+ assert serializer.is_valid() is valid, serializer.errors
+
class TestReviewRunAPI(StamphogTeamScopedTestMixin, APIBaseTest):
databases = PRODUCT_DATABASES
@@ -1059,6 +1082,7 @@ class TestSyncInstallationAPI(StamphogTeamScopedTestMixin, APIBaseTest):
review_mode=ReviewMode.ALL,
trigger_label="nobody-uses-this",
routing_mode=RoutingMode.ALWAYS,
+ routing_fork_labels={"team-alpha": "area: alpha"},
)
response = self.client.post(
self.url, {"installation_id": "42", "code": "oauth-code", "state": self.state}, format="json"
@@ -1075,6 +1099,7 @@ class TestSyncInstallationAPI(StamphogTeamScopedTestMixin, APIBaseTest):
assert manual.review_mode == ReviewMode.LABEL
assert manual.trigger_label == StamphogRepoConfig._meta.get_field("trigger_label").get_default()
assert manual.routing_mode == RoutingMode.OFF
+ assert manual.routing_fork_labels == {}
@patch(f"{_GITHUB_FACADE}.list_user_accessible_repositories", return_value=["PostHog/posthog"])
@patch(f"{_VIEWS}.user_can_access_installation", return_value=True)
diff --git a/products/stamphog/frontend/generated/api.schemas.ts b/products/stamphog/frontend/generated/api.schemas.ts
index 9e59bc912c0e..898f870591e0 100644
--- a/products/stamphog/frontend/generated/api.schemas.ts
+++ b/products/stamphog/frontend/generated/api.schemas.ts
@@ -258,6 +258,11 @@ export const ReviewModeEnumApi = {
Label: 'label',
} as const
+/**
+ * On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual.
+ */
+export type StamphogRepoConfigApiRoutingForkLabels = { [key: string]: string }
+
export interface StamphogRepoConfigApi {
readonly id: string
/** SCM provider this config talks to. Defaults to 'github'. */
@@ -283,8 +288,10 @@ export interface StamphogRepoConfigApi {
* * `always` - Always
* * `fallback` - When stamphog does not approve */
readonly routing_mode: RoutingModeEnumApi
+ /** On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual. */
+ readonly routing_fork_labels: StamphogRepoConfigApiRoutingForkLabels
/**
- * The caller's access level on the stamphog resource, resolved for the team that owns this row. 'editor' can turn reviews on. 'manager' is required to turn them off or to change review_mode, trigger_label or routing_mode.
+ * The caller's access level on the stamphog resource, resolved for the team that owns this row. 'editor' can turn reviews on. 'manager' is required to turn them off or to change review_mode, trigger_label, routing_mode or routing_fork_labels.
* @nullable
*/
readonly user_access_level: string | null
@@ -301,6 +308,11 @@ export interface PaginatedStamphogRepoConfigListApi {
results: StamphogRepoConfigApi[]
}
+/**
+ * On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual. Sending the field replaces the whole map, and an empty object removes every label.
+ */
+export type StamphogRepoConfigWriteApiRoutingForkLabels = { [key: string]: string }
+
/**
* Input shape for creating/updating a repo config.
*
@@ -335,8 +347,15 @@ export interface StamphogRepoConfigWriteApi {
* * `always` - Always
* * `fallback` - When stamphog does not approve */
routing_mode?: RoutingModeEnumApi
+ /** On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual. Sending the field replaces the whole map, and an empty object removes every label. */
+ routing_fork_labels?: StamphogRepoConfigWriteApiRoutingForkLabels
}
+/**
+ * On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual. Sending the field replaces the whole map, and an empty object removes every label.
+ */
+export type PatchedStamphogRepoConfigWriteApiRoutingForkLabels = { [key: string]: string }
+
/**
* Input shape for creating/updating a repo config.
*
@@ -371,6 +390,8 @@ export interface PatchedStamphogRepoConfigWriteApi {
* * `always` - Always
* * `fallback` - When stamphog does not approve */
routing_mode?: RoutingModeEnumApi
+ /** On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual. Sending the field replaces the whole map, and an empty object removes every label. */
+ routing_fork_labels?: PatchedStamphogRepoConfigWriteApiRoutingForkLabels
}
/**
diff --git a/products/stamphog/frontend/generated/api.zod.ts b/products/stamphog/frontend/generated/api.zod.ts
index 3d8a547295c2..56a147b620ef 100644
--- a/products/stamphog/frontend/generated/api.zod.ts
+++ b/products/stamphog/frontend/generated/api.zod.ts
@@ -12,6 +12,8 @@ import * as zod from 'zod'
/**
* Per-repo stamphog settings — enable/disable review, GitHub App installation, policy overrides.
*/
+export const stamphogRepoConfigsCreateBodyRoutingForkLabelsMaxOne = 50
+
export const StamphogRepoConfigsCreateBody = /* @__PURE__ */ zod
.object({
provider: zod.string().optional().describe("SCM provider this config talks to. Defaults to 'github'."),
@@ -39,6 +41,12 @@ export const StamphogRepoConfigsCreateBody = /* @__PURE__ */ zod
.describe(
"When stamphog requests reviews from the code owners in the repository's owners.yaml: 'off' (the default) never; 'always' when a pull request opens ready for review or is marked ready; 'fallback' only when stamphog does not approve, where an approval requests only the owners of sensitive and new paths.\n\n\* `off` - Off\n\* `always` - Always\n\* `fallback` - When stamphog does not approve"
),
+ routing_fork_labels: zod
+ .record(zod.string(), zod.string().max(stamphogRepoConfigsCreateBodyRoutingForkLabelsMaxOne))
+ .optional()
+ .describe(
+ "On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual. Sending the field replaces the whole map, and an empty object removes every label."
+ ),
})
.describe(
"Input shape for creating\/updating a repo config.\n\nSeparate from the read serializer because the contract is an output shape: it carries a\nrequired id, which a create request has no way to supply. Same split as visual_review's\ninput serializers.\n\ninstallation_id is deliberately absent: it may only ever be set by the verified\nsync_installation flow, which proves the caller owns the installation before binding it. A\nclient-supplied value on this path is ignored, so a manually created config carries no\ninstallation and simply won't resolve webhooks until synced."
@@ -47,6 +55,8 @@ export const StamphogRepoConfigsCreateBody = /* @__PURE__ */ zod
/**
* Per-repo stamphog settings — enable/disable review, GitHub App installation, policy overrides.
*/
+export const stamphogRepoConfigsUpdateBodyRoutingForkLabelsMaxOne = 50
+
export const StamphogRepoConfigsUpdateBody = /* @__PURE__ */ zod
.object({
provider: zod.string().optional().describe("SCM provider this config talks to. Defaults to 'github'."),
@@ -74,6 +84,12 @@ export const StamphogRepoConfigsUpdateBody = /* @__PURE__ */ zod
.describe(
"When stamphog requests reviews from the code owners in the repository's owners.yaml: 'off' (the default) never; 'always' when a pull request opens ready for review or is marked ready; 'fallback' only when stamphog does not approve, where an approval requests only the owners of sensitive and new paths.\n\n\* `off` - Off\n\* `always` - Always\n\* `fallback` - When stamphog does not approve"
),
+ routing_fork_labels: zod
+ .record(zod.string(), zod.string().max(stamphogRepoConfigsUpdateBodyRoutingForkLabelsMaxOne))
+ .optional()
+ .describe(
+ "On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual. Sending the field replaces the whole map, and an empty object removes every label."
+ ),
})
.describe(
"Input shape for creating\/updating a repo config.\n\nSeparate from the read serializer because the contract is an output shape: it carries a\nrequired id, which a create request has no way to supply. Same split as visual_review's\ninput serializers.\n\ninstallation_id is deliberately absent: it may only ever be set by the verified\nsync_installation flow, which proves the caller owns the installation before binding it. A\nclient-supplied value on this path is ignored, so a manually created config carries no\ninstallation and simply won't resolve webhooks until synced."
@@ -82,6 +98,8 @@ export const StamphogRepoConfigsUpdateBody = /* @__PURE__ */ zod
/**
* Per-repo stamphog settings — enable/disable review, GitHub App installation, policy overrides.
*/
+export const stamphogRepoConfigsPartialUpdateBodyRoutingForkLabelsMaxOne = 50
+
export const StamphogRepoConfigsPartialUpdateBody = /* @__PURE__ */ zod
.object({
provider: zod.string().optional().describe("SCM provider this config talks to. Defaults to 'github'."),
@@ -109,6 +127,12 @@ export const StamphogRepoConfigsPartialUpdateBody = /* @__PURE__ */ zod
.describe(
"When stamphog requests reviews from the code owners in the repository's owners.yaml: 'off' (the default) never; 'always' when a pull request opens ready for review or is marked ready; 'fallback' only when stamphog does not approve, where an approval requests only the owners of sensitive and new paths.\n\n\* `off` - Off\n\* `always` - Always\n\* `fallback` - When stamphog does not approve"
),
+ routing_fork_labels: zod
+ .record(zod.string(), zod.string().max(stamphogRepoConfigsPartialUpdateBodyRoutingForkLabelsMaxOne))
+ .optional()
+ .describe(
+ "On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual. Sending the field replaces the whole map, and an empty object removes every label."
+ ),
})
.describe(
"Input shape for creating\/updating a repo config.\n\nSeparate from the read serializer because the contract is an output shape: it carries a\nrequired id, which a create request has no way to supply. Same split as visual_review's\ninput serializers.\n\ninstallation_id is deliberately absent: it may only ever be set by the verified\nsync_installation flow, which proves the caller owns the installation before binding it. A\nclient-supplied value on this path is ignored, so a manually created config carries no\ninstallation and simply won't resolve webhooks until synced."
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index cf66278c1d66..0c6ecdb75bfa 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -75931,6 +75931,11 @@ export namespace Schemas {
Label: 'label',
} as const;
+ /**
+ * On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual.
+ */
+ export type StamphogRepoConfigRoutingForkLabels = {[key: string]: string};
+
export interface StamphogRepoConfig {
readonly id: string;
/** SCM provider this config talks to. Defaults to 'github'. */
@@ -75956,8 +75961,10 @@ export namespace Schemas {
* * `always` - Always
* * `fallback` - When stamphog does not approve */
readonly routing_mode: RoutingModeEnum;
+ /** On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual. */
+ readonly routing_fork_labels: StamphogRepoConfigRoutingForkLabels;
/**
- * The caller's access level on the stamphog resource, resolved for the team that owns this row. 'editor' can turn reviews on. 'manager' is required to turn them off or to change review_mode, trigger_label or routing_mode.
+ * The caller's access level on the stamphog resource, resolved for the team that owns this row. 'editor' can turn reviews on. 'manager' is required to turn them off or to change review_mode, trigger_label, routing_mode or routing_fork_labels.
* @nullable
*/
readonly user_access_level: string | null;
@@ -88048,6 +88055,11 @@ export namespace Schemas {
readonly status?: SignalSourceSyncStatusEnum | null;
}
+ /**
+ * On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual. Sending the field replaces the whole map, and an empty object removes every label.
+ */
+ export type PatchedStamphogRepoConfigWriteRoutingForkLabels = {[key: string]: string};
+
/**
* Input shape for creating/updating a repo config.
*
@@ -88082,6 +88094,8 @@ export namespace Schemas {
* * `always` - Always
* * `fallback` - When stamphog does not approve */
routing_mode?: RoutingModeEnum;
+ /** On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual. Sending the field replaces the whole map, and an empty object removes every label. */
+ routing_fork_labels?: PatchedStamphogRepoConfigWriteRoutingForkLabels;
}
export type PatchedSubscriptionWriteContextsItem = {
@@ -109560,6 +109574,11 @@ export namespace Schemas {
owners_file: OwnersFileStatusEnum;
}
+ /**
+ * On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual. Sending the field replaces the whole map, and an empty object removes every label.
+ */
+ export type StamphogRepoConfigWriteRoutingForkLabels = {[key: string]: string};
+
/**
* Input shape for creating/updating a repo config.
*
@@ -109594,6 +109613,8 @@ export namespace Schemas {
* * `always` - Always
* * `fallback` - When stamphog does not approve */
routing_mode?: RoutingModeEnum;
+ /** On fork pull requests, routing adds the mapped label instead of requesting a review from the team, so an outside author cannot notify it. Keys are owners.yaml team slugs such as 'team-devex', values are GitHub label names. A team with no entry gets a review request as usual. Sending the field replaces the whole map, and an empty object removes every label. */
+ routing_fork_labels?: StamphogRepoConfigWriteRoutingForkLabels;
}
export interface StamphogRoutingFile {