What the agent does
The agent reads the issue, then reads how the main and renderer processes already talk. In an app shaped like electron-react-boilerplate/electron-react-boilerplate, package.json pins electron 44, electron-vite 5, react 19 and react-router-dom 7, tests with jest 30 through the ts-jest kept in .erb/tooling, and requires Node 24. src/main/main.ts creates the BrowserWindow with a preload script and the defaults for context isolation and sandboxing, registers one ipcMain.on('ipc-example') handler, and builds the menu through MenuBuilder in src/main/menu.ts, whose Windows and Linux File menu holds only { role: 'close' } and whose macOS template has no File menu at all. src/main/preload.ts exposes window.electron.ipcRenderer with sendMessage, on and once, typed by a Channels union of one string, and src/renderer/preload.d.ts declares it on Window. src/renderer/App.tsx renders a single Hello route. No code calls dialog.
The agent keeps file access in the main process. A new src/main/files.ts registers ipcMain.handle('file:open'), which calls dialog.showOpenDialog on the focused window with openFile and a text filter, reads the chosen path with fs.promises.readFile and returns { path, content }, or null when the dialog is cancelled; and ipcMain.handle('file:save'), which takes { path, content }, asks dialog.showSaveDialog when path is missing, writes with fs.promises.writeFile and returns the path written. main.ts calls registerFileHandlers before the window is created. preload.ts gains a files object with open() and save() built on ipcRenderer.invoke, and the Channels union gains the two names, so the renderer never sees fs or a raw channel string.
In src/main/menu.ts the agent adds Open… with CmdOrCtrl+O and Save with CmdOrCtrl+S to the Windows and Linux File submenu and adds a File menu to the macOS template, each item sending file:menu-open or file:menu-save to the window's webContents. src/renderer/App.tsx gains a small editor route: a textarea bound to state, the current path in the heading, and buttons that call window.electron.files.open() and save(), with the menu events subscribed through the existing ipcRenderer.on and unsubscribed on unmount.
The tests follow the two that exist. src/__tests__/files.test.ts runs under the node environment like updates.test.ts, mocks electron with jest.mock so dialog.showOpenDialog resolves to a cancelled result and then to a temporary file written under os.tmpdir(), and asserts the handler returns null and then the file's content and path. App.test.tsx gains a case that stubs window.electron.files and checks the editor shows the opened content. The agent runs npm run lint, npx tsc --noEmit, npm test and npm run build, the steps test.yml runs before its packaging and smoke test, and starts the app once in the sandbox to screenshot the dialog.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "A Linear issue labelled agent says: \"Let users open a text file from disk, edit it, and save it back, with File menu items and the usual shortcuts.\" Do the work in this repository. Read package.json, electron.vite.config.ts, jest.config.js, src/main/main.ts, src/main/menu.ts, src/main/preload.ts, src/main/updates.ts, src/renderer/App.tsx, src/renderer/preload.d.ts, src/__tests__/updates.test.ts, src/__tests__/App.test.tsx and .github/workflows/test.yml first. Add src/main/files.ts with ipcMain.handle handlers for file:open and file:save that use dialog.showOpenDialog and dialog.showSaveDialog on the focused window and fs.promises for reading and writing, returning null on cancel; register them from main.ts. Extend preload.ts with a files object exposing open and save through ipcRenderer.invoke and add the channels to the Channels union; keep fs out of the renderer. Add Open and Save items with CmdOrCtrl+O and CmdOrCtrl+S to the File menu on Windows and Linux and add a File menu to the macOS template, each sending a message to the window. Add an editor route in App.tsx with a textarea, the current path, and open and save buttons that also respond to the menu messages. Add src/__tests__/files.test.ts in the node environment that mocks electron and checks the cancel and success paths against a temporary file, and extend App.test.tsx for the editor. Run npm run lint, npx tsc --noEmit, npm test and npm run build, start the app once and screenshot the open dialog, and put the results in the pull request description. Do not change updates.ts or the auto-update flow.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
What comes back is a pull request with the new src/main/files.ts, the registerFileHandlers call in main.ts, the files bridge and widened Channels in preload.ts, the menu items in menu.ts, the editor route in App.tsx, and the two test files. The description shows the lint, type check, Jest and build output from the sandbox and a screenshot of the native open dialog over the app window.
The repository's Test workflow runs on the pull request across macOS, Windows and Linux: npm run package, lint, tsc --noEmit, npm test and the startup smoke test under xvfb on Linux, so the handlers and the menu template are exercised on each platform's Electron build.
A reviewer checks that fs and dialog are only imported in the main process, that the preload exposes two named functions rather than a generic invoke, that the macOS File menu keeps the standard app menu first, and that a cancelled dialog leaves the editor unchanged. Then they try CmdOrCtrl+O on their own machine.
Run it on every Linear issue labelled agent
In the Project that holds the app, add an automation with this prompt and a linear trigger on linear.issue.labeled filtered to the agent label. Each labelled desktop issue starts its own run in its own sandbox and ends in its own pull request; the issue's text follows the prompt as data, so an issue that asks for recent files or a different file filter makes its own change.
Changes made by an app integration never fire the trigger, so the agent's own comments on the issue start no further runs, and the automation's max_runs_per_hour caps how many issues become runs at once.
The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.
Why run it on Rush?
A file dialog spans three Electron surfaces, the main process, the preload bridge and the renderer, and a mistake in any of them either does nothing or exposes the filesystem to page code. In a Rush sandbox the agent runs the Jest suite with electron mocked, builds all three bundles with electron-vite, starts the real app with a display and screenshots the dialog; every command and image is kept in the run's transcript, so the pull request shows the feature working rather than describing it.
The result passes the repository's own gates on three operating systems before a reviewer opens it, and the preload stays a narrow typed surface. The same automation handles every desktop issue the team labels, one sandbox and one pull request each.
Frequently asked questions
Why go through the preload instead of calling dialog from React?
Because the window is created with the defaults for context isolation and sandboxing, so the renderer has no Electron or Node modules, and that is the right setup. The preload exposes open() and save() as two typed functions over ipcRenderer.invoke, and the main process owns dialog and fs.
Does the macOS menu change the standard app menu?
No. The macOS template keeps appMenu, editMenu and windowMenu as they are; the agent inserts a File menu with the two items after the app menu, which is where macOS applications place it, and the Windows and Linux File menu keeps its close role.
How are the handlers tested without a real dialog?
The same way updates.test.ts tests the updater: jest.mock('electron') replaces dialog and ipcMain, the test captures the registered handler and calls it with a cancelled result and with a temporary file's path, and asserts what comes back. The real dialog is exercised once in the sandbox for the screenshot.
What file types does Open… show?
The issue says text files, so the open dialog carries a text filter and the save dialog defaults to the opened path. Both are a few lines in src/main/files.ts; widening the filter or adding an All Files entry is a one-line follow-up.
More Electron jobs
The same job on other stacks
More jobs like this: Turn a Linear label into a PR
- Add File Uploads to a React Router App (React Router)
- Add File Uploads to a Vapor API (Vapor)