-
Notifications
You must be signed in to change notification settings - Fork 123
add AgentSessionStateDelta for state sync #1393
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -187,12 +187,19 @@ message JobTermination { | |
| string job_id = 1; | ||
| } | ||
|
|
||
| message AgentSessionStateDelta { | ||
| // if base_version is empty, this is the delta from the initial state | ||
| optional string base_version = 1; | ||
| string new_version = 2; | ||
|
Comment on lines
+192
to
+193
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could we keep this simple by making these uint64s and incrementing by 1 for every turn?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah it could be int |
||
| bytes changeset = 3; | ||
| } | ||
|
|
||
| message TextMessageRequest { | ||
| string message_id = 1; | ||
| string session_id = 2; | ||
| string agent_name = 3; | ||
| string metadata = 4; | ||
| bytes session_data = 5; | ||
| repeated AgentSessionStateDelta session_state = 5; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. two options for sync state from cloud to worker:
for the second case we may also need a protocol to ask and answer the db version
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can maintain sticky routing with state on the server that includes which state version a worker has. |
||
| string text = 6; | ||
| } | ||
|
|
||
|
|
@@ -207,6 +214,6 @@ message PushTextRequest { | |
| message TextMessageResponse { | ||
| // Indicate the request is completed | ||
| string message_id = 1; | ||
| bytes session_data = 2; | ||
| AgentSessionStateDelta session_state = 2; | ||
| string error = 3; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
request
response
Uh oh!
There was an error while loading. Please reload this page.
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.
there could be multiple deltas if the cloud doesn't combine them into a single one. maybe we can have only deltas and use the v1 as the base snapshot, what do you think
request
response
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.
based on benchmarks merging the changesets is inexpensive enough that we can always deliver snapshots for a cold start request.
we shouldn't expect the server to maintain the full changeset history. the minimum requirement is changeset version n and snapshot n-1 (in case we have to cold start a worker for a client retry).
separating the snapshot and delta fields makes the api more explicit than relying on version number to interpret the meaning of the data field.
Uh oh!
There was an error while loading. Please reload this page.
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.
do you mean the cloud will merge the changesets into a single changeset, or merge the changesets to the snapshot? I think it makes a lot of sense if the cloud can merge the changesets to the snapshot.
Uh oh!
There was an error while loading. Please reload this page.
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.
yeah, that's what i mean. we'll only ever send the agent a snapshot for cold start