-
Notifications
You must be signed in to change notification settings - Fork 106
feat: implement state persistence #177
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
Open
35C4n0r
wants to merge
30
commits into
main
Choose a base branch
from
35C4n0r/agentapi-state-persistence
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
e3bd936
chore(lib): extract Conversation interface
johnstcn e5f1bda
Merge branch 'main' into cj/refactor-conversation
35C4n0r a0f8bb5
feat: implement state persistence
35C4n0r ca3cdff
feat: pid file writing and clearing and improved error handling for l…
35C4n0r 1c224e9
refactor: remove redundant save logic
35C4n0r 30f82d7
feat: improve logic for first run with empty state file
35C4n0r 12bed1c
feat: implement platform-specific signal handling
35C4n0r e366e8b
feat: refactor cfg -> Config and move pid ops to server
35C4n0r 26fdf81
feat: unregister the signal handlers on teardown
35C4n0r 021e33f
Merge branch 'main' into 35C4n0r/agentapi-state-persistence
35C4n0r 5795db7
feat: resolve conflicts and improve shutdown sequence
35C4n0r b44fe5d
Merge branch 'main' into 35C4n0r/agentapi-state-persistence
35C4n0r 9deab88
feat: resolve conflicts
35C4n0r 18fb1e4
chore: not dirty after load state
35C4n0r b719dac
feat: add tests
35C4n0r 3959002
feat: remove comment
35C4n0r 7e389d2
feat: remove comments
35C4n0r 1d7aaed
wip: address comments
35C4n0r 058b18f
feat: remove anti-pattern for graceful shutdown
35C4n0r 2565a3c
feat: remove additional message upon load state fail
35C4n0r 1033cd7
wip: apply suggestions from cian
35C4n0r cfb7601
wip: apply suggestions from cian
35C4n0r 9d7eb5a
feat: update tests
35C4n0r 759ec53
feat: improved initial prompt handling
35C4n0r 03c6f16
chore: comments
35C4n0r bd75240
chore: address cian's file permission comments
35C4n0r b1ab615
feat: implement error handling for agent events
35C4n0r 31d27a7
fix: no screen adjustment in case of loadState failure
35C4n0r 220d360
feat: add three e2e tests for statePersistence
35C4n0r eef927d
feat: address maf's review
35C4n0r File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We could consider moving this into
case <-gracefulCtx.Done():above? I'm guessing we don't have to callsrv.Stopif we receive onserverErrCh.Does stop error if the server already closed? If yes, we'll end up printing a misleading error here.
EDIT: I looked at Stop and the once does guard against multiple Stops, but not against Stop producing an error if the server closed before?
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.
We return early if we receive anything(non nil) on serverErrCh
True, I had an alternative in mind, but I decided to proceed with
oncehere for the above-mentioned reason. I'll add a check inStopI'll check for this ErrServerClosed, and return nil in that case.