Skip to content

CloudApiClient: no retry for idempotent reads, one transient 503 fails the whole operation #216

Description

@Nicolas0315

Summary

Every method on CloudApiClient (packages/arkor/src/core/client.ts) is single-shot (rg -in "retry" src/core/client.ts → no hits). The SSE stream gets a full reconnect state machine in trainer.ts, but plain reads (job detail, deployment list/get, ...) fail on the first transient 503 / 429 / network blip. Studio surfaces these as errors the user has to manually refresh past, and SDK callers see avoidable throws.

Proposal

A small bounded retry for idempotent READ operations only:

  • attempts: 3 total; delay: full-jitter exponential (base 300 ms, ×2, cap 2 s);
  • retry on network-level errors and 408 / 429 / 5xx; never on other 4xx;
  • explicitly NOT retried: createJob, cancelJob, deployment mutations, chat, openEventStream (POSTs have no upstream idempotency keys; the stream already has its own reconnect logic in trainer.ts and must not be double-retried).

Injectable sleep via CloudApiClientOptions (next to the existing fetch seam) keeps tests instant and deterministic.

(A PR implementing this, with vitest coverage incl. "createJob is never retried", is ready to follow this issue.)

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions