Before adding retries to a tool registry, give each write endpoint a short contract. “Create issue”, “replace a known file version” and “send a notification” may all be POST calls, yet their retry behavior can differ. Document what the destination actually guarantees instead of inferring it from the tool name.
A per-endpoint worksheet
For each endpoint record its effect, authoritative receipt, supported operation key or version precondition, uniqueness scope, deduplication retention and available lookup method. Distinguish a rejection that establishes no effect from a timeout after dispatch. A successful local queue insert establishes that a request is queued. It does not establish that the remote operation happened. The PostgreSQL INSERT reference documents which rows are returned by an insert that encounters a conflict.
Consider an endpoint whose contract supports a stable caller key. Persist the user-authorized operation, its parameters and key before the first call. In a relational store a unique constraint on tenant plus operation can elect the first dispatcher. With INSERT ... ON CONFLICT DO NOTHING RETURNING, a returned row identifies a successful insertion. A worker that receives no row must inspect the existing operation. It must not send simply because the winner has not yet stored its receipt.
Test the response-loss window
Use a synthetic endpoint that creates a resource, stores its operation-to-resource mapping and then drops a reply. A supporting provider can return the original receipt on a permitted same-key retry while its deduplication contract remains valid. A provider authoritative lookup by operation reference is another way to resolve the result. An empty search result in an eventually consistent list, or a match on title alone, does not settle it. Without sufficient evidence, leave the operation unresolved.
Then repeat with a deterministic validation rejection and with a separate user request containing identical parameters. The rejection should have no remote effect; the independent request has a new operation identity. This exercise tells the registry exactly which tools can be retried automatically and which need reconciliation.
This article was created with AI assistance.
Top comments (0)