feat: implement issue #2216 — dev-lead: an agent session can leave base-branch content in the PR worktree, and the harness commits it (follow-up to #2211)
Problem
dev-lead: an agent session can leave base-branch content in the PR worktree, and the harness commits it (follow-up to #2211)
From the issue: Follow-up to #2211 (budget-guard split). On PR #2198, run 38072695498, the fix-bot-comment pass's worktree was on the PR head: gh pr checkout switched it to dev-lead/issue-2196-20261010-1316 at 17:52:43, two seconds after the intermediate Preparing worktree (detached HEAD e6b666d). The harness runs no git command between the engine and commit_and_push. So when the agent session ended, its working tree held origin/main's content for the PR's three files while HEAD was still on the PR branch, and...
Risk
Medium — changes GitHub Actions workflow behavior, which is exercised only post-merge; verify via the affected workflow runs.
Test plan
Tests added/updated: tests/dev-lead/unit/test_base_residue_guard.bats,tests/dev-lead/unit/test_fix_reviews.bats. Verification: bash scripts/dev-lead-lint.sh (shellcheck --severity=warning) ran pre-commit; the bats suite runs in CI.
Rollback
Revert this PR. No non-revertible side effects (no tags, migrations, or external state).
Monitoring
Watch the affected workflow run(s) in the Actions tab and this PR's Lint check for regressions.
Closes #2216