-
Notifications
You must be signed in to change notification settings - Fork 164
feat: revert changes made by developer agent #8655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
| // maybeCreateCheckpoint creates a checkpoint if this is the 1st write file message in the current message chain. | ||
| func (t *WriteFile) maybeCreateCheckpoint(ctx context.Context, s *Session, path string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we agreed there should be a way to toggle auto-commits on/off in the UI. So it will need a bool flag like EnableCheckpointCommits in the DeveloperAgentArgs, which it should handle here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm there doesnt seem to be any mention for this in the PRD. Doesnt hurt to add it in the API though right now, will work the product to add a good place in the UI for the toggle.
runtime/ai/file_write.go
Outdated
| for i := len(s.messages) - 1; i >= 0; i-- { | ||
| if s.messages[i].Tool == WriteFileName && s.messages[i].Type == MessageTypeResult { | ||
| msg = s.messages[i] | ||
| } | ||
|
|
||
| if s.messages[i].Role == RoleUser { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of accessing the internal messages variable, use the predicate-based message finding utils here:
Line 670 in 3ed62a8
| func (s *BaseSession) Message(predicates ...Predicate) (*Message, bool) { |
| } else { | ||
| hash, err = repo.CommitHash(ctx) | ||
| } | ||
| if err != nil { | ||
| return "", err | ||
| } | ||
| return hash, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can the UI know whether a checkpoint was made or not? I'm thinking about how the UI can show which auto-commits have been made, and know which are safe to revert or not (so it doesn't revert a user commit).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presence of a hash in write file tool result is what we use in the UI. We call RestoreGitCommit with that hash
d351198 to
f452cfc
Compare
Adds a new block at the end of tool calls just before a text response from LLM.

Adds a revert button that creates a new commit reverting the changes to just before the message chain starts.

Checklist: