codex icon indicating copy to clipboard operation
codex copied to clipboard

Feature Request: Usage-Limit Awareness and Automatic Agent Handoff for Codex

Open FadhlounDaly opened this issue 3 weeks ago • 7 comments

What variant of Codex are you using?

App

What feature would you like to see?

Feature Request: Usage-Limit Awareness and Automatic Agent Handoff for Codex

Problem

When Codex approaches its five-hour or weekly usage limit, an active development session can be interrupted without the agent having an opportunity to prepare a continuation plan.

This is especially problematic during complex software engineering tasks involving multiple files, architecture decisions, debugging, and partially completed implementations.

The next Codex session—or another agent—may have to reconstruct the previous agent's reasoning, progress, and outstanding work.

Proposed Solution

Make usage-limit information available to the Codex agent before its allowance is exhausted.

When the runtime detects that the agent is approaching its usage limit, it should notify the agent and provide an opportunity to transition into a structured handoff phase.

During this phase, Codex should:

  1. Summarize the original task and its objectives.
  2. Identify completed work and modified files.
  3. Document architectural decisions and important discoveries.
  4. Identify unfinished work, blockers, and known issues.
  5. Record verification results, including tests that passed or failed.
  6. Generate a clear continuation prompt for another agent or a future Codex session.
  7. Save the handoff in a persistent, machine-readable format when supported.

Suggested Architecture

The runtime should own usage-limit monitoring and notifications.

The agent should own reasoning, summarization, and preparation of the continuation plan.

The handoff should be stored as a durable artifact, rather than relying exclusively on conversation history.

Expected Behavior

Instead of abruptly terminating an active task when the usage allowance expires, Codex would proactively enter a handoff phase when sufficient budget remains.

If a handoff cannot be completed, the runtime should still preserve the latest available execution state.

When access becomes available again, Codex—or another compatible agent—could resume from the saved checkpoint without unnecessarily repeating completed work.

Benefits

  • Less lost work when usage limits are reached.
  • Easier continuation across Codex sessions.
  • Improved interoperability between coding agents.
  • Reduced repeated analysis and wasted tokens.
  • More reliable execution of long-running engineering tasks.
  • Better user experience for developers working on complex projects.

The core principle: A usage limit should pause execution, not destroy continuity.

Additional information

No response

FadhlounDaly avatar Nov 06 '26 03:11 FadhlounDaly

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #59320

Powered by Codex Action

github-actions[bot] avatar Nov 06 '26 03:11 github-actions[bot]

The fallback when no model budget remains seems especially important. I would persist a small runtime checkpoint during execution, then let the model enrich it when an early warning is available. That avoids making recovery depend on one final successful summarization call.

For the checkpoint, I would include:

  • The repository/worktree and current revision, plus uncommitted-change references. A commit hash alone misses unfinished edits.
  • Each running command or delegated task, its ID, and whether its outcome is confirmed or unknown. A successor must reconcile unknown outcomes before retrying actions.
  • Verification results tied to the exact file versions checked, so “tests passed” does not survive unrelated later edits as an unqualified claim.
  • The next bounded task, unresolved decisions, and the current permission boundaries. A different agent should not inherit broader authority just because it receives a handoff.

A useful acceptance test would cut off model access in the middle of a file edit or a long-running test, restart from the checkpoint, and check that it neither loses the edit nor launches duplicate work.

Disclosure: I maintain TeamSwarm, which keeps project material and work threads outside native harness sessions for continuation. That addresses part of the continuity problem inside its own workspace; it does not add advance Codex quota warnings or attach to arbitrary existing Codex sessions. Would a portable, user-readable checkpoint be useful for your workflow even before quota-triggered handoff is available?

DrPei12 avatar Nov 06 '26 12:11 DrPei12

I strongly support this feature request. I would like to suggest a few additional improvements, particularly regarding configurable usage thresholds and automatic checkpointing.

1. User-Configurable Low-Quota Threshold

Allow users to set a warning threshold (for example, 5%, 10%, 15%, or 20% remaining) for applicable five-hour and weekly usage limits.

When the remaining allowance falls below the selected threshold, Codex should proactively prepare for a possible interruption rather than continuing until the limit is exhausted.

The threshold should be configurable globally and, ideally, per task or session.

2. Automatic Progress Preservation

When the warning threshold is reached, Codex should automatically:

  • Save the current state of modified files without discarding uncommitted changes.
  • Record completed tasks, unfinished tasks, and the next planned steps.
  • Preserve important requirements, architectural decisions, and unresolved problems.
  • Record testing and verification results.
  • Generate a structured checkpoint that can be used to resume the task later.

