Files
sim/apps
Waleed 451d2ccbde fix(knowledge): stop billing a document once per processing attempt (#6911)
The usage sourceReference carried a per-attempt timestamp, which defeated by
construction the eventKey deduplication it flows into. With three Trigger
attempts plus the stuck-document sweep, one document could be billed four times
for a single indexing pass.

Key on the dispatch request id instead — already the codebase's name for one
indexing pass, fixed across attempts of a run and fresh on every new dispatch —
so retries collapse while a genuine re-index still bills. Falls back to the
embedding pricing id where no pass id is threaded. usage_log has no retention,
so keying on documentId alone would have suppressed legitimate re-indexing
permanently.

Thread requestId through the Trigger worker, which previously dropped it before
the call — the path that actually retries.
2026-08-20 17:33:50 -07:00
..
…