core/app-server: preflight image modality mismatch with typed error#10697
core/app-server: preflight image modality mismatch with typed error#10697
Conversation
f9af4d9 to
0e2d752
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9af4d9576
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ) -> CodexResult<SamplingRequestResult> { | ||
| preflight_validate_sampling_input_modalities(turn_context.as_ref(), &input)?; | ||
|
|
There was a problem hiding this comment.
Apply modality preflight beyond sampling requests
This new preflight only runs in run_sampling_request, so any other model calls that build a Prompt directly (e.g., compaction via run_compact_task_inner/drain_to_completed in core/src/compact.rs) still send image-bearing history to text-only models. In practice, a thread with images that triggers auto‑compaction (or a manual compact) will bypass the new typed error and still hit provider 400s. If the goal is an authoritative guard for all outgoing payloads, the same check needs to be enforced in the compaction path (or centralized before any prompt is streamed).
Useful? React with 👍 / 👎.
Summary
unsupportedInputModality) through protocol and app-server v2.docs/model-update.mdwith the implemented contract and client handoff details.Rationale (from spec findings)
Scope
codex-rs/core: preflight check + error mapping.codex-rs/protocol: image detection helpers + new error variant.codex-rs/app-server-protocol: v2 error variant + generated schema/types.docs/model-update.md: implementation-focused spec notes for consumer clients.Trade-offs
Client follow-up
codexErrorInfo.unsupportedInputModalityas non-retryable.Testing
cargo fmt --allcargo check -p codex-protocol -p codex-core -p codex-app-server-protocol -p codex-app-servercargo test -p codex-app-server-protocol unsupported_input_modality -- --nocapture