Skip to content

fix(queuefs): harden embedding tracker across worker loops#1024

Merged
MaojiaSheng merged 2 commits intomainfrom
fix/embedding-tracker-loop-safety
Mar 27, 2026
Merged

fix(queuefs): harden embedding tracker across worker loops#1024
MaojiaSheng merged 2 commits intomainfrom
fix/embedding-tracker-loop-safety

Conversation

@qin-ctx
Copy link
Copy Markdown
Collaborator

@qin-ctx qin-ctx commented Mar 27, 2026

Description

Fix cross-event-loop completion tracking in EmbeddingTaskTracker so semantic and embedding queue workers can safely coordinate embedding completion without transient re-enqueue failures.

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Replace the global asyncio.Lock in EmbeddingTaskTracker with thread-safe coordination for cross-worker access
  • Dispatch embedding completion callbacks back to the owner event loop and add fallback handling for closed loops
  • Add regression tests for cross-loop completion tracking and update semantic DAG test doubles to match the current vectorize signature

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

Validated with:

  • python -m pytest --override-ini addopts='' tests/storage/test_embedding_tracker.py
  • python -m pytest --override-ini addopts='' tests/storage/test_semantic_dag_stats.py tests/storage/test_semantic_dag_skip_files.py tests/storage/test_collection_schemas.py

Replace the global asyncio lock in EmbeddingTaskTracker with thread-safe
coordination so semantic and embedding workers can share completion state
without cross-event-loop failures. Add regression coverage for cross-loop
completion dispatch and align semantic DAG test doubles with the current
vectorize API.
@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

Treat stopped semantic owner loops as unavailable before dispatching
completion callbacks from embedding workers. Add regression coverage for
the stop-before-close shutdown window so the final decrement path falls
back to the current loop instead of hanging.
@MaojiaSheng MaojiaSheng merged commit 7eb50cb into main Mar 27, 2026
7 checks passed
@MaojiaSheng MaojiaSheng deleted the fix/embedding-tracker-loop-safety branch March 27, 2026 06:01
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Mar 27, 2026
zeattacker pushed a commit to zeattacker/OpenViking that referenced this pull request Mar 27, 2026
…e#1024)

* fix(queuefs): harden embedding tracker across worker loops

Replace the global asyncio lock in EmbeddingTaskTracker with thread-safe
coordination so semantic and embedding workers can share completion state
without cross-event-loop failures. Add regression coverage for cross-loop
completion dispatch and align semantic DAG test doubles with the current
vectorize API.

* fix(queuefs): avoid handing callbacks to stopped owner loops

Treat stopped semantic owner loops as unavailable before dispatching
completion callbacks from embedding workers. Add regression coverage for
the stop-before-close shutdown window so the final decrement path falls
back to the current loop instead of hanging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants