Galaxy Shell / docs
Docs / Decisões e planos

Immutable base and overlay (spec, 2026-11-05) (the part that did not land)

openspec/changes/immutable-base/design.md · Editar no GitHub ↗

Esta página ainda não tem tradução em português. O conteúdo abaixo está em inglês.

Este documento registra decisões, planejamento ou evidências de uma etapa do projeto. Não implica que todos os itens estejam implementados ou validados na versão atual.

Nesta página

Immutable base and overlay (spec, 2026-11-05) (the part that did not land)

The landed part and the current rules are in openspec/specs/immutable-base/spec.md. The sections below are the original text of the doc, unchanged.

The problem

Galaxy Shell is installed today as a development checkout, and three costs follow:

  • Recovery is a second full copy. The installer requires --fallback-root and creates nothing. A prepared clone took 4 min 16 s and 2.5 GB on the development machine, with the Liquid download already cached. Nothing renews it, so it ages: the fallback of the owner has stayed at a commit of 2026-10-31.
  • Every machine needs the toolchain. The login runs prepare-project.py, which needs Node, npm and Rust to rebuild changed sources.
  • A customization has to edit the running product. Outside the profile CSS, a change to the interface edits the same tree that the next login runs.

Phases

Each phase is useful alone and can be rolled back alone. Synthetic tests of each one use the isolation of testEnvironment.

  1. Audit (done). See the section below. No change in behavior.

  2. Release builder (done). scripts/build-release.py builds the directory and the manifest from a clean, prepared commit, with the shared Liquid. --verify checks a release against its manifest. nested-qa.py start --root <release> --no-build already runs a built root, so it needed no change. No login change.

  3. The base as recovery, for installs with a checkout (done). The existing dispatcher already accepts this layout as fallbackRoot, since configure() checks only the compositor and the supervisor there. So scripts/install.sh without --fallback-root builds a release of the checkout commit and registers it, and a dirty checkout stops before the downloads. It then removes other releases, keeping the new one, the recovery registered before, the root of the running login and any release a process runs from, and it removes nothing when it cannot read the login state. A release of the same commit is built again when it is damaged or differs from the checkout. --fallback-root still names any other known-good copy. A clone stays on disk, since the release has not recovered a real login yet. To renew the recovery, run the installer again: nothing promotes the mutable checkout on its own. configure() still needs a prepared source, so installs without a checkout wait for phase 3. Rollback: a manual copy of previous-login/project.json.

    Warning (GLES removal, step 8). A release built from the current checkout has no GLES. Running scripts/install.sh without --fallback-root (or otherwise renewing the recovery release) would register the new release as the recovery in place of releases/20261110-6566fa54a959, the only way back that still has GLES, which decision H (Step 6 result of openspec/changes/archive/2026-11-10-gles-removal-plan/design.md) depends on. The first renewal does not delete the old release: scripts/configure-project.py reads the registered recovery before it changes the registration and keeps it in the cleanup, so it stays on disk but is no longer the registered recovery, and a later renewal can remove it. Do not renew the recovery and do not run install.sh until the owner confirms a physical login with the wgpu renderer. No code guard is described here.

  4. Install without a toolchain. The new dispatcher, with an optional sourceRoot, releases/state.json, the manifest check and the supervisor that leaves release rollback to it. The installer takes a release archive and registers the GDM entry, which is its one step that needs root.

  5. Updates. Download with verification, two kept releases and promotion after a validated login. Releases do not share files by hard link, since a write to one would change the other. A filesystem reflink is fine. Rollback: the previous release.

  6. Overlay (done, ahead of 3 and 4). The build, the served routes, the card, safe mode with its new supervisor check and the notices. This phase updated the operating philosophy of AGENTS.md. The spec put it last because it is the only phase that changes the authority surface and recovery has to exist first; the recovery of phase 2 already exists, and the owner chose the order. See the section below for what the code does where the text above left a choice, and for the proofs.

Proof limits. A nested session proves one output with no real provider. The login path, GDM, a failed login that falls back and an update across a reboot need the user on the real session, and the report must keep these proofs apart.

Phase 0 audit and phase 1 proofs (2026-11-05)

