Repository navigation
fix(client): stop resending a 429 that settles the request - #37
Merged
Merged
Conversation
A direct LinkedIn send refused at a provider limit answers 429 with a reference and state failed: Reply has recorded the attempt. That answer carries no Retry-After, so the retry loop resent it three times, and one send could leave four failed records. A 429 is now returned as it is when its body names a reference or says a daily or weekly allowance has run out. The decision reads the body, so another route answering in the same shape is covered, and an allowance code matches on its last part because the part before the dot only names the family of the route. A 429 with neither keeps its retry and its Retry-After handling. The body was already read before the decision, so the caller gets the refusal of the one attempt, with its reference, state and Retry-After, as before.
The reply-api and reply-cli skills told an agent that the CLI retries every 429. A 429 that names a reference or says a daily or weekly limit was reached is never resent and comes back at once as the refusal it is, so each skill now says so. Their versions move one patch: reply-api to 1.5.1, reply-cli to 1.3.1.
ArtemKosolap
marked this pull request as ready for review
November 6, 2026 00:04
vigubikReply
approved these changes
Nov 6, 2026
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.
What changed
sendinsrc/utils/client.tsno longer resends a429whose body names areferenceor says a daily or weekly allowance has run out. The answer goes back to the caller after one attempt. Any other429keeps its retry and itsRetry-Afterhandling exactly as before.The README's two paragraphs on retries say so.
Why
A direct LinkedIn send refused at a provider limit answers
429withdirectLinkedIn.weeklyLimitReached, areferenceandstate: failed: Reply recorded the attempt, and a failed send does not hold itsIdempotency-Key, so a repeat is a new attempt. That answer has noRetry-After, so the retry loop resent it three times with backoff, and one send could leave four failed records. The retries could not have helped either: an allowance that has run out does not come back within the few seconds the loop waits.How the decision is made
referencecounts when it is a non-empty string. Reply's problem bodies can carryreference: null, which names nothing.directLinkedIn.weeklyLimitReachedandweeklyLimitReachedboth match. The part before the dot only says which route family answered, and matching it would turn the decision back into a list of routes. Matching the whole last part, not a substring, leaves a code likedailySampleLimitReachedan ordinary429.supportRequest.dailyLimitReachedmatches too. It already came back at once because itsRetry-Afterruns to hours; now it also comes back in the last 3 seconds of that wait.What did not change
src/operations/direct-send.tsis untouched:LIMITSstill maps a429with a limit code tolinkedin.limit_reached, and at any other status those codes still map toreply.refused.sendalready read the body before the retry decision, so the caller gets the same refusal as before, withreference,state,sendAfterand anyRetry-After. A shortRetry-Afteron such a429is passed on, not waited out.409for a reused idempotency key is not involved.How it was verified
Tests were written first and run against the unchanged client: 15 failed, each on the call count: four calls where one was expected.
429with a reference, and for each allowance code with and without a family, throughrequest_raw,requestand the direct-send command.429still retries: empty body, title only, another code, a look-alike code, a null, empty or non-stringreference, and bodies that are JSONnull, a JSON list or not JSON. A shortRetry-Afteris still waited out, and a retried send goes through.reply.refused, one call, and still names the send.npm test: 963 passed, 5 skipped.npm run buildpasses.