Codex Security Deep Scan fails on missing candidate_ledger.json, consumes most weekly quota, then automatically starts another full scan

Open 💬 1 comment Opened Aug 13, 2026 by Kuzjayo
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What issue are you seeing?

Codex Security Deep Scan successfully entered real repository discovery and ran for a substantial amount of time, consuming most of my weekly Codex usage limit.

The scan then terminally failed with:

invalid_discovery_artifacts

because discovery worker discovery-0006 did not create the mandatory:

candidate_ledger.json

The missing artifact was:

...\artifacts\deep_discovery\workers\discovery-0006\output\artifacts\02_discovery\candidate_ledger.json

The underlying filesystem error was:

ENOENT

No validation, attack-path analysis, canonical completion, or final security report was produced.

The more serious second problem happened immediately afterward.

The parent agent explicitly recognized that the previous Deep Scan had terminally failed, but then automatically reran preflight and called codex-security.start_codex_security_deep_scan(...) again for the same full repository scope.

This happened without asking for confirmation while Codex was already warning that less than 5% of my weekly limit remained.

The result was that nearly the entire weekly Codex allowance was consumed without producing the requested Deep Security Scan report.

What steps can reproduce the bug?

I cannot deterministically force the missing-artifact condition; the following is the exact sequence observed in my run.

Environment:

  • Windows 11 Pro 25H2 x64, build 26200
  • Codex CLI: 0.147.0-alpha.6.6
  • Codex Security plugin: 0.1.19
  • Model: GPT-5.6 Terra
  • Reasoning: High
  • Full repository Deep Security Scan
  • Preflight: ready
  • Repository worktree: clean
  • Scan mode: read-only

The earlier Windows worker-launch problem (spawn EPERM) had already been worked around, so this attempt successfully reached actual repository discovery.

Steps:

  1. Start a full Codex Security Deep Security Scan on a large repository.
  2. Allow preflight to complete successfully.
  3. Allow repeated discovery to run normally.
  4. Wait for discovery workers to complete and produce the terminal discovery manifest.
  5. In my run, worker discovery-0006 failed to produce candidate_ledger.json.
  6. The coordinator terminated the scan with:

invalid_discovery_artifacts

and:

ENOENT

  1. Codex reported that validation, attack-path analysis, and report generation had not run.
  2. Despite the terminal failure, the parent agent then reran preflight and automatically called:

codex-security.start_codex_security_deep_scan(...)

again for the same repository and full scope.

During the original scan Codex first warned:

Heads up, you have less than 25% of your weekly limit left.

By the time the terminal artifact failure occurred, it warned:

Heads up, you have less than 5% of your weekly limit left.

Despite this, another full Deep Scan was started automatically.

What is the expected behavior?

A discovery worker should not be considered successfully finalized until all mandatory artifacts have been durably written and validated.

If a required artifact such as candidate_ledger.json cannot be produced, Codex Security should:

  1. preserve successfully completed discovery evidence where possible;
  2. return a clear terminal failure with actionable diagnostics;
  3. expose whether any completed work can be resumed;
  4. avoid silently discarding expensive completed discovery work.

After a terminal Deep Scan failure, the parent workflow should:

  1. report the stable failure reason and failure-manifest path;
  2. stop the current workflow;
  3. not automatically start a replacement Deep Scan;
  4. require explicit user confirmation before another expensive full scan is started.

This should be especially strict when the user is already close to a weekly usage limit.

Additional information

This is related to #36588, but it is not the same failure.

#36588 reports a Deep Security Scan failing because a worker did not produce:

threat_model.md

My failure occurred on a different mandatory discovery artifact:

candidate_ledger.json

There is also an additional orchestration problem not covered by #36588:

after the terminal discovery failure, the parent automatically started another full Deep Scan and continued consuming quota.

The 'codex-security 0.1.19' Deep Security Scan skill installed in my environment explicitly states that after a terminal discovery/tool failure the current response must stop and must not call 'start_codex_security_deep_scan' again in the same response.

Useful additional diagnostics for this failure mode would include:

  • discovery worker exit status;
  • worker stdout/stderr tail;
  • whether candidate discovery completed before artifact serialization failed;
  • why candidate_ledger.json was missing;
  • whether the worker was marked complete before artifact publication;
  • token/credit usage of the failed worker;
  • total usage consumed by the failed Deep Scan;
  • whether completed discovery work can be resumed instead of discarded.

User impact:

The failed Deep Scan consumed nearly all of my weekly Codex usage allowance but produced no final security report. The automatic second full-scan attempt made the impact substantially worse by beginning to spend the remaining quota after the first scan had already terminally failed.

<img width="2047" height="719" alt="Image" src="https://github.com/user-attachments/assets/6da1e9b8-f77d-486c-8f8f-f1d64bbfe02a" />

View original on GitHub ↗

1 Comment

github-actions[bot] contributor · 14 days ago

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

  • #38266
  • #37651

Powered by Codex Action