Support --output-schema for exec resume (#23123)

## Why

`codex exec resume` should have the same structured-output support as
top-level `codex exec`. Without `--output-schema`, multi-turn automation
has to choose between resumed session context and schema-validated JSON
output.

Fixes #22998.

## What changed

- Marked `--output-schema` as a global `codex exec` flag so it can be
passed after `resume`.
- Reused the existing output schema plumbing so resumed turns attach the
schema to the final response request while preserving session context.
This commit is contained in:
Eric Traut
2026-05-18 08:55:22 -07:00
committed by GitHub
parent fce10e009d
commit af6ffb6ebb
4 changed files with 68 additions and 3 deletions

View File

@@ -2346,7 +2346,7 @@ mod tests {
}
#[test]
fn exec_resume_accepts_output_last_message_flag_after_subcommand() {
fn exec_resume_accepts_output_flags_after_subcommand() {
let cli = MultitoolCli::try_parse_from([
"codex",
"exec",
@@ -2354,6 +2354,8 @@ mod tests {
"session-123",
"-o",
"/tmp/resume-output.md",
"--output-schema",
"/tmp/schema.json",
"re-review",
])
.expect("parse should succeed");
@@ -2369,6 +2371,10 @@ mod tests {
exec.last_message_file,
Some(std::path::PathBuf::from("/tmp/resume-output.md"))
);
assert_eq!(
exec.output_schema,
Some(std::path::PathBuf::from("/tmp/schema.json"))
);
assert_eq!(args.session_id.as_deref(), Some("session-123"));
assert_eq!(args.prompt.as_deref(), Some("re-review"));
}