Repository navigation
Conversation
OpenAI marks assistant messages as commentary or final_answer. The message types had no phase field, so the value was dropped from public output, stored history and replayed input. Model it as an optional closed enum, keep it through conversion and storage, and reject it on non-assistant input. Signed-off-by: Zheng Lu <Lz429671594@gmail.com>
Zheng-Lu
requested review from
bbrowning,
franciscojavierarceo,
haoshan98,
jiahuei,
leseb,
maralbahari,
noobHappylife,
qandrew and
tjtanaa
as code owners
September 25, 2026 17:03
Collaborator
Contributor
Author
Thanks, you're right. I'll close #383. The only behavior #383 adds is rejecting phase on non-assistant input messages with a 400; |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related to #335 (split from #350)
Summary
OpenAI marks assistant messages with
phase(commentaryorfinal_answer). The gateway's message types had no such field, so the value was dropped from the public response, from stored history, and from the input replayed on the next turn.MessagePhaseto input and output messages. It passes through completion, output-to-input conversion, storage and rehydration unchanged. The gateway never infers a phase: absent ornullstays absent, and vLLM's"phase": nulloutput is unchanged.phaseon non-assistant input messages with a 400 before any inference.InputMessageandOutputMessageintotypes/io/message.rsto stay within the file-size policy. Existing import paths still work. Rust struct literals must now setphase; the constructors default it toNone.Test Plan
cargo test -p agentic-server-core -p agentic-server: 1,728 passed, 0 failed, 17 ignored.cargo clippy --workspace --all-targets -- -D warnings,cargo fmt --checkand pre-commit (including Rust file sizes) pass.message_phase_test.rsreplays the recorder-generatedcustom-tool-openai-reference-gpt-5.6cassettes (JSON and SSE):phase: final_answerreaches the public output.previous_response_idcontinuation replays it upstream.mainboth values are missing, in both modes.nulllegacy values, storage round trips, the upstream wire projection, and rejection foruser,systemanddeveloper.openapi.rschecks the schema accepts absent,nulland both values, and rejects unknown ones.