The trace deployed in round5 located the cost: batches_ms carried 80% of
every work-buffer poll (1400-3900ms of 1600-4100ms total). The poller's
enablement check called ListHumanBatches for the project, which — because
the legacy migration created one batch per task — materialized 12,009 full
batch documents on every 3s poll, walking an organizationId-only index over
17,334 docs.
- HasRawHumanAnnotationBatch (Memory + Mongo): projects only the stages
field and stops at the first three-role raw_human match (105ms on the
production dataset, was 2000ms+).
- New humanBatches index organizationId_projectId_pluginId backs both the
enablement query and ListHumanBatches' project-scoped reads.
- store.Store interface gains the method; both store implementations keep
identical semantics (mid-test profile flips stay visible).
The new indexes cut the work-buffer poll from 3-5s to 2-3s, but the remaining
cost is unlocated. This trace records where the time goes per poll so the
next fix targets evidence, not guesses.