feat(sdk): resume durable agent sessions - #2477
Merged
Merged
Conversation
Persist explicit SDK sessions across managed Host restarts and restore them through the existing Agent Runtime. Keep transient query behavior unchanged and preserve same-session writer exclusion.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Session.close()and Host shutdown without deleting historyclient.query()transient and continue using the existing per-session writer lock for same-session exclusionWhy
The Host should be a replaceable process, not the owner of durable conversation state. An external application can now retain a session ID, restart its SDK client/Host, and resume that same session without introducing a machine-wide daemon or a second Agent Runtime.
client.query()client.sessions.create()client.sessions.resume(id)Boundaries
Compatibility
Validation
cargo test --locked -p bitfun-sdk-host --test host_lifecycle(42 passed)cargo test --locked -p bitfun-sdk-host --test protocol_contracts(8 passed)cargo test --locked -p bitfun-sdk-host-app --test stdio_transport(10 passed)cargo test --locked -p bitfun-sdk-host-app --test process_initialization(6 passed)pnpm --dir sdk/typescript test(65 passed, 1 platform skip)cargo check --locked --workspace --exclude bitfun-desktoppassedgit diff --checkpassedcargo test --locked --workspace --exclude bitfun-desktopstopped on the unrelated existing app-server testlightweight_client_negotiates_with_the_production_serverbecausesession/reloadContextwas not advertised. This PR does not modify app-server files. The full Desktop workspace check also remains blocked by the absent generatedsrc/mobile-web/distdirectory, so neither baseline limitation was expanded into this PR.