fix: ensure_repo_local self-heals dirty trees #91
No reviewers
Labels
No labels
Agent
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
joshtronic/igor!91
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/ensure-repo-stash-pull-pop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Crashed ticks (W_LOG-style unbound var, OOM, timeout, push
failure mid-flow) can mutate working-tree files but never reach
the commit step. The dirty state then blocks
git pull --rebaseforever, and the only signal is the one-line "warning: pull of
$repo failed; using stale local copy" -- which the harness logs
and walks past. Today's example: blog-ideas.md sat uncommitted
for 6+ hours because this morning's W_LOG crash mutated it
before the brain commit step. Every tick since has logged the
warning and silently used stale state; brain effectively
stopped getting new commits.
ensure_repo_local now self-heals at tick start:
git add -A+ commit withsubject "recovery: auto-commit leftover changes from prior
tick", try to push.
gets rebased onto origin if origin moved).
Trade-off: the recovery commit preserves whatever partial state
the prior tick left behind. If that state was "the :wq idea got
removed but the post never shipped," the idea stays removed --
no re-drafting on the next tick. Manual restore is possible by
reverting the recovery commit or re-adding the idea to
blog-ideas.md. Accepting partial-state preservation is the lesser
evil vs. silent rot for hours.
Untracked files don't trigger the detection (they don't block
git pull --rebase). The recovery
git add -Adoes sweep themup if a tracked-file diff already triggered, so any orphaned
scratch files in brain get committed alongside the real changes.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
Crashed ticks (W_LOG-style unbound var, OOM, timeout, push failure mid-flow) can mutate working-tree files but never reach the commit step. The dirty state then blocks `git pull --rebase` forever, and the only signal is the one-line "warning: pull of $repo failed; using stale local copy" -- which the harness logs and walks past. Today's example: blog-ideas.md sat uncommitted for 6+ hours because this morning's W_LOG crash mutated it before the brain commit step. Every tick since has logged the warning and silently used stale state; brain effectively stopped getting new commits. ensure_repo_local now self-heals at tick start: 1. Detect dirty tracked-file diff (staged or unstaged). 2. If dirty: log the file list, `git add -A` + commit with subject "recovery: auto-commit leftover changes from prior tick", try to push. 3. Pull normally. Recovery commit is now on top of origin (or gets rebased onto origin if origin moved). Trade-off: the recovery commit preserves whatever partial state the prior tick left behind. If that state was "the :wq idea got removed but the post never shipped," the idea stays removed -- no re-drafting on the next tick. Manual restore is possible by reverting the recovery commit or re-adding the idea to blog-ideas.md. Accepting partial-state preservation is the lesser evil vs. silent rot for hours. Untracked files don't trigger the detection (they don't block git pull --rebase). The recovery `git add -A` does sweep them up if a tracked-file diff already triggered, so any orphaned scratch files in brain get committed alongside the real changes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>