You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vector ORDER BY, ORDER BY RANK relevance ranking, and object-shaped DISTINCT queries failed with a continuation-token error even though the query itself succeeded. The Cosmos SDK throws from ResponseMessage.ContinuationToken when the pipeline cannot export a resumable token, and query read that property unconditionally.
Read the token through TryReadContinuationToken, which separates query execution from the ability to resume it. A pipeline that refuses to export a token no longer fails the command, and a token collected from an earlier page is dropped so the caller never receives one the service would reject.
MCP calls to a non-resumable query keep advancing the same iterator, including through empty intermediate pages, until the requested limit is reached instead of returning after a single page.
A result that is truncated by the limit and cannot be resumed is reported explicitly: the shell prints that the query cannot be resumed, and the MCP payload sets resultIncomplete. For these queries a null token alone no longer means the result set is exhausted.
Resumable pagination is unchanged: MCP still returns one page and its token, and interactive queries still page until the limit.
Documentation for query and the MCP payload, the MCP tool description, and the changelog are updated.
This PR updates Cosmos query handling so successful queries that cannot export continuation tokens still return results and report incomplete MCP results.
Changes:
Handles non-resumable continuation tokens and pagination.
Adds incomplete-result state and MCP payload support.
Updates tests, documentation, localization, and changelog.
Broaden release note for DISTINCT projection behavior
CHANGELOG.md:12
The release note claims only DISTINCT projections without ORDER BY are affected, but the reported object-shaped DISTINCT reproduction has ORDER BY and still receives the unsupported-token response. Please make the note cover the broader set of DISTINCT projections so the documented fix matches the shipped behavior.
This branch is the only protection for the promise that a token from an earlier page is discarded when a later response rejects token export, but the added execution tests only exercise a throwing getter on the first page. Add a multi-page regression with a valid first-page token followed by a successful page whose getter throws, and assert the returned state never exposes the stale token; otherwise this caller-safety guarantee is untested.
Clarify null token exception for truncated non-resumable results
docs/commands.md:395
The preceding MCP contract still says that a null token means there are no more pages, which contradicts the new non-resumable behavior: when resultIncomplete is true, the null token explicitly accompanies results that were truncated and cannot be resumed. Qualify that sentence so clients do not treat this response as exhausted.
Document resultIncomplete exception for null continuation tokens
docs/mcp.md:131
The payload-shape table still defines a null continuationToken as meaning that no results remain, but this new field is emitted alongside a null token for truncated non-resumable queries. The two rows are therefore contradictory for the response shape introduced here; include the resultIncomplete exception in the token description so clients reading this table do not treat such results as exhausted.
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
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 #219.
Vector
ORDER BY,ORDER BY RANKrelevance ranking, and object-shapedDISTINCTqueries failed with a continuation-token error even though the query itself succeeded. The Cosmos SDK throws fromResponseMessage.ContinuationTokenwhen the pipeline cannot export a resumable token, andqueryread that property unconditionally.TryReadContinuationToken, which separates query execution from the ability to resume it. A pipeline that refuses to export a token no longer fails the command, and a token collected from an earlier page is dropped so the caller never receives one the service would reject.resultIncomplete. For these queries a null token alone no longer means the result set is exhausted.Documentation for
queryand the MCP payload, the MCP tool description, and the changelog are updated.