Repository navigation
Fix OpenAI response created timestamp - #16401
yuzhichang merged 18 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough
ChangesOpenAI response timestamp handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/unit_test/api/utils/test_api_utils.py`:
- Around line 28-31: Update test_get_data_openai to cover the falsy
explicit-value regression by asserting that api_utils.get_data_openai preserves
an explicitly passed created value of 0, not just a truthy value like 123. Keep
the focus on the get_data_openai behavior so the test would fail if the old
truthiness check returns a default instead of the provided value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 02d3c2c1-6efc-4e3a-a11b-552f301fc407
📒 Files selected for processing (2)
api/utils/api_utils.pytest/unit_test/api/utils/test_api_utils.py
78db4e9 to
f86a0e7
Compare
fc5ba9c to
f372b99
Compare
|
Synced with latest main. Could a maintainer add the ci label so workflows can run? Okay, please review it. |
50cc40b to
9fd0b19
Compare
96dc199 to
e76ec16
Compare
|
Follow-up: branch is current with |
…openai-created-timestamp
…openai-created-timestamp
|
Can someone take a look when you have a chance? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16401 +/- ##
==========================================
- Coverage 94.56% 93.16% -1.40%
==========================================
Files 10 10
Lines 717 717
Branches 118 118
==========================================
- Hits 678 668 -10
- Misses 25 29 +4
- Partials 14 20 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What this fixes
Closes #16400.
get_data_openai()currently returnscreated: nullwhen callers do not pass a timestamp, and it replaces explicit timestamp values with the current time. This makes non-streaming OpenAI-compatible responses inconsistent with the expected integercreatedtimestamp field.Change
createdvalues when provided.int(time.time())whencreatedis not provided.Verification
./.venv/bin/python -m pytest test/unit_test/api/utils/test_api_utils.py -qpython3 -m py_compile api/utils/api_utils.py test/unit_test/api/utils/test_api_utils.pyuvx ruff check api/utils/api_utils.py test/unit_test/api/utils/test_api_utils.py