Annotation.create() cannot tell a caller the write didn't land
Reading the SDK to understand how annotation writes report failure, and I think three distinguishable outcomes are collapsing into one. Flagging it because the asymmetry looks unintentional rather than by design — happy to be told it's deliberate.
packages/traceloop-sdk/traceloop/sdk/client/http.py — post() catches
requests.exceptions.RequestException, prints the formatted error, and returns None.
Because raise_for_status() runs inside that try, an HTTP 500 becomes a RequestException
too. So three different worlds produce the identical return:
- the annotation was written
- the network never reached you
- your server received it and explicitly rejected it
packages/traceloop-sdk/traceloop/sdk/annotation/base_annotation.py — create() calls
post(...) and discards the result. Its signature is -> None, so a caller has nothing to
inspect even if they wanted to.
What makes this look like an oversight rather than a policy: the same function is perfectly
willing to raise. It raises ValueError three times, for a missing annotation_task, a missing
entity_id, and empty tags. It will stop you for a malformed argument and stay silent when the
write itself is lost.
The error channel is also a print() to stdout rather than a logger or a warning. In a worker,
a scheduled job, or a container, that is nobody's alerting — human feedback data disappears behind
a red line no one reads.
Same shape on the sibling verbs, so it isn't one method: get → None, delete → False, and
put → None on failure but {} on an empty success, so even the boolean one can't separate
refused from unreachable.
And the part that argues against a blanket reading: evaluator.py is clean. It uses httpx
directly and raises on a non-200. So this isn't "the SDK swallows errors" — it's two client paths
in one SDK with opposite failure policies, and a caller's guarantees depend on which one they
happened to hit.
A fix that keeps the property you probably want: if the swallow is deliberate — and it very
plausibly is, a telemetry SDK that crashes the host app is worse than one that loses a write — then
the honest version is a return value that distinguishes delivered / refused / could-not-reach,
with create() handing it back rather than returning None. An SDK that won't take your app down
is right. One that can't tell you it lost your data is a different thing.
What I have not done, and it matters for how much weight to give this: I read this on main
through the API. I have not run it and have not reproduced a dropped write. Fifteen files
use this client — datasets/* and annotation/user_feedback.py among them, all write paths — and
I traced exactly one of them. The mechanism is certain for the annotation path; the blast radius is
inference on my part.
I do this class of work — checks that can't come out against you, guards that never fire, verdicts with nothing behind them — at unreached.dev, and I'll say so plainly rather than pretend I'm only here to be helpful. The issue stands either way and I'm happy to leave it at that.