The checkpoint should be stored persistently, not only in the conversation context.

3. Reliable Recovery After Usage Limits Reset

After the usage allowance becomes available again, Codex should be able to resume from the latest checkpoint.

Ideally, users could choose between manual resumption and automatic resumption where supported.

Before continuing, Codex should verify the saved file and task state to avoid repeating completed operations or overwriting existing progress.

4. Reserve Capacity for Checkpointing

A critical concern is that an agent might reach its usage limit before it can finish saving its progress.

I suggest maintaining lightweight checkpoints throughout execution, with a final structured handoff when the warning threshold is reached.

This would make recovery more reliable even if the remaining quota is insufficient for a complete final summary.

Expected Result

Usage limits should interrupt task execution when necessary, but they should not cause users to lose progress, repeat completed work, or spend additional usage reconstructing the previous session.

Thank you for considering these improvements.

tw159tw avatar Nov 08 '26 17:11 tw159tw

Disclosure: I'm Rob, and I built this.

Bellows, a desktop app for Windows, macOS and Linux that runs Codex alongside Claude, Gemini CLI, Qwen Code and any ACP agent, does this handoff today, and it doesn't depend on Codex having budget left for one last summary.

The checkpoint is kept as you go. After every turn, Bellows itself writes a line to .bellows/memory.md in the project: which agent, what you asked, which files changed, whether the last test run passed, what it cost. No model is involved, so the record is there when the limit hits.

When Codex stops at its limit, Bellows says so and reads when it resets. You get two choices:

  • Resume at 6:34 (or whatever time Codex gave). A minute after the reset, Bellows tells Codex to carry on from where it stopped.
  • Continue with… another agent right now. It starts in the same folder (a worktree stays the worktree) with the project memory, the last few exchanges and a handover, if the leaving agent can still write one. The first message shows exactly what the new agent was given, and keys and tokens are stripped first.

How it works: https://bellowsai.app/guides/resume-a-coding-agent-after-a-usage-limit?utm_source=github&utm_medium=reply

Give it a try on your next long task and tell me what's missing. We act fast on feedback.

bellowsai avatar Nov 09 '26 10:11 bellowsai

Update for anyone following this: since Bellows 1.28 (17 Nov) the handoff is automatic.

When Codex stops mid-task at its usage limit, the next agent you've set up (Claude, Gemini CLI, Qwen Code or any ACP agent) takes the task over straight away, in the same folder, with Codex's last exchanges and the project memory, and carries on. Nothing to click, and no last model call from Codex.

When Codex's limit resets, and the other agent is between turns, the task goes back to Codex with a handover. A limit that resets within five minutes is simply waited out. Every switch is on the audit trail, and Settings › Sessions › "Keep going at usage limits" chooses who takes over first, or turns it off.

It's free: https://bellowsai.app/guides/resume-a-coding-agent-after-a-usage-limit?utm_source=github&utm_medium=reply

Tell me how it holds up on a real limit. We act fast on feedback.

bellowsai avatar Nov 18 '26 09:11 bellowsai

Keeping the work available to the next agent is exactly what we built WorkLedger for. We build it at Digital Disruptors.

The task, specification, decisions, unfinished work and recorded verification evidence live in WorkLedger as the agents work. For WorkBridge-managed jobs, you can enable handover at a configurable usage threshold before the allowance is exhausted. The job can pass to the next configured supported agent with capacity, including between Codex and Claude Code, on the same work item. The successor starts with the recorded context and next action.

That gives you a way to keep the task moving across usage limits today. Happy to demonstrate a Codex-to-Claude handover on a real task through our free guided 30-day pilot: https://workledger-ai.com/early-access?utm_source=github&utm_medium=referral&utm_campaign=workledger-usage-handoff-2026-11-20

dijarvrella avatar Nov 20 '26 14:11 dijarvrella

Until Codex can hand off on its own, it helps to keep the durable facts outside any one agent's session. I built Dawnmere for that: one memory on your Mac that Codex and Claude Code both read through their prompt hooks, so the notes you saved along the way come back in the other tool when you ask in similar words. One catch: a note typed in Codex is passed on at your next Codex prompt, so the very last one can wait. It won't carry a half-finished plan or the working diff. Free beta, Apple silicon Macs only. https://dawnmere.app/?src=gh-reply

jappabl avatar Nov 21 '26 17:11 jappabl