Repository navigation
fix(desktop): omit undefined fields from renderer IPC payloads - #50599
Merged
Merged
Conversation
Since anomalyco#50112 the renderer posts RPC payloads over the MessagePort by structured clone, without RpcClient's schema encoding. The main process still decodes with the JSON codec, where an optional field is 'key absent | value | null'. A present key holding undefined, which is what the composer sends for the picker title and extensions, is rejected before the handler runs and surfaces to the user as 'Desktop IPC handler failed'. Drop undefined properties at the renderer request boundary the way JSON.stringify would, leaving Uint8Array payloads untouched. Closes anomalyco#50583, closes anomalyco#50153, closes anomalyco#50503, closes anomalyco#50177, closes anomalyco#50173, closes anomalyco#50309
This was referenced Sep 22, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #50583, closes #50153, closes #50503, closes #50177, closes #50173, closes #50309
The composer's attach button, the folder picker, save dialogs and
openPathall fail withDesktop IPC handler failedsince 2.0.11. The native dialog never opens.Why
#50112 made the renderer post RPC payloads over the
MessagePortdirectly (structured clone, noRpcClient). The main process still decodes withSchema.toCodecJson, whereSchema.optional(String)means key absent | string | null. Structured clone keeps a present-but-undefinedkey, so the request dies in schema decoding before the handler runs.flowchart LR A["files.ts<br/>{ title: options?.title }<br/>→ title: undefined"] --> B["ipc-client.ts<br/>port.postMessage(raw)"] B --> C["ipc-transport.ts<br/>codecFor: toCodecJson"] C -- "Expected string | null<br/>at ["options"]["title"]" --> D["Cause.Die"] D --> E["toast: Desktop IPC handler failed<br/>(cause never shown)"] style D fill:#ff5c7a,color:#000Before #50112,
RpcClientencoded the payload through the same schema and dropped theundefinedoptionals on the way out. This restores that behaviour at the renderer boundary.Change
omitUndefineddropsundefinedproperties from a request payload the wayJSON.stringifywould, leavingUint8Arraypayloads untouched.ipc-client.tsruns every outgoing request payload through it.The transport test drives the real
FilesOpenFilePickerschema throughIpcServerProtocolLivewith a raw renderer-style request and asserts both the rejection without normalisation and the success with it.Affected requests
undefinedfieldFilesOpenFilePickertitle,extensionsFilesOpenDirectoryPickertitleFilesSaveFiletitleFilesOpenPathapplicationDrag & drop and clipboard paste bypass these RPCs, which is why they kept working.