Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[macOS App] Task marked complete while background Codex CLI inference continues and exhausts usage limit

Open
#52,382 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
12/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Active
Tech stack
python

Research direction

The payload names no file in the Codex Desktop codebase. It cites a user's scripts/maintenance/batch.py and extraction.py, which are outside the project, and a session rollout JSONL. Start by finding where the desktop app marks a turn complete relative to child command processes, and compare it with the related #14731 and #40041. Done would need a maintainer decision on expected lifecycle behavior before any code change.

Written by the indexing model from the issue text.

Description

app bug exec rate-limits tool-calls
What version of the Codex App are you using (From “About Codex” dialog)?

ProductVersion: 26.6.2 BuildVersion: 25G83

What subscription do you have?

ChatGPT Plus

What platform is your computer?

Darwin 25.6.0 arm64 arm

What issue are you seeing?

Summary

Codex Desktop on macOS marked an agent turn as completed while a Python batch-processing command launched by that turn was still running.

The background process continued launching independent, authenticated codex exec inference requests for approximately 17 minutes after the main agent turn emitted task_complete.

I did not send any additional instructions during this period.

The continued inference was not clearly visible in the completed desktop conversation. The background process eventually encountered a usage_limit error, and my ChatGPT Plus five-hour Codex allowance was exhausted.

Confirmed Timeline

Date: October 9, 2026 (UTC+8)

Time Event
09:37:41.279 Codex Desktop launched a Python batch command through unified exec
09:37:48 Main agent turn emitted task_complete
09:37–09:54 Background batch continued running authenticated Codex CLI inference
09:54:01 A child inference request recorded error_category: usage_limit
09:54:53.500 Background CommandExecution completed with exit code 0

The background process remained active for approximately 17 additional minutes after the main agent turn was marked complete.

Verified Usage Evidence

I identified 15 successful inference receipts completed after the main task was marked finished.

Their recorded usage totals were:

Metric Tokens
Input tokens 465,678
Output tokens 90,511
Combined tokens 556,189

An additional child request recorded:

error_category: usage_limit

Some of these requests may have started before the main agent turn completed. The figures above represent requests that completed afterward, not an exact measurement of exclusively post-completion token consumption.

OpenAI Support subsequently confirmed that my five-hour usage window was at 100%.

Core Problem

The primary issue is the mismatch between the Codex Desktop application's task-completion state and the lifecycle of background processes that continue consuming authenticated Codex usage.

The main conversation appeared finished while the underlying batch process continued scheduling additional model requests.

This created unexpected usage consumption without clear visibility or an obvious way to control the remaining background inference.

I would like the maintainers to investigate whether this is expected behavior or a background-process lifecycle defect.

Image
What steps can reproduce the bug?

Reproduction Conditions

This issue was observed in a real Codex Desktop session on macOS.

The following steps describe the observed execution pattern. They have not been independently validated as a minimal reproduction.

  1. Open Codex Desktop on macOS while authenticated through a ChatGPT Plus account.

  2. Start an agent task that launches a long-running Python batch-processing command through unified exec.

  3. The Python batch script uses ThreadPoolExecutor(max_workers=2) to process independent jobs concurrently.

  4. Each worker invokes the signed-in Codex CLI using Python subprocess.run().

  5. The main Codex agent generates its final response and emits task_complete before the batch process exits.

  6. The Python batch continues scheduling and executing independent codex exec inference requests.

  7. Observe that the desktop conversation appears completed even though authenticated background inference continues.

  8. Inspect the local session log and extraction receipts to confirm that the background command completes after task_complete.

Actual Background Command

The command launched by the Codex agent was:

.venv/bin/python scripts/maintenance/batch.py run batch-0002 --workers 2 --retry-failed

Relevant Implementation

The batch processor uses a thread pool to schedule independent inference jobs:

with ThreadPoolExecutor(max_workers=workers) as executor:
    pending[executor.submit(extract, pack, processing_path)] = (
        video_id, pack
    )

The extraction adapter then launches independent Codex CLI subprocesses:

command = [
    cli,
    "exec",
    "--ephemeral",
    "--skip-git-repo-check",
    "--json",
    # Additional execution arguments
]

result = subprocess.run(
    command,
    input=prompt,
    capture_output=True,
    text=True,
    env=env,
    timeout=900
)

The actual command also includes:

-c 'forced_login_method="chatgpt"'

The child CLI invocation does not explicitly specify a model using --model.

Relevant Session Information

Affected session ID:

01a11983-...-a2d25f6c

The full session ID has been provided to OpenAI Support.

Command execution ID:

exec-2ababd5a-b62e-4af9-b208-fed22eaa4dd7

Execution source:

unified_exec_startup

Process ID:

83963

Command duration:

1032.18 seconds

Exit code:

0

Model Information

  • Main desktop session: gpt-6.1-sol
  • Main session reasoning effort: High
  • Current CLI default model: gpt-6-sol
  • Current CLI default reasoning effort: High
  • Child CLI model: Not independently verified

The main session historically used both Sol and Astra.

However, I have not established that the post-completion child requests used Astra. Their actual model identities require further investigation.

Reproduction Limitations

I have not rerun the workload solely to reproduce the issue because doing so could consume additional Codex usage allowance.

The original rollout logs, command execution records, and inference receipts have been preserved.

What is the expected behavior?

Expected Behavior

