Skip to content

feat(logs): index scan sessions and optionally retain rollout events - #278

Open
2830500285 wants to merge 34 commits into
openai:mainfrom
2830500285:codex/retain-rollout-sessions
Open

2830500285 wants to merge 34 commits into
openai:mainfrom
2830500285:codex/retain-rollout-sessions

Conversation

@2830500285

@2830500285 2830500285 commented Aug 4, 2026 •

Copy link
Copy Markdown

Summary

Fixes #187. Local scans can finish or stop after starting several native sessions. A private index in the scan directory records the threads and their relationships before the temporary Codex home is removed.

Changes

  • Write artifacts/rollout-sessions/index.json. The SDK and CLI can locate it for completed, failed or interrupted local scans. Existing scan histories require no migration.
  • Mark execution threads and receipted workers as recorded. Descendants found only from a parent thread and timing are inferred.
  • --retain-rollout-sessions opts a scan, bulk run, rerun or resume into retaining attributable JSONL events. Reruns and resumes need their own opt-in. The archive uses immutable event segments and atomically publishes its index.
  • Opted-in discovery workers include their existing attempt UUID in the submitted prompt. The receipt stores a SHA-256 digest of the complete input. On a retry, the exporter can identify a native user item by that digest and its thread, turn and attempt window, even when the SDK omits the turn ID. It exports subsequent attributable events and omits submitted worker input.
  • Preserve the primary scan outcome if export fails. Verify the stopped scan receipt and pin the registered output directory before creating directories or publishing files. An exporter delayed by archival leaves the replacement available for another scan.
  • Include a discovery worker when its on-disk scan receipt identifies the thread and the workbench did not save the thread registration. The same registered thread set drives lineage selection and the recorded attribution label.

Testing

At b39abf35, all five portable source checks passed. The SDK and MCP type checks passed. The plugin build used the source-matched universal native artifact. All 87 session reader, index and CLI navigation tests passed. Removing the database thread binding from the five existing discovery-retry cases reproduced the missing worker before the fix. The cases now pass, including rejection of duplicate, late or mismatched inputs.

The SDK format check, 23 SDK tests for scan outcomes, resume and workflow identity, the end-to-end custom-validation retention case, all 46 Deep worker executor checks, and the complete bundled MCP smoke test passed. A broader SDK run was stopped after three fixtures failed inside an enclosing Git checkout. Both campaign cases and the workflow prompt-file case passed in private temporary directories outside that checkout.

On earlier revisions, contributors exercised the session reader with active, archived and compressed logs, multiple turns, cutoffs and overlapping invocations. Sixty current log-reader tests passed. Earlier integration tests exercised CLI and SDK result access, saved history, interrupted scans, directory reuse and package installation. A local native loopback test of a resumed thread retained the scan’s response and excluded the later manual turn. A second loopback test forced three failures in one thread with the pinned Codex 0.167.1. The private on-disk export retained the two receipted worker attempts and excluded the interleaved manual turn and both worker prompts. The reader, index, CLI navigation and MCP environment suites passed 90 tests. The complete MCP smoke test ran against a freshly built plugin, including its exact environment allowlist, and all 20 Deep worker runtime tests passed. A regression reproduced a stale exporter leaving directories in an empty replacement. With the fix, the replacement stayed empty and accepted a fresh scan without archival. Additional tests swapped the output or an artifact-directory link during publication and verified the replacement and link target received no files. Directory reuse discussion Earlier CI run

Risk and rollout

Retained events can contain prompts, source and tool output. Metadata collection is best effort. Older retry receipts without a native turn ID or an input digest cannot establish ownership. A missing, ambiguous, or out-of-window user item also leaves the attempt metadata-only. A failure before the native user item is persisted can have this outcome. Retry attribution discussion

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.

Historical automated reviews link to the signed-in viewer’s Codex settings. Historical workflow logs were not reviewed in full.

@github-actions github-actions Bot added the enhancement New feature or request label Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Thanks for putting this together. One interaction to watch: the new CodexRolloutReader in src/codex-rollouts.ts currently throws Codex session event exceeds the 1 MiB safety limit., which reproduces #291 for legitimate large tool output. #326 changes the existing reader to discard oversized records and continue processing later token_count events. This PR's broader rollout-observability work is complementary, but the extracted reader should preserve that same nonfatal behavior.

@mldangelo-oai mldangelo-oai changed the title feat: retain rollout sessions for scan observability feat(logs): retain rollout sessions for scan observability Oct 8, 2026
@mldangelo-oai mldangelo-oai added area:artifacts Saved scan state, storage, sealing, recovery, history, and artifact integrity. and removed area:artifacts Saved scan state, storage, sealing, recovery, history, and artifact integrity. labels Oct 8, 2026

mldangelo-oai commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

The conflicts are resolved against the current archived-worker and compressed-session behavior. The rollout export remains opt-in and bounded to the invocation. The follow-up removes the wrapper-only metadata caps and keeps the retention option out of reusable workflow identity. All 76 workflow, rollout, navigation, and scan-log tests passed. The full CI run passed.

I published the maintainer branch in this repository. From the PR branch, you can apply the tested commit with

git fetch https://github.com/openai/codex-security.git maintainer-sync/pr-278
git merge --ff-only FETCH_HEAD

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T06:34:22.876633Z be13e58 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: 02b88eac84

ℹ️ 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/scan-logs.ts Resolved
Comment thread sdk/typescript/src/api.ts Resolved

Copy link
Copy Markdown
Collaborator

This PR branch now contains the tested merge with main, published by fast-forward.

@codex review

@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: 8b8d98b119

ℹ️ 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/scan-logs.ts Resolved
Comment thread sdk/typescript/src/api.ts Resolved

Copy link
Copy Markdown
Collaborator

@codex review

@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: 2dfad7af8e

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

Please hold this PR before merging. The rollout exporter can write the old scan’s index or retained events into a replacement output directory. The fix needs to preserve the original directory identity throughout publication and cleanup. The green CI run does not exercise this interleaving.

#278 (comment)

Copy link
Copy Markdown
Collaborator

Merged main at 50da780. The feature diff is unchanged and all 49 focused rollout tests passed. The existing archive-reuse review blocker remains open.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 584d01e323

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

@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: cd9cb23a57

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

@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: b8e1114884

ℹ️ 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
@mldangelo-oai mldangelo-oai changed the title feat(logs): retain rollout sessions for scan observability feat(logs): index scan sessions and optionally retain rollout events Nov 13, 2026

@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: 09e702e53f

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

This branch has not been deployed

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose a durable scan-session artifact index and optional rollout export

2 participants