What a release needs from a checkout. Nothing at run time for the login, the host or the core. builtInThemeIds reads native/smithay/themes, so the release ships it. change-proposals.js still needs Git and npm (review card, base mode is phase 5). register-smithay-session.sh reads packaging/, so the release ships it for phase 3. link-interface.py runs on the source at install, not on the release.

An older core on a newer profile. This is what the code does today when a file has a version other than 1, or an invalid shape:

File Version Older core
schedules.json 1 Sets the file aside and starts empty
changes.json, proposals.json 1 Refuses with the original preserved
window-session.json 1 Blocks the login restore and reports it
web-panels.json, manual-control.json 1 Refuses with the file preserved
notifications.json 1 Ignores it and overwrites it at the next save: loses notifications
state.json, workspace-windows.json, interface.json none Reads it as it is: a newer shape is not detected
opencode-v2.db OpenCode's Not audited: an older OpenCode on a newer database

A version check does not catch an additive change either: self-maintenance.md records that a core older than canvas phase 7 reads window-session.json without complaint and drops the canvas fields at its first save.

So a rollback across a format change is not safe yet, and phase 4 (updates) must solve this before it ships: the additive contract under Recovery, a real fixture test of an older release on a newer profile, and a decision for the database of OpenCode. Phase 2 does not depend on it on the day of the install, since the release has the code of the checkout, but the gap grows as the checkout moves on, as it does with any fallback.

Proved, on a real release built from a clean commit (865 MB):

  • Nested session (nested-qa.py --root <release> --no-build): compositor and host run from the release, the chat renders, with no write or module error in the logs. A run of this kind turns OpenCode off on purpose, so ready is false there, on a checkout too.
  • Isolated synthetic core from the release with the real OpenCode, no provider call: ready true, the child process is runtime/opencode of the release although another opencode is in the PATH, the memory and plan plugins load from the release, and its log has 0 errors.
  • localInstalled() finds Liquid through the link, and llama-server --version runs through it. No model was loaded.
  • Writing inside the release is refused, and --verify takes under 4 s.
  • The overlay compiler loads under Electron as Node (build-ui.js --check passes with ELECTRON_RUN_AS_NODE), which phase 5 needs.

Not proved: the release recovering a real failed login. The tests cover the dispatcher with synthetic processes, and a real one needs the user.

Alternatives considered

  • A clone per user. Built and proven on 2026-11-05 on the unpublished branch claude/installer-fallback (782efec). It works, but costs 2.5 GB and makes the development shape the default. Rejected as the product direction.
  • Only a smaller snapshot of the checkout. It lowers the disk use but leaves the toolchain requirement and the lack of an overlay. Phase 2 is roughly this, as a step on the way.
  • A native recovery UI in the compositor. Refused by the decision that all visual components stay web.
  • Filesystem snapshots (Btrfs, OSTree). They depend on how the machine was installed, and do not give a user-level way to separate the overlay from the base.
  • An AppImage or Flatpak. A compositor needs a session entry and direct device access, which their isolation and desktop integration do not fit. Not tested.

Open questions

Each has a recommendation, so that the phases before it can start.

  1. Where the base and the active overlay live (before phase 3). In the home directory, updates need no root, but an agent running as the user can alter them. In /usr/lib, through a package, the base survives execute_command, but updates need root. Recommendation: home for now, since it keeps the current trust model, and revisit with a package when there are real users.
  2. The manual way into safe mode (answered on 2026-11-05: both). A GDM entry alone means logging out through a broken desktop, so a blank screen would need a second TTY. The owner took the recommendation: both the entry and a compositor key.
  3. Which systems get a release (before phase 3). Recommendation: only the Ubuntu in use until someone asks for another, with the linked libraries checked at install time.
  4. Where updates come from and how they are verified (before phase 4). Recommendation: GitHub Releases with a signature checked against a key that ships in the base. The license is chosen (GPL-3.0-or-later, naming.md): each published release must offer its matching source, such as a tag of its commit, and carry LICENSE, which the release builder already copies. The terms of the LFM Open License must be read before an archive ships the Liquid model.
  5. Overriding whole files, or only defined extension points (answered on 2026-11-05: whole files). Whole files match what the owner described and need no API to maintain, but they hide later fixes and give the whole authority of the host. Extension points could keep the approval dialogs out of reach of an overlay, at the cost of an API to maintain. Recommendation: whole files, with the base hash warning and the fixed line in the card, since the owner accepts that the user may change the system.