-
Notifications
You must be signed in to change notification settings - Fork 29
enhance: use workspace file revisions to avoid clobbering the database #437
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
enhance: use workspace file revisions to avoid clobbering the database #437
Conversation
69e6681 to
ed9f368
Compare
ed9f368 to
e09f799
Compare
database/go.mod
Outdated
|
|
||
| go 1.23.3 | ||
|
|
||
| replace github.com/gptscript-ai/go-gptscript => github.com/thedadams/go-gptscript v0.0.0-20250219113618-25d959a071ff |
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 need gptscript-ai/go-gptscript#93 to merge before we can remove this and merge this PR.
| lastRevisionIndex := slices.IndexFunc(revisions, func(rev gptscript.FileInfo) bool { | ||
| return rev.RevisionID == revisionID | ||
| }) | ||
|
|
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.
Revisions should come out in order.
| return nil | ||
| } | ||
|
|
||
| for _, rev := range revisions[:lastRevisionIndex+1] { |
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.
This seems to be delete ALL revisions. Is that the intention?
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.
Iiuc, this drops all revisions up-to and including the previous revision (not the one we just created).
workspace-files/main.go
Outdated
| } | ||
|
|
||
| data, err := client.ReadFileInWorkspace(ctx, path.Join(FilesDir, filename)) | ||
| response, err := client.ReadFileInWorkspace(ctx, path.Join(FilesDir, filename)) |
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.
In the latest version of the go-gptscript changes, this function returns []byte instead of the data structure.
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.
Ah, meant to drop this. Thanks for catching.
e09f799 to
45df4c8
Compare
| if err := g.DeleteRevisionForFileInWorkspace(ctx, dbWorkspacePath, rev.RevisionID, gptscript.DeleteRevisionForFileInWorkspaceOptions{ | ||
| WorkspaceID: workspaceID, | ||
| }); err != nil { | ||
| fmt.Fprintf(os.Stderr, "Error deleting revision %s: %v\n", rev.RevisionID, err) |
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.
Same here
Signed-off-by: Nick Hale <4175918+njhale@users.noreply.github.com>
45df4c8 to
24f984e
Compare
Addresses obot-platform/obot#1813