Add --warmup: keep the main worktree fresh, make setup wait on it#6
Open
EasterPeanut wants to merge 1 commit into
Open
Add --warmup: keep the main worktree fresh, make setup wait on it#6EasterPeanut wants to merge 1 commit into
EasterPeanut wants to merge 1 commit into
Conversation
New worktrees are seeded from the main worktree's build caches and databases, so they are only as fresh as main. This adds: - werksfeer --warmup [--force]: updates the main worktree (checkout of the default branch, git pull --ff-only, then a per-project-type deps/build/migrate chain, overridable via [warmup] command). Refuses to touch a main worktree with uncommitted tracked changes. Optional min_interval throttle for cron/startup triggers. - A per-project lock while a warmup runs; the normal setup flow now waits on it (configurable wait_timeout, default 30m), so a new worktree never copies a half-built cache. Stale locks from crashed runs are detected by PID and removed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
|
Not merging this one yet, want to look at it with colleague when he returns from his vacation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New worktrees are seeded from the main worktree's build caches and databases, so they're only as fresh as main. A stale main means every new worktree starts with an outdated branch, cold caches, and an unmigrated database — and creating a worktree while main is mid-compile can copy a half-built cache.
What this adds
werksfeer --warmup [--force]Updates the main worktree (can be triggered from cron, launchd, or shell startup):
origin/HEAD; override with[warmup] branch) and pulls with--ff-only. Refuses to touch a main worktree with uncommitted tracked changes; untracked files are fine.[warmup] command):bundle install && bin/rails db:preparemix deps.get && mix compile && mix ecto.migrate(+ node package install ifpackage.jsonexists)uv sync/pipenv install/pip install -r requirements.txtnpm ci/yarn/pnpm/bunOptional
[warmup] min_interval(minutes) throttles repeated triggers;--forceoverrides.Setup waits on a running warmup
While a warmup runs it holds a per-project lock under
~/.local/share/werksfeer/warmup/. The normal setup flow now waits on that lock before copying from main (configurable[warmup] wait_timeout, default 1800s), so a new worktree never copies a half-built_build/.bundle. Stale locks from crashed runs are detected by PID and removed automatically. Projects that never run--warmupare unaffected — no lock ever exists, the wait is a no-op.Testing
bash -nclean--warmuppulls and runs the configured command; second run withinmin_intervalskips;--forceoverridesWarmup in progress on main worktree, waiting..., blocked until the lock cleared, then completed; lock dir removed afterwards🤖 Generated with Claude Code