Skip to content
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

Figure out how to manage merge errors #2

Closed
j6k4m8 opened this issue Jun 6, 2023 · 2 comments · Fixed by #11
Closed

Figure out how to manage merge errors #2

j6k4m8 opened this issue Jun 6, 2023 · 2 comments · Fixed by #11
Labels
bug Something isn't working git good first issue Good for newcomers thirdparty:overleaf

Comments

@j6k4m8
Copy link
Member

j6k4m8 commented Jun 6, 2023

Right now, if we encounter more recent changes, we fail completely and nuke the repo:

try:
self._repo.git.stash()
self._repo.remotes.origin.pull(force=True)
try:
self._repo.git.stash("pop")
except Exception as e:
# TODO: this just means there was nothing to pop, but
# we should handle this more gracefully.
logger.debug(f"Nothing to pop: {e}")
pass
except Exception as e:
logger.error(
f"Error pulling from repo {self._reposlug}: {e}. "
"Falling back on DESTRUCTION!!!"
)

This costs us an extra round-trip to the LLM, or, at worst, an endless loop of human edits overruling AI's opportunistic editing. I think this is just because I don't know how to use the git python library that well; surely there must be a way to stash and 3-way.

@wrongu
Copy link
Contributor

wrongu commented Jun 7, 2023

Quick footnote: from the perspective of #10 , note that overleaf internally appears to handle "live" edits using operational transforms. Source line might be this one?

Upshot is that their internals allow them to gracefully handle rapid-fire edits by multiple users in the same line of a document. This gets around git-style merge errors.

Unclear at this stage how much the long delay in LLM calls affects our strategy here. Git merge may still be the natural thing to use if the text is a few seconds old by the time the LLM is ready.

@j6k4m8
Copy link
Member Author

j6k4m8 commented Jun 7, 2023

Especially if we can stream text from the model into the editor (which is roughly the same OOM speed as a human typing), I imagine that resolves merge issues entirely!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working git good first issue Good for newcomers thirdparty:overleaf
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants