Skip to main content

Process supervision

Every external program the IDE runs for you (language servers and tasks; later debug adapters) is started by the ide-process supervisor. It answers one question: how does a process run and stop safely? Whether it may run at all is decided by workspace trust before the supervisor is called.

What the supervisor guarantees​

  • Typed launch. Program, argument list, working folder and environment are explicit. Nothing goes through a shell, so file names and arguments are never interpreted.
  • Minimal environment. Only an allowlist reaches the child: PATH, home and temp folders, locale, proxy and certificate settings, and toolchain variables (CARGO_*, RUSTUP_*, RUST*, DOTNET_*, NUGET_*, Windows system folders). Any variable whose name looks like a secret (TOKEN, SECRET, PASSWORD, API_KEY, AUTH, …) is dropped even if allowlisted. Callers add what a tool needs explicitly.
  • Owned process tree. Stopping a process stops everything it started.
  • Bounded output. stderr is always drained: by default only the last lines are kept, each truncated, with credential-looking values redacted; a caller that wants the whole stream (the task runner) takes it as a pipe and must drain it within its own bounds. Captured stdout has a byte limit; the rest is drained and dropped, so a noisy child can neither fill memory nor block on a full pipe.
  • Nothing blocks the UI. kill and terminate only send signals. A monitor thread per process waits, removes leftovers and reaps; a watchdog enforces deadlines and the forced kill after a graceful stop.

Platforms​

PlatformTree ownershipNotes
Linux, macOS, FreeBSDNew process group per child. The root is observed with waitid(WNOWAIT) and stays unreaped until the group has been killed, so its id cannot be reused and no unrelated process is ever signalled.Graceful stop is SIGTERM, then SIGKILL after the grace period.
WindowsJob object with kill-on-close; closing the job kills every member.No polite signal: protocol shutdown comes first, then the job is closed after the grace period.
OpenBSD and othersNot supported: spawning fails closed.
What ownership cannot cover
  • A descendant that deliberately leaves the tree (a daemon that starts its own session on Unix, or breaks away from the job on Windows) is not tracked.
  • On Windows a child that starts a grandchild in the instant before it is assigned to the job could escape.
  • Linux and the supervisor tests use the real kernel; macOS, FreeBSD and Windows code is type-checked in CI-equivalent cross builds but not yet run (see Phase 2 validation).

Language servers​

The language-service manager keys services by workspace root and server id and stops them through the supervisor:

  • Idle eviction, trust revocation and workspace switches send shutdown/exit and kill the tree after the shutdown timeout. A workspace switch does not wait.
  • Application exit kills and reaps every remaining tree within a fixed deadline.
  • Each start has a generation; events from an older process are ignored.

See ADR 0012 for the decision and alternatives.