Repository navigation
Ask a Codex title again when gpt-6-luna refuses it for rate limits - #3449
Merged
Merged
Conversation
A Codex thread title that gpt-6-luna refuses with a 429 is now asked again every 5 s, on a new thread, until it is answered or 120 s have passed since its first ask. The retry lives in `_name_thread`, which both Codex title paths run through: the page server's `codex_title` and the website host's `app_server_title`. It stops early once the agent has named the thread. Before this change, a refused title was logged as `thread_title_failed`. On App Server turns and the website, nothing else names the thread, so it stayed untitled until the user's next message in it. This implements Max's decision #39 on the overnight report (option A, retry on the same model), which also settles #38. The decision asked to wait out the delay the 429 names. Codex's backend does name one, as a `Retry-After` that counts down to a free slot: one refused title was told 33, 30, 28 … 4, 1 s and was answered 39 s after its first refusal. The App Server forwards only `responseTooManyFailedAttempts` with `httpStatusCode` 429, and Codex doesn't retry it, so Leaf cannot read that delay. A fixed 5 s interval writes a refused title within 5 s of a slot freeing. The 120 s cap covers two of the roughly one-minute windows the countdown showed. The module header records these numbers and the cap. Measured against luna on this account (codex-cli 0.160): - **Before:** 12 titles asked back to back. Titles 10 and 11 failed with a 429 after 1.5–1.8 s and stayed untitled. - **After, back to back:** all 12 were written. One was refused three times and was written 20 s late; the others had no refusal. - **After, all 12 at once (a burst of comments):** six were refused, as in the decision's reading, and each was written 41–48 s after its first ask. All 12 were written in 53 s. `thread_title_generated` records now carry `refusals` and `refusedMs`, the time from the first ask to the ask that was answered. `thread_title_failed` records carry `refusals`. The Codex journey waits `RETRY_FOR + TIMEOUT` for a title instead of 60 s, so a title that had to wait out a refusal still counts. A new test covers both paths through the retry with an App Server stand-in. A title refused twice is written on its third ask, and a title refused past the cap fails as `RateLimited`. With the retry removed, the test fails. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 21, 2026
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.
A Codex thread title that gpt-6-luna refuses with a 429 is now asked again every 5 s, on a new thread, until it is answered or 120 s have passed since its first ask. The retry lives in
_name_thread, which both Codex title paths run through: the page server'scodex_titleand the website host'sapp_server_title. It stops early once the agent has named the thread. Before this change, a refused title was logged asthread_title_failed. On App Server turns and the website, nothing else names the thread, so it stayed untitled until the user's next message in it. This implements Max's decision #39 on the overnight report (option A, retry on the same model), which also settles #38.The decision asked to wait out the delay the 429 names. Codex's backend does name one, as a
Retry-Afterthat counts down to a free slot: one refused title was told 33, 30, 28 … 4, 1 s and was answered 39 s after its first refusal. The App Server forwards onlyresponseTooManyFailedAttemptswithhttpStatusCode429, and Codex doesn't retry it, so Leaf cannot read that delay. A fixed 5 s interval writes a refused title within 5 s of a slot freeing. The 120 s cap covers two of the roughly one-minute windows the countdown showed. The module header records these numbers and the cap.Measured against luna on this account (codex-cli 0.160):
thread_title_generatedrecords now carryrefusalsandrefusedMs, the time from the first ask to the ask that was answered.thread_title_failedrecords carryrefusals. The Codex journey waitsRETRY_FOR + TIMEOUTfor a title instead of 60 s, so a title that had to wait out a refusal still counts.A new test covers both paths through the retry with an App Server stand-in. A title refused twice is written on its third ask, and a title refused past the cap fails as
RateLimited. With the retry removed, the test fails.