Skip to content

fix(sdk): persist canceled scans with their measured cost - #2307

Merged
mldangelo-oai merged 13 commits into
mainfrom
fix/sdk-durable-scan-cancellation
Nov 4, 2026
Merged

mldangelo-oai merged 13 commits into
mainfrom
fix/sdk-durable-scan-cancellation

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Canceling a registered SDK scan could leave it marked failed in saved history and lifecycle telemetry. A hosted scan could also return a canceled receipt while reporting failure for the same scan ID in local history. This affects dashboards and integrations that count failures or decide whether to retry.

Changes

  • Record caller cancellation, client closure and canceled hosted execution in the workbench. Retain measured cost and resolve the original scan by ID if the workspace has since switched scans.
  • Distinguish caller cancellation from an internal cost-monitor stop. When tracking fails under an enforced budget, retain the failure and its original diagnostic in history.
  • Use the same scan-level status in the hosted receipt and local lifecycle. A caller can cancel a scan while its executor returns a failure. The nested execution receipt keeps its error, session and usage. A caller deadline after registration records a failed scan even when the executor acknowledges it with cancellation. A late abort keeps an already committed scan failure. Unknown acceptance still requires reconciliation by the host.
  • Cover explicit cancellation with an advisory allowance and correct the installed-package expectations for both abort and client closure.

Testing

All 97 hosted and mock SDK cases passed, including comparisons against the real SQLite lifecycle, along with 13 focused budget and tracking cases and 43 Python cancellation, archive and migration cases. The SDK typecheck and the complete installed-package smoke passed on the final code. The packed tarball contained 881 entries. The smoke installed the packed tarball in a clean consumer and exercised SDK and CLI lifecycle, direct Deep Scan, worker retry, restart and finalization.

Risk and rollout

The status change affects SDK observers, saved scan history and hosted receipts. Existing completed scans keep their committed result. Older external workbenches that can store cost only with a failed transition retain that behavior. No database migration or public CLI option is required.

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 Nov 4, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 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
📝 Code Review ✅ Completed 2026-11-04T19:53:26.006892Z 163a3b8 New commits
🔒 Security Review ✅ Completed 2026-11-04T19:54:23.864167Z 163a3b8 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 50017a466d

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sdk/typescript/src/api.ts Resolved

@alandelong-oai alandelong-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for preserving canceled scan status and measured cost. No blocking findings in this owner-level merge-safety review. Durable lifecycle and hosted receipts now agree while retaining executor diagnostics and usage, deadline failures, uncertain acceptance, and previously committed outcomes.

Nine focused lifecycle checks and 18 additional hosted-status combinations passed locally; builds, types/schema, and formatting passed. Current-source CI passed all 84 hosted-scan cases and eight installed-package jobs. The remaining local fixture failure reproduces on the exact base with the same filesystem ownership diagnostic; the full CI run is still in progress.

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: df69daec69

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@mldangelo-oai
mldangelo-oai merged commit b71feff into main Nov 4, 2026
74 checks passed
@mldangelo-oai
mldangelo-oai deleted the fix/sdk-durable-scan-cancellation branch November 4, 2026 21:41
@github-actions github-actions Bot mentioned this pull request Nov 4, 2026
3 tasks done
mldangelo-oai pushed a commit to Hughhhhcoder/codex-security that referenced this pull request Nov 4, 2026
Preserve the contributor history and take main's registered scan cancellation
and cost semantics from openai#2307. Keep the independently verified native
terminal event ordering correction and shared component lifecycle test.
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.

2 participants