You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[OPIK-7279] [SDK] fix: convert trace lifecycle to upsert-only
QA of opik-hermes 0.1.1 surfaced the Opik SDK warning on every Hermes
message: "Calling Trace.update() shortly after creation with batching
enabled may cause data loss." That warning is the symptom of violating
the codebase-wide upsert-only rule for integrations: when an entity
finishes, re-send the same id with the finished payload rather than
mutating it via update()/end().
- lifecycle.py finish_trace: finalize via a single client.trace(id=...,
output=..., end_time=...) re-send instead of trace.update()+trace.end().
- state.py evict_stale_locked: finalize evicted traces via the same upsert
(id + end_time) instead of trace.end(); fail-open if no client.
- Spans were already upsert-compliant and are left untouched.
Tests: FakeOpik.trace() now models real Opik's upsert coalescing; FakeTrace
update()/end() raise so a regression fails loudly. E2E asserts the batching
warning is absent and the finalized trace carries output + end_time.
Implements OPIK-7279.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments