Skip to content

fix: stop Deep Scan workers when usage is exhausted - #1638

Merged
ianw-oai merged 3 commits into
mainfrom
dev/ianw/scan-budget-enforcement
Oct 14, 2026
Merged

ianw-oai merged 3 commits into
mainfrom
dev/ianw/scan-budget-enforcement

Conversation

@ianw-oai

Copy link
Copy Markdown
Collaborator

Summary

Deep Scan treated exhausted usage limits as retryable worker failures. It could retry the failed worker and launch replacements while other workers were shutting down.

Changes

Recognize Codex's terminal quota messages and immediately cancel the scan's active workers. Prevent retries and replacements, retain completed artifacts, and preserve the original error in the scan result. Ordinary temporary rate limits keep their existing retry behavior.

Testing

  • Passed the worker executor and coordinator suites, including fresh and resumed workers, temporary rate limits, and cancellation before worker shutdown completes.
  • Passed the stdio lifecycle, terminal-race, and handoff-race suites.
  • Passed Ruff lint and format, SDK build:ci, source-compatibility checks and tests, MCP type checking, formatting, and the plugin build.
  • Tested the pinned Codex executable against a local HTTP fixture returning usage_limit_reached and insufficient_quota. Both produced the expected permanent failure and cancellation notification, with one model request per case.

Risk and rollout

The current Codex SDK exposes terminal failures as text, so classification matches the pinned version's native quota messages. Upstream wording changes may require an update. This stops work after exhaustion and does not add a pre-exhaustion budget guardrail.

The native integration check ran on macOS with synthetic responses. No real account allowance was exhausted. A full repository test run was not repeated for this narrowed change.

Public disclosure review

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

@github-actions github-actions Bot added the bug Something isn't working label Oct 14, 2026
@ianw-oai
ianw-oai marked this pull request as ready for review October 14, 2026 06:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-14T15:53:41.399386Z c7eec5e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ianw-oai
ianw-oai merged commit a8f142f into main Oct 14, 2026
64 checks passed
@ianw-oai
ianw-oai deleted the dev/ianw/scan-budget-enforcement branch October 14, 2026 16:10
@github-actions github-actions Bot mentioned this pull request Oct 14, 2026
3 tasks done
@mldangelo-oai

Copy link
Copy Markdown
Collaborator

Thanks for addressing the dispatch race as well as retry classification. The immediate callback and eventual thrown error serve different purposes: cancellation must reach the coordinator before SDK stream cleanup finishes. Preserving the original quota error through shutdown is also the right behavior.

I would keep the fresh/resumed discovery and reducer coverage and both coordinator timing cases. Restricting classification to terminal turn failures correctly leaves temporary rate limits and similar text in ordinary output alone. The documentation accurately describes stopping after exhaustion. No additional changes suggested.

@zerox80

zerox80 commented Nov 7, 2026

Copy link
Copy Markdown

#2446

it seems buggy now... could u look into that? @mldangelo-oai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants