Repository navigation
fix(py): lead Dev UI stacks with user frames, title boxed spans, and tighten error text - #115
Merged
Merged
Conversation
Since 0.13.0 the Dev UI poster sent spans as OTLP/JSON to /api/otlp with no events. The telemetry server's OTLP converter drops span events anyway, and the Traces tab reads a non-model span's heading and stack only from its exception event, so failed Python flow and tool spans showed "Error" and no traceback. Spans now POST TraceData to /api/traces, the shape JS and Go send and what Python sent before 0.13. A raised error records exception.type, .message (str(err)) and .stacktrace the way OTel's record_exception formats them, stored as strings so finished spans hold no frames. Interrupts record no event so the tool span still renders as Interrupted. Failures returned without raising keep status but get no event. Logs stay on /api/otlp.
A boxed generate or a failed dotprompt returns instead of raising, so its
span had status text but no exception event, and the Dev UI Traces tab
titled it "Error". set_state('error', message=...) now adds an exception
event with that message. The boxed response holds no traceback, so the
event has no stack; the span that raised still has the full one. A raised
exception replaces it.
- Stack traces on spans and in the runner drop the leading frames under genkit/_core and genkit/_ai, per traceback in the cause chain, so a failed tool reads from the tool's own line instead of 6-10 runtime frames. A traceback that is all Genkit frames is kept whole. - The runner heading for a GenkitError is str(error), the same `STATUS: message[: cause]` as the span's status.message and JS's `STATUS: message`, instead of `message: repr(cause)`. - GenkitError skips the cause suffix when the cause's own .message is the message. A google-genai APIError's str() is that message again in a dict repr. - Config bound errors say "got 99.0" once; the bounds message already names the value, so the config check doesn't append the input.
MichaelDoyle
approved these changes
Nov 12, 2026
# Conflicts: # packages/genkit/src/genkit/_core/_error.py # packages/genkit/src/genkit/_core/_reflection.py # packages/genkit/src/genkit/_core/_reflection_v2.py # packages/genkit/src/genkit/_core/_telemetry/_http.py # packages/genkit/tests/genkit/core/telemetry/trace_data_encoder_test.py
This was referenced Nov 15, 2026
Merged
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.
Improves error readability across the Dev UI trace viewer and model runner by trimming internal runtime frames, titling boxed spans with their failure cause, and harmonizing error strings.
Stacked on #113 (
fix/py-devui-span-exception-events).Main Changes
run_in_new_span,_run_with_span,_invoke) before seeing their tool or flow code.format_exception_stacktrims leading frames undergenkit/_coreandgenkit/_aiacross each cause in the chain while preserving full stacks for errors originating entirely inside Genkit.ai.generate()catches a tool failure and boxes it into aModelResponse, the span completed without raising. Without an exception event, the Dev UI Traces tab fell back to titling the box "Error".set_state('error', message=...)now attaches anexception.messageevent so the trace viewer displays the actual failure cause.get_reflection_json()now formatsGenkitErrorviastr(error)(STATUS: message: cause), ensuring the Dev UI runner panel and the trace viewer display identical status strings rather than rawrepr()dumps of cause exceptions.APIError) whosestr()is a dict repr duplicating.message,GenkitErroravoids repeating the message twice in the error title.All unit tests pass.