Repository navigation
Conversation
This branch has not been deployed
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.
Fixes #4050
Problem
StoreSessionStorage.listPaths(prefix)discovered journal paths by pagingBaseStore.search(namespace, 256, offset)and filteringstartsWith(prefix)in the client. For JDBC stores,storeSearchprojectsitem_key, value_json, version, so every listing transferred the values of the entire namespace.In a shared workspace namespace with 9,140 commit segments (~395.8 MB), one chat-history export retry therefore pulled the full namespace before loading any segment:
Change
BaseStore.listKeys(namespace, keyPrefix)with a default pagedsearch+startsWithfallback, returning sorted keys so every existing backend stays compatible.StoreSessionStorage.listPaths(prefix)now delegates tostore.listKeys(namespace, prefix).JdbcStore.listKeys, backed by a newStoreDialect.storeListKeys:SELECT item_key FROM <store> WHERE namespace_path = ? AND item_key LIKE ? ESCAPE '!' ORDER BY item_keyvalue_json;%,_and the escape character itself.readAll/ batch-read andlistPathssemantics, including empty prefix handling.After the change,
listPathstransfers only the matching keys instead of every value in the namespace.Relationship to #3996
This is an independent optimization and does not replace or modify the batch-read work in #3996:
get→getAll);Both can land independently; neither changes the other's behavior.
Tests
BaseStoreContractTest: prefix filtering, ordering, empty prefix, and pagination beyond onesearchpage (300 keys).StoreSessionStorageListPathsTest:listPathsdelegates tolistKeys, and falls back to paged search for stores without an override.JdbcStoreH2Test: key-only listing order, LIKE wildcard escaping, empty prefix, and exact-namespace filtering.DialectSqlTests:storeListKeysSQL projects onlyitem_key.Verified with:
mvn -o -q -pl agentscope-harness,agentscope-extensions/agentscope-extensions-jdbc -am -DskipTests -Dmaven.javadoc.skip=true install mvn -o -q -pl agentscope-harness,agentscope-extensions/agentscope-extensions-jdbc spotless:check mvn -o -pl agentscope-harness,agentscope-extensions/agentscope-extensions-jdbc testHarness: 1,623 tests, 0 failures (12 skipped). JDBC: 181 tests, 0 failures. No production MySQL was used; JDBC coverage runs on H2.
Merge order
listKeysandgetAllare adjacent).JdbcStoreH2Testbefore merging.listKeysnot loading values; it should land after this PR.