You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prevent cwd loss during branch-finish prune (#424)
The prior cleanup fix only pivoted before the cleanup prune path, leaving the no-cleanup temporary prune able to spawn gx from an agent worktree cwd that may have disappeared during nested finish cleanup.
This moves the cwd pivot behind a shared helper, calls it before both prune paths, restores scripts/template parity, and mirrors the legacy frontend script copy.
Constraint: gx worktree prune may run after merge-side cleanup or parent gitlink handling changes the active worktree state.
Rejected: stderr filtering in wrapper scripts | it would hide the warning without fixing the package behavior.
Confidence: high
Scope-risk: narrow
Directive: Keep branch-finish prune calls preceded by the cwd pivot when running from active agent worktrees.
Tested: bash -n scripts/agent-branch-finish.sh; bash -n templates/scripts/agent-branch-finish.sh; bash -n frontend/scripts/agent-branch-finish.sh; node --test --test-name-pattern 'agent-branch-finish pivots' test/metadata.test.js; node --test test/finish.test.js; openspec validate --specs
Not-tested: full metadata.test.js remains blocked by unrelated vscode/guardex-active-agents/extension.js template drift
Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>
0 commit comments