webhooks: add durable signed lifecycle delivery - #179
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Mango applications currently have to poll or keep an SSE recovery loop open to notice major Session and scheduled Deployment Run lifecycle changes. A self-hosted operator needs an application-owned, signed notification path that survives API and worker replacement without delegating runtime behavior to a hosted service.
Solution
/v1/webhooksCRUD, pagination, status changes, deletion, and explicit signing-secret rotationwhsec_signing secrets only on create/rotation and encrypt them with the existing operator keyringCMA design decisions
Adopted: thin fetch-after-notification payloads, established event names, Standard Webhooks headers/signing, one-time secrets, subscription-at-emission/no-backfill semantics, duplicates and unordered delivery, three attempts, and immediate redirect/private-address disable.
Changed for Mango: endpoint management is a Mango HTTP resource because there is no hosted Console; secrets and delivery state remain inside Mango;
organization_idis omitted because Mango has no Organization resource; only lifecycle events backed by current Mango behavior are exposed.Deferred/rejected: no Anthropic auth/beta headers, no SDK compatibility requirement, no synthetic
deployment_run.started, and no invented sustained-failure duration because CMA does not publish its threshold. Mango records the continuous-failure window for a future operator policy.Acceptance criteria
Verification
make verifymake docs-checkmake securitymake test-serviceMANGO_TEST_DATABASE_URL='postgres://postgres:postgres@localhost:5432/mango?sslmode=disable' go test ./internal/pg -run Webhook -count=1