How to close/hide previous widget when a new tool call creates a new one?

I’m building a ChatGPT App where each user message triggers a tool call that returns a widget (via _meta.ui.resourceUri). The problem is that the old widget from the previous message stays visible in the conversation, and the new widget appears below it. I want the previous widget to close/collapse when the new one renders — similar to how Adobe Photoshop behaves in ChatGPT (only one active widget visible at a time).

What I’ve considered:

  1. openai/closeWidget: true in _meta — from the docs this seems to close the widget of the current tool response, not a previous one.
  2. window.openai.requestClose() — the widget can close itself, but I’m not sure how the old widget would know a new tool call happened.
  3. Listening for ui/notifications/tool-input — does ChatGPT broadcast this notification to all mounted widgets of the same app, or only to the widget associated with the current tool call? If all widgets receive it, I could call requestClose() in the old widget when it gets a tool-input for a new tool call.

Questions:

  • What is the recommended pattern for “single active widget” behavior — where only the latest widget is visible and previous ones are hidden?
  • Does ui/notifications/tool-input get delivered to previously rendered widgets of the same app?
  • Is there another mechanism I’m missing?