Skip to content

fix(client): wait for slow HTTP discovery in Auto mode - #1435

Open
charliermarsh wants to merge 1 commit into
modelcontextprotocol:mainfrom
charliermarsh:charlie/http-discovery-fallback
Open

charliermarsh wants to merge 1 commit into
modelcontextprotocol:mainfrom
charliermarsh:charlie/http-discovery-fallback

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Nov 6, 2026 •

Copy link
Copy Markdown

Summary

At present, a Streamable HTTP server that takes 12 seconds to answer server/discover can fail to connect in Auto mode. After 10 seconds, the client queues a legacy initialize request with ID 1. The HTTP worker is still reading the discovery POST, so when the server replies with ID 0, the client rejects the correct reply with expected 1, got 0 (see: openai/codex#57631).

In this PR, Auto still gives discovery 10 seconds, including time spent sending the probe and negotiating a version. Then, when the HTTP transport accepts the probe, it marks that request before the send future is polled. If the 10 seconds expire, Auto keeps waiting for that HTTP handshake within the caller’s startup deadline. A JSON or SSE reply can finish discovery, and an explicit legacy rejection still triggers initialize immediately.

@github-actions github-actions Bot added T-test Testing related changes T-core Core library changes T-service Service layer changes T-transport Transport layer changes labels Nov 6, 2026
@github-actions
github-actions Bot requested a review from jamadeo November 6, 2026 17:09
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

@jamadeo is on triage rotation this week and is the reviewer for this one.

Labels come from the PR labeler. Please review the change.

Automated triage. Labels are a first pass and the assigned maintainer has the final say.

@charliermarsh
charliermarsh force-pushed the charlie/http-discovery-fallback branch 3 times, most recently from 2cfa51f to cec7d60 Compare November 6, 2026 18:14
@charliermarsh charliermarsh changed the title fix(client): handle late discovery replies during startup fix(client): wait for slow HTTP discovery in Auto mode Nov 6, 2026
@charliermarsh
charliermarsh force-pushed the charlie/http-discovery-fallback branch from cec7d60 to 0fff88e Compare November 6, 2026 18:35
@charliermarsh
charliermarsh force-pushed the charlie/http-discovery-fallback branch from 0fff88e to 74d1079 Compare November 6, 2026 18:49
@charliermarsh
charliermarsh marked this pull request as ready for review November 6, 2026 19:02
@charliermarsh
charliermarsh requested a review from a team as a code owner November 6, 2026 19:02
@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-06T19:05:23.959702Z 74d1079 Draft marked ready
ℹ️ 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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-service Service layer changes T-test Testing related changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant