Skip to content

fix(client): retry policies and client options refuse values that would fail later - #121

Merged
kalaspuff merged 1 commit into
issues-stack/6-partiql-next-tokenfrom
issues-stack/7-retry-policy-values
Oct 31, 2026
Merged

kalaspuff merged 1 commit into
issues-stack/6-partiql-next-tokenfrom
issues-stack/7-retry-policy-values

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Several client options passed validation and then failed later, at connect or at the first call:

  • RetryPolicy(base_delay=timedelta(milliseconds=10)) raised TypeError ('<' not supported), and with both delays as timedelta the policy constructed but every client using it failed to connect with ConfigurationError: must be real number, not datetime.timedelta, although docs/reference/configuration.md says durations accept timedelta. The policy validated the durations but kept them unconverted; it now stores float seconds.
  • RetryPolicy(max_attempts=2.5), Client(batch_concurrency=2.5) and counts given as bool or str passed construction and failed at the first call. max_attempts, batch_concurrency, batch_max_rounds and event_buffer must now be ints of at most 4,294,967,295 (the core's counts are 32-bit), and Client(retry=...) a RetryPolicy, or the constructor raises TypeError (ValueError for a value out of range, with the messages as before).
  • Huge but finite durations (timeout=1e20, RetryPolicy(base_delay=1e300, max_delay=1e300), wait_until_active(timeout=1e19)) raised DynamoxyError: internal error: a dynamoxy task panicked: Duration::from_secs_f64 panics above about 1.8e19 seconds and Instant + timeout overflows. The core now caps durations at 1e9 seconds (about 31 years), which means no limit in practice, for the request and connect timeouts, retry delays and table waits.

wait_until_active() and wait_until_deleted() now also take a timedelta, like the other durations, and refuse a negative timeout before any request.

Verified with unit tests of the policy and client validation and of the capped durations (Rust and Python, including a memory client with all of these huge values that creates a table, waits for it and reads), which fail without the fix. make check passes.

Fixes #89

Checklist

  • Tests cover the change (in-memory backend; validation and core durations)
  • Docs updated (configuration reference, changelog)
  • make check passes locally (lint, types, clippy, consistency, tests)
  • Breaking change? No: what is now refused failed before at the first call or at connect

Worth confirming

  • Decision: durations longer than about 31 years are capped rather than refused, so timeout=1e20 means "no limit" instead of raising; the issue allowed either. Counts above 2**32 - 1 are refused, since the core cannot hold them.
  • Decision: RetryPolicy.base_delay and max_delay read back as float seconds when given as timedelta (they are typed float | timedelta).

fctl session


Note

Low risk. It tightens validation of client options and caps huge durations in the core, so it only changes behavior for values that already failed at connect or at the first call; the one rejection that could affect working code is non-int counts such as numpy integers.

What it does. Fixes client options that passed construction and then failed later. RetryPolicy now converts timedelta delays to float seconds, so a timedelta base_delay no longer raises TypeError and a policy with two timedelta delays no longer breaks connecting. max_attempts, batch_concurrency, batch_max_rounds and event_buffer must now be ints up to 4,294,967,295, and Client(retry=...) must be a RetryPolicy. The core caps durations at 1e9 seconds, so timeout=1e20 or base_delay=1e300 mean no limit instead of panicking, and wait_until_active() and wait_until_deleted() take a timedelta and refuse a negative timeout.

Stricter option types. Counts given as float, bool or str now raise TypeError when the client or policy is created, instead of failing at the first call; durations above about 31 years are capped rather than refused.

fctl review's first look at dab90e0 · 11 files, +169 −40 · Review agent settings

…ld fail later

RetryPolicy validated timedelta delays but kept them unconverted, so
base_delay=timedelta(...) raised TypeError and two timedelta delays
made every client using the policy fail to connect. It now stores
float seconds. max_attempts, batch_concurrency, batch_max_rounds and
event_buffer accepted floats, bools and strings that failed at the
first call: they must be ints now, and retry= a RetryPolicy.

Durations past what Duration and Instant arithmetic hold (timeout=1e20,
base_delay=1e300, wait_until_active(timeout=1e19)) panicked in the
core; the core caps durations at about 31 years, which means no limit.
wait_until_active() and wait_until_deleted() take a timedelta too.

Fixes #89

Co-authored-by: Carl Oscar Aaro <[email protected]>
@kalaspuff
kalaspuff added this pull request to stack #124 October 31, 2026 01:30
@kalaspuff
kalaspuff merged commit 4ab6081 into main Oct 31, 2026
22 checks passed
@kalaspuff
kalaspuff deleted the issues-stack/7-retry-policy-values branch October 31, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RetryPolicy accepts values that fail later: timedelta durations, fractional counts and huge durations

1 participant