chore: drop external payload not found errors#4308
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Benchmark resultsCompared against |
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent RabbitMQ pre-ack retry storms by treating “external payload not found” as a terminal (permanent) pre-ack failure and enriching drop logs with structured context for alerting/filtering.
Changes:
- Introduces a shared
ErrExternalPayloadNotFoundsentinel andExternalPayloadNotFoundErrorwrapper in the repository layer. - Extends RabbitMQ pre-ack error classification to treat
ErrExternalPayloadNotFoundas permanent and logspermanent_pre_ack_reasonplus external payload metadata. - Adds unit coverage for the new permanent pre-ack classification.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/repository/payloadstore.go | Adds a typed/sentinel error to represent terminal external payload misses. |
| internal/msgqueue/rabbitmq/rabbitmq.go | Classifies external-payload-not-found as a permanent pre-ack failure and enriches drop logs with structured fields. |
| internal/msgqueue/rabbitmq/permanent_preack_test.go | Adds test coverage for the external-payload-not-found permanent classification. |
| if errors.Is(err, repository.ErrExternalPayloadNotFound) { | ||
| return "external_payload_not_found" | ||
| } |
| return permanentPreAckErrorReason(err) != "" | ||
| } | ||
|
|
||
| func permanentPreAckErrorReason(err error) string { |
There was a problem hiding this comment.
I don't think this can work at the msgqueue layer, because messages are buffered (on both the pub and sub side). So consumers will need to shed these messages.
If we wanted to only nack part of the batch we'd need need to support individual acks for each message in the buffer, which we don't currently. But even if we did this, there's no way of getting around the pub buffer (which is why the pub buffer should be used sparingly)
Description
Adds a terminal external payload not found error and teaches RabbitMQ pre-ack handling to drop those messages instead of retrying indefinitely. This prevents missing S3 offloaded payload index files from generating noisy retry storms, while keeping other S3 failures retryable.
The permanent drop log is enriched with structured fields like
permanent_pre_ack_reason=external_payload_not_found,external_payload_kind, andexternal_payload_keyfor filtering and alerting.Fixes #
Type of change
What's Changed
ErrExternalPayloadNotFoundtyped error for terminal external payload misses.NoSuchKeyindex file fetch errors to the terminal payload error.Checklist
Changes have been:
Testing
go test ./internal/msgqueue/rabbitmq -run 'TestIsPermanentPreAckError' -count=1go test ./pkg/repository -run '^$' -count=1GOWORK=<temp local workspace> go test github.com/hatchet-dev/hatchet-cloud/internal/repository -run 'Test(FetchWithFallback|IndexFileFetchError)' -count=1🤖 AI Disclosure
I acknowledge that an LLM was used in the creation of this Pull Request, in accordance with Hatchet's AI_POLICY.md.
Details: Cursor agent was used to inspect the retry/error paths, implement the targeted code changes, add focused tests, and run validation commands.