Skip to content

Show usage freshness and ChatGPT allowance limits during long-running scans #29

Closed

Description

@agus-castro

Summary

A scan's estimated API-dollar cost does not measure remaining ChatGPT subscription allowance. During a long request, an unchanged estimate can also be mistaken for current usage. Operators need to see both the meaning of the measurement and whether it includes active work.

Current status — 19 October 2026

The remaining work is allowance visibility when the runtime provides it, clear handling when it does not, and an indication that usage measurements are stale or incomplete. #1640 is a related open proposal for usage freshness.

Original observation

Reported on CLI 0.1.1, macOS, Node 22.23.1, npm 10.9.8, using stored ChatGPT credentials and a Deep Scan with gpt-5.6-sol / xhigh.

codex-security scan /path/to/repository \
  --mode deep \
  --model gpt-5.6-sol \
  --codex 'model_reasoning_effort="xhigh"' \
  --output-dir /path/outside/repository/results \
  --max-cost 10

The estimate updated regularly at first, reaching $0.591838 of $10.00 limit at 02:03. It then remained unchanged until the scan was canceled at approximately 42:47, while the weekly allowance shown in the ChatGPT usage interface was exhausted.

The expensive model/settings were intentional. The problem was the lack of information needed to decide whether to continue or cancel, rather than the mere fact that the scan consumed substantial usage.

Control observation

A later Standard scan using gpt-5.6-terra, medium effort, and --max-cost 0.25 stopped with:

Estimated cost: $0.25063 of $0.25 limit
codex-security: Scan stopped: estimated cost $0.25063 exceeded the $0.25 limit

This does not establish that the USD limiter failed during the earlier run. Missing in-flight measurements and subscription-allowance accounting are separate concerns.

Remaining expectations

  • Show when a displayed estimate was last updated and whether an active request's usage is still pending.
  • Distinguish observed usage from missing or unavailable usage; avoid presenting an unchanged estimate as a current reading.
  • Show plan-allowance information when available, or clearly state that it cannot be determined.
  • Keep --max-cost semantics separate from a subscription-allowance cap.

Allowance-based stopping controls were suggested in the discussion, but require a supported runtime signal and a separate design decision. Related: #25 for pre-spend planning and #70 for progress independent of cost.

Activity

  1. mariohercules commented on Jul 29, 2026

    @mariohercules
    Contributor

    A possible mechanical explanation for the frozen estimate, offered as a hypothesis rather than a diagnosis: this looks like it could be #31.

    ScanCostTracker only starts polling when maxCostUsd is set, which is the case here (--max-cost 10). Per #31, each 100 ms tick chains another full session-tree pass onto #pending without coalescing, and every pass re-enumerates $CODEX_HOME/sessions and opens each .jsonl it finds. Once a single pass takes longer than the interval, the queue grows without bound and cost updates fall progressively further behind.

    Three details in this report line up with that shape:

    • The estimate updated regularly for the first ~2 minutes and then stopped entirely, rather than degrading gradually. That is what a queue crossing the point where it outruns its timer looks like.
    • This was --mode deep, which delegates to many worker threads. Each one adds session files, so the per-pass cost grows over the life of the scan — the backlog gets worse precisely as the scan goes on.
    • The --max-cost 10 limit never fired even though the weekly allowance was exhausted. The abort is driven by the same onCost path that stopped reporting, so if the callback is starved, the limit cannot be enforced on time.

    If that is what happened, then the two things in this report have different fixes. The visibility gap you describe — the CLI never explaining how a USD estimate relates to a ChatGPT plan allowance — is a real and separate documentation/UX problem, and worth keeping this issue open for. But the estimate freezing and the budget limit not firing would be a straightforward bug rather than a reporting-granularity choice.

    One caveat: I have not reproduced your specific run, and a genuinely stalled scan would look similar from the outside. What would distinguish the two is whether the scan was still making progress while the estimate was frozen — for example whether the scan directory's artifacts were still being written during those 40 minutes.

  2. agus-castro commented on Jul 29, 2026

    @agus-castro
    Author

    Thanks for the hypothesis. I checked the available local evidence.

    The partial output directory is empty. The persisted scan details currently show:

    RUNNING · deep
    COVERAGE 0 of 0 reviewed · 792 files
    

    After the last cost update at approximately 02:03, the CLI continued displaying the elapsed Running scan timer until I canceled it at 42:47. It did not report any further cost, phase, worker, or coverage updates.

    Therefore, I cannot confirm that the scan was still making progress while the estimate was frozen. It may have been stalled, or it may have been processing a long-running request without writing intermediate artifacts.

    One clarification regarding --max-cost 10: exhausting the ChatGPT weekly allowance does not establish that the CLI's USD-equivalent estimate reached $10, since those metrics are not directly comparable. The issue I observed is that the estimate remained stale, so I could not determine the current estimated usage or make an informed decision about continuing the scan.

    The behavior is compatible with the mechanism described in #31, but the available evidence is not sufficient to confirm that #31 caused this specific run.

  3. added
    enhancement
    on Aug 3, 2026
  4. added
    area:auth
    area:cli
    area:cost
    documentation
    priority:p2
    on Aug 15, 2026
  5. mldangelo-oai commented on Aug 15, 2026

    @mldangelo-oai
    Collaborator

    #198 fixed the polling backlog, but API-equivalent USD estimates still do not explain ChatGPT allowance consumption or whether usage data is current. Keeping this open for that remaining distinction.

  6. mldangelo-oai commented on Oct 8, 2026

    @mldangelo-oai
    Collaborator

    Merged #853 improves token reporting, and #926 adds pricing ranges and assumptions. Open #1276 improves live usage display. None provides remaining ChatGPT allowance, so that part is still open.

  7. removed
    area:auth
    on Oct 8, 2026
  8. changed the title [-]Improve ChatGPT allowance visibility during long-running scans with stale estimated cost[/-] [+]Show usage freshness and ChatGPT allowance limits during long-running scans[/+] on Oct 19, 2026
  9. removed
    area:cli
    documentation
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:costenhancementpriority:p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions