Skip to content

feat: prune obsolete installed Beam state - #226

Merged
ejgallego merged 1 commit into
mainfrom
codex/install-prune
Aug 11, 2026
Merged

feat: prune obsolete installed Beam state#226
ejgallego merged 1 commit into
mainfrom
codex/install-prune

Conversation

@ejgallego

@ejgallego ejgallego commented Aug 4, 2026

Copy link
Copy Markdown
Owner

This PR adds a conservative installed-state pruning workflow so repeated Beam installs no longer leave unbounded runtime snapshots and stale bundle caches behind.

lean-beam prune is a dry run by default and verifies the installer ownership marker, acquires the installer lock before revalidating installed state, and never selects the current runtime. --bundles additionally selects stale-source, incomplete, or malformed bundle entries while preserving complete bundles for the current runtime source. Bundle readiness requires typed metadata, canonical workspace ownership, and regular non-symlinked artifacts.

For --apply, Beam holds the installer lock across validation, planning, and cleanup and acquires each selected bundle's build lock immediately before deletion. Cleanup is incremental: every successful removal is reported immediately, and a later failure explains that earlier reported removals remain applied.

Installed runtime recognition is shared by pruning and identity reporting and distinguishes source checkouts, valid installed runtimes, stale processes, and invalid installed state. CLI and MCP identities expose runtime_current and runtime_error where applicable, with error-specific recovery behavior documented for users and agents.

The installer and Lean runtime enforce the same canonical, non-symlinked ownership-marker contract, including exactly one valid schema, owner, and root field. Reuse validates current schema-3 manifests against the exact staged layout, executable commands, and payload contents. Schema-2 manifests remain readable only for identity and safe cleanup during the documented compatibility window; reinstall never republishes them.

Control-file reads reject non-regular and symlinked marker, manifest, metadata, and lock-PID paths. Lock publication cleans up a directory it acquired if writing the owner PID fails; only an existing lock counts as contention, so permission and other lock-creation failures propagate immediately. lean-beam ensure --hold now exits promptly and cleanly on SIGINT.

@ejgallego
ejgallego force-pushed the codex/install-prune branch 13 times, most recently from 14a71ee to 429d4ef Compare August 11, 2026 18:58
@ejgallego
ejgallego marked this pull request as ready for review August 11, 2026 19:39
@ejgallego
ejgallego force-pushed the codex/install-prune branch from 429d4ef to c23df11 Compare August 11, 2026 19:41
@ejgallego
ejgallego merged commit 03d4f2c into main Aug 11, 2026
27 checks passed
@ejgallego
ejgallego deleted the codex/install-prune branch August 11, 2026 20:16
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