Skip to content

Commit 51ea2b1

Browse files
committed
fix: prevent user-input activities from leaking into pending approvals projection
Activities with a requestId in their payload (e.g. user-input.requested, user-input.resolved) were incorrectly creating rows in the projection_pending_approvals table. The fall-through default branch in applyPendingApprovalsProjection only checked for approval.resolved and provider.approval.respond.failed before unconditionally upserting a "pending" row for any remaining activity carrying a requestId. This caused threads with answered user-input prompts to permanently display "Pending Approval" in the sidebar, since user-input.resolved never clears the erroneous pending row — only approval.resolved does. Add a kind guard (approval.requested) before the pending-row creation path, consistent with the backfill migration 024 which already filters by kind = 'approval.requested'.
1 parent 5e1dd56 commit 51ea2b1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎apps/server/src/orchestration/Layers/ProjectionPipeline.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,14 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
12841284
}
12851285
return;
12861286
}
1287+
// Only approval-requested activities should create pending-approval
1288+
// rows. Other activity kinds that happen to carry a requestId
1289+
// (e.g. user-input.requested / user-input.resolved) must not
1290+
// pollute this projection — they have their own accounting via
1291+
// derivePendingUserInputCountFromActivities.
1292+
if (event.payload.activity.kind !== "approval.requested") {
1293+
return;
1294+
}
12871295
if (Option.isSome(existingRow) && existingRow.value.status === "resolved") {
12881296
return;
12891297
}

0 commit comments

Comments
 (0)