Skip to content

Add custom request timeout support to @astroid/client fetch wrapper #97

Description

@Cjay-Cyber-2

Description — what to implement and the why/impact.

Agents operating in time-sensitive environments must not hang indefinitely if the Astroid API or Stellar network nodes become unresponsive. This issue adds configurable request timeout handling using AbortController to @astroid/client.

Context & Requirements — background, constraints, design references, edge cases; grounded in the actual repo (real files, stack, conventions).

The client should accept a default timeout (e.g. 30000ms) in its initialization options and support per-request timeout overrides. When a request exceeds the timeout, it must abort the underlying fetch operation and throw a clean, typed timeout error.

Acceptance Criteria — a checklist ("- [ ] ...") of specific, testable conditions that define "done"..

  • Add timeout option to client configuration and per-request options.
  • Use AbortController and setTimeout to abort requests exceeding the configured duration.
  • Throw a specific typed error or custom error subclass for timeout failures.
  • Add unit tests using fake timers or mock fetch to verify timeout cancellation.

Implementation Guidance — likely files/modules to touch (use real paths from the repo context) and a suggested approach, without over-prescribing.

Review packages/client/src/ for fetch execution logic. Ensure timer handles are properly cleared in finally blocks to prevent event loop leaks.

Testing & Validation — how the contributor should prove it works (tests to add/run, manual checks, screenshots for UI).

Run pnpm test --filter @astroid/client and verify the test suite passes cleanly.

Submission Guidelines — must open a PR that includes "Closes #"; assignment is required before starting; follow the repo's existing style and conventions.


Wave complexity: Medium

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions