Skip to content

Reconnect native MCP without replaying uncertain calls - #5556

Merged
markstuart-oai merged 5 commits into
feat/codex-harnessfrom
mark/req133-mcp-reconnect-python
Nov 6, 2026
Merged

markstuart-oai merged 5 commits into
feat/codex-harnessfrom
mark/req133-mcp-reconnect-python

Conversation

@markstuart-oai

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

Copy link
Copy Markdown
Contributor

Summary

The native MCP client reconnects before sending a tool request on a known-closed connection. If a tool loses its response after dispatch, the client preserves the original error and marks the connection for repair. A later request can use the replacement without repeating the interrupted tool.

Recovery and dispatch share the request's timeout budget. The client preserves the existing transient HTTP retry policy for tool discovery. Shutdown prevents a replacement from accepting work and waits for SDK-owned stdio servers to exit. Active HTTP requests can finish on their original connection.

Test plan

  • Built and installed the Linux wheel with Python 3.10. All 41 focused tests passed, including wheel contents and both reconnect scenarios.
  • Passed the focused Rust deadline, shutdown, stdio cleanup, and discovery retry regressions. The resource MRTR suite has one existing failure that reproduces on the unchanged source, so the passing run excludes it.
  • Passed the 172-case Python 3.10 optional MCP adapter lane with the traceback fix on the target branch.
  • Passed the full local SDK verification with 4,953 parallel tests and 41 serial tests.
  • Current-head GitHub Actions runs the platform and Python version matrices.

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 marked this pull request as ready for review November 6, 2026 04:08
@markstuart-oai
markstuart-oai requested review from a team, rm-openai and seratch as code owners November 6, 2026 04:08
@chatgpt-codex-connector

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

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T05:15:19.208848Z b9955e8 New commits
🔒 Security Review ✅ Completed 2026-11-06T05:15:05.364125Z b9955e8 New commits
ℹ️ 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.

@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.

Confirmed the existing operation-deadline finding. Admission recovery occurs before the operation timeout starts, and reconnect after a dispatched call also runs outside it. A stalled handshake can delay the original uncertain-call error indefinitely or allow dispatch after the supplied timeout. Carry one deadline through admission/recovery and preserve the original uncertain-call error, while retaining cancellation-safe process cleanup. Referencing the existing thread rather than duplicating an inline finding.

Static review only; no local code or tests executed. Hosted native platform checks passed; Python 3.10 failed three optional MCP Tasks cancellation traceback tests outside this diff (baseline causation unverified).

@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, superseding my request changes. The Rust reconnect patch exactly matches the approved JavaScript implementation. One active-time budget covers admission, replacement initialization, retries and dispatch; an uncertain tool failure keeps its original error without replay. Shutdown fencing blocks replacement dispatch and joins owned process cleanup. Python integration fixtures are unchanged. No new actionable findings.

Hosted CI remains pending with no observed current-head failures. Static coordinator and independent review only; no candidate code or local tests executed.

@markstuart-oai
markstuart-oai merged commit f04f058 into feat/codex-harness Nov 6, 2026
25 checks passed
@markstuart-oai
markstuart-oai deleted the mark/req133-mcp-reconnect-python branch November 6, 2026 05:33
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.

3 participants