Commit bd693e5
committed
fix: avoid mutating codex output schema input
Mirror the MCP fix in #3134 (and the FunctionTool fix in #3382) for the
Codex output_schema path. `_resolve_output_schema` currently does
`schema = dict(option)`, which is only a shallow copy — nested user
dicts (e.g. each entry in `option["properties"]`) are the same identity
as the caller's. `ensure_strict_json_schema` then mutates those nested
dicts in place (it is documented as mutating its input), leaking
strict-mode side effects like `additionalProperties: false` and
`required: [...]` back into the caller's stored schema.
Switch to `copy.deepcopy(dict(option))` so the strict conversion only
mutates the local copy, matching the precedent established by #3134.1 parent 5645845 commit bd693e5
2 files changed
Lines changed: 16 additions & 1 deletion
File tree
- src/agents/extensions/experimental/codex
- tests/extensions/experiemental/codex
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
694 | 695 | | |
695 | 696 | | |
696 | 697 | | |
697 | | - | |
| 698 | + | |
698 | 699 | | |
699 | 700 | | |
700 | 701 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
1516 | 1517 | | |
1517 | 1518 | | |
1518 | 1519 | | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
1519 | 1533 | | |
1520 | 1534 | | |
1521 | 1535 | | |
| |||
0 commit comments