Skip to content

Recover from patch apply failures during sandbox pull#398

Merged
robinaugh merged 1 commit intomainfrom
jason/patch-failure-recovery
Mar 5, 2026
Merged

Recover from patch apply failures during sandbox pull#398
robinaugh merged 1 commit intomainfrom
jason/patch-failure-recovery

Conversation

@robinaugh
Copy link
Contributor

@robinaugh robinaugh commented Mar 5, 2026

Summary

  • When git apply fails pulling sandbox changes locally, retries with git apply --reject to partially apply clean hunks and write .rej files for conflicts
  • Saves the full rejected patch to .rwx/sandboxes/patch-rejected.diff for manual inspection
  • Returns partially-applied files in the exec result so agents know what was pulled
  • Warns about leftover .rej files at the start of the next sync (sync still proceeds)

Example output

Pull with conflicts:

Warning: failed to pull changes from sandbox: patch partially applied. 1 file(s) have conflicts:
  Makefile (see Makefile.rej)
Resolve the conflicts in each .rej file, then delete the .rej files.
Full patch saved to /Users/jasonrobinaugh/code/cli/.rwx/sandboxes/patch-rejected.diff

Next sync with unresolved .rej files:

Warning: 1 unresolved .rej file(s) from a previous pull:
  Makefile.rej
These will be synced to the sandbox and may cause issues. Resolve and delete them when possible.

Test plan

  • Unit test: --reject retry produces .rej files and reports them in warnings
  • Unit test: saved patch is cleaned up when --reject succeeds fully
  • Unit test: rejected patch is saved to .rwx/sandboxes/patch-rejected.diff
  • Unit test: sync warns about leftover .rej files
  • Manual: created local/sandbox divergence on Makefile, verified .rej file + saved patch + warning output
  • Manual: verified .rej warning appears on next sync, disappears after cleanup

@robinaugh robinaugh self-assigned this Mar 5, 2026
@robinaugh robinaugh force-pushed the jason/patch-failure-recovery branch from 1d37ba0 to d8658d8 Compare March 5, 2026 18:36
@robinaugh robinaugh force-pushed the jason/local-sandbox-storage branch from de465c8 to 736c82e Compare March 5, 2026 18:53
Base automatically changed from jason/local-sandbox-storage to main March 5, 2026 19:01
@robinaugh robinaugh force-pushed the jason/patch-failure-recovery branch from d8658d8 to 3a19651 Compare March 5, 2026 19:11
When git apply fails pulling changes from a sandbox, retry with
--reject to partially apply hunks that succeed and write .rej files
for conflicts. Save the full patch to .rwx/sandboxes/patch-rejected.diff
for manual inspection. Warn about leftover .rej files on next sync.
@robinaugh robinaugh force-pushed the jason/patch-failure-recovery branch from 3a19651 to e16e35c Compare March 5, 2026 19:12
@robinaugh robinaugh marked this pull request as ready for review March 5, 2026 19:15
@robinaugh robinaugh merged commit 970fae9 into main Mar 5, 2026
1 check passed
@robinaugh robinaugh deleted the jason/patch-failure-recovery branch March 5, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants