mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-25 17:45:53 +01:00
Ambient PAPERCLIP_IN_WORKTREE leaking into a process (inherited shell env or the worktree-config test suite) made maybeRepairLegacyWorktreeConfigAndEnvFiles rewrite the main instance env at <home>/instances/default/.env, stamping it with PAPERCLIP_IN_WORKTREE=true and a stale worktree name. On the next service restart the main server then booted in worktree mode. Repair (and runtime port persistence) now only adopts a target when its config sits in a `<root>/.paperclip/` worktree layout AND the target's own persisted .env already declares PAPERCLIP_IN_WORKTREE=true. Instance-store configs like instances/default/config.json can never be adopted. Also make the test suite hermetic: scrub ambient PAPERCLIP_* env before each test. Previously the "rebalances duplicate ports" test inherited the real PAPERCLIP_CONFIG from agent shells and rewrote the machine's live default instance .env every time the suite ran (fixture name PAP-884-ai-commits-component is exactly what kept appearing in the contaminated file). PAP-13539 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>