Conversation
After a sandbox session, git commits made by the agent inside the VM are now preserved in the original workspace's git history. A new post-flush pipeline step extracts commits from the snapshot repo and recreates them in the original using the same author metadata. Key design decisions: - Replay runs after flush to preserve the interactive review security model - Best-effort: replay errors are warnings, file changes are already safe - Partial acceptance: rejected files are filtered from replayed commits - Merge commits are skipped; worktree snapshots skip replay entirely Security: ValidateInBounds symlink checks, .git path blocking, no shell invocation (exec.Command argv only), no --allow-empty commits. Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
…ntract
Add HEAD divergence detection to skip replay when the original repo's
HEAD moves during a VM session, preventing misleading commit ancestry.
Preserve executable file permissions by querying git ls-tree for the
tree mode instead of hardcoding 0o644. Fix ResolveHEAD to return
("", nil) for repos with no commits, matching its interface contract.
Wire ReplayCommits into the CLI composition root.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
0o755) in replayed commits instead of hardcoding0o644ResolveHEADto return("", nil)for repos with no commits, matching its interface contractCommitReplayerandReplayCommits()into the CLI composition rootTest plan
TestResolveHEAD_NoCommits— empty repo returns("", nil)not an errorTestReplay_HeadDiverged— diverged original returnsDiverged=true, Replayed=0TestReplay_PreservesExecutableBit— executable files keep0o755after replayTestGetFileModeAtCommit— table-driven: regular=0o644, executable=0o755, missing=0o644fallbackbbox claude-code -- -p "..."successfully replayed 1 commit onto original repo🤖 Generated with Claude Code