Skip to content

Fix the Claude Code tab widget fallback and the Codex sidebar contract - #6

Merged
rishirsv merged 2 commits into
mainfrom
fix/app-relay-fallback
Nov 21, 2026
Merged

rishirsv merged 2 commits into
mainfrom
fix/app-relay-fallback

Conversation

@rishirsv

@rishirsv rishirsv commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Problem

In the Claude desktop Code tab, the Screens widget renders but never connects. This happens for the dev server from .mcp.json and for any Screens server that Claude Code starts.

What I found while reproducing:

  • open_screen on screens-dev returned normally. The local service only ever saw the agent's connection, with no canvas connection from the view.
  • Claude Code logs every MCP call it forwards. Across about 20 sessions since Nov 8, it never logged one of the view's _screens_call / _screens_events calls.
  • Claude Code itself forwards these calls correctly. I sent it the desktop app's own mcp_call control request (result_not_for_model, check_permissions) for the app-only _screens_call, and the call reached the server and returned a session.
  • The desktop build (Nov 20) marks the feature that routes widget calls to Claude Code-started servers as "unavailable". This matches the open bug [BUG] MCP App tool calls fail with "IPC not available" in the Claude desktop Code tab anthropics/claude-code#106708 ("IPC not available for MCP tool call"). In that bug the Code-tab ui/initialize result also has no serverTools.
  • The claude_desktop_config.json registration from 6b86312 does not reach Code tab sessions. The session's server list does not include it.

The MCP Apps spec (2026-01-26), Claude's MCP Apps docs and OpenAI's Apps SDK reference all allow our setup: _meta.ui.resourceUri, text/html;profile=mcp-app, ["app"] helper tools called through tools/call, and an empty CSP. The relay gap is on the host side. We can't fix it, so the view now handles it.

Change

  • packages/client/src/bridge.ts: if the first relay call fails, the view raises AppRelayError and keeps listening. It reads the local URL from ui/notifications/tool-result, falling back to the text content when a host drops structuredContent. It only accepts http://127.0.0.1:<port> URLs. It opens the URL with ui/open-link.
  • packages/canvas/src/shell/main.tsx: shows "Screens can't connect in this view" with an Open in browser button and the selectable URL. If the host refuses the link, the view asks the person to copy the address.
  • app-bridge gains bridge-no-relay, a stand-in host that renders the view and fails every tool call the way the Code tab does.
  • README: the Desktop registration applies to Claude Desktop chat, not Code tab sessions.

Codex sidebar regression

12eea4a replaced the Codex open_screen with one tool for every host. That tool returns a 127.0.0.1 URL, takes openBrowser, and tells the agent to use a browser "if the app cannot display or connect". It also removed the Codex guide line that tells the agent to work on the Screen get_view reports for the sidebar or thread-tab view. A Codex agent can't tell whether the view connected, so these instructions send it to a browser, away from the view that Codex relays. The view's own relay still works in the current Codex build: the desktop log shows _screens_call, _screens_events and _screens_content calls, and get_view from a --host codex adapter finds the open sidebar view.

  • packages/mcp/src/main.ts, guide.ts: with --host codex, open_screen takes only screenId again. It returns {screenId, open} with no URL, and the guide has the pre-update sidebar text again. Claude and generic hosts keep the browser fallback.
  • bridge-live now fails if the Codex open_screen offers a URL or openBrowser. Its browser-tab checks build their URLs from the service origin.
  • README: the browser-URL advice now applies to Claude Code only.

Verification

  • probe bridge-no-relay: {"fallback":true,"urlFromText":true,"openLink":true,"browserOpened":true,"relayCalls":1,"localRequests":0}. The view showed the URL from text-only content and sent ui/open-link with exactly that URL. Opening it showed the same Screen in the browser canvas. The embedded view made no local requests.
  • bridge-live, bridge-claude and bridge-no-relay each pass in a fresh session (run --fresh --id …). bridge-claude passes on its own (--id bridge-claude). Run after bridge-live in one session, it fails at "image drop did not commit through multiple chunks (0)". It fails the same way on unchanged HEAD, because the image is already stored, so nothing is uploaded again.
  • A direct MCP probe from source: Codex open_screen takes [screenId] and returns [screenId, open]. Claude open_screen takes [screenId, openBrowser] and returns [screenId, url, open]. Both keep the global and thread entrypoints.
  • screens-cli check, npm run typecheck, npm test, npm run release:build and npm run release:verify pass.

I didn't see the fallback in the real Code tab, or a Codex agent use the restored tool in the Codex app. The pane's widget can't be inspected from a session, and screen capture is blocked here.

The Claude desktop Code tab renders the Screens MCP App from servers that
Claude Code starts, but never delivers the view's tool calls to them
(anthropics/claude-code#106708). The view stayed on a start-up error.

The view now keeps listening after its first relay call fails. It reads the
local URL from the open_screen tool result, using the text content when
structuredContent is missing. It then shows that URL with an Open in browser
button that sends ui/open-link.

A stand-in host that fails every tool call covers this as app-bridge
bridge-no-relay. The README no longer says the Desktop registration reaches
Code tab sessions.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 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-21T22:47:05.491694Z 0dadf7f 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.

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

Here are some automated review suggestions for this pull request.

Reviewed commit: a6956a95f2

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

function RelayFallback({ relay }: { relay: AppRelayError }) {
const [url, setUrl] = useState<string | null | undefined>(undefined);
const [failed, setFailed] = useState(false);
useEffect(() => { void relay.browserUrl().then(setUrl); }, [relay]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Update the fallback when a delayed tool result arrives

If the host delivers ui/notifications/tool-result more than three seconds after the relay fails, browserUrl() resolves to null and RelayFallback permanently renders “Ask the agent for the local Screens URL” without an Open in browser button. The message listener subsequently records the correct URL, but the component calls browserUrl() only once and never receives that update. This can occur when the view initializes before open_screen completes, particularly with openBrowser: true, whose launcher can wait up to five seconds. Keep the fallback subscribed to URL notifications after the initial timeout so a late result can populate the address and button.

Useful? React with 👍 / 👎.

12eea4a gave every host one open_screen that returns a 127.0.0.1 URL,
takes openBrowser and tells the agent to use a browser when the app
cannot connect. In Codex this sent agents away from the sidebar and
thread-tab view, which relays its own calls, and dropped the guide text
that tells them to work on the Screen get_view reports.

Codex gets its own open_screen again: screenId only, no URL, the
sidebar guide text. Claude and generic hosts keep the browser fallback.
bridge-live now checks that the Codex tool offers no browser URL or
launch, and takes its browser-tab URLs from the service origin.
@rishirsv rishirsv changed the title Offer the browser canvas when a host cannot relay widget calls Fix the Claude Code tab widget fallback and the Codex sidebar contract Nov 21, 2026
@rishirsv
rishirsv merged commit db84101 into main Nov 21, 2026
1 check passed
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.

1 participant