What the agent does
The agent reads the process boundary before it adds a feature that crosses it. In an app shaped like electron-react-boilerplate/electron-react-boilerplate, package.json runs Electron 44 with React 19 through electron-vite 5, electron-builder for packaging and Jest 30 with Testing Library for tests, and .github/workflows/test.yml runs npm run package, npm run lint, tsc --noEmit, npm test and a smoke start on macOS, Windows and Linux with Node 24. src/main/main.ts creates the BrowserWindow with preload.js, registers one ipcMain.on('ipc-example') handler that replies with a pong, and starts electron-updater from src/main/updates.ts. src/main/preload.ts exposes window.electron.ipcRenderer with sendMessage, on and once over a Channels union that holds only 'ipc-example', and src/renderer/preload.d.ts types it on window. src/renderer/App.tsx renders the hello page with two links, which src/__tests__/App.test.tsx checks by role.
The agent adds 'notify' to the Channels union in preload.ts and a dedicated notifications.notify(options) method on the bridge that calls ipcRenderer.invoke('notify', options) so the renderer gets a promise rather than fire-and-forget. A new src/main/notifications.ts registers ipcMain.handle('notify', ...): it checks Notification.isSupported(), validates that title is a non-empty string and body optional, builds a new Notification({ title, body, silent }), focuses mainWindow on click, and resolves with { shown: true } or { shown: false, reason }. main.ts calls registerNotifications(() => mainWindow) once in whenReady, following how startAutoUpdates is wired, and nothing is exposed to the renderer beyond the one method.
In the renderer, App.tsx gains a Notify me button beside the two existing links that calls window.electron.notifications.notify({ title: 'Hello', body: 'Sent from the renderer' }) and shows the result in a status line. On macOS a packaged app needs a signed bundle before the system shows notifications, so notifications.ts logs the reason through electron-log as updates.ts does, and the pull request says that the dev build on macOS shows them under the Electron app name.
Tests follow the two files in src/__tests__/. notifications.test.ts uses the /** @jest-environment node */ pattern from updates.test.ts, mocks electron with a Notification constructor and ipcMain.handle, and asserts that a valid payload constructs one notification and resolves shown: true, that an empty title resolves shown: false without constructing, and that isSupported false short-circuits. App.test.tsx gains a case that stubs window.electron.notifications.notify, clicks the button and checks the status text. The agent runs npm run lint, npm exec tsc -- --noEmit, npm test and npm run build, and on Linux the xvfb-run npm run test:smoke start check the workflow uses, and pastes the output in the pull request.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "codex",
"input": "Add native desktop notifications to this Electron app and open a pull request. Read package.json, src/main/main.ts, src/main/preload.ts, src/main/updates.ts, src/main/util.ts, src/renderer/preload.d.ts, src/renderer/App.tsx, src/__tests__/App.test.tsx, src/__tests__/updates.test.ts, jest.config.js and .github/workflows/test.yml first. Add a notify channel and a notifications.notify method on the preload bridge that uses ipcRenderer.invoke. Add src/main/notifications.ts with an ipcMain.handle('notify') handler that checks Notification.isSupported, validates the payload, shows a Notification, focuses the main window on click, logs failures with electron-log and resolves shown true or false with a reason; register it from main.ts in whenReady like startAutoUpdates. Add a Notify me button to App.tsx that calls the bridge and shows the result. Add src/__tests__/notifications.test.ts with a node environment and mocked electron covering success, an empty title and unsupported platforms, and extend App.test.tsx for the button. Run npm run lint, npm exec tsc -- --noEmit, npm test, npm run build and the smoke test, and paste the output in the pull request. Do not change the updater or the menu.",
"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 a new src/main/notifications.ts and src/__tests__/notifications.test.ts, small edits to src/main/main.ts, src/main/preload.ts, src/renderer/App.tsx and src/__tests__/App.test.tsx, and no change to package.json because electron-log is already a dependency. The description shows the Jest summary, the tsc and eslint results, the electron-vite build output and the smoke-test line from the Linux start.
On a repository with the boilerplate's workflow, the pull request runs the matrix on three operating systems, including npm run package which builds the installers, so a preload change that breaks the bundle or a type that does not line up with preload.d.ts fails there. The existing updates.test.ts runs unchanged.
A reviewer checks that the renderer cannot pass arbitrary options through to Notification, that the handler is registered once, and that clicking a notification restores a minimised window. Then they decide whether the demo button stays or becomes a call from their own feature code.
Run it on every Linear issue labelled agent
A Rush automation with a linear trigger starts one run for each issue that gets the label, with this prompt as the instructions and the issue's title and description added after it. An issue that asks for a notification when a long export finishes becomes a run that adds the channel and calls it from that export's completion, and opens a pull request that links the issue.
Each run is independent and has its own max_runs_per_hour cap on the automation, so a sprint's worth of desktop-integration issues becomes a set of separate pull requests.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
A notification is five lines in the main process, but doing it safely in an app with contextIsolation means a typed channel in the preload bridge, validation on the main side, and tests for both processes, and the workflow's three-platform package step is what actually catches a bridge mistake. In a Rush sandbox the agent makes the change, runs Jest, the type check, the Vite build and the Linux smoke start, and keeps every command and its output in the run's record.
The same request works on any Electron app built on this boilerplate's preload.ts pattern, and because the run opens a pull request through the Rush GitHub App, the feature arrives with its test file rather than as a snippet someone pastes into main.ts.
Frequently asked questions
Why invoke instead of send?
ipcRenderer.invoke returns a promise with the handler's result, so the renderer learns whether the notification was shown and why not. The existing ipc-example channel uses send and reply, which stays as the example it is.
Will notifications show in development on macOS?
Yes, attributed to the Electron app. A packaged build needs to be signed for the system to show them under your app's name, which the pull request notes next to the existing notarize.js script under .erb/scripts/.
Does the renderer get access to the Notification class?
No. Only notifications.notify is exposed through contextBridge, taking a title, an optional body and a silent flag. The main process constructs the Notification, so the renderer cannot set icons or actions it was not given.
Does it add a dependency?
No. Notification is part of Electron's main process API and electron-log is already used by updates.ts.
More Electron jobs
The same job on other stacks
- Add Native Notifications to a Tauri App (Tauri)
- Add Desktop Notifications to a Chrome Extension (Chrome extension)