Skip to content

fix(storage): avoid overflow in search page bounds - #4413

Open
CryoThrust wants to merge 1 commit into
agentscope-ai:mainfrom
CryoThrust:fix/store-search-pagination-bounds
Open

CryoThrust wants to merge 1 commit into
agentscope-ai:mainfrom
CryoThrust:fix/store-search-pagination-bounds

Conversation

@CryoThrust

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.1.0-SNAPSHOT (main@5a315a9af)

Description

Fixes #4412.

The in-memory, OSS and COS BaseStore implementations calculate start + limit before clamping it to the result count. A large positive limit can therefore overflow to a negative page end, causing subList to throw even for a two-item result set.

Each affected implementation now caps the page length at the remaining count before adding it to the start. The production change is one line per backend; existing listing, sorting, offset behavior, storage format and APIs stay unchanged. Matching EN/ZH documentation explains that this is safe page arithmetic, not a reduction in OSS/COS listing work.

Regressions cover a limit of Integer.MAX_VALUE with a nonzero offset, an offset beyond the result set, ordinary one-item pages and zero-length pages. OSS/COS use mocked SDK fixtures with no cloud credentials or live cloud calls. Negative-argument behavior is outside this fix.

Verification

The three overflow regressions fail on the unchanged base with fromIndex(1) > toIndex(-2147483648). After the fix, the existing BaseStore contract, OSS and COS suites pass 35 cases with no failures/errors/skips.

On Java 17:

mvn -o -B -T1C clean verify

The complete 114-module clean verification passed in 9:29: 13,493 tests, zero failures/errors, 221 skipped. These are local reactor results, not a claim that skipped provider/platform tests ran. No live OSS/COS service was used.

Documentation checks passed from docs/: npm test, npm run validate, npm run broken-links.

Checklist

  • Code formatted with Spotless
  • Complete reactor verification passed (skipped tests disclosed above)
  • Javadoc conventions preserved; no new public API
  • Related English and Chinese documentation updated
  • Code is ready for review

@mintlify

mintlify Bot commented Nov 25, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit a0ea87c.

Approve preview

@CryoThrust

Copy link
Copy Markdown
Contributor Author

Linux passed on a0ea87cb5f489416615cff2ede9b18f1efd63e1b. The Windows run has one assertion failure in the unchanged DashScopeMultiModalEmbeddingTest.synchronousSdkCallRunsOffNonBlockingSubscriberThread: its loopback server did not observe the SDK request within five seconds (job log). The three pagination regression suites pass there; the failure is in agentscope-extensions-rag-simple, which this PR does not change.

The same 114-module local clean verification passed (13,493 tests; zero failures/errors; 221 skips), but that does not establish the cause of this Windows-only failure. I attempted a failed-jobs-only rerun and GitHub rejected it with Must have admin rights to Repository. Could a maintainer rerun the failed Windows job? No source, CI configuration or assertion changes were made to bypass it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Large search limits overflow pagination in in-memory, OSS and COS stores

1 participant