Skip to content

feat: add native MCP prompt discovery and reads - #5604

Merged
markstuart-oai merged 2 commits into
feat/codex-harnessfrom
mark/req574-mcp-prompts-python
Nov 8, 2026
Merged

markstuart-oai merged 2 commits into
feat/codex-harnessfrom
mark/req574-mcp-prompts-python

Conversation

@markstuart-oai

@markstuart-oai markstuart-oai commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This pull request adds MCP prompt discovery and reads to idle native sessions. Applications can call list_mcp_prompts(server) to get the complete prompt inventory and get_mcp_prompt(server, name, arguments) to read a named prompt with optional string arguments.

Listing follows every cursor page and fails if pagination cannot complete. Both methods preserve prompt metadata and content. They use the existing server selection and lifecycle rules. Prompt content does not enter model instructions or conversation history automatically.

The native collector limits the complete serialized prompt catalog to 8 MiB. Prompt JSON responses and POST SSE events are also capped at 8 MiB. GET SSE streams now enforce their configured event limit, including legacy mode (16 MiB by default).

Test plan

  • Required repository verification passed: formatting, lint, Mypy, Pyright, 5,566 parallel tests, and 54 serial tests; 250 tests skipped.
  • Matching native build, 52 focused MCP and lifecycle tests, and 37 direct native MCP tests passed.
  • Built the Linux wheel and verified its source and patch provenance. The official installed-package verifier and prompt/cancellation checks passed in a fresh Python 3.10 environment.
  • Two independent final reviews found no issues.

Issue number

No linked public issue.

Checks

  • I've added new tests, if relevant
  • I've run the applicable checks in AGENTS.md, including .agents/skills/code-change-verification/scripts/run.sh when required
  • I've confirmed all required checks pass
  • I've completed the review required by AGENTS.md

@markstuart-oai
markstuart-oai requested review from a team, rm-openai and seratch as code owners November 8, 2026 02:44
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T03:38:52.964415Z 9049d54 New commits
🔒 Security Review ✅ Completed 2026-11-08T03:39:26.577841Z 9049d54 New commits

Security findings

Advisory findings (1)

ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 45e5cb7272

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Request changes: [P2] bound prompt response and aggregate catalog bytes. I independently confirmed the existing finding; no duplicate inline comment.

A selected compromised HTTP MCP server can return very large descriptions or _meta within the 2,048-item/100-page limits. The pinned collector checks item count and then extends the retained catalog without a byte budget; the pinned HTTP JSON transport deserializes response.json() without a response-size cap. Thus one response or several individually acceptable pages can exhaust host memory before the timeout. Bound response bytes before materializing/deserializing the body and accumulated catalog bytes before retaining another page; reject overflow without partial results. Add coverage for oversized single responses and cumulative overflow across pages.

The API, metadata preservation, selected-server restrictions, idle mutation fencing, cancellation/close and caller-data isolation otherwise look sound after independent static reviews. Hosted CI remains in progress. No candidate code or tests executed.

@markstuart-oai
markstuart-oai force-pushed the mark/req574-mcp-prompts-python branch from 45e5cb7 to 9049d54 Compare November 8, 2026 03:37

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved at 9049d54. The prior byte-bound finding is resolved: serialized prompt arrays share an 8 MiB budget checked before catalog retention; prompt HTTP POST bodies are bounded before parsing, and resumed SSE honors the configured per-event bound. Counting includes preserved metadata and escaped UTF-8 without materializing a second catalog copy. Existing pagination, authority, cancellation, and caller-data isolation behavior remains intact. Reviewed focused regressions for cumulative pages, exact bounds, oversized JSON/SSE, resumed unterminated events, and session reuse. Hosted CI remains pending. Static review only; no candidate code or tests run.

@markstuart-oai
markstuart-oai merged commit 4c11900 into feat/codex-harness Nov 8, 2026
31 checks passed
@markstuart-oai
markstuart-oai deleted the mark/req574-mcp-prompts-python branch November 8, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants