core-agent-ide/codex-rs/app-server-protocol
Michael Bolin 53bcfaf42d
fix: explicitly list name collisions in JSON schema generation (#12406)
## Why

JSON schema codegen was silently resolving naming collisions by
appending numeric suffixes (for example `...2`, `...3`). That makes the
generated schema names unstable: removing an earlier colliding type can
cause a later type to be renumbered, which is a breaking change for
consumers that referenced the old generated name.

This PR makes those collisions explicit and reviewable.

Though note that once we remove `v1` from the codegen, we will no longer
support naming collisions. Or rather, naming collisions will have to be
handled explicitly rather than the numeric suffix approach.

## What Changed

- In `codex-rs/app-server-protocol/src/export.rs`, replaced implicit
numeric suffix collision handling for generated variant titles with
explicit special-case maps.
- Added a panic when a collision occurs without an entry in the map, so
new collisions fail loudly instead of silently renaming generated schema
types.
- Added the currently required special cases so existing generated names
remain stable.
- Extended the same approach to numbered `definitions` / `$defs`
collisions (for example `MessagePhase2`-style names) so those are also
explicitly tracked.

## Verification

- Ran targeted generator-path test:
- `cargo test -p codex-app-server-protocol
generate_json_filters_experimental_fields_and_methods -- --nocapture`


---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/12406).
* #12408
* __->__ #12406
2026-02-20 17:51:53 -08:00
..
schema Add ability to attach extra files to feedback (#12370) 2026-02-20 22:26:14 +00:00
src fix: explicitly list name collisions in JSON schema generation (#12406) 2026-02-20 17:51:53 -08:00
tests feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00
BUILD.bazel feat: vendor app-server protocol schema fixtures (#10371) 2026-02-01 23:38:43 -08:00
Cargo.toml app-server: improve thread resume rejoin flow (#11776) 2026-02-20 05:29:05 +00:00