GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(rag): cancel sibling vector queries when one search fails by rome-xi · Pull Request #3656 · agentscope-ai/agentscope

Conversation

@rome-xi

@rome-xi rome-xi commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

AgentScope Version

2.0.12dev (main at fc3445e)

Description

Fixes #3649.

KnowledgeBase.search() fans out one vector query per input with asyncio.gather. When one query raised, gather re-raised right away and search() returned control to the caller while the sibling queries kept running in the background.

This keeps references to the per-query tasks. If the gather fails or is cancelled, it cancels the siblings that are still running (without re-cancelling ones that are already cancelling) and awaits them before re-raising the original error. Same approach as #3148 for embedding batches. The success path is unchanged.

Tests (tests/rag_knowledge_search_test.py, event-synchronised vector store double like the one in the issue):

  • one query fails after both have started: the original error propagates and the sibling has finished when search() raises (checked for each failing index)
  • a child query is cancelled: the sibling is cancelled and joined
  • the caller cancels search(): every query is cancelled and joined
  • the success path still dedupes, applies the score threshold, and ranks results

On unmodified main the first two cases fail (Sibling query 1 was not awaited before search returned); with the fix the new tests and tests/rag_knowledge_metadata_test.py pass, and pre-commit is clean on the touched files.

AI-assisted; I reviewed the change and ran the tests.

Checklist

  • An issue has been created for this PR
  • I have read the CONTRIBUTING.md
  • Docstrings are in Google style
  • Related documentation has been updated (not needed, internal behaviour only)
  • Code is ready for review

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rome-xi
fix(rag): cancel sibling vector queries when one search fails
a055336
@github-actions github-actions Bot added the pr/awaiting-review Waiting for maintainers to review this PR label Nov 3, 2026
@rome-xi

rome-xi commented Nov 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Hi maintainers, a gentle ping on this one when you have a moment. It's a small change for #3649: when one of the per-query vector searches in KnowledgeBase.search() fails or is cancelled, the sibling queries are now cancelled and awaited instead of being left running in the background, with regression tests for the failure, cancellation and success paths. CI is green. Happy to adjust anything. Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@shuxiachai shuxiachai mentioned this pull request Nov 12, 2026
[Bug]: RAGMiddleware drops all knowledge-base context when one knowledge base cannot embed an attachment #3975
Closed
2 tasks done
@Winoren Winoren mentioned this pull request Nov 23, 2026
[Bug]: RAG middleware leaves sibling knowledge-base searches running after cancellation #4239
Closed
qbc2016 added 2 commits November 24, 2026 12:08
@qbc2016
fix(rag): protect vector query cleanup during cancellation
2bca028
@qbc2016
test(rag): streamline concurrent search coverage
af83698
qbc2016
qbc2016 approved these changes Nov 24, 2026
View reviewed changes

@qbc2016 qbc2016 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot removed the pr/awaiting-review Waiting for maintainers to review this PR label Nov 24, 2026
@qbc2016
qbc2016 merged commit 5149d33 into agentscope-ai:main Nov 24, 2026
9 checks passed

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@qbc2016 qbc2016 qbc2016 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug]: KnowledgeBase.search leaves sibling vector queries running after one query fails

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@rome-xi @qbc2016
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.