Skip to content

refactor: share Codex session execution - #917

Open
mldangelo-oai wants to merge 19 commits into
mainfrom
mdangelo/codex/shared-codex-execution
Open

mldangelo-oai wants to merge 19 commits into
mainfrom
mdangelo/codex/shared-codex-execution

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Standard scans and Deep workers duplicate streamed-turn handling. Share that handling while retaining their execution and result contracts. The latest change makes the reconstructed-worker test wait for its child processes to close before removing their temporary executable.

Changes

  • Use one internal stream reducer; callers retain permissions, cancellation, retries and artifact acceptance.
  • Preserve the selected provider and resolved worker settings through concurrent and reconstructed workers, and add the session worker-configuration path to generated model-tool denials.
  • Keep literal paths and glob patterns distinct through parent-policy parsing, serialization and preflight. Remove unused executor option forwarding.
  • Bundle shared imports and cover child-process behavior, installed SDKs and physically detached plugins.
  • Track and close the existing synthetic fixture children during cleanup, including assertion failures. The latest increment changes tests only and preserves the original assertions.

Testing

  • Three native zero-finding reports cover the exact cleanup increment b80972f..a82da86; the reports alone are structural evidence. Separate reviewer-eligibility and source verification are now complete, and the finalized receipt passed its exact-source check with zero candidates. This satisfies only the cleanup-increment source-review criterion. Each reviewer’s fixture command failed on missing esbuild before assertions, providing no test-pass or native-enforcement credit.
  • Original outputs corroborate the historical Linux qualification of a82da86 composed with main 6cb0d51: 45 direct dependencies matched that composition’s locks; the portable checks, SDK/MCP types and formatting, complete executor fixture, unchanged Bun wrapper and six existing pure timeout-helper tests passed. These results remain bound to that earlier composition.
  • The historical Linux lifecycle controls recorded six children still open before parent-fixture removal and none after the fix. With an injected assertion error, the corresponding counts were one and zero; the fixed fixture preserved the original synthetic error. Expected negative-control exits remain recorded as exit 1. These controls do not establish Windows file-lock behavior.
  • The separate historical composition with main b9fa40d had no conflicts and passed all 44 file-inventory tests. Earlier checks remain bound to their tested composition; they were not rerun as whole-suite results.
  • A separate Linux qualification of a82da86 composed with main 32c8645 (uncommitted tree 3cbbfb1) passed nine checks: both Ruff checks, SDK build:ci, the source-compatibility checker and its nine tests, SDK/MCP types, formatting, the complete synthetic executor fixture and its unchanged Bun shutdown wrapper (one test). Frozen SDK/MCP installs matched all 45 direct dependency versions to the composition’s locks; all 688 tracked file hashes stayed unchanged. This qualifies those source/worker checks on that composition; it supplies no Windows, full-SDK, package-smoke, evaluation or native-enforcement result.
  • The previous published head b80972f has a Windows CI fixture failure: 405 passed, three skipped and one failed; two coverage aggregates failed afterward. Its package job completed, but the production audit command exited 1 under continue-on-error. These failures are retained; the new test change still needs Windows CI.
  • The earlier PR description records review/verification and composition checks for 2877c44..b80972f with main 8fb0cde; this disclosure review did not rerun them. Historical full SDK orders at 2877c44 recorded 3,085 passed / 50 skipped / 1 pre-existing Git-fixture failure each; these are historical evidence, not final-head full-suite passes.
  • Original setup and dependency failures remain recorded. No live-model evaluation was run for these increments.

Risk and rollout

This internal change adds no command, public setting, result field, dependency, migration or scheduler policy. Standard and Deep retain their intentional permission differences and follow-up behavior. Older SDKs without worker snapshots retain their inherited-home behavior.

