Service: a live webhook batch that fails in pipeline_sync is dropped after Stripe got a 200
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- postgresql, typescript
- Lĩnh vực
- backend, distributed-systems
Hướng nghiên cứu
Start with the live batching loop in apps/service/src/temporal/workflows/pipeline-lifecycle.ts and the pipelineSync activity in apps/service/src/temporal/activities/pipeline-sync.ts; the issue also points to apps/service/src/tests/workflow.test.ts for the Temporal workflow test setup. Reproduce the failed eof and errored-stream cases with the described stubbed activity, then verify the batch is retried while successful batches still run once. Decide how retries are bounded or delayed, since the issue identifies repeated permanent failures as a risk.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens
POST /webhooks/:pipeline_id verifies the signature, signals the pipeline workflow and answers 200 (app.ts#L973-L1004). The workflow's live loop takes up to 10 events off inputQueue with splice and awaits pipelineSync, but does not look at the eof it returns (pipeline-lifecycle.ts#L83-L101).
A processing failure comes back as a returned eof, not as a thrown error: the engine turns a throw into eof { status: 'failed' } (engine.ts#L695-L712), the Postgres destination reports a flush error as stream_status: error (index.ts#L445-L466), and the activity throws only when there is no eof at all (pipeline-sync.ts#L26). So the activity's retry policy never applies, the batch is not put back, and Stripe does not resend it, because it only retries deliveries that did not get a 2xx (webhooks docs).
An invoice.paid or customer.subscription.deleted that arrives while Postgres restarts or hits max_connections never reaches the table. The weekly reconcile does not repair it: it lists only objects created since the previous backfill (pipeline-lifecycle.ts#L121-L128, src-list-api.ts#L262-L266), so an existing invoice stays open in Postgres.
Reproduction
The workflow code from dev as of 2026-10-20, types stripped and nothing else changed, under @temporalio/testing's local server as in apps/service/src/__tests__/workflow.test.ts. Only the activities are stubbed: pipelineSync returns a failed eof for the first live batch and succeeds afterwards. Then one source_input signal with evt_1, which is what the webhook endpoint sends before answering 200:
https://github.com/terminalstate/callback-audit/tree/main/repro/stripe-sync-engine
dev |
with the change below | |
|---|---|---|
| successful batch (control) | evt_1 processed once |
once |
batch eof status: 'failed' |
evt_1 passed to pipelineSync once, then gone |
processed again |
eof status: 'started' with a stream errored (flush error) |
once, then gone | processed again |
Possible fix
Keep a failed batch instead of dropping it. The change the test runs with puts the events back at the head of the queue and waits before the next attempt:
const { eof } = await pipelineSync(pipelineId, { input: events, run_id: workflowInfo().runId })
operationCount++
const batchFailed =
eof.status === 'failed' ||
Object.values(eof.run_progress.streams).some((stream) => stream.status === 'errored')
if (batchFailed) {
inputQueue.unshift(...events)
await sleep(LIVE_BATCH_RETRY_DELAY)
}
It needs a growing delay or a limit, or an event that always fails is retried forever. The other option is to throw a retryable ApplicationFailure from the activity for a failed live batch, so the existing retry policy handles it.
- Ngôn ngữ chính
- TypeScript
- Star
- 1.1k
- Fork
- 118
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của stripe/sync-engine
-
Typo in GitHub repo descriptionĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
stripe/sync-engine#331 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
stripe/sync-engine#346 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 67/100
stripe/sync-engine#337 · 1 bình luận · 2 reaction ·
-
Canceled subscriptions are not being backfilledCó thể đã có người làm @janpio đã nhận 162 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
stripe/sync-engine#336 · 3 bình luận · 2 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
stripe/sync-engine#332 · 1 bình luận ·
Tất cả issue của stripe/sync-engine
Issue tương tự
-
area:plugins area:security area:skills bug has repro
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
anthropics/claude-code#105911 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
openspec-apply-change skill: when blocked, may select a ready artifact unrelated to missingArtifactsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Fission-AI/OpenSpec#2165 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
🐞 bug 🧐 unconfirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Tencent/tdesign-vue-next#7032 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
gnosis/gnosis_vpn#661 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
content-freshness: staleOwnedContent doc comments still say 'complete receipt' (follow-up to #7912)Đang mởtriage:bug-verified
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
Maintainer thường phản hồi trong vòng 1 ngày