Skip to content

Add non-git fallback snapshotting for git_changed_files#271

Open
mmprotest wants to merge 5 commits into
mainfrom
mmprotest/fix-dirty-file-detection-for-non-git-workspaces
Open

Add non-git fallback snapshotting for git_changed_files#271
mmprotest wants to merge 5 commits into
mainfrom
mmprotest/fix-dirty-file-detection-for-non-git-workspaces

Conversation

@mmprotest

Copy link
Copy Markdown
Owner

Motivation

  • Ensure change/progress detection works in non-git sandboxes by avoiding a silent “no changes” when git status fails.
  • Provide a lightweight in-memory fallback so verification, patch sanity, and autonomy progress tracking see real file edits in empty or non-git workspaces.

Description

  • Replaced git_changed_files(repo) in villani_code/state_runtime.py to preserve git status --short behavior when it succeeds and fall back to a filesystem snapshot diff when it fails.
  • Added a module-level in-memory snapshot store _NON_GIT_SNAPSHOT_BY_REPO keyed by absolute repo path and a _snapshot_workspace_files() helper that records per-file fingerprints (size, mtime_ns) using relative POSIX-style paths and the existing is_ignored_repo_path logic.
  • Fallback diff reports added, modified, and deleted relative paths (sorted) and updates the baseline after each call; on first non-git call the baseline is created and [] is returned.
  • Kept changes local to state_runtime.py, reused the repo ignore rules, avoided disk persistence, and did not modify autonomy, verification or stop logic.

Testing

  • Ran the focused tests for the new behavior with pytest -q tests/test_state_runtime.py -k git_changed_files and all relevant cases passed (7 passed).
  • Ran the full state runtime test file with pytest -q tests/test_state_runtime.py and all tests passed (39 passed).

Codex Task

…ty-assistant-turns

Detect repeated empty assistant turns, inject compact recovery, and fail cleanly on stall
…ention-for-failed-shell-commands

Block immediate retries of failed Bash commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant