[codex] Add X11 forwarding support#835
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27a6efbc83
ℹ️ 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".
| const line = output | ||
| .split(/\r?\n/) | ||
| .find((entry) => new RegExp(`\\b${MIT_MAGIC_COOKIE_PROTOCOL}\\b\\s+[0-9a-fA-F]+`).test(entry)); | ||
| const match = line?.match(new RegExp(`\\b${MIT_MAGIC_COOKIE_PROTOCOL}\\b\\s+([0-9a-fA-F]+)`)); |
There was a problem hiding this comment.
Match xauth cookie to the requested display
This lookup returns the first MIT-MAGIC-COOKIE-1 entry from xauth output without checking whether it belongs to the configured display, so hosts with multiple .Xauthority records (for example :0 plus stale/forwarded :10) can get the wrong cookie and fail every forwarded X11 app auth. The selected entry should be filtered against the target display before extracting the cookie.
Useful? React with 👍 / 👎.
| localSocket.on("error", () => cleanup()); | ||
| acceptedChannel.on("close", () => destroyStream(localSocket)); | ||
| localSocket.on("close", () => destroyStream(acceptedChannel)); | ||
| const realCookie = options.localAuthCookie || readLocalX11AuthCookie({ display, platform }); |
There was a problem hiding this comment.
Cache local X11 auth instead of blocking per channel
Each incoming X11 channel triggers readLocalX11AuthCookie() here, and that function uses execFileSync with a 2s timeout; because this runs on the Electron main process thread, apps that open multiple X11 channels can repeatedly freeze IPC/UI while cookies are fetched. Resolve the local cookie once per SSH session (or switch to async lookup) and reuse it for channel handlers.
Useful? React with 👍 / 👎.
Summary
Adds X11 forwarding support for SSH hosts so remote graphical applications can display through a local X server such as XQuartz.
What changed
ForwardX11 yeswhen importing and exporting SSH config.Validation
node --test --import tsx electron/bridges/x11Forwarding.test.cjsnpm run lintnpm testnpm run buildxeyesthrough an SSH session.