The selected-provider snapshot finding and the later provider-argument review concern remain open. The security review merge gate is failing, and the earlier outdated review thread is unresolved. This update is not merge clearance. Acceptance of the final composition, provider-isolation compatibility, final integrated SDK/package checks and supported-platform qualification remain open. Linux lifecycle controls do not establish Windows file-lock behavior or native model-enforcement equivalence.

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.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact head 2135d4c32372f5fd4d7acf1f9839926c450944c7, including adapter behavior, provider forwarding, unknown-usage completion and the MCP-only/installed build paths.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 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-09-17T20:26:56.694732Z a82da86 New commits
🔒 Security Review Completed 2026-09-17T20:28:26.080509Z a82da86 New commits

Security findings

Blocking findings (1)

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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 2135d4c323

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

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact head 0b43c3f4741609f1d5ac27a9db5e1b700538ce36: shared stream handling, per-session provider and authentication selections, cancellation and reconstruction, and installed/standalone build behavior. The PR body records the known full-suite Git fixture failure and offline-install limitation.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 0b43c3f474

ℹ️ 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 marked this pull request as ready for review September 16, 2026 11:31

@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 Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 0b43c3f474

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread sdk/typescript/src/config.ts Outdated
"model_reasoning_effort",
"model_reasoning_summary",
"service_tier",
"model_providers",

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 Security Review · Automatically triggered

P0 Badge Security: Keep provider secrets out of the worker snapshot

When codexOverrides.model_providers contains an embedded credential (including in an unrelated provider), this loop copies the entire table into <CODEX_SECURITY_CONFIG_PATH>.workers.toml. Every scan child receives the base path, and its filesystem profile grants root read, so repository-controlled instructions can read the predictable sibling and return the credential in a model request. This bypasses the existing sanitized preflight projection. Store the worker snapshot outside scan-readable paths or project only the selected provider without exposing secrets.

SECURITY.md reference: SECURITY.md:L94-L100


Dismiss this finding: Reply with @codex security dismiss <reason> [context]. Codex will resolve this conversation automatically; GitHub may require a page refresh to show the result.

Valid reasons: false-positive, duplicate, out-of-scope, compensating-control, risk-accepted, or other. Example: @codex security dismiss duplicate Already flagged by another review

What each reason means
  • false-positive — Not a vulnerability
  • duplicate — Already tracked elsewhere
  • out-of-scope — Outside this review's scope
  • compensating-control — Mitigated by another control
  • risk-accepted — Risk intentionally accepted
  • other — Another reason; context required

Useful? React with 👍 / 👎.

@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: 2877c44477

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

isObject(providers) &&
Object.hasOwn(providers, selected)
) {
result["model_providers"] = { [selected]: providers[selected]! };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep selected provider credentials out of the worker snapshot

When the selected custom provider contains literal credentials such as experimental_bearer_token or an authorization value in http_headers, this assignment preserves them verbatim in the predictable <CODEX_SECURITY_CONFIG_PATH>.workers.toml file. The file is written before both Standard and Deep parent sessions start, and their root-read sandbox plus the exported config path lets repository-controlled instructions read the credential and return it in a model request or scan artifact. Fresh evidence in this head is the new config.test.ts case explicitly asserting that these selected-provider secret fields survive, even though unrelated providers are now removed. Project only non-secret settings, or explicitly deny the snapshot path to scan processes.

AGENTS.md reference: sdk/typescript/AGENTS.md:L8-L12

Useful? React with 👍 / 👎.

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

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

};
const { model_providers: _providers, ...sdkModelConfig } = modelConfig;
const configOverrides = [
...modelProviderConfigOverride(modelConfig as JsonObject),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep provider secrets out of worker arguments

When the selected custom provider contains a literal experimental_bearer_token or authorization header, modelProviderConfigOverride serializes the full provider definition into the Codex worker's command-line arguments. On Linux, repository-controlled worker tools running with the configured root-read profile can inspect the ancestor command line through /proc or process-listing tools and return the credential in a model request. Although this head now denies access to the snapshot file, the new provider tests confirm these secret fields still survive into configOverrides, leaving this separate disclosure path; pass secret material through a mechanism unavailable to sandboxed tools rather than argv.

AGENTS.md reference: sdk/typescript/AGENTS.md:L8-L12

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant