[Codex][CLI] Gate image inputs by model modalities#10271
Conversation
wiltzius-openai
left a comment
There was a problem hiding this comment.
lgtm but someone with more client familiarity should take a look too
|
Going to merge in an hour or so to keep things moving and unblock app/extension. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82210d2a10
ℹ️ 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".
codex-rs/tui/src/chatwidget.rs
Outdated
| if !local_images.is_empty() && !self.current_model_supports_images() { | ||
| let local_image_paths = local_images.iter().map(|img| img.path.clone()).collect(); | ||
| self.bottom_pane | ||
| .set_composer_text(text, text_elements, local_image_paths); |
There was a problem hiding this comment.
Preserve mention paths when blocking image submits
When a submit is blocked for unsupported images, this path restores the draft via set_composer_text, which clears mention_paths in the composer (set_text_content resets self.mention_paths). If the draft includes tool/skill mentions (e.g., $file inserted via the mention popup), those linked paths are lost; after the user removes images and re‑submits, collect_tool_mentions will see the mention names but no linked paths, so the tool references silently drop. This only occurs when the model rejects images, so the regression is tied to this new gating behavior.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Clarifying “mention linkage”: when a user picks an item from the $-mention popup, we store both (1) the visible token in the draft text (for example $foo) and (2) an internal mapping mention_paths[name] -> canonical target (skill file path or app://... connector id).
In this blocked-image path we restore the draft via set_composer_text, which currently clears mention_paths. That means the user still sees $foo after the warning, but we’ve lost the canonical target they selected.
On retry (after removing images), mention parsing falls back to name-only heuristics. Unambiguous cases may still work, but ambiguous/colliding names can resolve to the wrong target or be dropped. So this is user-visible as “I picked a mention, but after the image warning + retry it didn’t reference what I selected.”
Also, this affects both skill mentions and connector/app mentions (not just skills), because both rely on the same linkage map.
|
Added some docs in docs: clarify model input modality contracts |
ee38e70 to
addb4a4
Compare
| /// failures do not hard-block user input in the UI. | ||
| fn current_model_supports_images(&self) -> bool { | ||
| let model = self.current_model(); | ||
| self.models_manager |
There was a problem hiding this comment.
I think this info should be on ModelPreset for tui and on the Model info app-server sends to client
| #[strum(serialize_all = "lowercase")] | ||
| pub enum InputModality { | ||
| /// Plain text turns and tool payloads. | ||
| #[default] |
There was a problem hiding this comment.
default shouldn't be text. Let's not have a default
There was a problem hiding this comment.
should be Image+Text as default unless model_cache says differently
pub fn default_input_modalities() -> Vec<InputModality> {
vec![InputModality::Text, InputModality::Image]
}
aibrahim-oai
left a comment
There was a problem hiding this comment.
Let's not have a default and always have the two text and image as values. Also, add the information on ModelPreset so we don't need to list models again
Could we get there in two stages? I'd like to avoid having an opening surface area for regression w/ backward compatibility this close to a release cycle. How does this sound
|
baafcf0 to
921ee7c
Compare
Document protocol compatibility defaults for input_modalities. Clarify TUI image attach/paste gating invariants and warnings. Add model metadata update guidance for contributors.
Restore mention_paths when submit is blocked for unsupported images so $-mentions keep their canonical targets after users remove images and retry. Add a chatwidget regression test covering blocked-image draft restore with image placeholders and mention links.
921ee7c to
431331e
Compare
Summary
Rationale
Scope
Trade-offs
Follow-up
Testing