Skip to content

fix(components): use registered local Machine RPC bridge - #77

Merged
wibus-wee merged 1 commit into
LodyAI:mainfrom
Pleasurecruise:fix/file-preview
Aug 27, 2026
Merged

fix(components): use registered local Machine RPC bridge#77
wibus-wee merged 1 commit into
LodyAI:mainfrom
Pleasurecruise:fix/file-preview

Conversation

@Pleasurecruise

@Pleasurecruise Pleasurecruise commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Author type

  • I am an Agent (check this if an LLM agent authored this PR)
  • I am a human

Problem / pressure

Electron's preload migration removed the legacy window.api.sendLocalMachineRpc bridge and replaced it with the typed window.ipc bridge, but workspace-machine-rpc-facade still 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 registered machineRpc.send service.

This directly affects the session's Project Files surface. Its file provider loads the local file index through requestLocalCodeCollabFileIndex and loads a selected file's contents through requestFilePreview; 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-local

Before this fix, the chain stopped in workspace-machine-rpc-facade because window.api.sendLocalMachineRpc no longer existed. The preview request therefore never reached Electron or the local daemon.

The Project Files index follows the same transport path via runtime.requestLocalCodeCollabFileIndex and the code-collab/get-file-index Machine RPC method.

Summary

  • Route local Machine RPC through Electron's registered machineRpc.send service and typed window.ipc.invoke bridge.
  • Restore Project Files index and selected-file content requests that depend on the facade.
  • Update the facade tests to exercise the real window.ipc.invoke bridge contract.

Before / after

Before After
Before: selecting a file in Project Files opens a preview with no content because local Machine RPC is unavailable After: the selected Project Files file loads after local Machine RPC is restored

Regression origin

e8d8748 migrated Electron preload from window.api to window.ipc, but workspace-machine-rpc-facade and its tests retained the removed window.api.sendLocalMachineRpc bridge.

Test plan

  • workspace-machine-rpc-facade.test.ts: 5 tests passed.
  • Components TypeScript check passed.
  • git diff --check passed.

Agent handoff

Instructions for reviewing agents

  • Review focus: Verify that workspace-machine-rpc-facade.ts resolves the existing registered machineRpc.send service without changing local-versus-cloud routing.
  • Decisions to challenge: Confirm that the facade should consume the shared typed Electron IPC proxy rather than recreate a preload bridge contract.
  • Plausible failures / evidence gaps: Focused tests cover local preview, file-index, session control, unresolved local routing, and remote routing; no full Electron end-to-end run was performed.

Authoring context

  • User goal / directives: Keep the PR atomic and repair only the stale local Machine RPC bridge.
  • Constraints / non-goals: Do not include ACP/file-path provenance changes; preserve the two uploaded images at a compact size; do not use browser or computer-control tooling.
  • Risk-bearing decisions: Reuse the registered typed Electron IPC service while preserving the existing no-cloud-fallback behavior for unresolved local routes.
  • Destructive or irreversible behavior: None; no user data or persistent format changes are involved.
  • Deliberately not done or tested: ACP/file-path handling was restored to main; no full Electron end-to-end run was performed.
  • Unknowns / confidence: High confidence in the bridge contract and focused coverage; desktop integration outside the facade was not re-exercised.

Sharing consent (author side)

  • Author-side user explicitly allowed publishing the Authoring context above
  • Author-side user explicitly declined publishing Authoring context and understands that maintainers may decline or close the contribution; keep every field as N/A / redacted

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
@Pleasurecruise Pleasurecruise changed the title fix: restore local Code Collab file previews fix(components): use registered local Machine RPC bridge Aug 27, 2026
@wibus-wee

Copy link
Copy Markdown
Member

For your agent: The "before/after" section shown in your PR body is unrelated to the changes you made.

@Pleasurecruise

Copy link
Copy Markdown
Contributor Author

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

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-local

After the preload migration removed window.api.sendLocalMachineRpc, the chain stopped in workspace-machine-rpc-facade, so the request never reached Electron or the local daemon. This PR restores that exact route through the registered machineRpc.send service. The Project Files index also uses the same transport through requestLocalCodeCollabFileIndex and code-collab/get-file-index.

The previous PR description did not connect the screenshots to this call chain clearly enough. I have updated it to make the relationship explicit.

@wibus-wee

Copy link
Copy Markdown
Member

OK, I understand. That was my oversight. Sorry about that. 😄

@wibus-wee wibus-wee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@wibus-wee
wibus-wee merged commit e028702 into LodyAI:main Aug 27, 2026
4 checks passed
@Pleasurecruise
Pleasurecruise deleted the fix/file-preview branch August 27, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants