Repository navigation
Daemon: park retry backoffs, classify in-stream overloads, keep statements prepared - #257
Merged
Merged
Conversation
…ments prepared - A retry backoff of a second or more parks the turn durably instead of sleeping in its task with an active slot held. - The pacer reads retry-after-ms before retry-after; a socket overload closes the pool; Responses in-stream server_is_overloaded, slow_down and server_error are classified as Codex does instead of failing the turn. - delete and configure stop answering bot_busy once a turn's task has submitted its finish, so a client that saw turn_finished is not refused. - Each SQLite connection keeps 256 prepared statements instead of 16, so an admission no longer re-parses its statements. - AGENTS.md: keep the daemon fast and light. bench/footprint.py measures idle, per-bot and after-turn memory with CPU and store work per turn. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGGx6KWd2rVq3RoYuXt
…rint workspace path Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGGx6KWd2rVq3RoYuXt
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Oct 28, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
George asked that the daemon stay fast and light as features land: bots never block each other, model bots park properly on provider errors, and the pacer learns from every pacing fact. This PR fixes what a re-measurement against September and a review of the error paths found.
Changes
prepare_cachedsites. A callgrind profile ofbench.admission_burstshowedDatabase::beginparsing its statements again on every admission, which was the +47% lone-submit CPU regression between Oct 11 and 0.4.1. Each connection now keeps 256.retry-after-msbeforeretry-after, as both providers send it and both SDKs prefer it. A socket overload event now closes the pool, as a rate limit does.server_is_overloadedmaps toprovider_overloaded(paced),slow_downtoprovider_rate_limited, andserver_errortoprovider_server_error(retried), as Codex classifies them (openai/codex e8e6a92,sse/responses_error.rs). Before, all three becameprovider_incompleteand failed the turn.bot_busyafterturn_finished. The CI thread found thatdeletecould answerbot_busyright after a client sawturn_finished, because the event publishes at commit while the slot frees on reap. The task now sets anendingflag just before it submits its finish. From then on,deleteandconfigureask the store instead of the in-memory slot.bench/footprint.pyis new. It reports idle RSS, RSS per idle bot (1000 bots), RSS after a turn each, and CPU, store jobs and commits per turn.How it keeps the principles
Nothing new runs on the runtime thread. The backoff park makes a waiting bot hold nothing live. The
endingflag is one atomic store per turn. The statement cache adds no store jobs and costs about 0.5 MiB at the 32-bot screen's peak.Measurements
Linux x86_64 container, synthetic provider,
c16210cagainst this branch, two alternating rounds:Store jobs per turn are unchanged (7.5). macOS is not measured.
Tests
test_a_provider_outage_parks_its_retries_and_leaves_the_slot_to_others: with one active slot, a healthy bot finishes in under 0.9 s while another bot's turn sits in a 4-try outage, and the outage turn completes.cargo test, clippy and fmt pass, and so does the full runtime suite (tests/run.py,AGENT_TEST_RUNTIME=1). One run had a single failure that a rerun did not reproduce, matching the flakes the CI thread reported on main.No visible change, so no screenshots.