fix(feedback): isolate delivery route setup

Keep unrelated issue routes independent of the delivery-state read model and publish the operator retry endpoint in OpenAPI.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-08-16 20:05:28 +00:00
1 parent f3b9b221ab
commit f72f5e6ede
3 files changed
+18 -3

No files matched your search

@@ -205,6 +205,9 @@ function registerRouteMocks() {
listIssueVotesForUser: vi.fn(async () => []),
saveIssueVote: vi.fn(async () => ({ vote: null, consentEnabledNow: false, sharingEnabled: false })),
}),
feedbackDeliveryCommentStateService: () => ({
listForIssue: vi.fn(async () => new Map()),
}),
goalService: () => ({}),
heartbeatService: () => mockHeartbeatService,
instanceSettingsService: () => ({
+8 -3
View File
@@ -2767,7 +2767,12 @@ export function issueRoutes(
const goalsSvc = goalService(db);
const issueApprovalsSvc = issueApprovalService(db);
const recoveryActionsSvc = issueRecoveryActionService(db);
const feedbackDeliveryStatesSvc = feedbackDeliveryCommentStateService(db);
// Build this query service only for the two feedback-delivery routes that
// use it. Most issue routes do not read delivery state, so route setup must
// not couple them to this optional read model.
const listFeedbackDeliveryForIssue = (
input: Parameters<ReturnType<typeof feedbackDeliveryCommentStateService>["listForIssue"]>[0],
) => feedbackDeliveryCommentStateService(db).listForIssue(input);
const executionWorkspacesSvc = executionWorkspaceServiceDirect(db);
const workProductsSvc = workProductService(db);
const documentsSvc = documentService(db);
@@ -10779,7 +10784,7 @@ export function issueRoutes(
// banner to act on, and the run reference stays gated behind the same
// board/user authority that guards run detail.
const isOperatorViewer = req.actor.type !== "agent";
const feedbackDeliveryByComment = await feedbackDeliveryStatesSvc.listForIssue({
const feedbackDeliveryByComment = await listFeedbackDeliveryForIssue({
companyId: issue.companyId,
issueId: issue.id,
viewerCanRetry: isOperatorViewer,
@@ -10812,7 +10817,7 @@ export function issueRoutes(
const actor = getActorInfo(req);
const readStates = () =>
feedbackDeliveryStatesSvc.listForIssue({
listFeedbackDeliveryForIssue({
companyId: issue.companyId,
issueId: issue.id,
viewerCanRetry: true,
+7
View File
@@ -6838,6 +6838,13 @@ registerCurrentRoute({
summary: "Retry a scheduled issue run now",
});
registerCurrentRoute({
method: "post",
path: "/api/issues/{id}/feedback-delivery/retry",
tags: ["issues"],
summary: "Retry exhausted human feedback delivery",
});
registerCurrentRoute({
method: "post",
path: "/api/issues/{id}/monitor/check-now",