Commit Graph

9 Commits

Author SHA1 Message Date
yuneng-jiang f351bbdb36 [Fix] Derive SPEND_PER_REQUEST dynamically in spend accuracy tests
Instead of hardcoding SPEND_PER_REQUEST (which broke when the model
changed from gpt-3.5-turbo-0301 to gpt-3.5-turbo), make a single
calibration request first, poll for its spend, and use that as the
per-request cost. Fails fast with pytest.fail() after 5 retries if
calibration cannot determine the cost.

Also fixes a bug in test_basic_spend_accuracy where the user spend
assertion error message referenced user_info['info'] instead of
user_info['user_info'].

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 13:27:06 -07:00
yuneng-jiang 3012c6d070 fix(tests): replace fixed sleeps with polling in spend accuracy tests
The spend accuracy tests were flaky because they used fixed sleeps
(45s/30s) to wait for the batch writer to flush. Under CI load, the
batch writer scheduler can be delayed beyond these windows, causing
all spend values to remain 0.0 and the test to fail.

Replace fixed sleeps with a polling loop that checks key spend every
10s for up to 120s, only proceeding once spend becomes non-zero.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 00:06:09 -07:00
Cursor Agent cc3f9cd65b fix(ci): stabilize CI tests - conditional import, mock fixes, timing adjustments
Fix 1.1: Make ResponseApplyPatchToolCall import conditional with try/except
  for compatibility with openai==1.100.1 (CI environment)
Fix 1.2: Move Router creation inside mock context in vector store tests
  so mocks are applied before Router captures function references
Fix 1.3: Update test_model_group_info_e2e to check for 'anthropic/*'
  wildcard group instead of specific model names not in proxy config
Fix 2.1: Increase redis cache test sleep from 1s to 5s
Fix 2.2: Increase spend accuracy test sleep from 25s to 45s
Fix 2.3: Add 0.5s sleep between budget test calls
Fix 2.4: Increase vertex AI spend test sleep from 20s to 40s

Co-authored-by: yuneng-jiang <yuneng-jiang@users.noreply.github.com>
2026-03-13 00:01:25 +00:00
yuneng-jiang 65829411e0 increasing time for spend tracking 2026-01-20 16:31:25 -08:00
Ishaan Jaffer 014362cace fix ocr test 2025-10-31 20:32:03 -07:00
OrionCodeDev 5f52533294 Fix spend tracking for OCR/aOCR requests (log pages_processed + recognize OCRResponse) (#16070)
* fix-ocr-cost

* fix1
2025-10-29 18:11:21 -07:00
Alexsander Hamir eaa04cd8ce fix: use fastuuid helper (#14903)
* fix: use fastuuid helper across the codebase

First batch of changes, simple drop in replacement.

* second batch of changes

* fixed: script mistake on helper file
2025-09-25 15:47:01 -07:00
Ishaan Jaff 9951b356da test_long_term_spend_accuracy_with_bursts 2025-03-31 21:09:29 -07:00
Ishaan Jaff 271b8b95bc test spend accuracy 2025-03-31 19:35:07 -07:00