Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(signals): let reviewers claim inbox reports from the report page (#122234)

Alex Lebedev6d82761b4491
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 52a46ee9acfa..c894856bba51 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -11586,6 +11586,10 @@ snapshots:
hash: v1.k794b7964.2e98fb53587691240518fe22cb0ba7ecb491d5378be4d3b47a51740f129507ec.Et4sZvSyF0ga_GAL5yXYOKhBxMkfoK-9ANvRAkYC9DQ
scenes-app-inbox-detail--report--light:
hash: v1.k794b7964.b22ea87eae11c6b42ca4a71ed48b01cfbc52141976c75ef702785bc5384d5cbb.z60U5Tv13QSg9yoIwg1KfzSq378Zw3KiR-B2xit1JFU
+ scenes-app-inbox-detail--report-claimed-by-teammate--dark:
+ hash: v1.k794b7964.6620bdf4380f172047471a0dd63b4a43389803a19035bfc697a5178706fc9307.2wBEflMH_dXgWgJ_4BQphFMde2EEdCN6RWGpWOK0RZw
+ scenes-app-inbox-detail--report-claimed-by-teammate--light:
+ hash: v1.k794b7964.0b215feb576751f2a1e252dee1340ec414f5704a0fb832cc18ae9818832a2e84.0m_wxGnW2u2UVrLnyaxVvHXz6gNzOLycfZkXZ4fWzYc
scenes-app-inbox-detail--report-follow-up-pending--dark:
hash: v1.k794b7964.7c5fdee00eb64783cbd3679b1a4666eb94d32ab3979fc31f6fb49321eb6adf3e.i4N8yd315sb7BBoeqIznOadnoabzU0Q30EirBwUUnFs
scenes-app-inbox-detail--report-follow-up-pending--light:
@@ -11711,13 +11715,13 @@ snapshots:
scenes-app-inbox-detail-runs--with-and-without-summaries--light:
hash: v1.k794b7964.6c3e85a31ef2b95a1c7a9ba55f0bf5166772df5441610b3e491ea712e141af42.rDcRBjts6xukOiG1_LTLeE8oQofZ_GhqBrAjbfYNFD0
scenes-app-inbox-detail-suggested-reviewers-mockup--added-by-full-name--dark:
- hash: v1.k794b7964.f0b5c3a154327faef9373221c5d053762754483c78660a41488021699990e88b.hUOkotbEje_eMv14ZliPO1CdlPYu-xenAxG48x24Txc
+ hash: v1.k794b7964.7fd83e32c1b9fa66f827bd10142e8c937b6d9e9fe42ad3bff5aaa44670e46470.1xn6TU2yqNkLJAG6VuNDAH-I8bfkMQV7iFDKtzu4QYo
scenes-app-inbox-detail-suggested-reviewers-mockup--added-by-full-name--light:
- hash: v1.k794b7964.1cb827b67c4ba1965f8072a92fddc4c7268f739bfc84d7cd88dbf767c492d12b.1yavavVSHLqlaH2yQa7msHKhKzMxiHNrWeH8XPZvdWY
+ hash: v1.k794b7964.1db2a8764fbdb2d378c885205457cd272e940e76dffe9abded447b39c6bce090.Wec0Fz6zw-5B4-Kxecupov5vqEWU9EoyGogZ0g_hAWA
scenes-app-inbox-detail-suggested-reviewers-mockup--added-by-teammate--dark:
- hash: v1.k794b7964.a867161f73d1dee15e10a25eeab2ab7f255ab16f321bf7e2c82a1e4e409610c0.BC7lEy4hLOVgBjAwFHty0QspNaZPv_MrEMInu7_U0Us
+ hash: v1.k794b7964.1a90646ee4faabfe03ab63bfee6e1201164ed068f975be79fd4a9f4aa087d318.NXGZeCbbXNZl5KUXmbmqhuYf7hz3Pq7s6UEy0Ut481A
scenes-app-inbox-detail-suggested-reviewers-mockup--added-by-teammate--light:
- hash: v1.k794b7964.0b7a15a6f305c3bf9db835ffe723965e8ef3589a5a948c25054091c4a387ef4a.H2c-bITD3hLDbE3Lztv2wjGZN-J6UVW89t991oCOlQY
+ hash: v1.k794b7964.bbd1b4441b8da026aa1c0f15de9b12376cad111d4ed25f59b6327158bce070f2.GuHCBJDXWUJnZSeivhFDzlI29eHHOUgsS17oJxMhZGg
scenes-app-inbox-detail-suggested-reviewers-mockup--code-history--dark:
hash: v1.k794b7964.f9bafb4368152c8e2fd1c25e92a1711a6d8294df2c51f36f5ebcba0f376ad9b8.mEU64XMQnZPIp42v5qHktXr7ETqiHmvaGQrRuXBQUG8
scenes-app-inbox-detail-suggested-reviewers-mockup--code-history--light:
@@ -11727,13 +11731,13 @@ snapshots:
scenes-app-inbox-detail-suggested-reviewers-mockup--grouped-and-individual-reviewers--light:
hash: v1.k794b7964.cc0693e7e8f3dc05c6f66e5725fe3f8df9ec34f3a55f4213ba36b5a595e0ef74.KrOMWBTRvRv-SuqbMS1M1RTwBB1mfiZB940fwRpGV1E
scenes-app-inbox-detail-suggested-reviewers-mockup--mixed-sources--dark:
- hash: v1.k794b7964.57f5217b78c0a97cfc915d4ad8cfec785e0a4c032e33a8dbe09c7388f89f409b.NC_94o_MTKh9gDoYqREBMU7Io3Q6v3G1es7SkQmw4Uo
+ hash: v1.k794b7964.1f31739984cd8ea9983f2c565e6cb8f67fed1b8de8a667ac4f6df5c574ad3eb4.3bk59bURb6P0_Owh9t9ec1TIkvXeMfjgLOwhVI0ZenA
scenes-app-inbox-detail-suggested-reviewers-mockup--mixed-sources--light:
- hash: v1.k794b7964.385a6c1f49809eb92e7a98863df0bffdb44665ea496512d874aa1f353b98ad29.42ImL41ZzDN3LOG13_3rjo2lzkz4_yR30XOiPNRx8jI
+ hash: v1.k794b7964.d697055b95cb43b3f589a3dc5edbf49a542b999cdc642540ecf53ef82aa3221d.HB4_Ah_opnTmXKwSq-WuktzNIO7hc3UzsW5fcUA4XtI
scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel--dark:
- hash: v1.k794b7964.72dd6e614f35eec72ccc7aa812bda9e28b4a9eda6fc06959613f1ce7b0247160._1KkfPGvRAs1GxcG9ctthBTMN2aRkWVvtpFqctdVqeA
+ hash: v1.k794b7964.1608f42db9783f72e18b9837707ba4af7b9990c8a94be010df64ad028a8af32b.BQwPsqHXPMzQaJRA6khbJ8KtPQ8lRGP0rJhY0dcinGk
scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel--light:
- hash: v1.k794b7964.52295cf5405e49ac699cc04bd36488fc434eafb16838dd5851c2eeb9c3f0be0f.efICxPRhq-JTpGnhJPFCw7lz41OiWayo19dWcYSYP4M
+ hash: v1.k794b7964.3c166e631c75800801df7acbc630b4bf6219f994639c1ceb01dca1cd37aa3eb8.Gg84V3V7UcfGmj1SMDP8nR-kbqgixrSyzTMMTnxG7Lw
scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel-long-reason--dark:
hash: v1.k794b7964.74f6390474422006f84cbe1a9e8034c5152b0592c5c2ba510f042fc1431b6ba5.OvPvTOrWFdvC9s5_WZOFcHRMGl5XMm5wHFqyV4gVT38
scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel-long-reason--light:
@@ -11743,13 +11747,13 @@ snapshots:
scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel-mixed-provenance--light:
hash: v1.k794b7964.81eeb1960bcebdc1ddc4670fa4d3ad4a3fbe939d235e83b3b3216465a201704b.Le09tdCGZPe6y33tHEJZxsVcuP-Bg9IGx2VhJgAXofg
scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel-mixed-sources--dark:
- hash: v1.k794b7964.1052b551e0d15becb03ff73678370724a2604f8aa23d75ad14858dbc9c74cbd7.AdWAHAoDMDrRwnwt6koCvs_Dt_7hjp3TDz4gQ5XE8Xo
+ hash: v1.k794b7964.526a8a57b4cd35c001ae3848540008830402d911809b1f92e6cda05dd4ff517a.qWA4Xg2y-gbTFdxZjy78DQo5kWDRiiyPjCHskWWg5js
scenes-app-inbox-detail-suggested-reviewers-mockup--narrow-panel-mixed-sources--light:
- hash: v1.k794b7964.f82ed35ebe329f4799b849152fd07e40aa76a5c7265673bfd76cc822467cc4ac.4m2LPevf0AypSxt_WypTAnmkWH6jdj4xsF5OXBKddQE
+ hash: v1.k794b7964.df53fd2fffb91b1546e4e11d8d363b1f8861465bf573577450a7bfb447b86802.HvcbTqqL9Mxkx3Ev10ZmWEbCHkJ0WPiVSAR1lPHW8Hc
scenes-app-inbox-detail-suggested-reviewers-mockup--shared-reason--dark:
- hash: v1.k794b7964.f8a7746f91db3fc932bf1685b8a4448114ed5aae86e8d187f767039523b0ec56.14YwYMQ72UNYl0kLoo-kgPzZkOBp183tZiSPgl-9v8I
+ hash: v1.k794b7964.9e3f3ae55aa881086bfcb9da48be8c369e4056b19a3956e122de3e067ff9e833.4-mVZOn_E8-7oQKg_G6XOlkvyURfI3DQmfEEOHzMjJs
scenes-app-inbox-detail-suggested-reviewers-mockup--shared-reason--light:
- hash: v1.k794b7964.c9e0b01d5bb20e440b2a55c7c14f549196d4b96c124c727d17d8c886504935d1.jLX-fGW4Hb8y9GLNk4M4oxG_Ca2IwwK4l0QQYDMMtV8
+ hash: v1.k794b7964.95317d2264a906dbbbc1d840f0ec74319d0a9ba999e3456272998f2d6741b969.T9eNdqs_DLZYzN3pBn8S6hK-oy8OIxaVaBx5FcIkl3c
scenes-app-inbox-detail-suggested-reviewers-mockup--wide-panel-long-reason--dark:
hash: v1.k794b7964.416d6b37e787201bcf33ae67cd46ca701825ab022a8f278fb38b979083f049cb.wvD1Ef6zAy-zzV-D7Ledq6no5HqGkZZ1RE_FCxN1Djw
scenes-app-inbox-detail-suggested-reviewers-mockup--wide-panel-long-reason--light:
diff --git a/products/signals/ARCHITECTURE.md b/products/signals/ARCHITECTURE.md
index 0c025c27a61f..f8c90a4ba7ff 100644
--- a/products/signals/ARCHITECTURE.md
+++ b/products/signals/ARCHITECTURE.md
@@ -564,6 +564,11 @@ Unknown clients use "Alex's agent". The label is fixed at claim time and does no
The returned `claim_id` identifies the work attempt; stale or foreign claims are rejected, and taking another actor's claim requires explicit `takeover=true`.
The shared ownership helper derives the active owner from the latest `work_claim` artefact and its `work_release` entries.
Internal task agents automatically receive a `task_run` association on claim; clients do not write task associations separately.
+When a person holds the claim and starts an implementation task themselves, the task works under that claim instead of replacing it, so the person stays the owner while the agent writes the PR.
+A task started by anyone else is refused while a person holds the claim.
+That task can resume the person's claim and add pull requests and notes to it, but only the person can release it.
+A takeover can name the claim it expects to replace in `takeover_claim_id`, and the server refuses it when a different claim is active.
+In the Inbox, a suggested reviewer claims a report from their own row, and the report shows who works on it under the title. Agent and task claims are not shown there, because a person still has to review the agent's work.
Notes, commits, and PR links can reference the claim without mixing that context into actor attribution.
Attribution identifies the authenticated user plus coding-agent name, or the internal task, and describes who attached the PR rather than its GitHub author.
diff --git a/products/signals/backend/models.py b/products/signals/backend/models.py
index 5a0ae0d34f19..72e803f28cb8 100644
--- a/products/signals/backend/models.py
+++ b/products/signals/backend/models.py
@@ -1639,12 +1639,12 @@ class SignalReportArtefact(UUIDModel):
if isinstance(content, TaskRunArtefact) and content.task_id != attribution.task_id:
raise ArtefactContentValidationError("task_run content.task_id must match the artefact's attributed task")
if attribution.task_id and not claim_id and artefact_type_for(content) in {"commit", "note", "task_run"}:
- from products.signals.backend.report_claims import actor_owns_claim, get_active_claim
+ from products.signals.backend.report_claims import actor_works_under_claim, get_active_claim
active = get_active_claim(team_id=team_id, report_id=report_id)
if (
active
- and actor_owns_claim(active, attribution)
+ and actor_works_under_claim(active, attribution)
and cls.objects.filter(team_id=team_id, id=active.claim_id).exists()
):
claim_id = str(active.claim_id)
@@ -1699,7 +1699,7 @@ class SignalReportArtefact(UUIDModel):
# The rules import this model; load them only on a reviewer write.
from posthog.models.team.team import Team
- from products.signals.backend.report_claims import actor_owns_claim, get_active_claim
+ from products.signals.backend.report_claims import actor_works_under_claim, get_active_claim
from products.signals.backend.reviewer_rules import ReviewerRules
rules = ReviewerRules(team=Team.objects.get(id=team_id), report_id=report_id)
@@ -1709,7 +1709,11 @@ class SignalReportArtefact(UUIDModel):
)
if claim_id:
claim = get_active_claim(team_id=team_id, report_id=report_id)
- if claim is None or str(claim.claim_id) != claim_id or not actor_owns_claim(claim, attribution):
+ if (
+ claim is None
+ or str(claim.claim_id) != claim_id
+ or not actor_works_under_claim(claim, attribution)
+ ):
raise ArtefactContentValidationError("Claim is stale or belongs to another actor.")
update = rules.prepare(content, attribution=attribution, proposal=reviewer_proposal, edit=reviewer_edit)
if update.corrections is not None:
diff --git a/products/signals/backend/report_assignments.py b/products/signals/backend/report_assignments.py
index 4c64ac8d3ff2..4ab593121f4c 100644
--- a/products/signals/backend/report_assignments.py
+++ b/products/signals/backend/report_assignments.py
@@ -32,7 +32,14 @@ from products.signals.backend.pull_requests import (
link_pull_request,
update_pull_request_state,
)
-from products.signals.backend.report_claims import ReportClaim, actor_owns_claim, claim_from_artefact, get_active_claim
+from products.signals.backend.report_claims import (
+ ReportClaim,
+ actor_owns_claim,
+ actor_works_under_claim,
+ claim_from_artefact,
+ get_active_claim,
+ is_user_claim_of_task_creator,
+)
from products.tasks.backend.facade import api as tasks_facade
logger = structlog.get_logger(__name__)
@@ -126,23 +133,27 @@ def create_claim(report: SignalReport, actor: ArtefactAttribution) -> ReportClai
attribution=actor,
)
if actor.task_id:
- associations = SignalReportArtefact.objects.filter(
+ _associate_task_with_claim(report, actor.task_id, claim)
+ return claim_from_artefact(claim)
+
+
+def _associate_task_with_claim(report: SignalReport, task_id: str, claim: SignalReportArtefact) -> None:
+ associations = SignalReportArtefact.objects.filter(
+ team_id=report.team_id,
+ report_id=report.id,
+ type="task_run",
+ task_id=task_id,
+ )
+ if not associations.exists():
+ SignalReportArtefact.add_log(
team_id=report.team_id,
- report_id=report.id,
- type="task_run",
- task_id=actor.task_id,
+ report_id=str(report.id),
+ content=TaskRunArtefact(task_id=task_id, product="tasks", type="agent_run"),
+ attribution=ArtefactAttribution.from_task(task_id),
+ claim_id=str(claim.id),
)
- if not associations.exists():
- SignalReportArtefact.add_log(
- team_id=report.team_id,
- report_id=str(report.id),
- content=TaskRunArtefact(task_id=actor.task_id, product="tasks", type="agent_run"),
- attribution=actor,
- claim_id=str(claim.id),
- )
- else:
- associations.filter(claim__isnull=True).update(claim=claim)
- return claim_from_artefact(claim)
+ else:
+ associations.filter(claim__isnull=True).update(claim=claim)
def assignment_actor(assignment: SignalReportAssignment) -> ArtefactAttribution:
@@ -175,6 +186,13 @@ def claim_report_for_task(*, team_id: int, report_id: str, task_id: str) -> Repo
import_report_pull_requests(report)
claim = get_active_claim(team_id=team_id, report_id=report_id)
actor = ArtefactAttribution.from_task(task_id)
+ if claim is not None and is_user_claim_of_task_creator(claim, task_id):
+ # The person who claimed the report started this task, so the task works under their
+ # claim. Replacing it would remove the person from the report while they still own the work.
+ claim_artefact = SignalReportArtefact.objects.filter(team_id=team_id, id=claim.claim_id).first()
+ if claim_artefact is not None:
+ _associate_task_with_claim(report, task_id, claim_artefact)
+ return claim
if claim is not None and not actor_owns_claim(claim, actor):
raise ReportClaimConflict("This report already has an active claim.")
return claim or create_claim(report, actor)
@@ -360,6 +378,7 @@ def claim_report(
pull_requests: list[str] | None = None,
claim_id: str | None = None,
takeover: bool = False,
+ takeover_claim_id: str | None = None,
) -> ReportClaim | None:
"""Claim, release, or attach a PR to one report and return the current assignment."""
if release and (pr_url or pull_requests or takeover):
@@ -376,7 +395,7 @@ def claim_report(
before = assignment_snapshot(locked_report, assignment)
if claim_id and (assignment is None or str(assignment.claim_id) != claim_id):
raise ReportClaimConflict("This claim is no longer active.")
- if claim_id and assignment is not None and not actor_owns_claim(assignment, actor):
+ if claim_id and assignment is not None and not actor_works_under_claim(assignment, actor):
raise ReportClaimConflict("This claim belongs to another actor.")
if release:
@@ -397,12 +416,14 @@ def claim_report(
if (
not takeover
and assignment is not None
- and actor_owns_claim(assignment, actor)
+ and actor_works_under_claim(assignment, actor)
and all((pr.repository, pr.number) in existing_prs for pr in details)
):
return assignment
raise ReportClaimConflict(f"Reports with status '{report_status}' cannot be claimed.")
- if assignment is not None and not actor_owns_claim(assignment, actor):
+ if assignment is not None and not actor_works_under_claim(assignment, actor):
+ if takeover_claim_id and str(assignment.claim_id) != takeover_claim_id:
+ raise ReportClaimConflict("The report's claim changed. Reload the report and try again.")
if not takeover:
raise ReportClaimConflict(
"This report already has an active claim. Use takeover=true to take ownership."
diff --git a/products/signals/backend/report_claims.py b/products/signals/backend/report_claims.py
index eca3d63e27ba..86863366215f 100644
--- a/products/signals/backend/report_claims.py
+++ b/products/signals/backend/report_claims.py
@@ -119,3 +119,23 @@ def actor_owns_claim(claim: ReportClaim, actor: ArtefactAttribution) -> bool:
and (str(claim.actor_task_id) if claim.actor_task_id else None) == actor.task_id
and claim.actor_agent == actor.agent_name
)
+
+
+def is_user_claim_of(claim: ReportClaim, user_id: int | None) -> bool:
+ """Whether a person holds the claim directly, not through an agent or an internal task."""
+ return claim.actor_kind == "user" and user_id is not None and claim.actor_user_id == user_id
+
+
+def is_user_claim_of_task_creator(claim: ReportClaim, task_id: str) -> bool:
+ """Whether the person holding the claim started the task, so the task works under their claim."""
+ if claim.actor_kind != "user":
+ return False
+ tasks = tasks_facade.get_tasks_by_ids([task_id], [claim.team_id])
+ return bool(tasks) and is_user_claim_of(claim, tasks[0].created_by_id)
+
+
+def actor_works_under_claim(claim: ReportClaim, actor: ArtefactAttribution) -> bool:
+ """Whether the actor can resume the claim and add work to it. Only the owner can release it."""
+ return actor_owns_claim(claim, actor) or (
+ actor.task_id is not None and is_user_claim_of_task_creator(claim, actor.task_id)
+ )
diff --git a/products/signals/backend/serializers.py b/products/signals/backend/serializers.py
index 8c4dcd0c9b5e..79769891ae46 100644
--- a/products/signals/backend/serializers.py
+++ b/products/signals/backend/serializers.py
@@ -700,6 +700,13 @@ class SignalReportClaimSerializer(serializers.Serializer):
takeover = serializers.BooleanField(
required=False, default=False, help_text="Explicitly end another actor's claim and take ownership."
)
+ takeover_claim_id = serializers.UUIDField(
+ required=False,
+ help_text=(
+ "With takeover, the claim the caller expects to replace. The takeover is rejected when a different "
+ "claim is active, so a takeover based on a stale read cannot replace a newer claim."
+ ),
+ )
pr_url = serializers.URLField(
required=False,
help_text="Compatibility alias for adding one PR. Prefer pull_requests for new callers.",
@@ -715,6 +722,8 @@ class SignalReportClaimSerializer(serializers.Serializer):
raise serializers.ValidationError("Release cannot be combined with PR attachment or takeover.")
if attrs.get("claim_id") and attrs.get("takeover"):
raise serializers.ValidationError("A claim ID cannot be combined with takeover.")
+ if attrs.get("takeover_claim_id") and not attrs.get("takeover"):
+ raise serializers.ValidationError("takeover_claim_id requires takeover.")
return attrs
diff --git a/products/signals/backend/task_run_artefacts.py b/products/signals/backend/task_run_artefacts.py
index 2a9f9989b74b..2835c7b91b1f 100644
--- a/products/signals/backend/task_run_artefacts.py
+++ b/products/signals/backend/task_run_artefacts.py
@@ -32,7 +32,7 @@ from products.signals.backend.artefact_schemas import (
from products.signals.backend.billing import first_billable_pr_run_at, mark_report_billing_exempt
from products.signals.backend.models import ArtefactAttribution, SignalReport, SignalReportArtefact, SignalReportTask
from products.signals.backend.report_assignments import ReportClaimConflict, claim_report_for_task, release_claim
-from products.signals.backend.report_claims import get_active_claim
+from products.signals.backend.report_claims import get_active_claim, is_user_claim_of, is_user_claim_of_task_creator
# The task-run vocabulary lives in `artefact_schemas` (a leaf module the model layer can import
# without a cycle); re-exported here so existing `from task_run_artefacts import …` callers keep
@@ -219,7 +219,12 @@ def _implementation_slot_claim(
def enforce_report_task_cap(
- *, team_id: int, report_id: str, relationship: str | None, description: str | None = None
+ *,
+ team_id: int,
+ report_id: str,
+ relationship: str | None,
+ description: str | None = None,
+ created_by_id: int | None = None,
) -> None:
"""Cap the tasks a single report can spawn; raises `ReportTaskCapExceeded` at the limit.
@@ -246,6 +251,9 @@ def enforce_report_task_cap(
if claim is not None:
raise ReportTaskCapExceeded(kind=TASK_RUN_TYPE_IMPLEMENTATION, detail=claim.detail)
assignment = get_active_claim(team_id=team_id, report_id=report_id)
+ if assignment and is_user_claim_of(assignment, created_by_id):
+ # The person who claimed the report starts the task, and the task works under their claim.
+ return
if assignment and assignment.actor_kind:
if assignment.actor_kind != "task":
raise ReportTaskCapExceeded(
@@ -319,7 +327,12 @@ def enforce_report_implementation_rerun_cap(*, team_id: int, report_id: str, tas
if report is None:
return
assignment = get_active_claim(team_id=team_id, report_id=report_id)
- if assignment and assignment.actor_kind and str(assignment.actor_task_id) != task_id:
+ if (
+ assignment
+ and assignment.actor_kind
+ and str(assignment.actor_task_id) != task_id
+ and not is_user_claim_of_task_creator(assignment, task_id)
+ ):
raise ReportTaskCapExceeded(
kind=TASK_RUN_TYPE_IMPLEMENTATION, detail="This report is claimed by another actor."
)
diff --git a/products/signals/backend/test/test_signal_report_assignment_api.py b/products/signals/backend/test/test_signal_report_assignment_api.py
index 344f212faf00..1d1b4173f41d 100644
--- a/products/signals/backend/test/test_signal_report_assignment_api.py
+++ b/products/signals/backend/test/test_signal_report_assignment_api.py
@@ -158,6 +158,34 @@ class TestSignalReportAssignmentAPI(APIBaseTest):
assert change["before"]["agent"] == "claude-code"
assert change["after"]["agent"] == "codex"
+ @parameterized.expand(
+ [
+ ("expected_claim", True, status.HTTP_200_OK, SignalActorKind.USER),
+ ("stale_claim", False, status.HTTP_409_CONFLICT, SignalActorKind.AGENT),
+ ]
+ )
+ def test_takeover_claim_id_guards_against_stale_reads(
+ self, _name: str, expect_current_claim: bool, expected_status: int, expected_kind: str
+ ):
+ report = self._create_report()
+ agent_claim = self.client.post(
+ self._claim_url(report), data={}, format="json", headers=self._agent_headers("codex")
+ ).json()["assignee"]["claim_id"]
+
+ response = self.client.post(
+ self._claim_url(report),
+ data={
+ "takeover": True,
+ "takeover_claim_id": agent_claim if expect_current_claim else "00000000-0000-0000-0000-000000000001",
+ },
+ format="json",
+ )
+
+ assert response.status_code == expected_status
+ assignment = get_active_claim(team_id=self.team.id, report_id=report.id)
+ assert assignment is not None
+ assert assignment.actor_kind == expected_kind
+
@patch("products.signals.backend.report_assignments.GitHubIntegration.first_for_team_repository", return_value=None)
def test_additive_pr_updates_and_stale_claims(self, _integration):
report = self._create_report()
@@ -387,6 +415,32 @@ class TestSignalReportAssignmentAPI(APIBaseTest):
claim = SignalReportArtefact.objects.get(report=report, type="work_claim")
assert json.loads(claim.content)["display_name"] == expected
+ def test_claimants_own_task_works_under_their_claim(self):
+ Task = apps.get_model("tasks", "Task")
+ report = self._create_report()
+ claim_id = self.client.post(self._claim_url(report), data={}, format="json").json()["assignee"]["claim_id"]
+ task = Task.objects.create(
+ team=self.team, created_by=self.user, title="Signal task", origin_product=Task.OriginProduct.SIGNAL_REPORT
+ )
+ task_headers = {"X-PostHog-Task-Id": str(task.id)}
+
+ resumed = self.client.post(
+ self._claim_url(report), data={"claim_id": claim_id}, format="json", headers=task_headers
+ )
+ note = self.client.post(
+ f"/api/projects/{self.team.id}/signals/reports/{report.id}/artefacts/",
+ {"artefact_type": "note", "content": {"note": "Opened the PR"}, "claim_id": claim_id},
+ format="json",
+ headers=task_headers,
+ )
+ release = self.client.post(self._claim_url(report), data={"release": True}, format="json", headers=task_headers)
+
+ assert resumed.status_code == status.HTTP_200_OK
+ assert resumed.json()["assignee"]["kind"] == SignalActorKind.USER
+ assert note.status_code == status.HTTP_201_CREATED
+ assert note.json()["claim_id"] == claim_id
+ assert release.status_code == status.HTTP_409_CONFLICT
+
def test_internal_task_claim_uses_task_attribution(self):
Task = apps.get_model("tasks", "Task")
task = Task.objects.create(
diff --git a/products/signals/backend/test/test_task_run_artefacts.py b/products/signals/backend/test/test_task_run_artefacts.py
index bd03a63cdce0..d2ee724b29c9 100644
--- a/products/signals/backend/test/test_task_run_artefacts.py
+++ b/products/signals/backend/test/test_task_run_artefacts.py
@@ -3,12 +3,15 @@ from datetime import UTC, datetime
from posthog.test.base import BaseTest
+from django.db import transaction
+
from parameterized import parameterized
from products.signals.backend.billing import first_billable_pr_run_at
from products.signals.backend.custom_agent.persistence import create_custom_agent_ready_report
from products.signals.backend.custom_agent.schemas import CustomAgentFinalReport
from products.signals.backend.models import (
+ ArtefactAttribution,
SignalActorKind,
SignalReport,
SignalReportArtefact,
@@ -16,7 +19,7 @@ from products.signals.backend.models import (
SignalReportPullRequest,
SignalReportTask,
)
-from products.signals.backend.report_assignments import sync_task_pull_request_to_assignments
+from products.signals.backend.report_assignments import create_claim, sync_task_pull_request_to_assignments
from products.signals.backend.report_claims import get_active_claim
from products.signals.backend.report_generation.research import (
ActionabilityAssessment,
@@ -29,8 +32,11 @@ from products.signals.backend.task_run_artefacts import (
TASK_RUN_TYPE_IMPLEMENTATION,
TASK_RUN_TYPE_REPO_SELECTION,
TASK_RUN_TYPE_RESEARCH,
+ ReportTaskCapExceeded,
aappend_task_run_artefact,
append_task_run_artefact,
+ enforce_report_implementation_rerun_cap,
+ enforce_report_task_cap,
record_implementation_task,
release_quota_cancelled_implementation,
signals_task_ids,
@@ -180,6 +186,55 @@ class TestTaskRunArtefacts(BaseTest):
record_implementation_task(team_id=self.team.id, report_id=str(report.id), task_id=str(task.id))
assert SignalReportTask.objects.filter(report=report, task=task).count() == 1
+ def test_claimer_starts_implementation_under_their_own_claim(self):
+ report = self._report()
+ claimer = self._create_user("[email protected]")
+ create_claim(report, ArtefactAttribution.from_user(claimer.id))
+
+ with transaction.atomic():
+ enforce_report_task_cap(
+ team_id=self.team.id,
+ report_id=str(report.id),
+ relationship=TASK_RUN_TYPE_IMPLEMENTATION,
+ created_by_id=claimer.id,
+ )
+ task = Task.objects.create(
+ team=self.team,
+ title="task",
+ description="desc",
+ origin_product=Task.OriginProduct.SIGNAL_REPORT,
+ created_by=claimer,
+ )
+ record_implementation_task(team_id=self.team.id, report_id=str(report.id), task_id=str(task.id))
+ enforce_report_implementation_rerun_cap(
+ team_id=self.team.id, report_id=str(report.id), task_id=str(task.id)
+ )
+
+ assignment = get_active_claim(team_id=self.team.id, report_id=report.id)
+ assert assignment is not None
+ assert assignment.actor_kind == SignalActorKind.USER
+ assert assignment.actor_user_id == claimer.id
+ task_run = SignalReportArtefact.objects.get(report=report, type="task_run", task_id=task.id)
+ assert task_run.claim_id == assignment.claim_id
+
+ def test_person_claim_blocks_implementation_started_by_someone_else(self):
+ report = self._report()
+ claimer = self._create_user("[email protected]")
+ other = self._create_user("[email protected]")
+ create_claim(report, ArtefactAttribution.from_user(claimer.id))
+
+ with transaction.atomic(), self.assertRaises(ReportTaskCapExceeded):
+ enforce_report_task_cap(
+ team_id=self.team.id,
+ report_id=str(report.id),
+ relationship=TASK_RUN_TYPE_IMPLEMENTATION,
+ created_by_id=other.id,
+ )
+
+ assignment = get_active_claim(team_id=self.team.id, report_id=report.id)
+ assert assignment is not None
+ assert assignment.actor_user_id == claimer.id
+
@parameterized.expand([(False,), (True,)])
def test_task_run_pr_is_linked_to_the_claim(self, attach_after_merge):
report = self._report()
diff --git a/products/signals/backend/views.py b/products/signals/backend/views.py
index 10c796f1f0f1..febc31f255e0 100644
--- a/products/signals/backend/views.py
+++ b/products/signals/backend/views.py
@@ -176,7 +176,7 @@ from products.signals.backend.report_check_authoring import (
replace_metric_check,
)
from products.signals.backend.report_claims import (
- actor_owns_claim,
+ actor_works_under_claim,
get_active_claim,
get_active_claims,
reports_with_active_claim,
@@ -2275,6 +2275,7 @@ class SignalReportViewSet(
pull_requests=data.get("pull_requests"),
claim_id=str(data["claim_id"]) if data.get("claim_id") else None,
takeover=data["takeover"],
+ takeover_claim_id=str(data["takeover_claim_id"]) if data.get("takeover_claim_id") else None,
)
except InvalidPullRequestUrl as err:
raise serializers.ValidationError({"pr_url": str(err)})
@@ -5910,7 +5911,7 @@ class SignalReportArtefactViewSet(
if (
assignment is None
or assignment.claim_id != claim_id
- or not actor_owns_claim(assignment, attribution)
+ or not actor_works_under_claim(assignment, attribution)
):
return Response(
{"detail": "Claim is stale or belongs to another actor."}, status=status.HTTP_409_CONFLICT
diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.ts
index e635ca259d26..f1b526a3f2f9 100644
--- a/products/signals/frontend/generated/api.schemas.ts
+++ b/products/signals/frontend/generated/api.schemas.ts
@@ -2035,6 +2035,8 @@ export interface SignalReportClaimApi {
pull_requests?: string[]
/** Explicitly end another actor's claim and take ownership. */
takeover?: boolean
+ /** With takeover, the claim the caller expects to replace. The takeover is rejected when a different claim is active, so a takeover based on a stale read cannot replace a newer claim. */
+ takeover_claim_id?: string
/** Compatibility alias for adding one PR. Prefer pull_requests for new callers. */
pr_url?: string
/** Release ownership while preserving any attached pull request. */
diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.ts
index fd264b0288e3..007811ee677c 100644
--- a/products/signals/frontend/generated/api.zod.ts
+++ b/products/signals/frontend/generated/api.zod.ts
@@ -690,6 +690,12 @@ export const SignalsReportsClaimBody = /* @__PURE__ */ zod.object({
.boolean()
.default(signalsReportsClaimBodyTakeoverDefault)
.describe("Explicitly end another actor's claim and take ownership."),
+ takeover_claim_id: zod
+ .uuid()
+ .optional()
+ .describe(
+ 'With takeover, the claim the caller expects to replace. The takeover is rejected when a different claim is active, so a takeover based on a stale read cannot replace a newer claim.'
+ ),
pr_url: zod
.url()
.optional()
diff --git a/products/signals/frontend/inbox/components/detail/ImplementButton.tsx b/products/signals/frontend/inbox/components/detail/ImplementButton.tsx
index 394afb67fe2f..03f98e410444 100644
--- a/products/signals/frontend/inbox/components/detail/ImplementButton.tsx
+++ b/products/signals/frontend/inbox/components/detail/ImplementButton.tsx
@@ -8,6 +8,7 @@ import type { AgentPromptDestination } from 'lib/components/AgentPromptButton'
import { LemonTextArea } from 'lib/lemon-ui/LemonTextArea'
import { copyToClipboard } from 'lib/utils/copyToClipboard'
import { addProjectIdIfMissing } from 'lib/utils/kea-router'
+import { fullNameOrEmail } from 'lib/utils/strings'
import { urls } from 'scenes/urls'
import { captureInboxReportAction } from '../../inboxAnalytics'
@@ -24,7 +25,7 @@ const SLOT_CLAIM_DISABLED_REASON: Record<ImplementationSlotClaim, string> = {
export function ImplementButton({ report }: { report: SignalReport }): JSX.Element {
const { isCreatingPr, isDiscussing, createPrDisabledReason } = useValues(inboxTaskKickoffLogic)
- const { implementationSlotClaim, reportTaskToOpen } = useValues(
+ const { implementationSlotClaim, reportTaskToOpen, reportClaimant, isClaimedByMe } = useValues(
inboxReportDetailLogic({ reportId: report.id, report })
)
const { createPrFromReport, openReportTask } = useActions(inboxTaskKickoffLogic)
@@ -34,10 +35,11 @@ export function ImplementButton({ report }: { report: SignalReport }): JSX.Eleme
const disabledReason =
createPrDisabledReason ??
(isDiscussing ? 'Wait for the discussion task to start.' : undefined) ??
- (implementationSlotClaim ? SLOT_CLAIM_DISABLED_REASON[implementationSlotClaim] : undefined)
+ (implementationSlotClaim ? SLOT_CLAIM_DISABLED_REASON[implementationSlotClaim] : undefined) ??
+ (reportClaimant && !isClaimedByMe ? `${fullNameOrEmail(reportClaimant)} is working on this report.` : undefined)
const submit = (note: string): void => {
- if (isCreatingPr || isDiscussing || implementationSlotClaim) {
+ if (isCreatingPr || isDiscussing || implementationSlotClaim || (reportClaimant && !isClaimedByMe)) {
return
}
if (createPrDisabledReason) {
diff --git a/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsx b/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsx
index 6cfef0c71fd7..c299c40c3565 100644
--- a/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsx
+++ b/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsx
@@ -264,6 +264,27 @@ export const ReportReadyToImplement: Story = {
),
}
+export const ReportClaimedByTeammate: Story = {
+ decorators: [readyToImplementMocks],
+ render: () => (
+ <Frame>
+ <ReportDetail
+ report={{
+ ...reportTabReports[0],
+ assignee: {
+ claim_id: '019e64b8-0000-7000-8000-000000000098',
+ kind: 'user',
+ user: { id: 1, uuid: 'u-1', email: '[email protected]', first_name: 'Octo', last_name: 'Cat' },
+ task_id: null,
+ agent: null,
+ claimed_at: '2026-06-10T10:00:00Z',
+ },
+ }}
+ />
+ </Frame>
+ ),
+}
+
export const ReportWithMetrics: Story = {
render: () => (
<Frame>
diff --git a/products/signals/frontend/inbox/components/detail/ReportClaimPill.tsx b/products/signals/frontend/inbox/components/detail/ReportClaimPill.tsx
new file mode 100644
index 000000000000..d939513574fc
--- /dev/null
+++ b/products/signals/frontend/inbox/components/detail/ReportClaimPill.tsx
@@ -0,0 +1,39 @@
+import { LemonTag, ProfilePicture } from '@posthog/lemon-ui'
+
+import { TZLabel } from 'lib/components/TZLabel'
+import { fullNameOrEmail } from 'lib/utils/strings'
+
+import type { _UserApi } from 'products/signals/frontend/generated/api.schemas'
+
+export function ReportClaimPill({
+ claimant,
+ isClaimedByMe,
+ claimedAt,
+}: {
+ claimant: _UserApi | null
+ isClaimedByMe: boolean
+ claimedAt: string | null
+}): JSX.Element | null {
+ if (!claimant) {
+ return null
+ }
+ const name = fullNameOrEmail(claimant)
+
+ return (
+ <div>
+ <LemonTag
+ type="success"
+ icon={<ProfilePicture user={claimant} name={name} size="xs" />}
+ data-attr="inbox-report-claim-pill"
+ >
+ <span>{isClaimedByMe ? "You're working on this" : `${name} is working on this`}</span>
+ {claimedAt && (
+ <>
+ <span aria-hidden>·</span>
+ <TZLabel time={claimedAt} />
+ </>
+ )}
+ </LemonTag>
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/detail/ReportDetail.tsx b/products/signals/frontend/inbox/components/detail/ReportDetail.tsx
index 1d01b48096ea..c3f21abe9ce8 100644
--- a/products/signals/frontend/inbox/components/detail/ReportDetail.tsx
+++ b/products/signals/frontend/inbox/components/detail/ReportDetail.tsx
@@ -51,6 +51,7 @@ import { ReportActivitySection } from './ReportActivitySection'
import { ReportChart } from './ReportChart'
import { ReportChartsContext } from './reportChartsContext'
import { ReportChecksSection } from './ReportChecksSection'
+import { ReportClaimPill } from './ReportClaimPill'
import { useReportDetailActions } from './ReportDetailActions'
import { ReportExpectedImpact } from './ReportExpectedImpact'
import { ReportFeedbackFooter } from './ReportFeedbackFooter'
@@ -238,6 +239,8 @@ export function InboxDetailFrame({
reportChecks,
reportChecksError,
prioritySaving,
+ reportClaimant,
+ isClaimedByMe,
report: currentReport,
} = useValues(inboxReportDetailLogic(logicProps))
const { setDetailTab, expandEvidence, collapseEvidence, updatePriority } = useActions(
@@ -329,6 +332,14 @@ export function InboxDetailFrame({
</h1>
)
+ const claimPill = (
+ <ReportClaimPill
+ claimant={reportClaimant}
+ isClaimedByMe={isClaimedByMe}
+ claimedAt={(currentReport ?? report).assignee?.claimed_at ?? null}
+ />
+ )
+
// The report body: title, summary, charts, and the rating. On a PR-bearing report it is the
// "Summary" tab; otherwise it sits under the "Report summary" header.
// The key observation leads the evidence rail; the supporting tiles belong to the body's Impact section.
@@ -351,7 +362,10 @@ export function InboxDetailFrame({
const summaryColumn = (
<div className="flex flex-1 flex-col gap-6">
- {titleHeading}
+ <div className="flex flex-col gap-2">
+ {titleHeading}
+ {claimPill}
+ </div>
<ReportChartsContext.Provider value={chartsById}>
<div>
@@ -404,6 +418,7 @@ export function InboxDetailFrame({
)}
{titleHeading}
</div>
+ {claimPill}
<div className="flex flex-wrap items-center gap-2 text-xs text-tertiary">
{diffStat && (
<>
diff --git a/products/signals/frontend/inbox/components/detail/SuggestedReviewerClaimControls.tsx b/products/signals/frontend/inbox/components/detail/SuggestedReviewerClaimControls.tsx
new file mode 100644
index 000000000000..02a2d8db4d18
--- /dev/null
+++ b/products/signals/frontend/inbox/components/detail/SuggestedReviewerClaimControls.tsx
@@ -0,0 +1,72 @@
+import { LemonButton, LemonTag } from '@posthog/lemon-ui'
+
+import { EnrichedReviewer } from '../../types'
+
+export interface ReviewerClaim {
+ claimantUuid: string | null
+ currentUserUuid: string | null
+ claimable: boolean
+ saving: boolean
+ onSetClaimed: (claimed: boolean) => void
+}
+
+function isClaimant(reviewer: EnrichedReviewer, claim: ReviewerClaim): boolean {
+ return !!reviewer.user && reviewer.user.uuid === claim.claimantUuid
+}
+
+export function reviewerClaimRemoveDisabledReason(
+ reviewer: EnrichedReviewer,
+ claim: ReviewerClaim | undefined,
+ displayName: string
+): string | undefined {
+ if (!claim) {
+ return undefined
+ }
+ if (!isClaimant(reviewer, claim)) {
+ // A pending claim makes this row the claimant row, so the remove must wait for it.
+ return claim.saving && !!reviewer.user && reviewer.user.uuid === claim.currentUserUuid ? 'Updating…' : undefined
+ }
+ return reviewer.user?.uuid === claim.currentUserUuid
+ ? "You're working on this report. Unclaim it before you remove yourself."
+ : `${displayName} is working on this report.`
+}
+
+export function SuggestedReviewerClaimControls({
+ reviewer,
+ claim,
+}: {
+ reviewer: EnrichedReviewer
+ claim: ReviewerClaim | undefined
+}): JSX.Element | null {
+ if (!claim || !reviewer.user) {
+ return null
+ }
+ const isMe = reviewer.user.uuid === claim.currentUserUuid
+ const claimant = isClaimant(reviewer, claim)
+ if (!claimant && !(isMe && claim.claimable)) {
+ return null
+ }
+
+ return (
+ <div className="flex shrink-0 items-center gap-1">
+ {claimant && (
+ <LemonTag type="success" size="small">
+ Working on it
+ </LemonTag>
+ )}
+ {isMe && (
+ <LemonButton
+ type="secondary"
+ size="xxsmall"
+ loading={claim.saving}
+ disabledReason={claim.saving ? 'Updating…' : undefined}
+ onClick={() => claim.onSetClaimed(!claimant)}
+ tooltip={claimant ? undefined : "Let your team know you're working on this report."}
+ data-attr={claimant ? 'inbox-report-unclaim' : 'inbox-report-claim'}
+ >
+ {claimant ? 'Unclaim' : "I'm on it"}
+ </LemonButton>
+ )}
+ </div>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/detail/SuggestedReviewerPerson.test.tsx b/products/signals/frontend/inbox/components/detail/SuggestedReviewerPerson.test.tsx
index 11f701a7330e..7a1baec06fc6 100644
--- a/products/signals/frontend/inbox/components/detail/SuggestedReviewerPerson.test.tsx
+++ b/products/signals/frontend/inbox/components/detail/SuggestedReviewerPerson.test.tsx
@@ -6,6 +6,7 @@ import userEvent from '@testing-library/user-event'
import { initKeaTests } from '~/test/init'
import { EnrichedReviewer } from '../../types'
+import { ReviewerClaim, reviewerClaimRemoveDisabledReason } from './SuggestedReviewerClaimControls'
import { SuggestedReviewerPerson } from './SuggestedReviewerPerson'
import { SuggestedReviewersSectionMockup } from './SuggestedReviewersSectionMockup'
@@ -98,6 +99,27 @@ describe('Suggested reviewer presentation', () => {
await userEvent.click(removeButton)
expect(onRemove).toHaveBeenCalledWith([maya])
})
+ test.each([
+ ['your own row while your claim is saving', 'me', true, 'Updating…'],
+ ['your own row when no claim is saving', 'me', false, undefined],
+ ["a teammate's row while your claim is saving", 'teammate', true, undefined],
+ ])('removal of %s', (_case, uuid, saving, expected) => {
+ const reviewer: EnrichedReviewer = {
+ github_login: uuid,
+ github_name: null,
+ relevant_commits: [],
+ user: { id: 1, uuid, first_name: 'Sam', last_name: 'Lee', email: '[email protected]' },
+ }
+ const claim: ReviewerClaim = {
+ claimantUuid: null,
+ currentUserUuid: 'me',
+ claimable: true,
+ saving,
+ onSetClaimed: () => undefined,
+ }
+
+ expect(reviewerClaimRemoveDisabledReason(reviewer, claim, 'Sam Lee')).toEqual(expected)
+ })
it('shows a manual addition as a reason without a source badge', () => {
const quinn: EnrichedReviewer = {
github_login: 'quinn',
diff --git a/products/signals/frontend/inbox/components/detail/SuggestedReviewerPerson.tsx b/products/signals/frontend/inbox/components/detail/SuggestedReviewerPerson.tsx
index cd451c05cb2a..5dc0080d68dd 100644
--- a/products/signals/frontend/inbox/components/detail/SuggestedReviewerPerson.tsx
+++ b/products/signals/frontend/inbox/components/detail/SuggestedReviewerPerson.tsx
@@ -5,6 +5,11 @@ import { PersonDisplay } from 'products/persons/frontend/components/PersonDispla
import { EnrichedReviewer } from '../../types'
import { getReviewerDisplayName } from './reviewerDisplay'
+import {
+ ReviewerClaim,
+ reviewerClaimRemoveDisabledReason,
+ SuggestedReviewerClaimControls,
+} from './SuggestedReviewerClaimControls'
import { SuggestedReviewerScoutTag } from './SuggestedReviewerScoutTag'
const OTHER_SOURCE_LABELS = new Set(['Code history', 'Added by teammate', 'Agent suggestion'])
@@ -40,16 +45,18 @@ export function SuggestedReviewerPerson({
reviewer,
disabled,
onRemove,
+ claim,
}: {
reviewer: EnrichedReviewer
disabled: boolean
onRemove: () => void
+ claim?: ReviewerClaim
}): JSX.Element {
const displayName = getReviewerDisplayName(reviewer)
const sourceLabel = getReviewerSourceLabel(reviewer)
return (
- <div className="grid min-w-0 grid-cols-[minmax(0,1fr)_auto_auto] items-start gap-2 rounded px-1.5 py-1.5 hover:bg-fill-highlight">
+ <div className="grid min-w-0 grid-cols-[minmax(0,1fr)_auto_auto_auto] items-start gap-2 rounded px-1.5 py-1.5 hover:bg-fill-highlight">
<Tooltip
title={
reviewer.user
@@ -74,11 +81,15 @@ export function SuggestedReviewerPerson({
{sourceLabel}
</LemonTag>
)}
+ <SuggestedReviewerClaimControls reviewer={reviewer} claim={claim} />
<LemonButton
type="tertiary"
size="xsmall"
icon={<IconX />}
- disabledReason={disabled ? 'Updating…' : undefined}
+ disabledReason={
+ reviewerClaimRemoveDisabledReason(reviewer, claim, displayName) ??
+ (disabled ? 'Updating…' : undefined)
+ }
onClick={onRemove}
tooltip={`Remove ${displayName}`}
/>
diff --git a/products/signals/frontend/inbox/components/detail/SuggestedReviewerReasonGroup.tsx b/products/signals/frontend/inbox/components/detail/SuggestedReviewerReasonGroup.tsx
index 5ff61851d949..af7dfb2392b7 100644
--- a/products/signals/frontend/inbox/components/detail/SuggestedReviewerReasonGroup.tsx
+++ b/products/signals/frontend/inbox/components/detail/SuggestedReviewerReasonGroup.tsx
@@ -5,6 +5,11 @@ import { PersonDisplay } from 'products/persons/frontend/components/PersonDispla
import { EnrichedReviewer } from '../../types'
import { getReviewerDisplayName } from './reviewerDisplay'
+import {
+ ReviewerClaim,
+ reviewerClaimRemoveDisabledReason,
+ SuggestedReviewerClaimControls,
+} from './SuggestedReviewerClaimControls'
import { getReviewerSourceLabel, isScoutReviewer } from './SuggestedReviewerPerson'
import { SuggestedReviewerScoutTag } from './SuggestedReviewerScoutTag'
@@ -13,11 +18,13 @@ export function SuggestedReviewerReasonGroup({
reason,
disabled,
onRemove,
+ claim,
}: {
reviewers: EnrichedReviewer[]
reason: string
disabled: boolean
onRemove: (reviewer: EnrichedReviewer) => void
+ claim?: ReviewerClaim
}): JSX.Element {
const scoutNames = new Set<string>()
const otherSourceLabels = new Set<string>()
@@ -52,7 +59,7 @@ export function SuggestedReviewerReasonGroup({
return (
<div
key={reviewer.user?.uuid ?? reviewer.user_uuid ?? reviewer.github_login}
- className="grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-2 rounded py-0.5 pr-0.5 hover:bg-fill-highlight"
+ className="grid min-w-0 grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-2 rounded py-0.5 pr-0.5 hover:bg-fill-highlight"
>
<Tooltip
title={
@@ -71,11 +78,15 @@ export function SuggestedReviewerReasonGroup({
/>
</span>
</Tooltip>
+ <SuggestedReviewerClaimControls reviewer={reviewer} claim={claim} />
<LemonButton
type="tertiary"
size="xsmall"
icon={<IconX />}
- disabledReason={disabled ? 'Updating…' : undefined}
+ disabledReason={
+ reviewerClaimRemoveDisabledReason(reviewer, claim, displayName) ??
+ (disabled ? 'Updating…' : undefined)
+ }
onClick={() => onRemove(reviewer)}
tooltip={`Remove ${displayName}`}
/>
diff --git a/products/signals/frontend/inbox/components/detail/SuggestedReviewersList.tsx b/products/signals/frontend/inbox/components/detail/SuggestedReviewersList.tsx
index 5d91ef3aaec9..dd883de79acb 100644
--- a/products/signals/frontend/inbox/components/detail/SuggestedReviewersList.tsx
+++ b/products/signals/frontend/inbox/components/detail/SuggestedReviewersList.tsx
@@ -3,6 +3,7 @@ import { useState } from 'react'
import { LemonButton } from '@posthog/lemon-ui'
import { EnrichedReviewer } from '../../types'
+import { ReviewerClaim } from './SuggestedReviewerClaimControls'
import {
getReviewerExplanation,
getReviewerSourceLabel,
@@ -80,10 +81,12 @@ export function SuggestedReviewersList({
reviewers,
disabled,
onRemove,
+ claim,
}: {
reviewers: EnrichedReviewer[]
disabled: boolean
onRemove: (reviewers: EnrichedReviewer[]) => void
+ claim?: ReviewerClaim
}): JSX.Element {
const [showAll, setShowAll] = useState(false)
const items = buildReviewerItems(reviewers)
@@ -99,6 +102,7 @@ export function SuggestedReviewersList({
reason={item.reason}
disabled={disabled}
onRemove={(reviewer) => onRemove([reviewer])}
+ claim={claim}
/>
) : (
<SuggestedReviewerPerson
@@ -106,6 +110,7 @@ export function SuggestedReviewersList({
reviewer={item.reviewer}
disabled={disabled}
onRemove={() => onRemove([item.reviewer])}
+ claim={claim}
/>
)
)}
diff --git a/products/signals/frontend/inbox/components/detail/SuggestedReviewersSection.tsx b/products/signals/frontend/inbox/components/detail/SuggestedReviewersSection.tsx
index 989e139b718d..139136112f2d 100644
--- a/products/signals/frontend/inbox/components/detail/SuggestedReviewersSection.tsx
+++ b/products/signals/frontend/inbox/components/detail/SuggestedReviewersSection.tsx
@@ -5,6 +5,7 @@ import { IconPlus } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
import { LemonDropdown } from 'lib/lemon-ui/LemonDropdown'
+import { userLogic } from 'scenes/userLogic'
import { inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'
import { EnrichedReviewer, SignalReport } from '../../types'
@@ -13,8 +14,10 @@ import { SuggestedReviewersSectionView } from './SuggestedReviewersSectionView'
export function SuggestedReviewersSection({ report }: { report: SignalReport }): JSX.Element | null {
const logic = inboxReportDetailLogic({ reportId: report.id, report })
- const { displayReviewers, isUpdatingReviewers, reportArtefacts } = useValues(logic)
- const { updateReviewers } = useActions(logic)
+ const { displayReviewers, isUpdatingReviewers, reportArtefacts, reportClaimant, isReportClaimable, claimSaving } =
+ useValues(logic)
+ const { updateReviewers, setReportClaimed } = useActions(logic)
+ const { user } = useValues(userLogic)
const [addOpen, setAddOpen] = useState(false)
const baseReviewers = displayReviewers ?? []
@@ -40,6 +43,13 @@ export function SuggestedReviewersSection({ report }: { report: SignalReport }):
reviewers={baseReviewers}
disabled={isUpdatingReviewers}
onRemove={removeReviewers}
+ claim={{
+ claimantUuid: reportClaimant?.uuid ?? null,
+ currentUserUuid: user?.uuid ?? null,
+ claimable: isReportClaimable,
+ saving: claimSaving,
+ onSetClaimed: setReportClaimed,
+ }}
addControl={
<LemonDropdown
visible={addOpen}
diff --git a/products/signals/frontend/inbox/components/detail/SuggestedReviewersSectionView.tsx b/products/signals/frontend/inbox/components/detail/SuggestedReviewersSectionView.tsx
index b0251d686d29..50e5ec2bd482 100644
--- a/products/signals/frontend/inbox/components/detail/SuggestedReviewersSectionView.tsx
+++ b/products/signals/frontend/inbox/components/detail/SuggestedReviewersSectionView.tsx
@@ -5,6 +5,7 @@ import { Spinner, Tooltip } from '@posthog/lemon-ui'
import { EnrichedReviewer } from '../../types'
import { DetailSection } from './DetailSection'
+import { ReviewerClaim } from './SuggestedReviewerClaimControls'
import { SuggestedReviewersList } from './SuggestedReviewersList'
export function SuggestedReviewersSectionView({
@@ -12,18 +13,20 @@ export function SuggestedReviewersSectionView({
disabled,
onRemove,
addControl,
+ claim,
}: {
reviewers: EnrichedReviewer[]
disabled: boolean
onRemove: (reviewers: EnrichedReviewer[]) => void
addControl: ReactNode
+ claim?: ReviewerClaim
}): JSX.Element {
return (
<DetailSection icon={<IconPeople />} title="Suggested reviewers" collapsible>
{reviewers.length === 0 ? (
<p className="m-0 text-xs text-tertiary">No suggested reviewers yet.</p>
) : (
- <SuggestedReviewersList reviewers={reviewers} disabled={disabled} onRemove={onRemove} />
+ <SuggestedReviewersList reviewers={reviewers} disabled={disabled} onRemove={onRemove} claim={claim} />
)}
<div className="mt-3 flex items-center justify-between gap-2">
<Tooltip title="PostHog uses these suggestions to route the report. Add reviewers on the pull request to request a GitHub review.">
diff --git a/products/signals/frontend/inbox/inboxAnalytics.ts b/products/signals/frontend/inbox/inboxAnalytics.ts
index a06c757c101b..132eb3033ff8 100644
--- a/products/signals/frontend/inbox/inboxAnalytics.ts
+++ b/products/signals/frontend/inbox/inboxAnalytics.ts
@@ -182,6 +182,8 @@ export type InboxReportActionType =
| 'collapse_section'
| 'add_suggested_reviewer'
| 'remove_suggested_reviewer'
+ | 'claim'
+ | 'unclaim'
/**
* Where the text of an "Ask AI" question came from. `suggested` is a scout-authored question sent as
diff --git a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts
index 69a98393316e..2fde5e36c71a 100644
--- a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts
+++ b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts
@@ -39,6 +39,7 @@ import {
signalsReportPrReviewCommentReactionsCreate,
signalsReportPrReviewCommentsCreate,
signalsReportPrReviewCommentUpdate,
+ signalsReportsClaim,
signalsReportsFeedbackCreate,
signalsReportsFeedbackStateRetrieve,
signalsReportsSignalsRetrieve,
@@ -57,6 +58,7 @@ import type {
SignalReportCheckApi,
SignalReportFeedbackStateApi,
SignalReportApi,
+ _UserApi,
} from 'products/signals/frontend/generated/api.schemas'
import type { SignalNodeApi } from 'products/signals/frontend/generated/api.schemas'
@@ -78,6 +80,7 @@ import { inboxSceneLogic } from '../inboxSceneLogic'
import { inboxTaskKickoffLogic } from '../inboxTaskKickoffLogic'
import { EnrichedReviewer, SignalReport, SignalReportArtefact, SignalReportStatus } from '../types'
import { ChartPlacements, resolveChartPlacements } from '../utils/chartPlacement'
+import { isReportClaimable, reportClaimant, reportClaimRequest } from '../utils/reportClaim'
import { reportPullRequests, primaryReportPullRequest, type ReportPullRequest } from '../utils/reportPullRequests'
import { inboxBulkActionsLogic } from './inboxBulkActionsLogic'
@@ -296,6 +299,7 @@ export interface inboxReportDetailLogicValues {
chartIdsKey: string
chartPlacements: ChartPlacements
chartsById: Map<string, ReportChartApi>
+ claimSaving: boolean
currentUserGithubLogin: string | null
detailTab: ReportDetailTab
diffArtefactId: string | null
@@ -320,8 +324,10 @@ export interface inboxReportDetailLogicValues {
implementationSlotClaim: ImplementationSlotClaim | null
inlineThreadCount: number
inlineThreadsByFile: Record<string, ReviewThread[]>
+ isClaimedByMe: boolean
isReResearch: boolean
isReportActive: boolean
+ isReportClaimable: boolean
isUpdatingReviewers: boolean
latestCommitArtefact: SignalReportArtefact | null
optimisticReviewers: EnrichedReviewer[] | null
@@ -345,6 +351,7 @@ export interface inboxReportDetailLogicValues {
reportChecks: SignalReportCheckApi[] | null
reportChecksError: string | null
reportChecksLoading: boolean
+ reportClaimant: _UserApi | null
reportDiff: CommitDiffResponseApi | null
reportDiffError: string | null
reportDiffLoading: boolean
@@ -601,6 +608,9 @@ export interface inboxReportDetailLogicActions {
selectPullRequest: (url: string) => {
url: string
}
+ setClaimSaving: (saving: boolean) => {
+ saving: boolean
+ }
setDetailTab: (tab: ReportDetailTab) => {
tab: ReportDetailTab
}
@@ -625,6 +635,9 @@ export interface inboxReportDetailLogicActions {
setReport: (report: SignalReport | null) => {
report: SignalReport | null
}
+ setReportClaimed: (claimed: boolean) => {
+ claimed: boolean
+ }
setSelectedTaskId: (taskId: string | null) => {
taskId: string | null
}
@@ -712,6 +725,9 @@ export interface inboxReportDetailLogicMeta {
user: null | import('~/types').UserType
) => AvailableReviewerOption[]
isReResearch: (reportTasks: ReportTaskEntry[] | null) => boolean
+ reportClaimant: (report: SignalReport | null) => _UserApi | null
+ isClaimedByMe: (reportClaimant: _UserApi | null, user: null | import('~/types').UserType) => boolean
+ isReportClaimable: (report: SignalReport | null) => boolean
implementationSlotClaim: (reportTasks: ReportTaskEntry[] | null) => ImplementationSlotClaim | null
primaryTask: (reportTasks: ReportTaskEntry[] | null) => ReportTaskEntry | null
reportTaskToOpen: (reportTasks: ReportTaskEntry[] | null) => ReportTaskEntry | null
@@ -774,6 +790,8 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([
setReport: (report: SignalReport | null) => ({ report }),
updatePriority: (priority: ReportPriorityApi) => ({ priority }),
setPrioritySaving: (saving: boolean) => ({ saving }),
+ setReportClaimed: (claimed: boolean) => ({ claimed }),
+ setClaimSaving: (saving: boolean) => ({ saving }),
// Optimistically replace the reviewer list while the PUT is in flight, then reload from the server.
// Addressed by report (not artefact) so a report with no reviewers yet can still be assigned one.
// Mirrors desktop `useUpdateSuggestedReviewers` optimistic behavior.
@@ -1040,6 +1058,7 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([
],
evidenceExpanded: [false, { expandEvidence: () => true, collapseEvidence: () => false }],
prioritySaving: [false, { setPrioritySaving: (_, { saving }) => saving }],
+ claimSaving: [false, { setClaimSaving: (_, { saving }) => saving }],
report: [
null as SignalReport | null,
{
@@ -1445,6 +1464,19 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([
return hasInFlight && hasPriorTerminal
},
],
+ reportClaimant: [
+ (s) => [s.report],
+ (report: SignalReport | null): _UserApi | null => (report ? reportClaimant(report) : null),
+ ],
+ isClaimedByMe: [
+ (s) => [s.reportClaimant, userLogic.selectors.user],
+ (claimant: _UserApi | null, user: { uuid: string } | null): boolean =>
+ !!claimant && !!user && claimant.uuid === user.uuid,
+ ],
+ isReportClaimable: [
+ (s) => [s.report],
+ (report: SignalReport | null): boolean => (report ? isReportClaimable(report) : false),
+ ],
implementationSlotClaim: [
(s) => [s.reportTasks],
(reportTasks: ReportTaskEntry[] | null): ImplementationSlotClaim | null =>
@@ -1537,6 +1569,54 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([
actions.loadReportArtefacts()
actions.setPrioritySaving(false)
},
+ setReportClaimed: async ({ claimed }) => {
+ const teamId = teamLogic.values.currentTeamId
+ const currentReport = values.report
+ if (!teamId || !currentReport || values.claimSaving) {
+ return
+ }
+ actions.setClaimSaving(true)
+ captureInboxReportAction({
+ report: currentReport,
+ actionType: claimed ? 'claim' : 'unclaim',
+ surface: 'detail_pane',
+ })
+ const scene = inboxSceneLogic.findMounted()
+ let updated: SignalReportApi
+ try {
+ updated = await signalsReportsClaim(
+ String(teamId),
+ props.reportId,
+ reportClaimRequest(currentReport, claimed)
+ )
+ } catch (error) {
+ if (inboxReportDetailLogic.isMounted(props)) {
+ actions.setClaimSaving(false)
+ if (error instanceof ApiError && error.status === 409) {
+ lemonToast.error('Someone else is already working on this report.')
+ // Reload so the page shows who holds the claim now.
+ scene?.actions.loadSelectedReport({ id: props.reportId })
+ } else {
+ lemonToast.error("Couldn't update who's working on this report. Try again.")
+ }
+ }
+ return
+ }
+ if (!inboxReportDetailLogic.isMounted(props)) {
+ return
+ }
+ const report: SignalReport = {
+ ...(values.report ?? currentReport),
+ assignee: updated.assignee,
+ updated_at: updated.updated_at,
+ }
+ actions.setReport(report)
+ if (scene?.values.selectedReportId === props.reportId) {
+ scene.actions.seedSelectedReport(report)
+ }
+ actions.loadReportArtefacts()
+ actions.setClaimSaving(false)
+ },
approveReportCheck: async ({ checkId }) => {
const teamId = teamLogic.values.currentTeamId
if (!teamId) {
diff --git a/products/signals/frontend/inbox/utils/reportClaim.test.ts b/products/signals/frontend/inbox/utils/reportClaim.test.ts
new file mode 100644
index 000000000000..78935e1f6ace
--- /dev/null
+++ b/products/signals/frontend/inbox/utils/reportClaim.test.ts
@@ -0,0 +1,43 @@
+import type { SignalActorKindEnumApi, SignalReportAssigneeApi } from 'products/signals/frontend/generated/api.schemas'
+
+import { SignalReportStatus } from '../types'
+import { isReportClaimable, reportClaimRequest } from './reportClaim'
+
+describe('report claim', () => {
+ const assignee = (kind: SignalActorKindEnumApi): SignalReportAssigneeApi => ({
+ claim_id: 'claim-1',
+ kind,
+ user: { id: 1, uuid: 'user-1', first_name: 'Bob', last_name: 'Smith', email: '[email protected]' },
+ task_id: kind === 'task' ? 'task-1' : null,
+ agent: kind === 'agent' ? 'codex' : null,
+ claimed_at: '2026-10-22T10:00:00Z',
+ })
+
+ it.each([
+ { case: 'unclaimed', current: null, claimable: true, request: { takeover: false } },
+ { case: 'held by a person', current: assignee('user'), claimable: false, request: { takeover: false } },
+ {
+ case: 'held by an agent',
+ current: assignee('agent'),
+ claimable: true,
+ request: { takeover: true, takeover_claim_id: 'claim-1' },
+ },
+ {
+ case: 'held by a task',
+ current: assignee('task'),
+ claimable: true,
+ request: { takeover: true, takeover_claim_id: 'claim-1' },
+ },
+ ])('claims a report $case', ({ current, claimable, request }) => {
+ const report = { assignee: current, status: SignalReportStatus.READY }
+ expect(isReportClaimable(report)).toBe(claimable)
+ expect(reportClaimRequest(report, true)).toEqual(request)
+ })
+
+ it.each([
+ { status: SignalReportStatus.FAILED, claimable: true },
+ { status: SignalReportStatus.RESOLVED, claimable: false },
+ ])('offers a claim on a $status report: $claimable', ({ status, claimable }) => {
+ expect(isReportClaimable({ assignee: null, status })).toBe(claimable)
+ })
+})
diff --git a/products/signals/frontend/inbox/utils/reportClaim.ts b/products/signals/frontend/inbox/utils/reportClaim.ts
new file mode 100644
index 000000000000..f712a4d3a0c6
--- /dev/null
+++ b/products/signals/frontend/inbox/utils/reportClaim.ts
@@ -0,0 +1,35 @@
+import type { SignalReportClaimApi, _UserApi } from 'products/signals/frontend/generated/api.schemas'
+
+import { SignalReport, SignalReportStatus } from '../types'
+
+/** Statuses the claim endpoint accepts. Mirrors the server's `CLAIMABLE_REPORT_STATUSES`. */
+const CLAIMABLE_STATUSES: ReadonlySet<SignalReportStatus> = new Set([
+ SignalReportStatus.READY,
+ SignalReportStatus.PENDING_INPUT,
+ SignalReportStatus.POTENTIAL,
+ SignalReportStatus.CANDIDATE,
+ SignalReportStatus.IN_PROGRESS,
+ SignalReportStatus.FAILED,
+])
+
+export function reportClaimant(report: Pick<SignalReport, 'assignee'>): _UserApi | null {
+ const assignee = report.assignee
+ return assignee?.kind === 'user' ? assignee.user : null
+}
+
+export function isReportClaimable(report: Pick<SignalReport, 'assignee' | 'status'>): boolean {
+ return CLAIMABLE_STATUSES.has(report.status) && reportClaimant(report) === null
+}
+
+// A person takes over an agent or task claim, because the agent keeps working either way.
+export function reportClaimRequest(report: Pick<SignalReport, 'assignee'>, claimed: boolean): SignalReportClaimApi {
+ if (!claimed) {
+ return { release: true }
+ }
+ const assignee = report.assignee
+ if (!assignee || assignee.kind === 'user') {
+ return { takeover: false }
+ }
+ // Naming the expected claim makes the server refuse the takeover when a person claimed meanwhile.
+ return assignee.claim_id ? { takeover: true, takeover_claim_id: assignee.claim_id } : { takeover: true }
+}
diff --git a/products/tasks/backend/facade/api.py b/products/tasks/backend/facade/api.py
index 976653db670c..989ffaf282b3 100644
--- a/products/tasks/backend/facade/api.py
+++ b/products/tasks/backend/facade/api.py
@@ -8322,6 +8322,7 @@ def create_task(
report_id=signal_report_id,
relationship=signal_report_task_relationship,
description=validated_data.get("description"),
+ created_by_id=user_id,
)
task = Task.objects.create(**validated_data)
if task.signal_report_id and task.origin_product == Task.OriginProduct.SIGNAL_REPORT:
@@ -9141,7 +9142,11 @@ def _reserve_report_warm_activation(
enforce_self_driving_free_trial(team, report_id=report_id)
with transaction.atomic():
enforce_report_task_cap(
- team_id=task.team_id, report_id=report_id, relationship=relationship, description=description
+ team_id=task.team_id,
+ report_id=report_id,
+ relationship=relationship,
+ description=description,
+ created_by_id=task.created_by_id,
)
return record_report_task(
team_id=task.team_id, report_id=report_id, task_id=str(task.id), relationship=relationship
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 2f246e41adf8..9003d75d220f 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -106415,6 +106415,8 @@ export namespace Schemas {
pull_requests?: string[];
/** Explicitly end another actor's claim and take ownership. */
takeover?: boolean;
+ /** With takeover, the claim the caller expects to replace. The takeover is rejected when a different claim is active, so a takeover based on a stale read cannot replace a newer claim. */
+ takeover_claim_id?: string;
/** Compatibility alias for adding one PR. Prefer pull_requests for new callers. */
pr_url?: string;
/** Release ownership while preserving any attached pull request. */
diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.ts
index d4ccb078db5e..d39a1809ccf5 100644
--- a/services/mcp/src/generated/signals/api.ts
+++ b/services/mcp/src/generated/signals/api.ts
@@ -470,6 +470,12 @@ export const SignalsReportsClaimBody = () => zod.object({
.boolean()
.default(signalsReportsClaimBodyTakeoverDefault)
.describe("Explicitly end another actor's claim and take ownership."),
+ takeover_claim_id: zod
+ .string()
+ .optional()
+ .describe(
+ 'With takeover, the claim the caller expects to replace. The takeover is rejected when a different claim is active, so a takeover based on a stale read cannot replace a newer claim.'
+ ),
pr_url: zod
.url()
.optional()
diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.ts
index 19bb3f290ba6..09329d2e8a4f 100644
--- a/services/mcp/src/tools/generated/signals.ts
+++ b/services/mcp/src/tools/generated/signals.ts
@@ -458,6 +458,9 @@ const inboxReportsClaim = (): ToolBase<
if (params.takeover !== undefined) {
body['takeover'] = params.takeover
}
+ if (params.takeover_claim_id !== undefined) {
+ body['takeover_claim_id'] = params.takeover_claim_id
+ }
if (params.pr_url !== undefined) {
body['pr_url'] = params.pr_url
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-claim.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-claim.json
index d27ac3f129ce..f888e322c302 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-claim.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-claim.json
@@ -33,6 +33,10 @@
"default": false,
"description": "Explicitly end another actor's claim and take ownership.",
"type": "boolean"
+ },
+ "takeover_claim_id": {
+ "description": "With takeover, the claim the caller expects to replace. The takeover is rejected when a different claim is active, so a takeover based on a stale read cannot replace a newer claim.",
+ "type": "string"
}
},
"required": ["id"],