mirror of
https://github.com/mastra-ai/mastra.git
synced 2026-11-17 08:44:46 +00:00
fix(client-js): stop retrying state-changing requests by default
BaseResource.request defaulted retries to 3 for every HTTP method, so a POST, PUT, PATCH, or DELETE that hit a server error was silently re-sent up to four times. When the server had already committed the work, a single call could duplicate a side effect such as an agent generation or a workflow start. Resolve the retry count by method: reads (GET, HEAD, OPTIONS) keep the three-attempt default, while writes are sent once unless the caller sets `retries` on the client or the call. Method-less requests are treated as reads, and an explicit count still opts writes back in. Also fix a leaking fetch mock in agent.client-tools.test.ts: one test queued two SSE responses but only issues one request, leaving an unconsumed mock behind. vi.clearAllMocks() does not drain the once-queue, so the leftover mock desynced the tests that followed. The write retry used to mask this by consuming the stale mock; now that writes are not retried, it surfaced as 23 failures. Fixes #30404 Co-Authored-By: mastra-platform[bot] <284800079+mastra-platform[bot]@users.noreply.github.com>
This commit is contained in:
parent
5b7f130224
commit
a2e46c41b1
7 changed files with 98 additions and 18 deletions
Loading…
Add table
Add a link
Reference in a new issue