Repository navigation
Conversation
prepare_to_drop_span ignored its err argument, so an errored Workflow or agent run was stamped SUCCESS with no error message, its trace ended as SUCCESS, and the span was never removed from trace_manager.active_spans. Set ERRORED/error on the span, mark the root trace errored, and remove the span, matching the sibling langchain error paths.
|
@BlueX888 is attempting to deploy a commit to the Confident AI Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LLamaIndexHandler.prepare_to_drop_spanignored itserrargument, so a LlamaIndex span that ended by raising was finalized exactly like one that completed: the span was stampedSUCCESSwith no error message, its root trace ended asSUCCESS, and the span was never removed fromtrace_manager.active_spans.Why
llama_index_instrumentationonly callsspan_drop(..., err=e)fromexcept BaseExceptionblocks (llama_index_instrumentation/dispatcher.py, lines 397, 435 and 467), so every span that reachesprepare_to_drop_spanis a failed span.In
deepeval/integrations/llama_index/handler.pybefore this change:base_span.status = TraceSpanStatus.SUCCESSunconditionally, discardingerr.trace_manager.end_trace(...)for root spans, andend_tracedefaults anIN_PROGRESStrace toSUCCESS(deepeval/tracing/tracing.py:352-353) — so a failed workflow or agent run was reported as a successful trace with no error.trace_manager.remove_span(...), unlike its siblingprepare_to_exit_span(same file, line 412), so every errored span stayed inactive_spansfor the lifetime of the process.The equivalent path is already handled correctly for LangChain in
deepeval/integrations/langchain/utils.py:446-449and:484-485: setERROREDpluserror = str(exc_val), mark the trace errored, thenremove_span. This change bringsprepare_to_drop_spanin line with that.Changes
deepeval/integrations/llama_index/handler.py, onlyprepare_to_drop_span:err is not Nonesetsbase_span.status = TraceSpanStatus.ERROREDandbase_span.error = str(err); otherwise the status staysSUCCESS.ERROREDbeforeend_traceis called, soend_tracecannot flip it back toSUCCESS.trace_manager.remove_span(base_span.uuid)is called at the end, matchingprepare_to_exit_span.The
else-branch (SUCCESS) behavior for a drop with no exception is unchanged.Testing
New regression test:
tests/test_integrations/test_llamaindex/test_drop_span.py. Four tests driveprepare_to_drop_spanagainst a synthetic span registered intrace_manager.active_spans(no LLM or API key needed), plus one end-to-end test that decorates a raising function with the real LlamaIndex dispatcher and asserts the posted trace comes backERROREDwith the error message and thatactive_spansis empty.On the unpatched tree:
With the fix:
Existing suites:
The 10 failures in
test_sync.py/test_async.pyare pre-existing in this environment and unrelated to this change — they all raiseValueError: No API key found for OpenAI.while constructing the test apps' embeddings, and the same 10 fail on unmodifiedmain.Lint (the repo's CI gate is
psf/black --check, pinned 25.12.0):ruff checkreports one issue,E722 Do not use bare exceptathandler.py:60, which is pre-existing and byte-identical onmain; that line is not touched by this diff.