Expand description
cargo xtask codex-schema <subcommand> — Rust port of the vendored
codex-app-server-client crate’s former schema/build_combined_schema.py,
plus staleness stamping and typify-panic bisection tooling.
Subcommands:
regen Rebuild schema/protocol.schema.json + schema/methods.json from a
fresh codex app-server generate-json-schema dump, and stamp the
codex version the vendored schema was generated from.
bisect Binary-search a fresh schema dump for the minimal definition(s)
that panic typify’s schema-merge logic, the same failure mode
documented for McpServerElicitationRequestParams in the
crate’s README.
drift Diff the vendored schema/methods.json against a fresh (or saved)
codex app-server generate-json-schema dump and report added,
removed, and changed methods per section - see drift.rs.
See crates/shared/codex-app-server-client/README.md’s “Regenerating the
schema” section for the end-to-end workflow this drives.
Modules§
- bisect 🔒
cargo xtask codex-schema bisect <dir>- binary-searches a fresh schema dump for the minimal definition(s) that panic typify’s schema-merge logic (typify-impl-0.7.0’smerge.rs:427, “not yet implemented” - the same failure modeMcpServerElicitationRequestParamshit; seecrates/shared/codex-app-server-client/README.md). Automates the “opaque out half the new/changed definitions, see if the panic goes away” process that was previously done by hand.- drift 🔒
cargo xtask codex-schema drift [--dir <dump-dir>] [--json] [--strict]- diffs the vendoredschema/methods.json+schema/CODEX_VERSION.txtagainst a freshcodex app-server generate-json-schemadump (or an existing dump directory passed via--dir), so an upstreamcodexversion bump that adds, removes, or renames a method can’t silently slip past the version-string-only staleness check incrates/shared/codex-app-server-client/build.rs.- merge 🔒
- Core schema-merging logic - a faithful Rust port of the definitions-
combining half of the former
schema/build_combined_schema.py(see git history for the original). Reused by bothregen(the real merge) andbisect(building opaqued-out candidate schemas from the same merge). - naming 🔒
- Method-name -> Rust-identifier derivation, ported from
build_combined_schema.py. Naming here must exactly match whattypifynames the corresponding generated Rust types/enum variants - this was empirically cross-validated against real typify output when this crate was first built, so keep it in lock-step with the Python original rather than “simplifying”. - regen 🔒
cargo xtask codex-schema regen <dir>- rebuilds the vendored schema assets from a freshcodex app-server generate-json-schemadump, and stamps thecodexversion they were generated from for staleness detection (seecrates/shared/codex-app-server-client/build.rs).- typify_
probe 🔒 - Runs
typify::TypeSpace::add_root_schemaagainst a candidate schema insidecatch_unwind, classifying the outcome sobisectcan distinguish “converts fine”, “panics with the known typify-0.7.0merge.rs:427shape”, and “something else entirely” (a different panic, or an ordinaryResult::Err).
Constants§
- CODEX_
VERSION_ 🔒PATH - Workspace-relative path to the staleness-tracking codex version stamp
(see
regen::stamp_codex_versionandbuild.rs’s staleness check). - MASTER_
BUNDLE_ 🔒FILE - Filename of the master (non-v2) schema bundle emitted by
codex app-server generate-json-schemainto its output directory. Shared byregenandbisect, which both read the same dump directory - must stay byte-identical between the two or one could silently start reading a stale/mismatched file. - METHODS_
JSON_ 🔒PATH - Workspace-relative path to the vendored per-method manifest.
- PROTOCOL_
SCHEMA_ 🔒PATH - Workspace-relative path to the vendored combined protocol schema.
- V2_
BUNDLE_ 🔒FILE - Filename of the v2-only schema bundle emitted alongside the master
bundle. See
MASTER_BUNDLE_FILE.
Functions§
- load_
combined_ 🔒defs - Reads the master + v2 schema bundles from
gen_dir, merges them viamerge::build_combined, and extracts the flatdefinitionsobject. Shared byregen::regen(which writes the combined schema out) andbisect::bisect(which probes the definitions with typify). - parse_
gen_ 🔒dir - Parses the single positional
<gen-dir>argument shared by thecodex-schema regenandcodex-schema bisectsubcommands:--help/-hprintsusageand exits 0 immediately, exactly one positional argument is accepted as the generated-schema directory, and any further positional argument is rejected.usagedoubles as the error context when the positional argument is missing. - print_
help 🔒 - read_
json 🔒 - Reads and parses a JSON file, with file-path context on failure.
- run