Skip to content

Conversation

@linuxmetel
Copy link
Contributor

Fix the issue #7416 that the codex-cli produce an error "MCP startup failure on missing 'type' field" in the startup.

  • Cause: serde in convert_to_rmcp (codex-rs/rmcp-client/src/utils.rs) failed because no r#type value was provided
  • Fix: set a default r#type value in the corresponding structs

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@chatgpt-codex-connector
Copy link
Contributor

💡 Codex Review

pub annotations: Option<Annotations>,
pub data: String,
#[serde(rename = "mimeType")]
pub mime_type: String,
#[serde(default = "image_str")]

P1 Badge Audio blocks without type now deserialize as images

Because ContentBlock is untagged and tries variants in order (image comes before audio), adding #[serde(default = "image_str")] to ImageContent.r#type means any payload from the Rust SDK that omits the type field but has data/mimeType will now match the image variant first; serde will fill type: "image" and never attempt the audio variant. The intended fix for missing type therefore misclassifies audio content rather than returning an error, so audio responses passed through convert_to_mcp will surface as images and be rendered/handled incorrectly.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@linuxmetel
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Dec 1, 2025
@linuxmetel
Copy link
Contributor Author

Thank you. I believe the structs that require default values for r#type are ToolOutputSchema and ToolInputSchema, and the issue seems to occur in calls such as RmcpClient::list_tools(). I will update the implementation so that only these two structs define default values for r#type.

@linuxmetel
Copy link
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@etraut-openai
Copy link
Collaborator

Thanks for the contribution. Before I assign this for review by one of the codex team members, please fix the CI failures. Looks like a simple format issue, so it should be straightforward.

@etraut-openai etraut-openai added the needs-response Additional information is requested label Dec 1, 2025
@linuxmetel
Copy link
Contributor Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 71 to 72
# apply patch
subprocess.run(["patch", "src/lib.py", "-i", "lib.py.patch"], check=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Correct mcp type generator patch command

Running generate_mcp_types.py without --check now fails because the new patch step calls patch src/lib.py -i lib.py.patch, but the generated file and the checked-in patch are src/lib.rs/lib.rs.patch. With check=True on subprocess.run, this raises immediately when the files aren’t found, preventing the mcp types from being regenerated or having the defaults re-applied when the schema changes.

Useful? React with 👍 / 👎.

@linuxmetel
Copy link
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@linuxmetel
Copy link
Contributor Author

linuxmetel commented Dec 1, 2025

@etraut-openai Thank you for your review. The CI error occurred because mcp-types/src/lib.rs differed from the auto-generated file after my fix. I’ve updated generate_mcp_types.py so that it applies the corresponding patch to the Rust source file. It might be a bit ad hoc, but it’s simple and appropriate for this case.

@etraut-openai
Copy link
Collaborator

That's a pretty bad hack. It's unlikely that change will be accepted.

@linuxmetel
Copy link
Contributor Author

I see. I will rewrite the script.

Cause:
- serde in `convert_to_rmcp` (`codex-rs/rmcp-client/src/utils.rs`) failed for `ToolInputSchema` and `ToolOutputSchema` because no `r#type` value was provided.

Fix:
- set a default `r#type` value for these two structs so a missing `type` no longer breaks MCP startup.
@linuxmetel
Copy link
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Nice work!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@linuxmetel
Copy link
Contributor Author

I’ve reworked the generate_mcp_types.py script to use a more proper approach.

@linuxmetel
Copy link
Contributor Author

@etraut-openai Is this now ok?

@etraut-openai etraut-openai removed the needs-response Additional information is requested label Dec 1, 2025
@linuxmetel linuxmetel closed this Dec 1, 2025
@linuxmetel linuxmetel reopened this Dec 1, 2025
@linuxmetel
Copy link
Contributor Author

it's my mistake

Copy link
Collaborator

@gpeal gpeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@gpeal gpeal merged commit c936c68 into openai:main Dec 1, 2025
52 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants