fix(components): use registered local Machine RPC bridge - #77
Conversation
Route local file preview, file-index, and session control requests through Electron's registered machineRpc.send service after the preload migration removed window.api. Model: GPT-5
56d59a3 to
e45de3d
Compare
|
For your agent: The "before/after" section shown in your PR body is unrelated to the changes you made. |
|
@wibus-wee The before/after screenshots are directly related to this change. They show the user-visible symptom of the stale local Machine RPC bridge: selecting a file in Project Files opens the preview without content. The selected-file content follows this call chain:
After the preload migration removed The previous PR description did not connect the screenshots to this call chain clearly enough. I have updated it to make the relationship explicit. |
|
OK, I understand. That was my oversight. Sorry about that. 😄 |
Author type
Problem / pressure
Electron's preload migration removed the legacy
window.api.sendLocalMachineRpcbridge and replaced it with the typedwindow.ipcbridge, butworkspace-machine-rpc-facadestill looked up the removed API. As a result, local Machine RPC requests made through that facade reported the bridge as unavailable instead of reaching Electron's registeredmachineRpc.sendservice.This directly affects the session's Project Files surface. Its file provider loads the local file index through
requestLocalCodeCollabFileIndexand loads a selected file's contents throughrequestFilePreview; both methods use the same stale local Machine RPC sender. The most visible symptom is that selecting a project file opens the preview without any content.Other file-preview providers and paths may remain healthy, but they are not the path shown in the before/after screenshots.
User-visible call chain
Opening a file from Project Files follows this path:
Project Files selection→
useCodeCollabSessionFileProvider.previewFile→
runtime.requestFilePreview→
workspace-machine-rpc-facade.requestFilePreview→
getIpcServices().machineRpc.send→
window.ipc.invoke('machineRpc.send', request)→
MachineRpcIpc.send→
CliService.sendLocalMachineRpc→ daemon
file/preview-localBefore this fix, the chain stopped in
workspace-machine-rpc-facadebecausewindow.api.sendLocalMachineRpcno longer existed. The preview request therefore never reached Electron or the local daemon.The Project Files index follows the same transport path via
runtime.requestLocalCodeCollabFileIndexand thecode-collab/get-file-indexMachine RPC method.Summary
machineRpc.sendservice and typedwindow.ipc.invokebridge.window.ipc.invokebridge contract.Before / after
Regression origin
e8d8748migrated Electron preload fromwindow.apitowindow.ipc, butworkspace-machine-rpc-facadeand its tests retained the removedwindow.api.sendLocalMachineRpcbridge.Test plan
workspace-machine-rpc-facade.test.ts: 5 tests passed.git diff --checkpassed.Agent handoff
Instructions for reviewing agents
workspace-machine-rpc-facade.tsresolves the existing registeredmachineRpc.sendservice without changing local-versus-cloud routing.Authoring context
main; no full Electron end-to-end run was performed.Sharing consent (author side)
N/A/ redacted