feat: expose outputSchema to user_turn/turn_start app_server API #8377
+722
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changed
outputSchemasupport to the app-server APIs, mirroringcodex exec --output-schemabehavior.sendUserTurnnow acceptsoutputSchemaand constrains the final assistant message for that turn.turn/startnow acceptsoutputSchemaand constrains the final assistant message for that turn (explicitly per-turn only).Core behavior
Op::UserTurnalready supportedfinal_output_json_schema; now V1sendUserTurnforwardsoutputSchemainto that field.Op::UserInputnow carriesfinal_output_json_schemafor per-turn settings updates; core maps it intoSessionSettingsUpdate.final_output_json_schemaso it applies to the created turn context.turn/startdoes NOT persist the schema viaOverrideTurnContext(it’s applied only for the current turn). Other overrides (cwd/model/etc) keep their existing persistent behavior.API / docs
codex-rs/app-server-protocol/src/protocol/v1.rs: addoutput_schema: Option<serde_json::Value>toSendUserTurnParams(serialized asoutputSchema).codex-rs/app-server-protocol/src/protocol/v2.rs: addoutput_schema: Option<JsonValue>toTurnStartParams(serialized asoutputSchema).codex-rs/app-server/README.md: documentoutputSchemaforturn/startand clarify it applies only to the current turn.codex-rs/docs/codex_mcp_interface.md: documentoutputSchemafor v1sendUserTurnand v2turn/start.Tests added/updated
outputSchemais forwarded into outbound/responsesrequests astext.format:codex-rs/app-server/tests/suite/output_schema.rscodex-rs/app-server/tests/suite/v2/output_schema.rssend_user_turn_output_schema_is_per_turn_v1turn_start_output_schema_is_per_turn_v2final_output_json_schemawhenNonefinal_output_json_schemawhenSome(schema)Call site updates (high level)
Op::UserInput { .. }constructions to includefinal_output_json_schema:codex-rs/app-server/src/codex_message_processor.rscodex-rs/core/src/codex_delegate.rscodex-rs/mcp-server/src/codex_tool_runner.rscodex-rs/tui/src/chatwidget.rscodex-rs/tui2/src/chatwidget.rsValidation
just fmtcargo test -p codex-corecargo test -p codex-app-servercargo test -p codex-mcp-servercargo test -p codex-tuicargo test -p codex-tui2cargo test -p codex-protocolcargo clippy --all-features --tests --profile dev --fix -- -D warnings