@bman654/clodex 2.9.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -398,6 +398,40 @@ clodex --version # version
398
398
  so telling the client never to resend a request is not quietly undone one
399
399
  layer down.
400
400
  Recovered requests appear in the inference log as `response_retried`.
401
+ - **Connection pacing (ChatGPT/Codex plans):** when many agents run at once,
402
+ clodex spaces out the new connections it opens to OpenAI, which should make a
403
+ burst of parallel work less likely to trip OpenAI's own rate limit. (In the
404
+ traffic we sampled, the rejections clustered in the busiest minutes; that the
405
+ rate is what triggers them is a reasonable reading of that, not something we
406
+ can prove.) A follow-up turn that can reuse the connection it already has is
407
+ never delayed by this;
408
+ what goes through the limiter is work that needs a *new* connection — a first
409
+ turn, a conversation that branched, or several agents running at once. The
410
+ default is 60 new connections a minute, with an allowance of 10 opened back
411
+ to back after a quiet spell.
412
+ **This is a real throughput ceiling, not a brief pause.** One new connection
413
+ per second means that if you run many agents at once and each needs its own
414
+ connection, they end up sharing that budget: roughly 20 agents settle at
415
+ about 20 seconds per turn instead of a few seconds. That is the trade — you
416
+ wait longer, in exchange for a lower chance of losing turns to rate-limit
417
+ errors. It reduces that risk rather than removing it: clodex cannot see
418
+ OpenAI's actual limit, and under a heavy enough fan-out pacing can itself
419
+ answer a turn with a rate-limit response. Work over the
420
+ rate is queued for a few seconds, and anything still over is answered with
421
+ the same "try again shortly" response OpenAI itself would return, which
422
+ clodex retries for you with backoff. Set
423
+ `CLODEX_WS_MAX_NEW_CONNECTIONS_PER_MIN` to another whole number between `1`
424
+ and `600` to change the rate, or to `0` to turn pacing off. Higher values
425
+ clamp to `600` with a one-time warning, and an unreadable value is reported
426
+ once and ignored. If you have turned retries off with
427
+ `CLODEX_UPSTREAM_MAX_RETRIES=0`, pacing never refuses a request — but it also
428
+ stops limiting once its initial allowance is used up, because there would be
429
+ nothing left to retry a refused request. The same applies at very low rates:
430
+ if clodex cannot retry a turned-away request for long enough to reach the
431
+ next free connection slot — which is the case around 1 or 2 connections a
432
+ minute at the default timeouts — it admits the excess late rather than
433
+ failing it, and says so once. Turning a rate that low into hard failures
434
+ would manufacture the errors this feature exists to reduce.
401
435
 
402
436
  ## Known limitations
403
437