Skip to content

Pacer: a lone overload backs off its own call; clustered overloads close the pool - #262

Merged
lydakis merged 2 commits into
mainfrom
claude/project-thread-adwocq
Oct 28, 2026
Merged

lydakis merged 2 commits into
mainfrom
claude/project-thread-adwocq

Conversation

@lydakis

@lydakis lydakis commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

This is the first of five pacer changes George approved ("All five, overload first").

Before this change, an overload that named no delay (a 529, or an overloaded_error or server_is_overloaded mid-stream) closed the model's pool for a second, and longer while refusals kept coming. Every bot on that model waited for one refused call. With 64 bots and 5% of calls refused, throughput fell from 290 to 20 turns/s.

Changes

  • Pace::overloaded(after):
    • An overload that names a delay closes the pool for that delay, as a rate limit does.
    • An overload that names none closes the pool only when overloads cluster: three within two seconds and at least a quarter of the answers in that window. Otherwise the pool stays open.
    • The pool counts answered calls in the same window.
  • A lone overload's own call backs off from half a second (±20%, doubling), as Codex and the providers' SDKs retry an overload per request. A backoff of a second or more parks, per Daemon: park retry backoffs, classify in-stream overloads, keep statements prepared #257.
  • Rate limits (429, rate_limit_exceeded, slow_down) still close the pool as before.
  • HTTP, Messages in-stream, Responses in-stream and the WebSocket all route through one refused() helper. A socket failure with status 429 stays a rate limit.
  • AGENTS.md's error-class principle now says how an overload differs from a rate limit.

How it keeps the principles

  • No new task or timer. The window is three integers in the pool's existing state, under its existing lock.
  • A refused call still parks when its backoff is a second or more.
  • Bots no longer wait on another bot's lone refusal.

Measurements

Linux x86_64 container, synthetic fixture: 64 bots resubmitting as each turn ends, 200 ms replies, a random fraction of calls refused with 529 and no Retry-After. 15 s measured, one run each. #257's head against this change:

Refused Before: turns/s p50 ms p95 ms After: turns/s p50 ms p95 ms
0 % 290.7 217 234 291.7 216 231
5 % 20.4 3096 5140 256.2 217 631
50 % 1.3 9324 16351 3.9 9179 17302

No turn failed in any run. At 50% the clusters still close the pool: the fixture saw 97 requests in 18 s, not a retry storm. The table is also recorded in docs/DAEMON_MEASUREMENTS.md.

Tests

  • New unit test a_lone_overload_leaves_the_pool_open_and_clustered_ones_close_it.
  • test_an_overload_mid_stream_closes_the_pool_and_is_retried_when_it_reopens becomes test_a_lone_overload_mid_stream_backs_off_its_own_call: the call is not parked and retries after 400–600 ms.
  • cargo test, clippy, fmt and the full runtime suite (tests/run.py) pass.

No visible change, so no screenshots.

…ose the pool

An overload that names no delay closed the model's pool for a second or
more, so with 5 % of calls refused 64 bots fell from 290 to 20 turns/s.
Codex and the providers' SDKs retry an overload per request. Now a lone
overload backs off its own call from half a second; the pool closes only
when overloads cluster (three in two seconds, a quarter or more of the
answers) or the provider names a delay. Rate limits still close it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGGx6KWd2rVq3RoYuXt
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T04:08:00.663209Z 65a35b4 Manual request
🔒 Security Review ✅ Completed 2026-10-28T04:09:39.388744Z 65a35b4 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

lydakis commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

@codex review

The code review has shown as running since 02:20Z.


Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 669233a36c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/DAEMON_MEASUREMENTS.md Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 669233a36c

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

lydakis commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

@codex review


Generated by Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 65a35b4ba2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 65a35b4ba2

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

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.

2 participants