Codex Security deep scan processes 9.45M tokens on an empty target and reports complete coverage
Summary
A Codex Security deep scan of an empty local directory dispatched multiple AI workers and subagents, recorded 9,447,862 processed tokens, and finalized with zero findings and coverage marked complete, despite having no source files to audit.
Direct filesystem inspection after the scan confirmed that the target was empty and readable. The original worker records independently reported successful enumeration with zero entries. No worker-specific access failure was observed.
Environment and trigger
- Codex desktop on macOS.
- Codex Security plugin version 0.1.32; Deep Security Scan mode.
- Scan model: GPT-6 Astra, high reasoning effort.
- Scope: the selected directory and its descendants.
- The empty directory was beneath an ancestor Git repository. Git resolved a valid revision from that ancestor, while the selected scope contained no files.
- Observed in one completed run. The scan has not been repeated to avoid further unnecessary consumption.
Actual behavior
- The coordinator used four concurrent Standard-scan workers and a stopping threshold of four consecutive results with no new findings.
- Eight Standard workers were dispatched. Four succeeded; four were canceled after the stopping threshold was reached. Replacement workers started while completed results were still being aggregated.
- Each Standard worker launched two subagents. Two additional AI workers aggregated the results. Including the coordinating chat, usage was measured across 27 chats.
- The coordinator stopped with terminal reason
saturated, rather than identifying an empty or unavailable source scope before repeated review. - Some worker results explicitly marked source review partial and retained unresolved questions. The final coverage artifact nevertheless contained
completeness: "complete", with empty surfaces and deferred-work lists. The report's prose acknowledged that no implementation was available and no application security assurance could be provided.
Measured resource use
| Work | Processed tokens |
|---|---|
| Four completed scans and their subagents | 5,201,258 |
| Four canceled scans and their subagents | 3,135,592 |
| Two aggregation workers | 346,340 |
| Coordinating chat | 764,672 |
| Total | 9,447,862 |
The total comprises 9,404,824 input tokens and 43,038 output tokens. Input includes 8,573,696 cached tokens and 831,128 noncached tokens. Cached input accounts for approximately 90.7% of the total.
Replaying the installed usage parser against existing records reproduced the exact saved total. Measurement is marked partial because the original setup chat was unavailable. These are token-processing counters, not a verified monetary charge or account-quota deduction.
Sample worker requests carried roughly 40,000–70,000 input tokens despite having no source to inspect. Repeated coordinating-chat waiting turns also added overhead; its subtotal includes setup and finalization preparation, not just waiting.
Expected behavior
- Check that the exact selected scope contains reviewable source before launching repeated scans and delegated reviews.
- Distinguish an empty directory from an enumeration or permission failure, and stop with a clear explanation in either case.
- Do not treat a revision inherited from an ancestor repository as evidence that the selected scope contains source.
- Report an empty source scope as “No source available / audit not performed,” separately from successful workflow finalization. Do not present it as complete application-security coverage.
- Preserve partial coverage and unresolved source-availability questions during aggregation.
- Avoid replacement scans and AI aggregation when an empty inventory already establishes that substantive review cannot proceed.
Suggested regression case
Suggested engineering test—not a request for another user-run scan: Add a local automated test using an empty child directory beneath a Git repository with a valid commit. Replace model-worker execution with a test substitute and verify that no review or aggregation workers are dispatched. Assert that the result explicitly reports “empty target / audit not performed” and does not claim complete security coverage. Also test unreadable and nonempty targets. This proposed test has not been implemented or run; it is intended to verify the correction without incurring live model usage.
Evidence and impact
The diagnosis used the existing scan report, canonical coverage, original worker outputs, coordinator lifecycle records, usage-accounting implementation, and scan-linked token records. No additional scan was started.
The observed impact is substantial processing without source review, plus a completion indicator that can imply assurance the scan did not establish. The observed control flow is consistent with a missing early exit for empty source and loss of partial-coverage semantics during aggregation; the exact implementation fix remains for investigation.
Private filesystem paths, project names, repository identifiers, scan/chat IDs, raw transcripts, and exact timestamps have been omitted. No raw diagnostic attachments are included.
I reproduced the worker dispatch on main at 6bee354. I started Deep Scan on an empty child directory with one committed file in its parent. The workbench counted zero files in scope, but the scan still launched two discovery workers and a reducer and finished as saturated. I used the test worker for this, so it made no model requests.
The saved coverage had zero surfaces and zero deferred entries. #1633 removed the completeness field from new reports. The existing tests for carrying worker questions and deferred work into the final results also pass on main. #921 tracks related work on retaining worker evidence during aggregation. The empty-target check is still missing at startup, so I’m keeping this open as P1.
I reproduced this on main at cd5f80f8. An empty child of a Git repository and an unreadable directory each started two discovery workers and a reducer, then published a completed report. I used synthetic workers, so neither reproduction made model requests.
I reran the public TypeScript SDK and packaged MCP server on #2054 at bfd27f39. The empty Git child and a selection of two empty directories now start zero workers and report that no security audit was performed. A file elsewhere in the repository stays out of the selection. The unreadable directory returns its permission error. None of those cases produces a report or manifest. Adding one readable file under a selected directory lets the scan finish, and the inventory contains just that file. An explicitly selected Git-ignored file also works. The remaining standalone installation regression is tracked in this review.
I also tried a nonempty scan with a worker that reported zero findings, partial coverage and an unanswered question about source availability. Current main preserves the question in the accepted checkpoint. Since #1762 the sealed report records workflow completion and no longer publishes a coverage-completeness field. #921 addresses a related case where retrying or recovering that worker could lose or misattribute saved evidence. #2054 is the PR linked to close this empty-target issue.
I reproduced this on Linux with scripted workers and no model calls. On an empty child of a Git repo, plugin 0.1.32 reported complete coverage even though the discovery worker marked its review partial. The released 0.8.2 CLI also ran discovery and a reducer and wrote a report for the empty child.
#2054 (b63f6d42) and #2181 (9698ef0c) both stop before launching workers on a physically empty directory and return the permission error for an unreadable one. When the directory contains only an ignored file or an empty subdirectory, though, the CLI counts zero files and both PRs still run discovery and reduction.
I also stopped the coordinator after it saved the discovery phase but before the first worker started, removed the only source file, and resumed the same scan after the lease expired. Both PRs launched a discovery worker and a reducer on the now-empty directory and finished as saturated. Keeping this open for those cases.
I rechecked the remaining ignored-only directory case on #2676 at 8147350d. On main at 173483d7, a fresh scan and a takeover before the first dispatch each started two synthetic discovery workers, recorded two reductions, and sealed a report with zero reviewed surfaces.
On the PR, both cases stopped with the empty-target diagnostic, started zero workers, and produced no coverage file, manifest, or report. An empty subdirectory and a directory emptied before takeover also stopped. Explicitly selecting the ignored file or force-tracking it still let the scan proceed.
The worker counts were verified with the coordinator and SQLite. The packaged publication fixture simulated filesystem-root ownership and made no model requests. All 65 Source CI jobs passed. Source CI