Developer finds SDK retried LLM calls twice despite explicit retry disable setting
A developer building an AI coding agent discovered that disabling retries at the harness level did not prevent the underlying OpenAI Node SDK from making its own default two retries, resulting in three server requests instead of one. To enforce a strict single-request policy, they implemented a fetch-level guard injected via NODE_OPTIONS, which initially passed local tests. However, end-to-end testing revealed the guard was being silently overwritten at startup by undici.install(), which reassigns globalThis.fetch, rendering the protection ineffective. The fix involved using Object.defineProperty to make the fetch property non-configurable, ensuring all requests always pass through the guard while still allowing the underlying fetch implementation to be swapped internally. The investigation also surfaced an unplanned analytics request to a PostHog telemetry endpoint, highlighting the importance of testing the full binary rather than individual library components in isolation.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in