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(workflows): let a person say why they rejected a suggestion (#111395)

Daniel Marchuk5677cf6fa6de
diff --git a/products/signals/skills/signals-scout-workflows/SKILL.md b/products/signals/skills/signals-scout-workflows/SKILL.md
index 9159bde97f26..5d3fb3cfb3e4 100644
--- a/products/signals/skills/signals-scout-workflows/SKILL.md
+++ b/products/signals/skills/signals-scout-workflows/SKILL.md
@@ -60,6 +60,7 @@ Never suggest against a workflow that is not on this list — the API refuses it
A workflow with a suggestion still `suggested` is waiting on a person, not on you.
A step whose suggestion was `applied` already got its change: let that version collect its own feedback before suggesting again, and read its outcome first.
A step whose suggestion was `rejected` is a human saying no: do not re-file the same idea in different words.
+ Read its `rejection_reason` when there is one. It says why, and a reason about what the step is for rules out every change aimed at the same metric on that step, not only the one rejected.
A rejected suggestion stays rejected however many times the workflow is published since: `is_stale` reads against the version live now, not against the version the person was looking at, so it cannot tell you the idea went unjudged.
### Read the numbers
@@ -161,7 +162,7 @@ Closing out with a finding you never tried to file wastes the run.
Write scratchpad entries for what should change your next run:
- `noise:<workflow>:<step>` — a step you looked at and ruled out, with why (sample, untracked share, deliverability).
-- `rejected:<workflow>:<step>` — a human rejected a suggestion for this step.
+- `rejected:<workflow>:<step>` — a human rejected a suggestion for this step, with their reason when they gave one.
Include what you suggested, and whether it was behind the live version when they rejected it, so a later run can tell a no from a clear-out.
- `baseline:<workflow>:<step>` — the open rate you saw, so a later run can tell a real move from noise.
diff --git a/products/workflows/backend/facade/contracts.py b/products/workflows/backend/facade/contracts.py
index 1551940ae2d0..4baf7da54f49 100644
--- a/products/workflows/backend/facade/contracts.py
+++ b/products/workflows/backend/facade/contracts.py
@@ -611,6 +611,7 @@ class WorkflowProposalRecord:
resolved_at: datetime | None
resolved_by: "User | None"
applied_version: int | None
+ rejection_reason: str
@frozen
diff --git a/products/workflows/backend/migrations/0030_workflowproposal_rejection_reason.py b/products/workflows/backend/migrations/0030_workflowproposal_rejection_reason.py
new file mode 100644
index 000000000000..27b55c963e51
--- /dev/null
+++ b/products/workflows/backend/migrations/0030_workflowproposal_rejection_reason.py
@@ -0,0 +1,22 @@
+# Generated by Django 5.2.17 on 2026-10-03 18:29
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("workflows", "0029_seal_reverse_accessors"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="workflowproposal",
+ name="rejection_reason",
+ field=models.TextField(
+ blank=True,
+ db_default="",
+ default="",
+ help_text="Why the person who rejected this said no. The producer reads it before suggesting again.",
+ ),
+ ),
+ ]
diff --git a/products/workflows/backend/migrations/max_migration.txt b/products/workflows/backend/migrations/max_migration.txt
index fbaf18d9c3f4..3434c9359664 100644
--- a/products/workflows/backend/migrations/max_migration.txt
+++ b/products/workflows/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0029_seal_reverse_accessors
+0030_workflowproposal_rejection_reason
diff --git a/products/workflows/backend/models/workflow_proposal.py b/products/workflows/backend/models/workflow_proposal.py
index 71dc6ad1c417..4b25f0c008e5 100644
--- a/products/workflows/backend/models/workflow_proposal.py
+++ b/products/workflows/backend/models/workflow_proposal.py
@@ -99,6 +99,12 @@ class WorkflowProposal(TeamScopedRootMixin, UUIDModel):
applied_version = models.IntegerField(
null=True, blank=True, help_text="Workflow version the approved change went live as."
)
+ rejection_reason = models.TextField(
+ blank=True,
+ default="",
+ db_default="",
+ help_text="Why the person who rejected this said no. The producer reads it before suggesting again.",
+ )
def save(self, *args: Any, **kwargs: Any) -> None:
# Mirrors the workflow's team, as HogFlowRevision does: fail-closed reads filter on this row's team_id.
diff --git a/products/workflows/backend/presentation/views/hog_flow.py b/products/workflows/backend/presentation/views/hog_flow.py
index 4afda0454d0c..439e78b8dac4 100644
--- a/products/workflows/backend/presentation/views/hog_flow.py
+++ b/products/workflows/backend/presentation/views/hog_flow.py
@@ -3647,6 +3647,10 @@ class WorkflowProposalSerializer(serializers.Serializer):
applied_version = serializers.IntegerField(
read_only=True, allow_null=True, help_text="Workflow version the approved change went live as."
)
+ rejection_reason = serializers.CharField(
+ read_only=True,
+ help_text="Why the person who rejected this suggestion rejected it, or empty when they gave no reason.",
+ )
@extend_schema_field(serializers.BooleanField)
def get_is_stale(self, proposal: WorkflowProposalRecord) -> bool:
@@ -3787,7 +3791,15 @@ class WorkflowProposalApproveRequestSerializer(serializers.Serializer):
class WorkflowProposalRejectRequestSerializer(serializers.Serializer):
- """Rejecting takes no body today. The serializer stays so a reason can be added without a new endpoint."""
+ reason = serializers.CharField(
+ required=False,
+ allow_blank=True,
+ max_length=2000,
+ help_text=(
+ "Why this suggestion is wrong for this workflow, in a sentence. Optional. The producer reads "
+ "it before suggesting again, so a reason stops the same idea coming back in other words."
+ ),
+ )
def _flatten_graph_errors(error: serializers.ValidationError) -> list[str]:
@@ -5450,6 +5462,7 @@ class HogFlowViewSet(
proposal_id=locked_proposal.id,
status=WorkflowProposalStatus.REJECTED,
resolved_by_id=request.user.pk if request.user.is_authenticated else None,
+ rejection_reason=param_serializer.validated_data.get("reason", "").strip(),
)
self._log_activity(instance.id, instance.name, "proposal_rejected")
diff --git a/products/workflows/backend/services/workflow_proposals.py b/products/workflows/backend/services/workflow_proposals.py
index 58133186d378..45d21de4a6e1 100644
--- a/products/workflows/backend/services/workflow_proposals.py
+++ b/products/workflows/backend/services/workflow_proposals.py
@@ -55,12 +55,20 @@ def _to_record(proposal: WorkflowProposal) -> WorkflowProposalRecord:
resolved_at=proposal.resolved_at,
resolved_by=proposal.resolved_by,
applied_version=proposal.applied_version,
+ rejection_reason=proposal.rejection_reason,
)
def _proposals(hog_flow_id: UUID, status: str | None) -> QuerySet[WorkflowProposal]:
- applied_only = status == WorkflowProposal.Status.APPLIED
- ordering = ("-applied_version", "-created_at", "-pk") if applied_only else ("-created_at", "-pk")
+ # Applied ones order by the version that shipped them and rejected ones by when they were rejected,
+ # since either can happen long after filing; the rest read as a queue, newest first.
+ # `-pk` breaks ties so OFFSET/LIMIT pages neither repeat nor skip a proposal.
+ if status == WorkflowProposal.Status.APPLIED:
+ ordering: tuple[str, ...] = ("-applied_version", "-created_at", "-pk")
+ elif status == WorkflowProposal.Status.REJECTED:
+ ordering = ("-resolved_at", "-created_at", "-pk")
+ else:
+ ordering = ("-created_at", "-pk")
queryset = WorkflowProposal.objects.filter(hog_flow_id=hog_flow_id).order_by(*ordering)
if status:
queryset = queryset.filter(status=status)
@@ -129,13 +137,19 @@ def lock_proposal(*, team_id: int, proposal_id: UUID) -> WorkflowProposalRecord:
def resolve_proposal(
- *, team_id: int, proposal_id: UUID, status: WorkflowProposalStatus, resolved_by_id: int | None
+ *,
+ team_id: int,
+ proposal_id: UUID,
+ status: WorkflowProposalStatus,
+ resolved_by_id: int | None,
+ rejection_reason: str = "",
) -> WorkflowProposalRecord:
proposal = WorkflowProposal.objects.get(team_id=team_id, id=proposal_id)
proposal.status = status
proposal.resolved_at = timezone.now()
proposal.resolved_by_id = resolved_by_id
- proposal.save(update_fields=["status", "resolved_at", "resolved_by"])
+ proposal.rejection_reason = rejection_reason
+ proposal.save(update_fields=["status", "resolved_at", "resolved_by", "rejection_reason"])
return _to_record(proposal)
diff --git a/products/workflows/backend/tests/api/test_workflow_proposals.py b/products/workflows/backend/tests/api/test_workflow_proposals.py
index cf2927b4f19a..e9c84e32b215 100644
--- a/products/workflows/backend/tests/api/test_workflow_proposals.py
+++ b/products/workflows/backend/tests/api/test_workflow_proposals.py
@@ -1,4 +1,5 @@
import json
+from datetime import UTC, datetime
from types import SimpleNamespace
from typing import Any
@@ -1322,35 +1323,68 @@ class TestWorkflowProposals(APIBaseTest):
assert "proposal_approved" in activities
assert "proposal_rejected" in activities
- def test_applied_suggestions_are_listed_by_the_version_that_carried_them(self, _mock_flag):
+ @parameterized.expand(
+ [
+ (
+ "with a reason",
+ {"reason": " This is the sign-off email, it is not meant to convert. "},
+ "This is the sign-off email, it is not meant to convert.",
+ ),
+ ("without a body", {}, ""),
+ ]
+ )
+ def test_the_producer_reads_why_a_suggestion_was_rejected(self, _mock_flag, _name: str, body: dict, expected: str):
flow_id = self._create_active_flow()
- flow = HogFlow.objects.get(id=flow_id)
- written_first = WorkflowProposal(
- hog_flow=flow,
- team=self.team,
- title="Written first, shipped last",
- rationale="Approved after the other one had already shipped.",
- content={"exit_condition": "exit_on_conversion"},
- base_version=1,
- status=WorkflowProposal.Status.APPLIED,
- applied_version=3,
+ proposal = self._propose(flow_id)
+
+ rejected = self.client.post(
+ f"/api/projects/{self.team.id}/hog_flows/{flow_id}/proposals/{proposal['id']}/reject/", body, format="json"
)
- written_first.save()
- written_last = WorkflowProposal(
- hog_flow=flow,
- team=self.team,
- title="Written last, shipped first",
- rationale="Approved and published before the other one.",
- content={"exit_condition": "exit_on_conversion"},
- base_version=1,
- status=WorkflowProposal.Status.APPLIED,
- applied_version=2,
+ assert rejected.status_code == 200, rejected.json()
+ self.client.logout()
+
+ listed = self.client.get(
+ f"/api/projects/{self.team.id}/hog_flows/{flow_id}/proposals/?status=rejected",
+ headers={"authorization": f"Bearer {self.producer_key}"},
)
- written_last.save()
+ assert listed.status_code == 200, listed.json()
+ assert [row["rejection_reason"] for row in listed.json()["results"]] == [expected]
+
+ @parameterized.expand(
+ [
+ ("applied", WorkflowProposal.Status.APPLIED, [{"applied_version": v} for v in (3, 4, 2)]),
+ (
+ "rejected",
+ WorkflowProposal.Status.REJECTED,
+ [{"resolved_at": datetime(2026, 5, day, tzinfo=UTC)} for day in (3, 4, 2)],
+ ),
+ ]
+ )
+ def test_resolved_suggestions_are_listed_by_when_they_were_resolved(
+ self, _mock_flag, status: str, kind: str, resolutions: list[dict]
+ ):
+ flow = HogFlow.objects.get(id=self._create_active_flow())
+ proposals = []
+ for index, resolution in enumerate(resolutions):
+ proposal = WorkflowProposal(
+ hog_flow=flow,
+ team=self.team,
+ title=f"Written {index + 1}",
+ rationale="Resolved out of filing order.",
+ content={"exit_condition": "exit_on_conversion"},
+ base_version=1,
+ status=kind,
+ **resolution,
+ )
+ proposal.save()
+ WorkflowProposal.objects.for_team(self.team.id).filter(id=proposal.id).update(
+ created_at=datetime(2026, 5, 1, index, tzinfo=UTC)
+ )
+ proposals.append(proposal)
- listed = self.client.get(f"/api/projects/{self.team.id}/hog_flows/{flow_id}/proposals/?status=applied&limit=1")
+ listed = self.client.get(f"/api/projects/{self.team.id}/hog_flows/{flow.id}/proposals/?status={status}")
assert listed.status_code == 200, listed.json()
- assert [row["id"] for row in listed.json()["results"]] == [str(written_first.id)]
+ assert [row["id"] for row in listed.json()["results"]] == [str(proposals[i].id) for i in (1, 0, 2)]
@patch("products.workflows.backend.presentation.views.hog_flow.posthoganalytics.feature_enabled", return_value=False)
diff --git a/products/workflows/frontend/Workflows/suggestions/workflowProposalsLogic.test.ts b/products/workflows/frontend/Workflows/suggestions/workflowProposalsLogic.test.ts
index ea539573c355..ae02e01dc167 100644
--- a/products/workflows/frontend/Workflows/suggestions/workflowProposalsLogic.test.ts
+++ b/products/workflows/frontend/Workflows/suggestions/workflowProposalsLogic.test.ts
@@ -8,7 +8,7 @@ import { initKeaTests } from '~/test/init'
import { workflowLogic } from '../workflowLogic'
import { workflowProposalsLogic } from './workflowProposalsLogic'
-jest.mock('lib/lemon-ui/LemonDialog', () => ({ LemonDialog: { open: jest.fn() } }))
+jest.mock('lib/lemon-ui/LemonDialog', () => ({ LemonDialog: { open: jest.fn(), openForm: jest.fn() } }))
const confirmTheDialog = (): void => {
const call = (LemonDialog.open as jest.Mock).mock.calls.at(-1)
@@ -23,6 +23,7 @@ describe('workflowProposalsLogic', () => {
let logic: ReturnType<typeof workflowProposalsLogic.build>
let approveBodies: Record<string, any>[]
let rejectedList: Record<string, any>[]
+ let rejectBodies: Record<string, any>[]
let approveStatus: number
let proposalsListStatus: number
let workflowVersion: number
@@ -49,6 +50,7 @@ describe('workflowProposalsLogic', () => {
beforeEach(() => {
approveBodies = []
rejectedList = []
+ rejectBodies = []
approveStatus = 200
proposalsListStatus = 200
workflowVersion = 3
@@ -87,7 +89,8 @@ describe('workflowProposalsLogic', () => {
approveBodies.push((await request.json()) as Record<string, any>)
return [approveStatus, approveStatus === 200 ? proposal : { code: 'stale_update' }]
},
- '/api/projects/:team_id/hog_flows/:id/proposals/:proposal_id/reject/': () => {
+ '/api/projects/:team_id/hog_flows/:id/proposals/:proposal_id/reject/': async ({ request }) => {
+ rejectBodies.push((await request.json()) as Record<string, any>)
const rejected = { ...proposal, status: 'rejected', resolved_at: '2026-05-03T00:00:00.000Z' }
rejectedList.push(rejected)
return [200, rejected]
@@ -245,10 +248,21 @@ describe('workflowProposalsLogic', () => {
logic.actions.setResolvingId(PROPOSAL_ID)
logic.actions.confirmApproveProposal(PROPOSAL_ID, DRAFT_STAMP)
- logic.actions.confirmRejectProposal(PROPOSAL_ID)
+ logic.actions.confirmRejectProposal(PROPOSAL_ID, '')
await expectLogic(logic).toFinishAllListeners()
expect(approveBodies).toEqual([])
+ expect(rejectBodies).toEqual([])
+ })
+
+ it('rejecting sends the reason the person gave', async () => {
+ await expectLogic(logic).toDispatchActions(['loadProposalsSuccess'])
+
+ await expectLogic(logic, () => {
+ logic.actions.confirmRejectProposal(PROPOSAL_ID, ' It is the sign-off email. ')
+ }).toDispatchActions(['removeResolvedProposal'])
+
+ expect(rejectBodies).toEqual([{ reason: 'It is the sign-off email.' }])
})
it('rejecting moves the suggestion into the rejected list, most recently rejected first', async () => {
@@ -266,9 +280,24 @@ describe('workflowProposalsLogic', () => {
expect(logic.values.rejectedProposals.map((p) => p.id)).toEqual(['rejected-earlier'])
await expectLogic(logic, () => {
- logic.actions.confirmRejectProposal(PROPOSAL_ID)
+ logic.actions.confirmRejectProposal(PROPOSAL_ID, '')
}).toDispatchActions(['removeResolvedProposal', 'loadRejected', 'loadRejectedSuccess'])
expect(logic.values.rejectedProposals.map((p) => p.id)).toEqual([PROPOSAL_ID, 'rejected-earlier'])
})
+
+ it('reopens the reject dialog with the reason when the request fails', async () => {
+ useMocks({
+ post: { '/api/projects/:team_id/hog_flows/:id/proposals/:proposal_id/reject/': () => [500, {}] },
+ })
+ await expectLogic(logic).toDispatchActions(['loadProposalsSuccess'])
+ ;(LemonDialog.openForm as jest.Mock).mockClear()
+
+ logic.actions.confirmRejectProposal(PROPOSAL_ID, 'It is the sign-off email.')
+ await expectLogic(logic).toFinishAllListeners()
+
+ expect((LemonDialog.openForm as jest.Mock).mock.calls.at(-1)[0].initialValues).toEqual({
+ reason: 'It is the sign-off email.',
+ })
+ })
})
diff --git a/products/workflows/frontend/Workflows/suggestions/workflowProposalsLogic.ts b/products/workflows/frontend/Workflows/suggestions/workflowProposalsLogic.tsx
similarity index 92%
rename from products/workflows/frontend/Workflows/suggestions/workflowProposalsLogic.ts
rename to products/workflows/frontend/Workflows/suggestions/workflowProposalsLogic.tsx
index f3c2371d716c..d9bc24cd48c3 100644
--- a/products/workflows/frontend/Workflows/suggestions/workflowProposalsLogic.ts
+++ b/products/workflows/frontend/Workflows/suggestions/workflowProposalsLogic.tsx
@@ -3,6 +3,8 @@ import { loaders } from 'kea-loaders'
import { ApiError } from 'lib/api'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
+import { LemonField } from 'lib/lemon-ui/LemonField'
+import { LemonTextArea } from 'lib/lemon-ui/LemonTextArea'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { teamLogic } from 'scenes/teamLogic'
@@ -81,8 +83,12 @@ export interface workflowProposalsLogicActions {
expectedDraftUpdatedAt: string | null
proposalId: string
}
- confirmRejectProposal: (proposalId: string) => {
+ confirmRejectProposal: (
+ proposalId: string,
+ reason: string
+ ) => {
proposalId: string
+ reason: string
}
loadApplied: () => any
loadAppliedFailure: (
@@ -162,8 +168,12 @@ export interface workflowProposalsLogicActions {
rejectedResponse: PaginatedWorkflowProposalListApi
payload?: any
}
- rejectProposal: (proposalId: string) => {
+ rejectProposal: (
+ proposalId: string,
+ reason?: string
+ ) => {
proposalId: string
+ reason: string | undefined
}
reloadLists: () => {
value: true
@@ -256,8 +266,8 @@ export const workflowProposalsLogic = kea<workflowProposalsLogicType>([
proposalId,
expectedDraftUpdatedAt,
}),
- rejectProposal: (proposalId: string) => ({ proposalId }),
- confirmRejectProposal: (proposalId: string) => ({ proposalId }),
+ rejectProposal: (proposalId: string, reason?: string) => ({ proposalId, reason }),
+ confirmRejectProposal: (proposalId: string, reason: string) => ({ proposalId, reason }),
removeResolvedProposal: (proposalId: string) => ({ proposalId }),
setResolvingId: (proposalId: string | null, action: 'approve' | 'reject' | null = null) => ({
proposalId,
@@ -549,30 +559,39 @@ export const workflowProposalsLogic = kea<workflowProposalsLogicType>([
actions.setResolvingId(null)
}
},
- rejectProposal: ({ proposalId }) => {
+ rejectProposal: ({ proposalId, reason }) => {
if (values.resolvingId !== null) {
return
}
- LemonDialog.open({
+ LemonDialog.openForm({
title: 'Reject this suggestion?',
description: 'It stays in the workflow history as rejected. Nothing changes on the workflow.',
- primaryButton: {
- children: 'Reject',
- status: 'danger',
- onClick: () => actions.confirmRejectProposal(proposalId),
- },
- secondaryButton: {
- children: 'Cancel',
- },
+ initialValues: { reason: reason ?? '' },
+ content: (
+ <LemonField name="reason" label="Why not? (optional)">
+ <LemonTextArea
+ placeholder="For example: this is the last email in the series, so clicks are not its goal"
+ maxLength={2000}
+ // The dialog form submits on Enter, which would reject before the reason is finished.
+ onKeyDown={(e) => e.key === 'Enter' && e.stopPropagation()}
+ data-attr="workflow-suggestion-reject-reason"
+ />
+ </LemonField>
+ ),
+ primaryButtonProps: { children: 'Reject', status: 'danger' },
+ onSubmit: ({ reason }) => actions.confirmRejectProposal(proposalId, reason ?? ''),
})
},
- confirmRejectProposal: async ({ proposalId }) => {
+ confirmRejectProposal: async ({ proposalId, reason }) => {
if (values.resolvingId !== null) {
return
}
actions.setResolvingId(proposalId, 'reject')
+ let retry = false
try {
- await hogFlowsProposalsRejectCreate(String(values.currentTeamIdStrict), props.id, proposalId, {})
+ await hogFlowsProposalsRejectCreate(String(values.currentTeamIdStrict), props.id, proposalId, {
+ reason: reason.trim(),
+ })
lemonToast.success('Suggestion rejected')
actions.removeResolvedProposal(proposalId)
actions.loadProposals()
@@ -585,10 +604,15 @@ export const workflowProposalsLogic = kea<workflowProposalsLogicType>([
actions.loadProposals()
} else {
lemonToast.error('Could not reject this suggestion. Please try again.')
+ retry = true
}
} finally {
actions.setResolvingId(null)
}
+ if (retry) {
+ // Reopen with what they wrote, so a failed request does not cost them the reason.
+ actions.rejectProposal(proposalId, reason)
+ }
},
})),
listeners(({ actions, props, values }) => ({
diff --git a/products/workflows/frontend/generated/api.schemas.ts b/products/workflows/frontend/generated/api.schemas.ts
index 938975ebfb25..645f0f63aaa6 100644
--- a/products/workflows/frontend/generated/api.schemas.ts
+++ b/products/workflows/frontend/generated/api.schemas.ts
@@ -1314,6 +1314,8 @@ export interface WorkflowProposalApi {
* @nullable
*/
readonly applied_version: number | null
+ /** Why the person who rejected this suggestion rejected it, or empty when they gave no reason. */
+ readonly rejection_reason: string
}
export interface PaginatedWorkflowProposalListApi {
@@ -1460,6 +1462,14 @@ export interface WorkflowProposalOutcomeApi {
unavailable_guardrails: string[]
}
+export interface WorkflowProposalRejectRequestApi {
+ /**
+ * Why this suggestion is wrong for this workflow, in a sentence. Optional. The producer reads it before suggesting again, so a reason stops the same idea coming back in other words.
+ * @maxLength 2000
+ */
+ reason?: string
+}
+
export interface HogFlowPublishRequestApi {
/** False (default) previews the publish: returns the impact on people in-flight without changing anything. True applies the staged draft to the live workflow. */
confirm?: boolean
diff --git a/products/workflows/frontend/generated/api.ts b/products/workflows/frontend/generated/api.ts
index cc8e4811e8a2..eac84d04f175 100644
--- a/products/workflows/frontend/generated/api.ts
+++ b/products/workflows/frontend/generated/api.ts
@@ -66,6 +66,7 @@ import type {
WorkflowProposalApproveRequestApi,
WorkflowProposalCreateApi,
WorkflowProposalOutcomeApi,
+ WorkflowProposalRejectRequestApi,
WorkflowStatsRowApi,
} from './api.schemas'
@@ -955,11 +956,14 @@ export const hogFlowsProposalsRejectCreate = async (
projectId: string,
id: string,
proposalId: string,
+ workflowProposalRejectRequestApi?: WorkflowProposalRejectRequestApi,
options?: RequestInit
): Promise<WorkflowProposalApi> => {
return apiMutator<WorkflowProposalApi>(getHogFlowsProposalsRejectCreateUrl(projectId, id, proposalId), {
...options,
method: 'POST',
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
+ body: JSON.stringify(workflowProposalRejectRequestApi),
})
}
diff --git a/products/workflows/frontend/generated/api.zod.ts b/products/workflows/frontend/generated/api.zod.ts
index e05d8aead253..d39f8fd8f1ba 100644
--- a/products/workflows/frontend/generated/api.zod.ts
+++ b/products/workflows/frontend/generated/api.zod.ts
@@ -2554,6 +2554,18 @@ export const HogFlowsProposalsApproveCreateBody = /* @__PURE__ */ zod.object({
),
})
+export const hogFlowsProposalsRejectCreateBodyReasonMax = 2000
+
+export const HogFlowsProposalsRejectCreateBody = /* @__PURE__ */ zod.object({
+ reason: zod
+ .string()
+ .max(hogFlowsProposalsRejectCreateBodyReasonMax)
+ .optional()
+ .describe(
+ 'Why this suggestion is wrong for this workflow, in a sentence. Optional. The producer reads it before suggesting again, so a reason stops the same idea coming back in other words.'
+ ),
+})
+
export const hogFlowsPublishCreateBodyConfirmDefault = false
export const HogFlowsPublishCreateBody = /* @__PURE__ */ zod.object({
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 08ba851a0a12..7b646d2abe56 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -76027,6 +76027,8 @@ export namespace Schemas {
* @nullable
*/
readonly applied_version: number | null;
+ /** Why the person who rejected this suggestion rejected it, or empty when they gave no reason. */
+ readonly rejection_reason: string;
}
export interface PaginatedWorkflowProposalList {
@@ -111637,6 +111639,14 @@ export namespace Schemas {
unavailable_guardrails: string[];
}
+ export interface WorkflowProposalRejectRequest {
+ /**
+ * Why this suggestion is wrong for this workflow, in a sentence. Optional. The producer reads it before suggesting again, so a reason stops the same idea coming back in other words.
+ * @maxLength 2000
+ */
+ reason?: string;
+ }
+
export interface WorkflowRunActivityPoint {
/** Integer run id; unique only together with ci_engine. */
run_id: number;