Skip to content

Conversation

@AdityaHegde
Copy link
Collaborator

@AdityaHegde AdityaHegde commented Jan 16, 2026

Adds a new block at the end of tool calls just before a text response from LLM.
Screenshot 2026-01-16 at 7 18 14 PM

Adds a revert button that creates a new commit reverting the changes to just before the message chain starts.
Screenshot 2026-01-16 at 7 18 43 PM

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@ericokuma
Copy link
Contributor

Comment on lines 168 to 169
// 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) {
Copy link
Contributor

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.

Copy link
Collaborator Author

@AdityaHegde AdityaHegde Jan 29, 2026

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.

Comment on lines 172 to 177
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 {
Copy link
Contributor

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:

func (s *BaseSession) Message(predicates ...Predicate) (*Message, bool) {

Comment on lines 203 to 209
} else {
hash, err = repo.CommitHash(ctx)
}
if err != nil {
return "", err
}
return hash, nil
Copy link
Contributor

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).

Copy link
Collaborator Author

@AdityaHegde AdityaHegde Jan 29, 2026

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

Copy link
Contributor

@begelundmuller begelundmuller Jan 30, 2026

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.
Okay I understand now. It was a little difficult to work out the behavior. What do you think about making it more explicit? Maybe by changing CheckpointCommitHash to:

  • CommitHash string: the commit hash before the write was made (not conditional)
  • AddedCheckpointCommit bool: true if it created a new checkpoint commit

We call RestoreGitCommit with that hash
Hmm, it looks like this reverts all commits and changes. So it would also revert changes made outside of the conversation as well? For example,

  • if the user adds a connector manually (maybe because the AI did a bad job), then it would get removed if they tried to revert the AI changes?
  • or if another user pushed a change to main and it got pulled, then this would revert it?

I have not kept up on the PRD, but my impression was that the original idea was to do checkpoint commits only of the AI's changes (after each call to the developer agent). And do revert commits of individual checkpoint commits, not reverts of any commits.

@AdityaHegde AdityaHegde force-pushed the feat/dev-chat-revert-flow branch from d351198 to f452cfc Compare January 29, 2026 07:48
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.

3 participants