feat: expose outputSchema to user_turn/turn_start app_server API#8377
Merged
apanasenko-oai merged 1 commit intomainfrom Jan 5, 2026
Merged
feat: expose outputSchema to user_turn/turn_start app_server API#8377apanasenko-oai merged 1 commit intomainfrom
apanasenko-oai merged 1 commit intomainfrom
Conversation
pakrym-oai
reviewed
Dec 23, 2025
| items: vec![UserInput::Text { | ||
| text: "hello 1".into(), | ||
| }], | ||
| final_output_json_schema: None, |
Collaborator
There was a problem hiding this comment.
we have this value on the UserTurn, should we use that instead? I'd like to remove UserInput all together. They call the same codepath eventually anyway.
pakrym-oai
approved these changes
Dec 24, 2025
Collaborator
pakrym-oai
left a comment
There was a problem hiding this comment.
Adding final_output_json_schema to UserInput isn't great but we should've unified it with UserTurn a long time ago.
owenlin0
approved these changes
Jan 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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