Skip to content

Bug: pre-commit stash pop creates merge conflicts in working tree #2416

@mrveiss

Description

@mrveiss

Problem

Pre-commit's git stash push/pop cycle corrupted 6 working tree files with merge conflict markers during the #2383 commit. The committed content was correct (hooks passed), but the unstaged working copies had <<<<<<< HEAD conflicts requiring manual resolution.

Discovered During

Committing #2383 — after successful commit, agent_seeder.py, slm_client.py, manager.py, model_constants.py, seed_agents.py, and ssot_config.py all had conflict markers in the working tree.

Root Cause

Known issue #1503 (pre-commit stash risk). The PostToolUse hook (Black + isort) modifies files between the pre-commit stash push and pop, causing the pop to conflict.

Workaround Applied

git checkout HEAD -- <files> to restore committed versions.

Proposed Fix

Add a post-commit hook or adjust the PostToolUse hook workflow:

  1. After commit success, run git checkout HEAD -- $(git diff --name-only) to auto-heal
  2. Or: disable the PostToolUse auto-format hook and rely solely on pre-commit hooks

Related

#1503 (pre-commit stash risk documentation)

Impact

Medium — requires manual cleanup after every commit that touches files also modified by PostToolUse hook.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions