Flaky system test: test_embedding_and_rerank_calls_are_in_request_history raises StopIteration

Open Beginner friendly
#7,228 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
83/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
testing-qa

Research direction

Start in hindsight-system-tests/tests/test_95_model_call_traces.py, at test_embedding_and_rerank_calls_are_in_request_history, and read the polling condition alongside the assertions below it. Update the loop to wait for the recall query row, retain document row, and rerank row associated with the recall trace, then run that system test; it is done when those rows are checked without an intermittent StopIteration.

Written by the indexing model from the issue text.

Description

core

What happens
hindsight-system-tests/tests/test_95_model_call_traces.py::test_embedding_and_rerank_calls_are_in_request_history fails now and then in CI with RuntimeError: coroutine raised StopIteration (seen on CI run 47121438293, job test-system (blackbox)). It passes locally.

Why
The poll loop stops as soon as any embedding_query trace exists and there is at least one rerank row:

if {"embedding_document", "embedding_query"} <= {r.scope for r in embedding} and rerank:
    break

An embedding_query row from another operation (e.g. consolidation) can satisfy that before the recall's own row is flushed (rows are written in batches). The next line then finds no recall row:

query = next(r for r in embedding if r.scope == "embedding_query" and r.operation == "recall")

and next() raises StopIteration inside the coroutine.

What should happen
The loop should wait for the rows it asserts on: an embedding_query row with operation == "recall", an embedding_document row with operation == "retain", and a rerank row with the recall's trace_id.

Dominant language
Python
Stars
45.2k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vectorize-io/hindsight

All issues in vectorize-io/hindsight

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.