:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(signals): release a report's PR slot when a run ships no PR (#94033)
posthog[bot]f4352cb0953a
diff --git a/products/signals/backend/task_run_artefacts.py b/products/signals/backend/task_run_artefacts.pyindex b32a46a9bfe9..79f40e3fb9b9 100644--- a/products/signals/backend/task_run_artefacts.py+++ b/products/signals/backend/task_run_artefacts.py@@ -14,6 +14,8 @@ purpose is *derived* — there is no relationship label on the task↔report assfrom __future__ import annotationsimport json+from collections.abc import Sequence+from enum import StrEnumfrom django.db import transaction@@ -69,11 +71,27 @@ _PIPELINE_TASK_RUN_TYPES = frozenset(# new run type that does ship code (a report is expected to grow several PRs) counts by default.NON_PR_BEARING_TASK_RUN_TYPES = frozenset({TASK_RUN_TYPE_RESEARCH, TASK_RUN_TYPE_REPO_SELECTION, TASK_RUN_TYPE_SCOUT})-_TERMINAL_NO_PR_RUN_STATUSES = frozenset({"failed", "cancelled"})+# Run statuses that mean the run is over. A run that ended is no longer spending inference, so it+# holds the report's implementation slot only through the PR it shipped, if it shipped one.+_TERMINAL_RUN_STATUSES = frozenset({"completed", "failed", "cancelled"})_GITHUB_PR_URL_PREFIX = "https://github.com/"+class _ImplementationSlotClaim(StrEnum):+ """Why a report's one implementation slot is still claimed."""++ IN_FLIGHT = "in_flight"+ SHIPPED_PR = "shipped_pr"++ @property+ def detail(self) -> str:+ """The message the person reads when the claim refuses their action."""+ if self is _ImplementationSlotClaim.SHIPPED_PR:+ return "This report already has a pull request. Open the existing task to continue it."+ return "A pull request run is already in progress for this report. Open the existing task to follow it."++class ReportTaskCapExceeded(Exception):"""A signal report already has its allowance of user-started tasks."""@@ -139,15 +157,44 @@ def signals_task_ids(*, report_id: str, type: str) -> list[str]:]-def _live_implementation_exists(*, team_id: int, report_id: str, exclude_task_id: str | None = None) -> bool:- """Whether the report has an implementation task that still claims its one slot.+def _runs_claim_implementation_slot(+ runs: Sequence[tuple[str | None, object]],+) -> _ImplementationSlotClaim | None:+ """Why one implementation task's runs still claim its slot, or `None` once it released the slot.++ A task with no runs yet claims the slot, because its first run is about to start; an empty+ status marks such a task row, where no run joined. A run that has not reached a terminal+ status claims the slot while it works. A run that shipped a GitHub PR claims it for good,+ because the report is implemented. Everything else is a run that ended with nothing to show,+ so the report can be tried again.++ A shipped PR outranks a live sibling run, because the PR is the more useful thing to send the+ person to.+ """+ has_runs = any(run_status is not None for run_status, _run_pr_url in runs)+ if not has_runs:+ return _ImplementationSlotClaim.IN_FLIGHT+ claim: _ImplementationSlotClaim | None = None+ for run_status, run_pr_url in runs:+ if run_status is None:+ continue+ if isinstance(run_pr_url, str) and run_pr_url.startswith(_GITHUB_PR_URL_PREFIX):+ return _ImplementationSlotClaim.SHIPPED_PR+ if run_status not in _TERMINAL_RUN_STATUSES:+ claim = _ImplementationSlotClaim.IN_FLIGHT+ return claim+++def _implementation_slot_claim(+ *, team_id: int, report_id: str, exclude_task_id: str | None = None+) -> _ImplementationSlotClaim | None:+ """Why the report's one implementation slot is still claimed, or `None` when it is free.Reads the `SignalReportTask` gate rows (not the API-mutable artefact log) and traverses- to runs via the FK, staying behind the tasks public interface like `billing`. A task- releases the slot only when it is deleted or every one of its runs ended failed/cancelled- without shipping a GitHub PR — a task with no runs yet still claims it, and a shipped PR- claims it permanently (the report is implemented). Quota-cancelled implementations delete- their gate rows (`release_quota_cancelled_implementation`), so they never count.+ to runs via the FK, staying behind the tasks public interface like `billing`. Per task, the+ rule is `_runs_claim_implementation_slot`; a deleted task claims nothing. Quota-cancelled+ implementations delete their gate rows (`release_quota_cancelled_implementation`), so they+ never count."""claimants = SignalReportTask.objects.filter(team_id=team_id, report_id=report_id, relationship=TASK_RUN_TYPE_IMPLEMENTATION@@ -158,18 +205,12 @@ def _live_implementation_exists(*, team_id: int, report_id: str, exclude_task_idruns_by_task: dict[str, list[tuple[str | None, object]]] = {}for task_id, status, pr_url in rows:runs_by_task.setdefault(str(task_id), []).append((status, pr_url))- for runs in runs_by_task.values():- has_runs = any(run_status is not None for run_status, _run_pr_url in runs)- if not has_runs:- return True- for run_status, run_pr_url in runs:- if run_status is None:- continue- if run_status not in _TERMINAL_NO_PR_RUN_STATUSES:- return True- if isinstance(run_pr_url, str) and run_pr_url.startswith(_GITHUB_PR_URL_PREFIX):- return True- return False+ claims = {_runs_claim_implementation_slot(runs) for runs in runs_by_task.values()}+ # A shipped PR is the better answer when one task shipped and another is still working.+ for claim in (_ImplementationSlotClaim.SHIPPED_PR, _ImplementationSlotClaim.IN_FLIGHT):+ if claim in claims:+ return claim+ return Nonedef enforce_report_task_cap(*, team_id: int, report_id: str, relationship: str | None) -> None:@@ -191,11 +232,9 @@ def enforce_report_task_cap(*, team_id: int, report_id: str, relationship: str |# The serializer already team-scoped the report; behave as the create path would without a cap.returnif relationship is None or relationship == TASK_RUN_TYPE_IMPLEMENTATION:- if _live_implementation_exists(team_id=team_id, report_id=report_id):- raise ReportTaskCapExceeded(- kind=TASK_RUN_TYPE_IMPLEMENTATION,- detail="A PR task already exists for this report. Open the existing task to continue.",- )+ claim = _implementation_slot_claim(team_id=team_id, report_id=report_id)+ if claim is not None:+ raise ReportTaskCapExceeded(kind=TASK_RUN_TYPE_IMPLEMENTATION, detail=claim.detail)return# Any non-implementation label is a discussion for cap purposes; server-only pipeline labels# can't reach here (the write serializer rejects them) and are excluded from the count.@@ -216,9 +255,9 @@ def enforce_report_implementation_rerun_cap(*, team_id: int, report_id: str, tas"""Re-check the one-live-implementation slot before starting another run of an existing task.`enforce_report_task_cap` guards task *creation*, but a task outlives its runs. An- implementation whose every run ended failed/cancelled without a PR releases its slot, which- lets a second implementation be created for the report — and then running the first one again- would put two live implementations on it, spending unbilled inference twice over.+ implementation whose every run ended without a PR releases its slot, which lets a second+ implementation be created for the report — and then running the first one again would put two+ live implementations on it, spending unbilled inference twice over.Only another task holding the slot blocks: a task reclaiming the slot it released is theordinary "my run failed, try again" path and stays allowed. Non-implementation tasks are@@ -244,11 +283,9 @@ def enforce_report_implementation_rerun_cap(*, team_id: int, report_id: str, tasreport = SignalReport.objects.select_for_update().filter(id=report_id, team_id=team_id).first()if report is None:return- if _live_implementation_exists(team_id=team_id, report_id=report_id, exclude_task_id=task_id):- raise ReportTaskCapExceeded(- kind=TASK_RUN_TYPE_IMPLEMENTATION,- detail="A PR task already exists for this report. Open the existing task to continue.",- )+ claim = _implementation_slot_claim(team_id=team_id, report_id=report_id, exclude_task_id=task_id)+ if claim is not None:+ raise ReportTaskCapExceeded(kind=TASK_RUN_TYPE_IMPLEMENTATION, detail=claim.detail)def record_implementation_task(diff --git a/products/signals/frontend/inbox/components/detail/CreatePrButton.tsx b/products/signals/frontend/inbox/components/detail/CreatePrButton.tsxindex 8bc94221157c..20f34f9408c3 100644--- a/products/signals/frontend/inbox/components/detail/CreatePrButton.tsx+++ b/products/signals/frontend/inbox/components/detail/CreatePrButton.tsx@@ -8,12 +8,20 @@ import { LemonTextArea } from 'lib/lemon-ui/LemonTextArea'import { captureInboxReportAction } from '../../inboxAnalytics'import { inboxTaskKickoffLogic } from '../../inboxTaskKickoffLogic'-import { inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'+import { ImplementationSlotClaim, inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'import { SignalReport } from '../../types'// Same string desktop uses, so the note reads the same on both surfaces.const PLACEHOLDER = 'Add direction for the agent (optional)…'+// A report funds one implementation at a time. The two claims send the reader to the same task but+// for different reasons, so they read differently: one run is still working, the other already+// shipped the PR.+const SLOT_CLAIM_DISABLED_REASON: Record<ImplementationSlotClaim, string> = {+ in_flight: 'A pull request run is already in progress for this report. Open it in the task log to follow it.',+ shipped_pr: 'This report already has a pull request. Open it in the task log to continue it.',+}+/*** The detail-pane "Create PR" action, as a split button.*@@ -29,20 +37,18 @@ const PLACEHOLDER = 'Add direction for the agent (optional)…'export function CreatePrButton({ report }: { report: SignalReport }): JSX.Element {const { isCreatingPr, aiConsentDisabledReason } = useValues(inboxTaskKickoffLogic)// Already mounted by `ReportDetail`, so this reads the loaded value rather than starting a fetch.- const { hasLiveImplementationTask } = useValues(inboxReportDetailLogic({ reportId: report.id, report }))+ const { implementationSlotClaim } = useValues(inboxReportDetailLogic({ reportId: report.id, report }))const { createPrFromReport } = useActions(inboxTaskKickoffLogic)const [feedback, setFeedback] = useState('')const disabledReason =aiConsentDisabledReason ??- (hasLiveImplementationTask- ? 'A PR task already exists for this report. Open it in the task log to continue.'- : undefined)+ (implementationSlotClaim ? SLOT_CLAIM_DISABLED_REASON[implementationSlotClaim] : undefined)const submit = (note: string): void => {// Enter submits straight from the textarea, so it never sees the button's `disabledReason`.// Each guard has to hold here too, or a keypress starts a paid run anyway.- if (isCreatingPr || hasLiveImplementationTask) {+ if (isCreatingPr || implementationSlotClaim) {return}if (aiConsentDisabledReason) {diff --git a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.ts b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.tsindex f9188badf609..b8028bd6a00d 100644--- a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.ts+++ b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.ts@@ -8,40 +8,52 @@ import { TaskRunStatus } from 'products/posthog_ai/frontend/types/taskTypes'import { ReportTaskPurpose } from '../components/detail/artefactTypes'import { SignalReport } from '../types'-import { ReportTaskEntry, hasLiveImplementationTask, inboxReportDetailLogic } from './inboxReportDetailLogic'+import { ReportTaskEntry, implementationSlotClaim, inboxReportDetailLogic } from './inboxReportDetailLogic'const REPORT = { id: 'report-1', status: 'ready', title: 'Checkout errors spiked' } as unknown as SignalReport-const linkedTask = (purpose: ReportTaskPurpose, status: TaskRunStatus | null): ReportTaskEntry =>+const linkedTask = (purpose: ReportTaskPurpose, status: TaskRunStatus | null, prUrl?: string): ReportTaskEntry =>({- task: { latest_run: status ? { status } : null },+ task: { latest_run: status ? { status, output: prUrl ? { pr_url: prUrl } : undefined } : null },purpose,purposeLabel: purpose,startedAt: '2026-01-01T00:00:00Z',}) as unknown as ReportTaskEntrydescribe('inboxReportDetailLogic', () => {- describe('hasLiveImplementationTask', () => {- // Only `failed` and `cancelled` hand the report's implementation slot back server-side, so a- // completed or still-running task has to keep the action disabled. Reusing the logic's- // TERMINAL_RUN_STATUSES (which includes `completed`) is the tempting mistake these rows catch:- // it would offer a second PR the server answers with a 429.+ describe('implementationSlotClaim', () => {+ // The claim has to match `_implementation_slot_claim` server-side, or the Create PR action+ // greys out on a report the server would accept. The `completed` rows are the ones that+ // matter: a run that stops without a PR (the agent judged the fix wrong) hands the slot+ // back, so the retry must stay offered.it.each([- { label: 'a task with no run yet', status: null, holdsSlot: true },- { label: 'a not-started run', status: TaskRunStatus.NOT_STARTED, holdsSlot: true },- { label: 'a queued run', status: TaskRunStatus.QUEUED, holdsSlot: true },- { label: 'a run in progress', status: TaskRunStatus.IN_PROGRESS, holdsSlot: true },- { label: 'a completed run', status: TaskRunStatus.COMPLETED, holdsSlot: true },- { label: 'a failed run', status: TaskRunStatus.FAILED, holdsSlot: false },- { label: 'a cancelled run', status: TaskRunStatus.CANCELLED, holdsSlot: false },- ])('$label holds the report implementation slot: $holdsSlot', ({ status, holdsSlot }) => {- expect(hasLiveImplementationTask([linkedTask('implementation', status)])).toBe(holdsSlot)+ { label: 'a task with no run yet', status: null, prUrl: undefined, claim: 'in_flight' },+ { label: 'a not-started run', status: TaskRunStatus.NOT_STARTED, prUrl: undefined, claim: 'in_flight' },+ { label: 'a queued run', status: TaskRunStatus.QUEUED, prUrl: undefined, claim: 'in_flight' },+ { label: 'a run in progress', status: TaskRunStatus.IN_PROGRESS, prUrl: undefined, claim: 'in_flight' },+ { label: 'a completed run with no PR', status: TaskRunStatus.COMPLETED, prUrl: undefined, claim: null },+ { label: 'a failed run', status: TaskRunStatus.FAILED, prUrl: undefined, claim: null },+ { label: 'a cancelled run', status: TaskRunStatus.CANCELLED, prUrl: undefined, claim: null },+ {+ label: 'a completed run that shipped a PR',+ status: TaskRunStatus.COMPLETED,+ prUrl: 'https://github.com/acme/web/pull/1',+ claim: 'shipped_pr',+ },+ {+ label: 'a failed run that shipped a PR',+ status: TaskRunStatus.FAILED,+ prUrl: 'https://github.com/acme/web/pull/1',+ claim: 'shipped_pr',+ },+ ])('$label claims the report implementation slot: $claim', ({ status, prUrl, claim }) => {+ expect(implementationSlotClaim([linkedTask('implementation', status, prUrl)])).toBe(claim)})it('ignores tasks that are not implementations, and an unloaded list', () => {- expect(hasLiveImplementationTask([linkedTask('research', TaskRunStatus.IN_PROGRESS)])).toBe(false)- expect(hasLiveImplementationTask([linkedTask('other', TaskRunStatus.IN_PROGRESS)])).toBe(false)- expect(hasLiveImplementationTask(null)).toBe(false)+ expect(implementationSlotClaim([linkedTask('research', TaskRunStatus.IN_PROGRESS)])).toBeNull()+ expect(implementationSlotClaim([linkedTask('other', TaskRunStatus.IN_PROGRESS)])).toBeNull()+ expect(implementationSlotClaim(null)).toBeNull()})})diff --git a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.tsindex 0c97fea3a4dc..1757004d403d 100644--- a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts+++ b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts@@ -75,11 +75,8 @@ import { ChartPlacements, resolveChartPlacements } from '../utils/chartPlacement/** Run statuses that count as terminal. Mirrors desktop `isTerminalStatus` / `ReportTasksSection`. */const TERMINAL_RUN_STATUSES: TaskRunStatus[] = [TaskRunStatus.COMPLETED, TaskRunStatus.FAILED, TaskRunStatus.CANCELLED]-// A report funds one implementation task at a time, enforced server-side by-// `_live_implementation_exists` in products/signals/backend/task_run_artefacts.py. Only a failed or-// cancelled run hands the slot back there, so `completed` is deliberately absent: reusing-// TERMINAL_RUN_STATUSES here would offer a second PR the server then refuses.-const IMPLEMENTATION_SLOT_RELEASING_STATUSES: TaskRunStatus[] = [TaskRunStatus.FAILED, TaskRunStatus.CANCELLED]+/** Why the report's one implementation slot is still claimed. Mirrors the server's `_ImplementationSlotClaim`. */+export type ImplementationSlotClaim = 'in_flight' | 'shipped_pr'// The task↔report association is the `task_run` artefact log now (the legacy `/tasks/` endpoint is// gone), and the activity timeline renders the whole log. Pull a generous page so early entries@@ -105,28 +102,39 @@ export interface ReportTaskEntry {}/**- * Whether an implementation task still holds this report's single implementation slot, which makes a- * manual "Create PR" fail with a `signal_report_task_cap` 429.+ * Why an implementation task still holds this report's single implementation slot, or `null` when+ * the slot is free. A claim makes a manual "Create PR" fail with a `signal_report_task_cap` 429.*- * Approximates the server predicate with what the client has: only `latest_run` rather than every- * run, and a shipped PR is read off the report instead (`hasImplementationPr`). Unloaded tasks read- * as no live implementation, so a cold load leaves the action enabled and the 429 stays the backstop- * rather than blocking a legitimate first press.+ * Mirrors `_implementation_slot_claim` in products/signals/backend/task_run_artefacts.py: a run+ * that has not settled holds the slot while it works, a run that shipped a PR holds it for good,+ * and a run that ended with no PR hands it back. Approximates the server with what the client has,+ * which is only `latest_run` rather than every run. Unloaded tasks read as no claim, so a cold load+ * leaves the action enabled and the 429 stays the backstop rather than blocking a legitimate first+ * press.*/-export function hasLiveImplementationTask(reportTasks: ReportTaskEntry[] | null): boolean {- return (reportTasks ?? []).some(- (entry) =>- entry.purpose === 'implementation' &&- !IMPLEMENTATION_SLOT_RELEASING_STATUSES.includes(entry.task.latest_run?.status ?? TaskRunStatus.NOT_STARTED)- )+export function implementationSlotClaim(reportTasks: ReportTaskEntry[] | null): ImplementationSlotClaim | null {+ let claim: ImplementationSlotClaim | null = null+ for (const entry of reportTasks ?? []) {+ if (entry.purpose !== 'implementation') {+ continue+ }+ // A shipped PR is the better answer when one task shipped and another is still working.+ if (getTaskPrUrl(entry.task)) {+ return 'shipped_pr'+ }+ if (!TERMINAL_RUN_STATUSES.includes(entry.task.latest_run?.status ?? TaskRunStatus.NOT_STARTED)) {+ claim = 'in_flight'+ }+ }+ return claim}/*** Whether an implementation run is still moving, which is what the Create PR gate waits on.*- * Unlike `hasLiveImplementationTask` this counts `completed` as settled, because a completed run- * holds the report's slot for good and no later change can hand it back. Reusing the slot predicate- * here would leave the poll running forever on a finished implementation.+ * Unlike `implementationSlotClaim` this ignores the PR a settled run shipped, because a shipped PR+ * is not going to change on its own. Reusing the slot predicate here would leave the poll running+ * forever on a finished implementation.*/export function implementationRunInFlight(reportTasks: ReportTaskEntry[] | null): boolean {return (reportTasks ?? []).some(@@ -254,8 +262,8 @@ export interface inboxReportDetailLogicValues {feedbackNoteSubmitting: booleanfeedbackSentiment: InboxReportFeedbackSentiment | nullhasImplementationPr: boolean- hasLiveImplementationTask: booleanhasPersonalGithub: boolean+ implementationSlotClaim: ImplementationSlotClaim | nullinlineThreadCount: numberinlineThreadsByFile: Record<string, ReviewThread[]>isReResearch: boolean@@ -545,7 +553,7 @@ export interface inboxReportDetailLogicMeta {user: null | import('~/types').UserType) => AvailableReviewerOption[]isReResearch: (reportTasks: ReportTaskEntry[] | null) => boolean- hasLiveImplementationTask: (reportTasks: ReportTaskEntry[] | null) => boolean+ implementationSlotClaim: (reportTasks: ReportTaskEntry[] | null) => ImplementationSlotClaim | nullprimaryTask: (reportTasks: ReportTaskEntry[] | null) => ReportTaskEntry | nullselectedTask: (reportTasks: ReportTaskEntry[] | null,@@ -1152,9 +1160,10 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([return hasInFlight && hasPriorTerminal},],- hasLiveImplementationTask: [+ implementationSlotClaim: [(s) => [s.reportTasks],- (reportTasks: ReportTaskEntry[] | null): boolean => hasLiveImplementationTask(reportTasks),+ (reportTasks: ReportTaskEntry[] | null): ImplementationSlotClaim | null =>+ implementationSlotClaim(reportTasks),],// The default task whose run log is shown: prefer one still in motion, tie-break by most-recent// link. Mirrors desktop `AgentRunDetail`'s `pickPrimaryTask`.diff --git a/products/tasks/backend/tests/test_api.py b/products/tasks/backend/tests/test_api.pyindex 510181e97130..bb11fe16090c 100644--- a/products/tasks/backend/tests/test_api.py+++ b/products/tasks/backend/tests/test_api.py@@ -2181,24 +2181,41 @@ class TestTaskAPI(BaseTaskAPITest):@parameterized.expand([- # a live implementation claims the report's one slot- ("created_never_run", [], False, status.HTTP_429_TOO_MANY_REQUESTS),- ("run_in_progress", [("in_progress", None)], False, status.HTTP_429_TOO_MANY_REQUESTS),- ("run_completed", [("completed", None)], False, status.HTTP_429_TOO_MANY_REQUESTS),+ # a live implementation claims the report's one slot, and the message says it is live+ ("created_never_run", [], False, status.HTTP_429_TOO_MANY_REQUESTS, "already in progress"),+ (+ "run_in_progress",+ [("in_progress", None)],+ False,+ status.HTTP_429_TOO_MANY_REQUESTS,+ "already in progress",+ ),+ # a shipped PR claims the slot for good, whatever status the run that shipped it ended on("failed_but_pr_shipped",[("failed", "https://github.com/acme/web/pull/1")],False,status.HTTP_429_TOO_MANY_REQUESTS,+ "already has a pull request",+ ),+ (+ "completed_and_pr_shipped",+ [("completed", "https://github.com/acme/web/pull/1")],+ False,+ status.HTTP_429_TOO_MANY_REQUESTS,+ "already has a pull request",),- # only a fully dead prior implementation (or a deleted task) releases the slot- ("all_runs_failed", [("failed", None), ("failed", None)], False, status.HTTP_201_CREATED),- ("run_cancelled_no_pr", [("cancelled", None)], False, status.HTTP_201_CREATED),- ("prior_task_deleted", [("in_progress", None)], True, status.HTTP_201_CREATED),+ # a prior implementation that ended with nothing to show (or a deleted task) releases it.+ # `completed` counts: the agent stops without a PR when the fix would be wrong, and that+ # used to lock the report out of ever being tried again.+ ("all_runs_failed", [("failed", None), ("failed", None)], False, status.HTTP_201_CREATED, None),+ ("run_cancelled_no_pr", [("cancelled", None)], False, status.HTTP_201_CREATED, None),+ ("run_completed_no_pr", [("completed", None)], False, status.HTTP_201_CREATED, None),+ ("prior_task_deleted", [("in_progress", None)], True, status.HTTP_201_CREATED, None),])def test_second_implementation_task_per_report_gated_on_prior_state(- self, _name, run_specs, prior_deleted, expected_status+ self, _name, run_specs, prior_deleted, expected_status, expected_detail):from products.signals.backend.models import SignalReport@@ -2210,6 +2227,7 @@ class TestTaskAPI(BaseTaskAPITest):self.assertEqual(response.status_code, expected_status)if expected_status == status.HTTP_429_TOO_MANY_REQUESTS:self.assertEqual(response.json()["code"], "signal_report_task_cap")+ self.assertIn(expected_detail, response.json()["error"])self.assertFalse(Task.objects.filter(title="Report task").exists())@parameterized.expand(