Files
PaperClipAI/server
DottaandClaude Fable 5 2e2887b833 fix(worktree): never adopt non-worktree targets in worktree repair
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>
2026-07-11 11:19:29 +00:00
..
2026-03-12 13:09:22 -05:00