When Codex Desktop launches background processes capable of making authenticated model requests, the application should provide accurate execution status and effective user control.

1. Accurate Task Completion Status

The application should distinguish between:

  • Completion of the main agent turn.
  • Completion of commands launched by that turn.
  • Completion of independently running inference subprocesses.

A completed main turn should not misleadingly imply that all usage-generating activity has stopped.

2. Background Inference Visibility

If model-consuming background processes remain active, the application should clearly indicate that they are still running.

Users should be able to identify which background tasks are consuming their usage allowance.

3. Reliable Cancellation

Users should have a way to terminate active background processes and their child inference requests.

When a user explicitly cancels a task, cancellation propagation should have clearly defined and predictable behavior.

4. Usage Transparency

The application should provide sufficient visibility into continued model usage after the main conversation has finished.

Users should not unknowingly exhaust their usage allowance through background inference that is no longer visible in the main task interface.

5. Model Configuration Transparency

Independently launched Codex CLI requests should have clearly identifiable effective model settings.

Important Clarification

I am not suggesting that all background processes must automatically terminate when an agent turn completes.

Some intentionally detached processes may need to continue running.

The expected behavior is that continued authenticated model inference remains visible, understandable, and controllable, particularly when it consumes the user's limited Codex allowance.

Additional information

Additional Technical Findings

Background Execution Lifecycle

The local rollout contains the following event sequence:

  • 09:37:41.279 — Background command started.
  • 09:37:48 — Main turn emitted task_complete.
  • 09:54:53.500 — The same command reported item_completed(CommandExecution).

The command completion event therefore appeared approximately 17 minutes after the main task-completion event.

The command exited successfully with code 0.

Independent Codex Inference

Source inspection confirmed that:

  • batch.py schedules concurrent inference jobs.
  • extraction.py invokes independent codex exec subprocesses.
  • These subprocesses authenticate through ChatGPT.
  • They do not explicitly specify a model.
  • The batch processor can continue assigning work after the main agent turn finishes.

The post-completion extraction receipts confirm continued inference activity.

Usage Limit Evidence

A child extraction failed at approximately 09:54:01 with:

{
  "error_category": "usage_limit"
}

The failed request was generated by the independent background inference workflow.

OpenAI Support confirmed that my account's five-hour Codex usage window was exhausted.

I am requesting verification of the actual usage charged after the main task completed.

Desktop Client Identification

I was using the standalone Codex Desktop App on macOS, not the VS Code extension.

However, the local session metadata reports:

source: vscode

This may reflect an internal client classification, but I am including it because it could be relevant to debugging.

Related GitHub Issues

Potentially related reports:

  • #14731 — Background process lifecycle and premature turn completion
  • #40041 — Command completion appearing after task_complete

My incident adds a usage-impact dimension: independently launched authenticated Codex inference continued after the main turn completed and eventually encountered a usage-limit error.

OpenAI Support Case

I have already reported the unexpected usage to OpenAI Support.

The case has been escalated to a human support specialist.

I am separately requesting a review of possible usage restoration or other appropriate remediation through the support channel.

This GitHub issue is intended to document the technical behavior and help prevent recurrence.

Available Evidence

I have preserved:

  • Original Codex session rollout JSONL
  • Command execution timestamps
  • Background process execution details
  • Inference usage receipts
  • usage_limit failure record
  • Relevant Python source files
  • Task completion screenshots
  • Usage-limit screenshots

I can provide appropriately redacted logs through a secure channel if requested.

Requested Investigation

Could the maintainers please investigate:

  1. Why the main task emitted task_complete while the background command was still running.
  2. Whether Codex Desktop should surface detached inference subprocesses more clearly.
  3. Whether users have sufficient control over such processes after the main turn finishes.
  4. Whether the command lifecycle and event ordering represent expected behavior or a defect.
  5. How the actual model identities and usage of the background CLI requests can be verified.

Thank you for investigating.

=== CODEX BACKGROUND EXECUTION EVIDENCE ===
Incident: 2026-10-09 (UTC+8)
Client: Codex Desktop / macOS
Session: 01a11983-...-a2d25f6c

=== MAIN TURN & BACKGROUND PROCESS ===
BACKGROUND PROCESS START: 09:37:41
MAIN TASK COMPLETE: 09:37:48
BACKGROUND PROCESS END: 09:54:53

PROCESS DURATION: 1032 seconds
POST-COMPLETION RUNTIME: ~17 minutes
EXIT CODE: 0

=== BACKGROUND INFERENCE RECEIPTS ===
Successful receipts completed after main turn: 15
Recorded input tokens: 465678
Recorded output tokens: 90511
Combined tokens: 556189

USAGE LIMIT ERROR: 09:54:01
ERROR CATEGORY: usage_limit

=== FINDINGS ===

  • Main agent turn completed before the background
    command exited.
  • Authenticated Codex CLI inference continued.
  • Additional inference jobs completed after the
    main turn was marked finished.
  • The background workflow encountered a usage limit.

NOTE:
Token totals cover requests completed after the
main turn, including some that may have started
before completion. They are not an exact measure
of exclusively post-completion usage.

Evidence derived from local Codex session logs
and extraction receipts.
No credentials or private project content included.

Dominant language
Rust
Stars
129k
Forks
20.3k
Avg merge
1m
Merged PRs (30d)
998

Getting set up

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.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.