Apps SDK: rapid-prompt startup race — first widget fails template fetch (404) and host "Searching..." indicator never resolves; only requestClose() workaround partially mitigates

Reproducible on web ChatGPT:

  1. User sends a prompt that triggers an MCP tool returning a widget (e.g., a hotel search). Server polls upstream API (~10s).

  2. Before the first widget renders, user sends a second prompt that chains another tool (e.g., “book the first room”).

  3. Both tool calls complete successfully on the server.

Observed:

  • First widget appears in chat but the SDK fails to load its HTML template — browser console shows 404 on /backend-api/ecosystem/widget?...&template_pointer=ui://widget/<our>.html&resource_path=....

  • Red error “Stopped talking to App — Error loading app — Failed to fetch template” appears with a Retry button.

  • Host indicator “Searching …” stays suspended forever for the first turn — openai/toolInvocation/invoked never transitions, even though the tool returned successfully.

  • Second widget (chained tool) loads correctly. Chat history shows the first card permanently broken alongside the second functional one.

Workaround in place: the official window.openai.requestClose() API, called from our boot via a short timer when no payload arrives, successfully dismisses the orphan when our JS runs. It does not address the cases where our JS never executes due to the failed template fetch.

Unresolved: the template-fetch 404, the “Failed to fetch template” UI error, and the stuck “Searching …” indicator — all host-side.

NB: This issue triggers only and exclusively at the first widget boot, when a second prompt is sent while the first one is still loading.

Thanks a lot for your help guys!!!

Another note (sorry): When a user sends two prompts in rapid succession in a ChatGPT conversation that uses an MCP-backed App, ChatGPT silently creates alternate conversation branches (visible as 1/2 ▸ 2/2 pagination at the bottom of the message): I literally see two parallel conversations within one thread (so, not just for the first bot widget mentioned into the description, also during a conversational flow).