-
Notifications
You must be signed in to change notification settings - Fork 5.5k
feat: git tooling for undo #3914
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
Conversation
@codex can you review this deeply ? |
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.
Codex Review: Here are some suggestions.
Reply with @codex fix comments
to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
} | ||
|
||
let options = CreateGhostCommitOptions::new(&self.config.cwd); | ||
match create_ghost_commit(&options) { |
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 do you intend on this being used? When should one be created?
Somethings that come to mind are:
- Ideally this adds no latency in most cases even though the underlying git operations may be slow. To do this, it may require kicking off the snapshot when a turn starts and awaiting on it before the first exec call which will hopefully be long enough after the turn starts for it to complete
- However, some turns won't make filesystem changes so we would do extra throwaway work in those cases but maybe that's fine?
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.
- Yes this is exactly what I'm doing right now
- I don't see how to pre-shot those turns unfortunately
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.
Agreed!
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.
For 1, this isn't using a tokio future so the snapshot runs synchronously on submit message which does add latency, right?
I was thinking we could use a tokio future that we launch at the same time but then await on before the first tool call to avoid the latency hit.
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.
For the record: it will be tackled in a dedicated PR
This is awesome! One thing to look out for is that unreachable commits get automatically garbage collected by git after a certain point (default is 14 days). Do we know if we need to create a ref/tag for each commit? |
# Conflicts: # codex-rs/tui/src/chatwidget.rs # codex-rs/tui/src/slash_command.rs
I think it's fine (good, actually) that these get garbage collected. The useful lifetime of the snapshot will likely be shorter than that. |
# Conflicts: # codex-rs/tui/Cargo.toml
Summary
Introduces a “ghost commit” workflow that snapshots the tree without touching refs.
Details