perf(remote): load session history pages on demand - #3203
Merged
Merged
Conversation
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
Opening a long remote conversation currently reads and projects every persisted turn before cutting the first stream page. Load historical turns on demand until the requested page reaches its event/byte budget instead. Android, iOS and HarmonyOS keep the existing
read_streamprotocol.Type and Areas
Type: Performance / bug fix.
Areas: Rust session persistence and Remote Connect host streams; native mobile transport regression tests.
Motivation / Impact
An opt-in benchmark compares both production persistence/projection/stream paths against the same 128-turn fixture (128 KiB input per turn). Fresh hubs are used for each of five samples, and the first-page payloads are asserted identical apart from revisions.
This is approximately 41x faster in this local synthetic fixture, not an end-to-end phone/relay measurement. All five samples are printed by the reproducible benchmark; there is no machine-dependent timing assertion in CI.
Verification
cargo test --locked -p openbitfun-core --no-default-features --features remote-connect,git --lib agentic::persistence::manager::tests::— 57 passed, 2 opt-in tests ignored.load_relay_session_turns_— 1 passed, including paged/full content equivalence after unloading the session.history_page_benchmark -- --ignored --nocapture— passed; measurements above.cargo test --locked -p openbitfun-services-integrations --no-default-features --features remote-connect --lib remote_connect::host_stream— 20 passed. Covers bounded reads, large-turn continuation, live updates, source gaps, epoch resets, eviction/backscroll and the existing Rust subscriber.node --test src/apps/mobile/harmonyos/tools/tests/host-stream.test.cjs— 10 passed.src/apps/mobile/shared:./gradlew :core-transport:jvmTest --tests '*HostStreamTest'— 19 passed, exercising the shared Android/iOS reader with JS-safe history/live cursors.pnpm run fmt:rsandgit diff --check— passed.pnpm run mobile:architecture— existing failure. A pristine worktree of basefaf5d4a41produces exactly the same output: onesharedReachesPlatformTreesentry inClientBuildContractTest.ktand threedefaultArgsInFeatureApientries. No baseline was loosened.Remote scenario exercised: Remote Connect host/readers in local fixtures. HarmonyOS hardware validation could not run because
hdc list targetsreturned empty. No live relay, SSH workspace, peer-device or detached-dispatch verification is claimed.Reviewer Notes
Checklist