Skip to content

feat: auto-continue after server overload - #16

Open
AVas112 wants to merge 4 commits into
Loongphy:mainfrom
AVas112:feat/auto-continue-server-overloaded
Open

feat: auto-continue after server overload#16
AVas112 wants to merge 4 commits into
Loongphy:mainfrom
AVas112:feat/auto-continue-server-overloaded

Conversation

@AVas112

@AVas112 AVas112 commented Jul 29, 2026

Copy link
Copy Markdown

What changed

  • The TUI now automatically submits Continue after a ServerOverloaded error.
  • Auto-continuation runs for every overload event and is not blocked by the quota pause state.
  • Recovery state for ServerOverloaded is kept separate from UsageLimitExceeded, preserving the existing usage-limit behavior.
  • Duplicate Continue entries are prevented by deduplicating the locally rendered prompt and its app-server echo using both turn_id and message content.
  • The same echo deduplication behavior is preserved for safety-buffering retries.
  • Added a configuration toggle for enabling or disabling overload auto-continuation.

Why

When the selected model is overloaded, the current turn ends with Selected model is at capacity. Previously, the user had to submit a continuation manually. Codext now starts the next turn automatically so work can continue without manual intervention.

Configuration

Auto-continuation is enabled by default. To disable it, add the following to config.toml:

[tui]
server_overloaded_resume_enabled = false

Validation

  • cargo build -p codex-cli
  • cargo build --release -p codex-cli
  • git diff --check
  • Project linters
  • Architecture review completed with no findings
  • Configuration schema regenerated

Tests and snapshot files were not changed, in accordance with the temporary rust-v0.145.0 reapply guardrails.

@Loongphy

Loongphy commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Thanks for your pr, I'll check this later.

@AVas112
AVas112 force-pushed the feat/auto-continue-server-overloaded branch from 2f7e649 to 149a3f5 Compare August 3, 2026 00:34
@Loongphy

Loongphy commented Aug 3, 2026

Copy link
Copy Markdown
Owner

The staged Continue is submitted immediately after the failing turn ends. If the model stays overloaded, this becomes an infinite immediate-retry loop that hammers the API and floods the transcript with error / Continue pairs.

   submit → immediate overload error → auto-Continue → immediate overload error → …

Suggested fix (fine as a follow-up): add a delay and a retry budget — e.g. wait 30s before the first retry and increase the delay on each subsequent attempt (30s, 60s, 120s, …), then stop after ~5 attempts and leave the error on screen for the user. Reset the counter once a turn completes successfully.

@AVas112

AVas112 commented Aug 4, 2026

Copy link
Copy Markdown
Author

@Loongphy
Fixed in the latest commit. Server-overload auto-Continue no longer submits immediately. It now waits 15 seconds before the first retry, followed by 30, 60, 120, and 240 seconds, with a budget of up to five automatic retries. After the retry budget is exhausted, the overload error remains visible and no further Continue messages are submitted. The retry counter is reset after a successful turn.

I chose 15 seconds for the first retry because transient overloads often clear quickly, and an immediate retry frequently succeeds. Waiting the full 30 seconds before the first attempt would add unnecessary latency in those cases.

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