Land starts in three overlapping phases: the native Mountain binary starts its gRPC listener and spawns the Cocoon Node.js sidecar, Cocoon bootstraps and completes the extension-host initialization handshake, and the Wind workbench renders in the Tauri webview. The Mountain↔Cocoon handshake is the hard ordering constraint that gates extension activation; everything else proceeds in parallel.
This is the foundational workflow that enables all others. Once the handshake completes and the workbench paints its first frame, the system is ready for user interaction and all dependent workflows - opening files, executing commands, language features - can proceed.
For the same sequence as a reader-facing checklist - what to observe after a build and where to look when a checkpoint does not happen - see First Launch Checkpoints.
Phase 1 - Mountain native startup
-
The OS launches the Mountain binary. The
mainfunction inElement/Mountain/Source/Binary/Main/Entry.rsbuilds a multi-thread Tokio runtime and, inside it, builds the centralApplicationState::default(), wraps it in anArc, and manages it on Tauri’sBuilderwith.manage(). The.setup()hook registers theland://service registry, starts the DNS server, and callsAppLifecycleSetup, which spawns the post-setup task. TheMountainEnvironment(which implements everyCommontrait) is created later, inAppLifecycle.rs;AppRuntimeis not part of this path - no such type exists underElement/Mountain/Source. -
Inside the post-setup task, four jobs run in three ordered stages:
-
ConfigurationInitialize- reads allsettings.jsonfiles from disk intoAppState.Configuration(stage 1, parallel with the extension scan). -
ExtensionPopulate- walks extension roots and loads manifests intoAppState.Extension(stage 1, parallel with configuration). If a pre-bakedextensions.manifest.jsonexists on disk (written bySky/Source/Function/Build/BakeExtensionManifest.ts, which runs from Sky’sprepublishOnlyin Mountain’sbeforeBuildCommand), this step completes in under 50 ms. On first boot or when the cache is absent, a paralleljoin_alllive scan runs (~1200 ms) and caches the result for subsequent launches. -
VineStart- starts the Vine gRPC server on127.0.0.1:50051, with Cocoon’s127.0.0.1:50052in the same pool, and begins listening for connections from Cocoon (stage 2, parallel with the configuration re-merge). -
CocoonStart(which callsInitializeCocoon,ProcessManagement/CocoonManagement.rs) - spawns the Node.js sidecar process (stage 3, parallel with the Air sidecar). It constructs a detailed environment that includesVSCODE_PARENT_PID, so the child terminates automatically when Mountain exits. The exact command is:node ./Element/Cocoon/Scripts/cocoon/bootstrap-fork.jsMountain then dials Cocoon’s gRPC server on port 50052 with exponential backoff under a hard 30-second connect budget, sends the
InitializeExtensionHostrequest, and validates Cocoon’s"initialized"response.
-
Phase 2 - Cocoon bootstrap and handshake
Cocoon’s Source/Service/Effect/Bootstrap.ts runs seven stages in strict order:
-
Environment - records Node.js version, platform, and architecture.
-
Configuration - resolves
MOUNTAIN_GRPC_PORT(50051) andCOCOON_GRPC_PORT(50052); populatesglobalThis.__cocoonBootstrapConfigandglobalThis.__LandTiers. -
RPCServer - starts Cocoon’s own gRPC server on port 50052; the bootstrap logs
[Cocoon] gRPC server status:followed by[Cocoon] gRPC services started successfully. This must complete before Mountain’s 30-second connection budget expires. -
ModuleInterceptor - installs the
require()interceptor, remappingelectronto Tauri stubs and patching VS Code bundle loading. -
MountainConnection - TCP-probes Mountain on port 50051 and opens the gRPC channel. Once the gRPC services are up, the bootstrap sends a
cocoon.readynotification to Mountain carryingpid,port(COCOON_GRPC_PORT) andversion, then logs[Cocoon] Readiness signaled to Mountainand[Cocoon] Bootstrap complete - Cocoon ready for Mountain integration. -
Extensions - activates enabled extensions concurrently (up to 8 in parallel). Extension activation uses topological ordering: if extension A declares
extensionDependencies: ["B"], extension B activates first. AnInProgressset prevents circular dependency deadlocks. -
HealthCheck - optional final service health sweep.
Between stages 5 and 6, Mountain completes the handshake:
-
Mountain connects to Cocoon’s gRPC server and calls
ProcessManagement/InitializationData.rs, which assembles the fullISandboxConfiguration+IExtensionHostInitDatapayload. This payload includes: workspace roots, extension list and metadata, configuration state (argv.json,settings.json,keybindings.json), registered profiles,dataFolderName(a primary crash source when missing),perfMarks,loggers,colorScheme,mainPid, and OS metadata (platform, arch, release, hostname). -
Mountain sends the
InitializeExtensionHostrequest to Cocoon, containing this initialization payload. The proto RPC is namedInitExtensionHost; the proto also still definesInitialHandshake, whose Mountain handler logs[CocoonService] Initial handshake received from Cocoon. Cocoon’s gRPC server dispatches the initialization request asInitializeExtensionHostand answers"initialized". -
Cocoon’s
InitializeExtensionHosthandler fires: it uses the payload to create and provide theInitDataLayer, runsFullAppInitialization, resolves theExtensionHostProvider, installs theRequireInterceptorso everyrequire('vscode')returns the Cocoon shim, and activates startup extensions (*activation event). The topological ordering from the Extensions stage (step 6) ensures that extension dependency chains resolve correctly before providers register. At this point, workflows like Language Features and Webviews can begin, as extensions register their providers.
Phase 3 - Wind workbench launch
These steps run in parallel with Phase 2, starting from the moment Tauri opens the main window.
-
Tauri loads
index.htmlin the webview, built bySky/Source/pages/Mountain.astro. The Astro page produces the static HTML shell that bootstraps the Wind application script.Wind/Source/Preload.tsexecutes first, shimmingwindow.vscodewith Tauri-backed implementations foripcRendererandprocess. This shim is the critical bridge that allows the VS Code workbench code to run in a non-Electron, Tauri-based webview context. -
The main Wind entry script waits for DOM ready, then runs the workbench entry (
web.main.js). The workbench’s concrete service handles are written toglobalThis.__CEL_SERVICES__by theExposeWorkbenchAccessor.tsoutput transform right afterworkbench.startup(), once the dependency-injection container has populated everycreateDecorator-registered service (seeSky/Source/Function/Sky/Bridge.ts, line 110). Each service is backed by Tauri IPC calls or native Rust commands, replacing the Electron APIs that VS Code’s workbench would normally consume. -
workbench.startup()kicks off the entire UI rendering lifecycle - creating every UI part: Activity Bar, Status Bar, Side Bar, Editor Part, and instantiating the editor pane itself. Each part begins requesting data from Wind services, which in turn invoke Mountain IPC for filesystem reads, command lists, configuration values, and extension contributions. -
As these parts are created, they trigger downstream workflows. For example, the File Explorer uses
IFileServiceto list directory contents (triggering the Opening a File workflow), and the Command Palette usesICommandService(triggering the Executing a Command workflow). Extension contributions to the UI (views, menus, keybindings) are registered via theIExtensionService, which is populated during Cocoon’s startup extension activation in Phase 2. -
Extension activation timing after handshake: Once Cocoon’s
InitializeExtensionHosthandler completes (Phase 2), activated extensions begin contributing to the workbench in real-time. TheIExtensionServiceon the Wind side subscribes to a gRPC stream from Cocoon that relaysactivatedExtensionevents as each extension finishes itsactivate()call. This means the Command Palette and language features become available progressively - the first extension’s contributions appear before the last one has finished activating. The workbench does not block paint on extension activation; it renders its chrome immediately and populates contributed UI elements as the extension stream arrives.
Important
The workbench’s first meaningful paint depends on Mountain
returning the InitializationData payload promptly. Delays in the extension
scan (Phase 1, step 2) or the handshake round-trip (Phase 2, stage 5)
directly delay first sidebar render. The pre-baked manifest and the
RPCServer-before-MountainConnection bootstrap ordering are the two changes
that keep first paint under 800 ms.
What you should see: in the boot log, Mountain’s [LandFix:Tier] lines before
the Tokio runtime spins up, then Cocoon’s
[Cocoon] gRPC services started successfully line, then
[Cocoon] Readiness signaled to Mountain, and finally the workbench’s first
frame. A blank workbench means the handshake never completed - see
Troubleshooting.
Failure modes
The sequence above fails in a small number of places, and each one leaves a
different trace. Read the boot log in order - Mountain’s [LandFix:Tier] lines,
then Cocoon’s [Cocoon] gRPC services started successfully, then
[Cocoon] Readiness signaled to Mountain, then the first frame - and stop at
the first line that never appears.
| Symptom | Where the sequence broke | What to check |
|---|---|---|
| Blank workbench, no first frame | Phase 2, stages 3-5 - Cocoon’s gRPC server never accepted Mountain’s connection, so the 30-second connect budget ran out | Whether [Cocoon] gRPC services started successfully printed at all. If it did not, Cocoon never bootstrapped. |
[Cocoon] gRPC services started successfully never prints, port conflict |
Phase 2, stage 3 - another process holds 50052 | An orphaned Cocoon from a previous run: lsof -i :50052, then kill the PID. |
Crash during InitializeExtensionHost |
Phase 2, handshake response - the payload was incomplete | dataFolderName in the initialization data. It is the payload’s primary crash source when missing. |
| Chrome paints, extension contributions missing | Phase 2, stage 6 - activation stream stalled | The activatedExtension events from Cocoon. The workbench does not block paint on activation, so a quiet stream looks like a working shell. |
| First launch is slow, later launches are not | Phase 1, step 2 - the pre-baked manifest was absent | Whether extensions.manifest.json exists. The live scan costs ~1200 ms; the cache path is under 50 ms. |
| Cocoon survives Mountain’s exit | Phase 1, step 4 - the child was not tied to the parent | VSCODE_PARENT_PID in the spawned environment. Without it the sidecar is not terminated automatically. |
A blank workbench is therefore almost always a handshake problem rather than a rendering problem. Troubleshooting covers the port and environment checks that follow from that.
See Also
- 🟠 Low-Level Shim - Engine-level prototype hooks
- 🔵 Coverage / Telemetry - Application-level service routing