Uh oh!
There was an error while loading. Please reload this page.
feat(apex): bootstrap ApexCode safety and evaluation foundation - #1
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:9ae17e784d
ℹ️ 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".
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| @@ -0,0 +1,7 @@ | |||
| [workspace] | |||
There was a problem hiding this comment.
Exercise the Apex workspace in CI
Adding this separate workspace does not make any existing PR job build or test it: .github/workflows/rust-ci.yml:43-47 only marks codex-rs/*, tooling, or workflow changes as relevant, and its Rust jobs run from codex-rs at lines 64-67. Consequently an Apex-only follow-up can merge with compilation, formatting, and all 29 tests skipped; add an Apex path detector and a job that checks this workspace.
Useful? React with 👍 / 👎.
| @@ -0,0 +1,7 @@ | |||
| [workspace] | |||
There was a problem hiding this comment.
Ignore the Apex Cargo target directory
Running Cargo in the newly added workspace creates an untracked apexcode/target/ tree. A repository-wide search shows only codex-rs/.gitignore entries for that workspace's own /target/, so the documented Apex build workflow dirties the worktree and risks generated artifacts being committed; add an ignore rule scoped to apexcode/target/.
Useful? React with 👍 / 👎.
| #[cfg(test)] | ||
| mod tests { |
There was a problem hiding this comment.
Move evidence tests into a sibling module
This is a newly introduced inline test module, whereas the repository requires new test modules to live in a descriptive sibling *_tests.rs file and be attached with an explicit #[path = "..."]; move these tests out of the implementation module.
AGENTS.md reference: AGENTS.md:L169-L178
Useful? React with 👍 / 👎.
| #[cfg(test)] | ||
| mod tests { |
There was a problem hiding this comment.
Move task-state tests into a sibling module
This newly introduced inline test module should be placed in a descriptive sibling *_tests.rs file and referenced through an explicit #[path = "..."], as required for all new test modules in this repository.
AGENTS.md reference: AGENTS.md:L169-L178
Useful? React with 👍 / 👎.
| members = [ | ||
| "apex-policy", | ||
| "apex-task-state", | ||
| "apex-evidence", |
There was a problem hiding this comment.
Split the independent foundation crates into stages
This non-mechanical commit changes 1,225 lines and combines three dependency-free crates with identity, security, fixture, and benchmark documentation, exceeding the repository's 800-line review limit. Land the smallest coherent stage first—such as the workspace plus apex-policy—then add task state, evidence, and documentation separately so their independent contracts remain reviewable.
AGENTS.md reference: AGENTS.md:L125-L131
Useful? React with 👍 / 👎.
Uh oh!
There was an error while loading. Please reload this page.
| let constraint_count = reader.u32().ok_or(SnapshotError::InvalidFormat)? as usize; | ||
| if constraint_count > reader.remaining() { | ||
| return Err(SnapshotError::InvalidFormat); | ||
| } | ||
| let mut constraints = Vec::with_capacity(constraint_count); |
There was a problem hiding this comment.
Bound constraint allocation before reserving
For malformed or corrupted snapshots, comparing constraint_count directly with the remaining byte count is insufficient because every constraint requires at least a four-byte length prefix and the snapshot also needs its status and revision. A roughly 100 MB input claiming 100 million constraints passes this check and Vec::with_capacity attempts about 2.4 GB of allocation before parsing fails, allowing recovery data to terminate the process through memory exhaustion; enforce the minimum encoded size and a hard count cap before reserving.
Useful? React with 👍 / 👎.
| let revision = self.revision.checked_add(1).ok_or(TransitionError { | ||
| from: self.status, | ||
| to: next, | ||
| })?; |
There was a problem hiding this comment.
Report revision exhaustion instead of an invalid transition
A structurally valid snapshot may decode with revision == u64::MAX, after which an otherwise allowed transition such as Planned -> Running fails here with TransitionError { Planned, Running } and is reported as an invalid state-machine edge. The dedicated TaskStateError::RevisionOverflow variant is never surfaced, so recovery code cannot distinguish revision exhaustion from an actually forbidden transition and the resumed task remains permanently stuck; return a distinct overflow error while preserving the state.
Useful? React with 👍 / 👎.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Bootstrap ApexCode as an upstream-friendly, independent extension of OpenAI Codex.
This PR intentionally avoids changing the upstream Codex runtime. It establishes the first isolated ApexCode implementation slice and public project identity.
What changes
README.mdwhile retaining the upstream Codex quickstart/contentSECURITY.mdwith separate upstream-vs-ApexCode reporting guidance and safety invariantsapexcode/apex-policyRust cratebenchmarks/APEXBENCH.mdfor reproducible high-complexity evaluationAlready established on main
During bootstrap, three additive documentation files were written directly to
mainbefore branch targeting was corrected:UPSTREAM.mdARCHITECTURE.mdROADMAP.mdNo Codex runtime code was changed by those direct documentation commits. History was not rewritten or force-reset. This PR is based on that documented main state.
Safety
Validation
The
apex-policycrate is dependency-free and includes five unit tests.Local execution was not completed because the available execution environment has neither outbound GitHub DNS access nor a Rust/Cargo toolchain. Tests must therefore be treated as UNVERIFIED until CI or a Rust-enabled environment executes them.
Suggested focused verification:
cargo fmt --manifest-path apexcode/apex-policy/Cargo.toml -- --check cargo test --manifest-path apexcode/apex-policy/Cargo.tomlReview gate
Keep this PR in draft until:
Do not merge automatically.
ApexCode foundation update
Implemented:
Verification:
cargo fmt --manifest-path apexcode/Cargo.toml -- --check— Cargo does not support target discovery for this virtual workspace without--all; the equivalent new-craterustfmt --edition 2024 --checkpassed.cargo test --manifest-path apexcode/Cargo.toml --workspace— PASS with the local GNU-linker workaroundRUSTFLAGS=-Clinker=rust-lld; 29 tests total: apex-policy 5, apex-task-state 11, apex-evidence 13.cargo clippy --manifest-path apexcode/Cargo.toml --workspace --all-targets -- -D warnings— PASS with the same linker workaround.git diff --check— PASS.NO CODEX RUNTIME INTEGRATION YET
NO PRODUCTION CHANGE
NO MERGE
Verification command correction
For the isolated virtual workspace, the exact formatting command is
cargo fmt --manifest-path apexcode/Cargo.toml --all -- --check. The formatting-only closure commit makes this foundation PR fmt-clean.