Skip to content

feat(com.visualstudio.code): use flatpark-spawn instead of the bundled host-spawn - #1568

Draft
jing2uo wants to merge 1 commit into
mainfrom
feat/vscode-flatpark-spawn
Draft

jing2uo wants to merge 1 commit into
mainfrom
feat/vscode-flatpark-spawn

Conversation

@jing2uo

@jing2uo jing2uo commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

VS Code moves from the bundled upstream host-spawn to flatpark-spawn, the shared extension added in #1566. Part of #1565.

What changes for users

Before, host commands needed host-spawn <command> or a terminal profile pointed at it; everything else (extensions, tasks, the default terminal) only saw the sandbox. Now, when VS Code, its terminal or an extension runs a command the host has (git, node, python, go, gh, the user's mise/asdf toolchains, ~/.local/bin), it runs on the host with the user's PATH and configuration, as if VS Code were installed there. Commands only the sandbox has still run in the sandbox. Existing "path": "host-spawn" terminal profiles keep working, since the extension ships host-spawn.

Changes

  • Manifest: declares org.flatpark.Spawn (lib/flatpark-spawn, version 1) and creates the mount point; the host-spawn extra-data is gone.
  • code.sh: the extension's bin on PATH (flatpark-spawn, host-spawn), and enable.sh sourced before the final exec.
  • apply_extra.sh: no host-spawn to unpack.
  • First-run note and metainfo: what runs where, that it runs outside the sandbox, how to turn it off (flatpak override --user --no-talk-name=org.freedesktop.Flatpak com.visualstudio.code), FLATPARK_SPAWN_LOCAL to keep a command in the sandbox, a host login-shell terminal profile.
  • flatpark.yml: the host-command entry and the talk-name comment describe flatpark-spawn.
  • config/flatpark-spawn.yml: com.visualstudio.code added. This is the grant: a maintainer decision, recorded against [Proposal] flatpark-spawn: one shared extension for apps that need the host's toolchain #1565.
  • tests/test_shared_extensions.sh: the "allow-list is empty" check becomes "every allowed app passes its audit".

Other permissions are unchanged. --filesystem=host stays: projects keep their real paths, and narrowing it wouldn't contain forwarded commands anyway.

For testers (test repo via needs-testers)

The test repository carries only this PR's build, not org.flatpark.Spawn, so the extension doesn't come along with it: install it from FlatPark as well (the command is in a comment below). Without it VS Code starts but runs everything in the sandbox. From FlatPark itself, the extension installs with the app. Carrying shared extensions in test repositories is a follow-up.

Please try your usual setup and report what differs from a host install:

  • the integrated terminal, tasks, debuggers, language servers and extensions that call CLIs;
  • per-project toolchains (mise/asdf/nvm pins), git with your credential helpers and signing;
  • interactive tools in the terminal (fzf, sudo/ssh prompts, editors).

Known limits are in flatpark-spawn's README: statically linked callers aren't intercepted (what they run through sh -c is), the host can't see /app, Ctrl-Z doesn't suspend a forwarded command, a forwarded command costs about 5 ms.

…d host-spawn

Commands VS Code, its terminal and its extensions run go to the host when
the host has them, through the shared extension org.flatpark.Spawn.
Adds com.visualstudio.code to the flatpark-spawn allow-list. Part of #1565.
@jing2uo jing2uo added the needs-testers Needs someone with specific hardware or a setup we don't have label Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Test this PR

A test repository with the apps this PR changes, built from 9d869a1 in this run.

App x86_64 aarch64
com.visualstudio.code yes yes

Install:

flatpak install --user https://test.flatpark.org/pr/1568/com.visualstudio.code.flatpakref

Already have it from FlatPark? Switch to the test build:

flatpak remote-add --user --if-not-exists flatpark-pr1568 https://test.flatpark.org/pr/1568/flatpark-pr1568.flatpakrepo
flatpak install --user --reinstall flatpark-pr1568 com.visualstudio.code

To go back to the released build (for a new app, flatpak uninstall --user <id> instead):

flatpak install --user --reinstall flatpark com.visualstudio.code
flatpak remote-delete --user flatpark-pr1568

Drop --user to install system-wide. The repository is signed with the FlatPark testing key (7858 FD7D D9F5 27EC 0234 2A9A 7630 ADC3 5A94 2414), not the release key. It is withdrawn when this PR closes or loses the needs-testers label. This comment is updated on every push.

@jing2uo

jing2uo commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

Testers: install the flatpark-spawn extension as well.

The test repository above has only this PR's VS Code build. The extension it uses, org.flatpark.Spawn, is in the FlatPark repository, and Flatpak only pulls an app's extensions from the app's own repository, so it won't come along with the test build. After the command above, install it from FlatPark:

flatpak remote-add --user --if-not-exists flatpark https://dl.flatpark.org/flatpark.flatpakrepo
flatpak install --user flatpark runtime/org.flatpark.Spawn/$(flatpak --default-arch)/1

Check it with flatpak info --user org.flatpark.Spawn//1; the version should be 0.2.0 or later. If you installed it earlier, flatpak update brings 0.2.0. Without the extension, VS Code still starts, but every command runs inside the sandbox, as if flatpark-spawn weren't there, and a host-spawn terminal profile won't start.

When VS Code is installed from FlatPark itself (once this PR is merged), the extension comes with it and you can skip this step.

Optional: ~/.config/flatpark-spawn/config.yaml

flatpark-spawn works without a config file. The file lives on the host and applies to every app that uses flatpark-spawn. You need it in two cases.

A tool isn't found, or runs from the sandbox instead of your system. VS Code removes LD_PRELOAD before it starts its extension host and the integrated terminal's process. That's how flatpark-spawn hooks in. Commands that extensions and the terminal run then reach your system only if they are listed as shims. Some extensions also look for a command on disk before they run it; vscode-neovim does this with nvim. A shim is a small file with the command's name, put first in the app's PATH, that runs the command on your system:

shims:
  - nvim
  - git
  - node

List only what you need. A name your system doesn't have gets no shim, and the app still starts. Shims are made when the app starts, so restart VS Code after changing the list.

Choosing where commands are looked up. By default, commands are looked up in your login shell's PATH, the same as in a terminal, so mise, asdf and similar per-project versions apply. You can add directories, or leave some out:

use_login_shell_path: true   # false: only include_path is searched
include_path:
  - /opt/tools/bin
exclude_path:                # commands in these directories are never forwarded
  - /snap/bin

Inside VS Code's terminal, flatpark-spawn check shows what the file says and what was found, with line numbers for mistakes. It exits non-zero when something is wrong. More: Configuration and shims.

@jing2uo
jing2uo marked this pull request as draft November 26, 2026 00:45

This branch was successfully deployed

1 active deployment
testing — 9d869a1e Deployed Nov 25, 2026 by jing2uo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-testers Needs someone with specific hardware or a setup we don't have

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant