feat(slots): slot lifecycle rework — intent-gated switch, auto-bootstrap, reclaim, cap-choice (3.4.0) - #35
Merged
Merged
Conversation
… before any mutation
…cuit
Adds a bootstrap map to slots.json ({slot: {repo: status}}) with tolerant
read/write helpers, plus a lockfile-fingerprint marker in bootstrap.py's
deps step so re-running bootstrap skips the install when the lockfile
hasn't changed since the last successful run.
…ssive reclaim on remote read
_resolve_cwd only consulted the feature coordinator for feature-set lookups, so slot-tracked features (canonical/warm without a features.json entry) raised unknown_feature. Consult slots.json first: warm features route to their worktree, canonical routes to its per-repo trunk path, before falling back to the coordinator.
…ap-choice rendering
…ker out of worktree, reclaim/preflight cleanups
…p) — fixes bg-bootstrap race
… — fixes flaky slots/git races
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.
What
Canopy 4.0 phase 4: the two-tier model becomes real. Worktrees become the workbench for PR-review changes;
switch→trunk shrinks to the rare "run it full-stack" action and gets bulletproofed.Design:
~/.claude/plans/2026-07-04-phase4-slot-lifecycle-design.md.The reframe
Intent decides switching, not the act of returning to a feature:
contextgives the path, the enforcement gate allows commits there. No switch.switchinto trunk (the only place with the full env).This evolves (doesn't break) "canonical is the only run target": trunk stays the RUN target; worktrees become the WORK target. Routing is implicit — canopy publishes the map, the agent works wherever the feature lives.
Changes
switchdefault flips to a warm-vs-cold policy: a feature vacating trunk keeps a warm slot only if it has an open PR or live WIP, else goes cold with a feature-tagged stash.--release-current/--evict/--evict-toremain explicit overrides.worktree_cap_reachedwith 3 runnable fix_actions: raise the cap / send vacating cold / evict a specific warm PR) — surfaced to the agent as a question instead of silently auto-evicting.installing/ready/failed) surfaced incontext; lockfile-unchanged short-circuit;--interactive/--forceescapes. (Timing is provisional — see design doc.)canopy reclaim+ MCP): a merged PR's slot is freed (worktree → base, entry dropped) for reuse; clean-only, dirty slots surfaced as advisories; also passive oncontext --remote.contextslots carry per-repo bootstrap status;run --featureroutes to a warm feature's worktree.Risk & verification
This branch reworks
switch(bricked twice historically). Mitigations: a table-driven lifecycle scenario harness with the two historical bricking bugs locked in as regressions, gating every switch change; validate-all-then-execute; and the shipped enforcement gate as a live net.Milestone review found and fixed: non-runnable cap-choice commands (now render
canopy config slots N/canopy switch <f> --release-current/--evict), and a deps-marker-in-worktree bug that would have defeated reclaim in real pnpm repos (marker moved to.canopy/state/).Tests
1006 passed. New suites: slot_policy, slot_bootstrap, reclaim, render, lifecycle scenarios + bootstrap/switch/registry extensions.
Version
3.4.0 (CHANGELOG updated).