Skip to content

Fix gt-pvx auto-save committing deletions of tracked files#3620

Open
justinstimatze wants to merge 1 commit intogastownhall:mainfrom
justinstimatze:fix/pvx-auto-save-deletions
Open

Fix gt-pvx auto-save committing deletions of tracked files#3620
justinstimatze wants to merge 1 commit intogastownhall:mainfrom
justinstimatze:fix/pvx-auto-save-deletions

Conversation

@justinstimatze
Copy link
Copy Markdown

Summary

  • Both auto-save mechanisms (gt done safety net and checkpoint_dog) use git add -A which stages deletions of tracked files
  • A polecat whose working tree has a missing tracked file (e.g. .beads/metadata.json) gets that deletion auto-committed, breaking infrastructure for subsequent sessions
  • Fix: after git add -A, unstage all staged deletions via git diff --cached --name-only --diff-filter=D
  • Also adds runtime dir exclusions to done.go (.beads/, .claude/, .runtime/, __pycache__/) matching checkpoint_dog's existing runtimeExcludeDirs

Fixes #3615

Changes

  • internal/git/git.go — new StagedDeletions() method
  • internal/cmd/done.go — add runtime dir exclusions + deletion unstaging
  • internal/daemon/checkpoint_dog.go — add deletion unstaging after existing runtime dir exclusions

Design rationale

A safety-net auto-commit should preserve work (additions + modifications), never destroy it (deletions). Renames are unaffected — git detects them as R status, not D, even with content changes down to 75% similarity.

Test plan

  • go build ./... passes
  • go test ./internal/git/... passes
  • go test ./internal/daemon/... passes
  • Verified renames not caught by --diff-filter=D (tested at 100% and 75% similarity)
  • Verified complete file replacement (0% similarity) correctly unstages deletion, preserving the new file
  • go test ./internal/cmd/... has pre-existing compile error in compact_report_test.go (unrelated)

Both auto-save mechanisms (gt done safety net and checkpoint_dog) use
git add -A which stages deletions. A polecat whose working tree has a
missing tracked file (e.g. .beads/metadata.json) gets that deletion
auto-committed, breaking infrastructure for subsequent sessions.

Fix: after git add -A, query staged deletions via
git diff --cached --name-only --diff-filter=D and unstage them.
A safety-net commit should preserve work (additions + modifications),
never destroy it (deletions).

Also adds runtime dir exclusions to done.go (.beads/, .claude/,
.runtime/, __pycache__/) matching checkpoint_dog's existing
runtimeExcludeDirs.

Fixes gastownhall#3615
@github-actions github-actions bot added the status/needs-triage Inbox — we haven't looked at it yet label Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/needs-triage Inbox — we haven't looked at it yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gt-pvx auto-save commits deletions of tracked files

1 participant