Skip to content

IDE: move from Electron to Tauri 2 (epic #477) - #501

Merged
aMonteSl merged 70 commits into
idefrom
claude/project-thread-urap9o
Dec 5, 2026
Merged

aMonteSl merged 70 commits into
idefrom
claude/project-thread-urap9o

Conversation

@aMonteSl

@aMonteSl aMonteSl commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator

Requested by Adrián · project thread

Summary

Moves the Code-XR IDE from Electron to Tauri 2: a Rust core (apps/ide/src-tauri) plus one bundled Node sidecar. Electron is removed (gate scripts/legacyShellGate.mjs).

Closes #497, #498, #499. Refs #477, #484-#492 (stories stay open until the manual tests pass), follow-up #500.

Numbers (CI, Electron baseline 58adf3a vs Tauri, warm medians)

Windows Linux macOS
Installer 129.2 -> 34.9 MB .deb 107 -> 58.2 MB .dmg 127.9 -> 56.5 MB
Installed 413.7 -> 147.9 MB 324 -> 168.1 MB 307.4 -> 179.1 MB
Memory +5.9 % -0.6 % -7.6 %
Start-up +8 % +35 % +206 % (#500)

Full report: docs/ide/tauri-migration.md section 19. Manual tests: docs/ide/tauri-test-guide.md.

Test plan

  • IDE on Tauri workflow (smoke, vsix, compat, installers, hung-keyring smoke) on Linux, Windows and macOS
  • IDE benchmark compare job against the Electron baseline
  • npm test (extension + IDE gates)

Generated by Claude Code

…s own step times; Tauri jobs trace a warm run (#480)
… webview on the scheme or a loopback port (#484)

Webview origins are no longer hard-wired to codexr-webview://<id>: the main
process names them (webviewRegistry configureWebviewOrigins), the extension
host gets them in its init data (cspSource, asWebviewUri) and the renderer
in each create event (iframe src, postMessage target and origin check).
Electron keeps the scheme, unchanged.

The sidecar answers the core's codexr-webview scheme handler
(webview.resolve) from the same registry, or, on Windows, where WebView2
reaches a custom scheme as one http://<scheme>.localhost origin, serves
them itself on 127.0.0.1 as http://<id>.localhost:<port>, refusing any Host
that is not a known webview on that port. The workbench's frame-src
follows. CODEXR_WEBVIEW_LOOPBACK=1/0 forces the choice (to try the Windows
path on Linux).
…macOS and lets frames load webview pages (#484)

src-tauri/src/webviews.rs registers the codexr-webview scheme (not on
Windows, where WebView2 would give every webview one origin and the sidecar
serves them on loopback instead) and forwards each request to the sidecar
(webview.resolve): the page comes back as text, a file as a path the core
reads. Requests from scene views or for anything but a webview id get a
404. The app window's navigation rule also accepts webview pages (either
spelling of their origin) and about:blank/about:srcdoc, as Electron's
hardening does for the workbench's child frames: WebKitGTK and WKWebView
ask it for frame navigations too.
…lan: the scheme on Linux and macOS, loopback on Windows, what was verified (#484)
…enchCompare.mjs); Electron job keeps the installer sizes (#480)
…atcher and the terminal (#485)

On the Tauri build the core now serves list-directory, list-files, read/write,
create, rename, copy, move, trash, copy-path, reveal, read-image/document and
set-watched (notify, non-recursive per folder, 150 ms batches) and the terminal
channels (portable-pty: profiles, custom profiles, create, input, resize, kill,
killed with their window, on reload and on exit), ported from the Node
handlers with the same shapes, limits and refusals. The sidecar keeps owning
which folder each window has open and mirrors it to the core
(host.workspace.set, answered in order); the core tells the sidecar about saves
and watcher changes (metrics) and about the terminals it starts for tasks,
programs and agents' commands (host.terminal.spawn). The sidecar registers no
route for these channels on Tauri (src/shared/nativeChannels.ts, checked
against native.rs). Electron is unchanged.
search, cancel-search and replace-in-files are answered by the core on the
Tauri build: the files quick open lists (ignore's gitignore matcher, the
excluded names, no symlinks), include/exclude globs against a file or any of
its folders, binary and >2 MB files skipped, lines found with grep-searcher and
grep-regex, columns, lengths and previews in UTF-16 units, at most 1,000
listed matches per file and 20,000 in all, results batched every 100 ms or 100
files, one search per window. Replace goes through the workspace's read and
write, so paths are checked and a file changed on disk is reported, with
JavaScript's $1/$&/$<name>/$$ expansions. The engine is Rust's regex: no
look-around or backreferences (reported as an invalid pattern).
The core owns recent-folders.json (same file and format, most recent first,
ten at most, case-insensitive on Windows and macOS, nothing recorded in a
benchmark run) and answers the renderer's recent-folders channel. The sidecar,
which opens folders, changes the list through host.recent.* and keeps each
answer as its copy (a RecentFolderStore), so "only a listed folder opens
without the picker" and the start-up folder read the list the core serves.
Electron keeps its file store.
)

What moved to Rust, how state is shared with the sidecar, the deviations
from the TS behaviour, before/after bench numbers, what runs where and
which Windows and macOS paths CI still has to prove.
… the TS code (#496)

- jsregex.rs: JavaScript patterns (no `u` flag) on regress over UTF-16
  units: look-around, backreferences, named groups, Annex B. Case-insensitive
  matching uses JavaScript's Canonicalize on a canonical copy of the line,
  since regress folds ſ, ı, K, Ω, Å, ϴ, ẞ unlike V8; escapes and classes are
  decided before regress sees the pattern.
- search.rs: regex queries and case-insensitive non-ASCII literals run on
  jsregex; a case-sensitive or ASCII literal keeps the grep fast path with
  Unicode off for \b and case. Replacements expand $1/$&/$<name> on UTF-16.
  A malformed include/exclude glob ends the search with the TS error.
- ignore_rules.rs: a line-by-line port of ignoreRules.ts (root .gitignore
  only, the same subset), each rule matched as the same JavaScript regex.
  The `ignore` crate is removed.
- collation.rs: Intl.Collator's numeric, base-sensitivity order with ICU4X,
  in ICU's default locale (LC_ALL, LC_MESSAGES, LANG; Windows API); ties keep
  fs.readdir's byte order, as libuv sorts it on Unix.
- workspace.rs: a taken rename target is allowed only for the same dev and
  ino on every OS (file index on Windows, as libuv's lstat), as doubles.
- workspace.ts exports NATURAL_SORT_OPTIONS for the parity test.
… test (#496)

test/rustParity.test.ts runs the TypeScript implementation (compileQuery,
findInText, replaceInText, parseGitignore, isIgnored, compileGlobs,
pathMatches, Intl.Collator with NATURAL_SORT_OPTIONS, Workspace.listDirectory
and rename, listWorkspaceFiles) on fixed inputs and checks the outputs in
test/fixtures/rust-parity/, failing when they go stale
(CODEXR_UPDATE_PARITY=1 rewrites them). src-tauri/src/parity.rs runs the
Rust core on the same files.

Covered: 2,110 search cases (hand-written and 1,500 seeded random patterns:
accents, ß/ẞ, sigma, dotted and dotless i, ſ, Kelvin/Ohm/Angstrom signs,
emoji, look-around, backreferences, whole word, replacements, invalid
patterns), the canonical case form of every BMP unit against V8, six
.gitignore files and twelve globs over 38 paths, 117 names compared
pairwise in 16 locales, and a real folder listed, walked and renamed.
…with the TS code (#496)

The four deviations R7 accepted are closed; the section says how each now
matches, how the fixtures prove it, and what still differs (regex error
reason wording, lone surrogates in previews, modifier groups, Unicode/CLDR
table versions, the default locale off Linux, quick open's order).
…celId and checkbox in the OS's own dialog (#487)

GtkMessageDialog on Linux, TaskDialogIndirect on Windows (looked up at run
time), NSAlert on macOS, as Electron draws them. The sidecar applies
Electron's defaults (cancelId from a Cancel/No button) and answers
{ response, checkboxChecked }; dialogs with more than three buttons no longer
answer their Cancel button unseen.
…elerators, and About with Tauri's versions (#487)

The sidecar sends Electron's menu template as plain nodes (menuModel.ts) and
keeps the click handlers; the core draws it (menu.rs): a menu bar on Linux
and Windows, the application menu on macOS (appMenu, windowMenu, help).
Clipboard roles are the OS's own items; zoom, full screen, reload, devtools
and minimize act on the focused window; Close and Quit go through the
windows' close handlers. Items Electron only labels with a key
(registerAccelerator: false) listen for none, and Undo/Redo on Linux run the
editing command, so GTK never takes a key from the page. The scene view
follows a zoomed page. Help > About, the welcome page and the status bar
name the shell and its webview (shellVersionList in the seam).
The macOS gap is between the explorer and the editor (about 2 s against
0.5 s), and WKWebView exposes no resource timing for the app scheme, so
the core's own trace of each IPC call and served asset is printed.
…screen capture through the engine's picker (#487)

Every webview the core opens asks the sidecar (permission.request): the
app's windows are denied everything, as hardening.ts denies it on Electron,
and the scene's session handler grants XR right after Enter XR. A screen
capture from a scene on its own server goes to the engine's own picker (a
system webview takes no stream picked outside it): WebKitGTK gets its media
stream setting on scene views only, WebView2 is checked through
ScreenCaptureStarting. Without a handler wry granted WKWebView camera and
microphone; now they are denied. Request filtering has no hook in a system
webview and is a silent no-op, with the navigation rule and the local
libraries as its equivalent.
…ng fallback, Tauri's drop handler off (#487)

- app.writeClipboard: the renderer's copy actions go through IPC to the
  host clipboard (Electron's clipboard, the sidecar's host on Tauri)
  instead of navigator.clipboard, which WebKit gates differently.
- Vite targets chrome140 and safari16, so the CSS carries the -webkit
  prefixes WebKitGTK and WKWebView need.
- The chat composer grows with its text where field-sizing is missing.
- Windows are built with disable_drag_drop_handler, so HTML5 drag and
  drop reaches the page on WebView2 as on Electron.
- Tests pin these and the CSP choice (no nonces).
On Windows a reused pid closed a cycle in the parent links and the walk
grew until "Invalid array length", failing the compare job.
Each host request ran on a thread of its own, so the theme picker's Dark then
Light previews reached set_theme in either order (Windows previewed:false,
Linux stored:false), and the Keyboard Shortcuts recorder's suspended and
restored menus could land in either order. host.theme.set and host.menu.set
now run one after another on one thread of their own.
Opening Keyboard Shortcuts reads keybindings.json; a key recorded at once is
saved before that read is answered, and the late, older answer was applied
last, putting the old rules back in the view and the registry. Drop a read
answered after any later report was applied (macOS smoke: recorded:false,
works:false; reproduced under load on Linux with the old build).
…489)

The eval check runs from a timer task: WebView2 runs an injected script's
first synchronous part with CSP's eval check off, as DevTools does. The theme
probe waits for the stored setting instead of one read that could precede the
picker's write. Failures of the eval, theme and Keyboard Shortcuts probes now
carry what the page showed (the served CSP, each theme step, the recorder's
state, saved rules and wait). Document the first Windows and macOS runs.
…indows (#489)

- Tauri updates WebView2's preferred colour scheme only on a window
  ThemeChanged, which the app-wide set_theme never posts on Windows, so
  the theme picker's Dark preview never changed prefers-color-scheme.
  The core now sets it on every webview's profile.
- The Rust parity fixtures are compared byte for byte; a Windows
  checkout made them CRLF and failed the unit tests.
The desktop seam (src/main/host/desktop.ts) now re-exports the Tauri host
(src/sidecar/tauriHost.ts) unconditionally. Removed: the Electron main entry,
window, app protocol, asset paths, hardening, node-mode runtime, webview
server, scene screen share, both preloads, electron-builder config, the
binary resolver and start script, and the electron/electron-builder
dependencies. Scripts (build, dev, start, smoke, vsixE2e, bench, sizes,
bundle) drive the Tauri build; installers land in release/ without the
-tauri suffix. CI drops the Electron smoke, vsix and installer jobs; the
benchmark builds its Electron baseline from the pinned commit 58adf3a in a
separate checkout.
scripts/legacyShellGate.mjs fails on any mention of Electron, in a path or
in content, among the tracked files of apps/ide, .github and the root
package.json, outside a short, explained allowlist: the R10 profile
migration (migration.rs, profileMigration.ts, its test and fixture) and the
benchmark's historical baseline (benchCompare.mjs, ide-bench.yml). It runs
first in the IDE's npm test (so in ci.yml's gate) and in ide-tauri.yml.

Everything else now speaks of the desktop host: comments, names
(migration.legacySecretKey, the accelerator parser, test titles), the
terminal environment (only NODE_OPTIONS is stripped), the Electron-only web
preferences checks, the unused protocol/desktopCapturer stand-ins, the
preload folder (codexrApi.ts moves to src/bridge), lint rules, README and
THIRD_PARTY_NOTICES (Tauri, wry, tao, muda, the system webviews and the
bundled Node replace Electron and Chromium).
docs/ide/tauri-migration.md section 16: what R13 removed and renamed, the
legacy-shell gate and its allowlist, the benchmark's baseline pinned at
58adf3a, and what was verified here. The
root README, docs/monorepo.md and .claude/docs/DEVELOPMENT.md describe the
IDE as Tauri 2 + a Node sidecar and its commands as they now run.
…tures (#489)

The plugin's uiPolicy test scans apps/ide for emoji and failed the root
npm test on three tracked test files and the Rust parity fixtures.

- rustParity.test.ts and profileMigration.test.ts spell the characters
  as \u escapes (the strings are unchanged).
- The parity serializer writes every character outside printable ASCII
  as a \u escape, so the fixtures are ASCII; regenerated with
  CODEXR_UPDATE_PARITY=1, each one parses to the same value as before.
…what the core did (#489)

The theme picker's Dark preview never changed prefers-color-scheme on
WebView2 (dev and installed smoke runs), although tao's ThemeChanged
handler and the core's own call both set the profile's
PreferredColorScheme without an error. The one thing only those runs
have is the InPrivate profile of a smoke run's window, which kept the
page on the OS's Light (inferred: Edge's InPrivate windows are reported
to ignore the browser theme the same way). A normal session's profile
takes the Light/Dark/Auto setting.

- On Windows a smoke run's pages keep their storage in a new folder of
  the run's own (inside the harness's scratch CODEXR_USER_DATA, else
  the temp directory) instead of InPrivate: the same empty start.
  Linux and macOS stay incognito.
- theme.rs: host.theme.set records each change with what every
  webview's profile reads back on Windows (InPrivate or not, the
  setter's error, the scheme), and errors of the COM chain or of
  with_webview are printed instead of dropped.
- host.smoke.native reports it (theme), and a failed theme check carries
  that report in its message, so the next run says which side did not
  follow.
…489)

Every window.codexr call is one codexr_ipc invocation, and Tauri runs
async commands on its runtime's worker threads beside each other, so
two terminal inputs sent in a row could reach the pty swapped. The
macOS smoke runs typed `echo codexr-smoke` then Enter and got the Enter
first (an empty prompt, then the command left unexecuted; the installed
run lost its file-link echo the same way); here on Linux, typing one key
per call gave `echoc odexr-smoke` in 1 of 3 runs before the fix.

- The bridge sends a terminal's inputs one call at a time
  (src/bridge/orderedInput.ts): what is typed while a call is out waits
  and goes, joined up to the core's input limit, in the next call.
- The sidecar's host.terminal.input and host.terminal.resize are
  answered in order on the reader thread instead of a thread each (they
  only queue for the pty's writer or set its size).
- The smoke's terminal probe types one input per key, as typing does,
  so a reordering fails it.
)

npm ci on the runner left node_modules/electron without its binary, so
the compare job could not start the baseline.
…hem (#497)

Tauri runs each codexr_ipc command as its own task, so two calls a page made
in a row could be handed to the sidecar in either order, where ipcRenderer
kept send order. The bridge now stamps every call with its page's id (new at
each load) and a sequence number taken when the call is made (ipcCalls.ts),
and the core hands call n on only after call n - 1 (call_order.rs): the
request written to the sidecar's stdin, or the core's own handler started.
Only the hand-over is ordered; answers come back as each handler finishes,
and webviews and pages never wait for each other. A stamped call that never
arrives is skipped after 2 s. The piecemeal guards of #489 stay: they order
the sidecar's requests to the core, or results that finish out of order.
…498)

The sidecar waited for the keyring key (and the R10 secrets migration) before
starting the services, so a Secret Service that did not answer (25 s on
D-Bus) left the window's folder unset: workspace:current answered null and
Search, Quick Open, the tab session and terminal links failed. The key and
the migration now run in the background (startSecrets); KeyVault decrypts
nothing and holds every write until the store is ready, then reads its file
again. Without a keyring nothing moves and a later start retries, as before.

Test hook: a smoke run with CODEXR_SMOKE_KEYRING=hang holds every keyring
call in the core; smoke.mjs --hung-keyring runs the probes that way and
checks a call was held. CI runs it on the three OS. Against the previous
sidecar the same run timed out with no result.
…497, #498)

Section 17 of the migration plan: the design of both fixes, why the piecemeal guards of #489 stay, the hung-keyring smoke hook, and what was verified here.
…e folder (#490)

- extensionCompat.mjs imports its modules through file:// URLs; a bare
  D:\ path is refused by Node's ESM loader on Windows.
- The core drops the verbatim \\?\ prefix Windows gives the resource
  folder, so the sidecar, the TypeScript server and path checks see the
  same D:\ path.
startupMarks.ts records performance marks (modules evaluated, shell
drawn, explorer shown, editor requested/loaded/created, terminal
requested/loaded) beside the navigation's own timings. The bench driver
adds them to its report (renderer.startup) and bench.mjs prints one
timeline line per run, so CI shows where the time goes before the
explorer and the editor are usable on every OS.
#499)

Both panes drew every row at start-up, twice (again when the start-up
reads answered), for panes nobody had opened: 21-58 ms for the keyboard
shortcuts, 6-24 ms for the settings on the page's one thread. A hidden
pane now keeps the latest snapshot and draws it, synchronously, when the
workbench shows it.
workspace:current and the root listing are the page's first calls, in
the same round trip, so their answers come back first and the explorer
no longer waits for a second round trip behind ~40 other answers. The
listing asked for ahead is used once and asked again if it failed (no
folder yet). The restored tab session opens once the explorer has
listed the folder and a frame was painted, so warm runs no longer
compile Monaco before the explorer appears.
Once the explorer is on screen, after 200 ms and an idle period
(requestIdleCallback where it exists; WebKit has none, so a timer
stands in), Monaco's modules and then xterm.js are imported. Nothing is
created: no editor group, model, worker, language client or shell
starts before it is asked for. The first file and the first terminal
no longer wait for their chunks to be compiled.
)

monaco-editor's main entry brings monaco.lsp, an LSP client the IDE
never uses (its language features go through lsp/languageClient.ts and
the sidecar). It resolves to an empty module: 75 KB less of the monaco
chunk to compile on every first file open.
…ens IPC (#499)

The workspace and terminal channels are answered in the core and
answered at once, so a page faster than the services got "No folder is
open in this window" for the folder it was opening. The sidecar's own
channels already waited for openIpc(); it now also tells the core
(host.ipc.open, in order after host.workspace.set), and the core holds
native calls until then: 60 s at most, released if the sidecar dies.
The call keeps its turn while it waits, so the #497 order holds.
…ervices (#499)

The core holds the page's requests until the sidecar sends the CSP, and
the sidecar needed ~130 ms for it, ~90 ms of which compiling its 3.2 MB
bundle. The entry now keeps only what the policy needs; the services,
terminals, workspaces, smoke run and display language are in
session.ts, a chunk loaded right after window.attach while the core
serves the page, and the profile migration's secrets step is a chunk
too. The entry is 173 KB and the policy goes out ~35 ms after Node
starts. NODE_COMPILE_CACHE covers the chunks; build.mjs's one-Tauri-host
check reads every chunk.

The page is now faster than the sidecar, so openIpc() moves after
afterFirstWindow: the page's calls are answered once the folder it
opens with is set (the smoke caught Search, Quick Open, the tab session
and a terminal link failing without it).

Being faster, the page also subscribes before the start-up folder is
set, so that folder's own change event reached it while its first
workspace:current was out and every view loaded twice (two Quick Open
file walks of ~1 s each in the core: +800 ms of CPU per start). An
event for the folder that first read returns is now dropped.
Section 18 of the migration plan: where the start-up time went, each
change, the local before/after numbers, what did not help (JavaScriptCore
and WKWebView start-up costs included), and what CI must show.
…499)

CI showed two macOS-only costs: from the editor requested to its modules
loaded (1.3-1.9 s, Linux ~0.3 s) and from the editor created to its first
line (1.7-1.9 s, Linux ~0.1 s). The timeline now splits them:

- each editor module's import resolved (loaded:<module>), and Monaco's
  own evaluation (monaco-eval-start, monaco-evaluated) apart from its
  download and parse;
- the editor widget created, the first model created and set, the first
  layout, the first .view-line (MutationObserver), and each worker's
  creation and first message;
- the next frame against the next task after the editor is created and
  after its model is set (+frame/+task): a frame far behind the task is
  a page not being drawn rather than busy;
- in bench pages: the focus and visibility at start and their changes,
  fonts loading and loaded, a 50 ms timer firing late (timer-gap), and a
  small fixed JS loop at each bench step (js-probe), which shows a
  process running slower at start-up than at the end.
On macOS the window is shown and focused when it is built, but on CI the
bench pages started "visible" without the focus: the window was not key,
and WebKit may run and draw the page of an app in the background at a
lower priority, which would fit the editor's macOS-only slowness. If the
window is still not focused when its first page has loaded, it is
focused then. Once per window, so a later reload never takes the focus
from another app. Linux (hidden until loaded) and Windows are unchanged.
The new marks (window-focus, js-probe) show on the next CI run whether
it helps.
@aMonteSl aMonteSl self-assigned this Dec 5, 2026
@aMonteSl
aMonteSl merged commit 8bcaaab into ide Dec 5, 2026
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant