Background agent resumed after host reboot gets permanently pinned inside a worktree

Status Open
Maintainer reply None cached
Activity 0 comments · opened Aug 7, 2026

A background agent session that happened to be inside a git worktree when the host rebooted came back, on resume, stuck treating that worktree as its permanent working directory — as if it had been isolated there intentionally, though it never was.

Symptom: recurring permission prompts for plain cd (notable since cd is normally always auto-allowed). Running cd /the/right/place succeeds and prints the correct path, but the very next tool call reports the shell cwd was silently reset back to the worktree — every time, not just once.

Workaround found: ExitWorktree with action: "keep" correctly un-pins the session and restores the real starting directory, preserving the worktree's contents. Plain cd cannot escape it.

View original on GitHub ↗