Menu ▾ ▴

#20 [Feature]: Add bounded HTTP retries, request timeouts, and custom CA support

open
nobody
2026-10-24
2026-09-11
Anonymous
No

Originally created by: thomijasir
Originally owned by: thomijasir

Feature description

Make CLI network behavior configurable and more tolerant of short service interruptions without retrying unsafe operations.

Current behavior

The API client uses a fixed 30-second timeout and does not expose retry or certificate authority controls.

Why we need this

Self-hosted servers may restart, sit behind a proxy, or use a private certificate authority. A brief connection failure should not break safe read commands, while write commands must not be repeated accidentally.

Proposed CLI interface

  • dopbase --timeout 30s <command>
  • dopbase --attempts 3 <command>
  • dopbase --ca-file /path/to/ca.pem <command>

Expected behavior

  • Treat --timeout as the total deadline for one logical request, including retries.
  • Accept between one and five attempts. Default to three attempts for idempotent GET requests.
  • Retry connection failures, timeouts, HTTP 408, 429, 502, 503, and 504.
  • Use bounded exponential backoff with jitter and honor Retry-After for HTTP 429.
  • Do not retry POST, PUT, PATCH, or DELETE automatically.
  • Load certificates from --ca-file in addition to the system trust store.
  • Apply the same request policy to normal reads and runtime secret fetches without changing cache fallback classification.
  • Report attempt counts and final causes through sanitized debug output.

Security and compatibility

  • Do not add a TLS verification bypass.
  • Reject unreadable, empty, or invalid CA files before making a request.
  • Never include authorization headers, tokens, request bodies, or secret values in retry logs.

Out of scope

  • Changing server timeout settings.
  • Retrying mutations or making them idempotent.
  • Adding a custom DNS resolver.

Acceptance criteria

  • [ ] Transient eligible GET failures are retried up to the configured limit.
  • [ ] Mutation requests are attempted once.
  • [ ] The total timeout bounds all attempts and backoff.
  • [ ] Retry-After is honored without exceeding the total timeout.
  • [ ] A server signed by the supplied CA is trusted.
  • [ ] An invalid CA file produces an actionable local error.
  • [ ] Defaults and global flag placement are documented and tested.

Test scenarios

  • Use local HTTP and TLS test servers under app/tests/cli/.
  • Cover each retryable status, non-retryable 4xx responses, connection refusal, total timeout, attempt bounds, mutation behavior, CA success, CA failure, and redaction.

Documentation

Document defaults, total-timeout semantics, retryable operations, proxy behavior inherited from the HTTP client, and private CA setup.

Dependencies

The debug details should use the global debug mode tracked in [#19]. No server change is required.

Related

Tickets: #19

Discussion

  • Anonymous

    Anonymous - 2026-09-11
     

Log in to post a comment.