Skip to content

Add request pacing, wait callbacks, and operation-wide timeouts - #97

Open
05tanish wants to merge 3 commits into
prooflinedev:mainfrom
05tanish:sdk-python-updates
Open

05tanish wants to merge 3 commits into
prooflinedev:mainfrom
05tanish:sdk-python-updates

Conversation

@05tanish

@05tanish 05tanish commented Nov 23, 2026 •

Copy link
Copy Markdown

Summary

Request pacing

Both ProoflineClient and AsyncProoflineClient accept an optional rate_limit argument, measured in HTTP request attempts per second.

  • Paces requests through the shared transport, including eligible GET retries and calls through MCP, knowledge, fixes, and exports.
  • Sync implementation is thread-safe.
  • Async implementation waits without blocking the event loop.
  • None disables pacing by default.
  • Rates must be finite and positive.
  • Limits apply per client instance, not across separate clients or processes.
  • Pacing waits count against HTTP timeouts and active wait deadlines.

Wait callbacks

Both clients support a keyword-only on_update callback in wait_for_review.

  • Called when polling finds a review still pending.
  • Sync client accepts synchronous callbacks.
  • Async client accepts synchronous or asynchronous callbacks.
  • Callbacks are not invoked for terminal or timed-out results.
  • Callback exceptions propagate to the caller.
  • Wait deadline context is restored even if a callback raises.

Operation-wide HTTP timeouts

The configured HTTP timeout now bounds the complete HTTP operation instead of resetting for every retry.

The same deadline covers:

  • Request pacing.
  • Every retry attempt.
  • Retry-After waits.
  • Response-body reading.

An active wait_for_review deadline can shorten the operation timeout. Sync and async transports follow the same deadline behavior.

Testing

Added deterministic tests covering:

  • Request pacing and retry behavior.
  • Sync and async callback behavior.
  • Callback exceptions and deadline cleanup.
  • Operation-wide timeout across retries and retry waits.
  • Timeout behavior in both sync and async transports.

Validation:

  • Full repository check script passed.
  • Pytest: 254 passed, 8 subtests passed.
  • Ruff: passed.
  • Mypy: passed (228 source files).
  • Build and smoke checks passed.

Validation was performed using Python 3.13.5; the exact CI-pinned Python 3.13.12 was unavailable locally.

@05tanish 05tanish changed the title Add request pacing and wait callbacks Add request pacing, wait callbacks, and operation-wide timeouts Nov 23, 2026

This branch has not been deployed

No deployments
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.

1 participant