openai / openai/codex

Proactive quota-aware task planning to avoid mid-task interruption

Open
#42,182 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

app CLI enhancement extension plan rate-limits
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What variant of Codex are you using?

App (macOS), CLI, IDE Extension

What feature would you like to see?

Codex should be aware of the user's remaining 5-hour and weekly usage quotas and actively use them as constraints when planning and executing long-running tasks.

Currently, Codex can begin a large multi-step task without considering whether the remaining quota is sufficient to complete it. This can result in quota exhaustion in the middle of implementation, testing, validation, cleanup, or other important completion steps.

Simply displaying the remaining quota to the user does not fully solve this problem. In an agentic workflow, Codex itself should be able to reason about the finite execution budget available to it.

Ideally, Codex should:

  • Check the remaining 5-hour and weekly quota before starting a substantial task.
  • Re-check the remaining quota periodically during long-running work.
  • Estimate, even approximately, whether the remaining work is likely to fit within the available quota.
  • Adjust the scope, order, or depth of work when quota becomes constrained.
  • Prioritize completing coherent units of work instead of starting additional unfinished work.
  • Reserve sufficient quota for validation, tests, cleanup, and checkpointing.
  • Create safe checkpoints before the remaining quota becomes critically low.
  • Split large tasks into independently completable stages when necessary.
  • Warn the user before starting if the requested task is unlikely to finish within the available quota.
  • Where appropriate, choose a lower-cost model or execution strategy in order to preserve enough quota to complete the task.

Perfect prediction of quota consumption is not required. Approximate, risk-aware planning would already be a significant improvement.

For example, if only a small amount of weekly quota remains and the user requests a repository-wide refactor, Codex should avoid starting every part of the refactor at once. It could instead:

  1. Complete the highest-priority implementation.
  2. Run the most important tests.
  3. Create a checkpoint or commit.
  4. Re-evaluate the remaining quota.
  5. Continue with secondary cleanup only if sufficient quota remains.

The key request is:

Treat the remaining usage quota as an explicit planning constraint, and actively manage the work so that the probability of an incomplete task due to quota exhaustion is minimized.

This is particularly important for an autonomous coding agent. In a normal chat interface, reaching a usage limit mainly interrupts a conversation. In an agentic coding workflow, it can interrupt an engineering process after files have already been modified but before the task has been safely completed or validated.

Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by locating existing quota or usage accounting and the flows that plan and execute long-running tasks, then determine how the five-hour and weekly limits are exposed. Done means defining and validating a scoped approach for quota-aware planning, re-checks, checkpoints, and user warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
ai, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.