Repository navigation
fix(py): log a failed generate turn as one line without a traceback - #65
Merged
Merged
Conversation
The ERROR line no longer carries exc_info, and no span keeps the stack, so a bug in Genkit or a plugin boxed as 'internal error' left no traceback anywhere. Log it at debug, same as reflection and startup failures.
huangjeff5
force-pushed
the
fix/py-log-failed-turn-one-line
branch
from
November 10, 2026 22:14
ae70352 to
60eb727
Compare
cabljac
approved these changes
Nov 11, 2026
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.
When a model or tool raises mid-
generate, Genkit now logs a singleERRORline naming the culprit, innermost frame location, error, andtrace_idinstead of pretty-printing a multi-hundred-linerichtraceback with frame locals.Changes
ERRORrecord withoutexc_infoby default: Previously,log_dropped_failurepassedexc_info=excatERROR, so structlog'sConsoleRenderer(rich) formatted ~1,000 lines per failed turn, spent hundreds of ms of synchronous CPU on the event loop, and dumped frame locals (including prompt text and config) to stdout. TheERRORrecord now carrieserror='<Type>: <message>'(or'<Type>'when the message is empty) andat='<file>:<line>'for the innermost frame instead ofexc_info. The caller already getsfinish_reason='failed', andtrace_idlinks to the span tree.GENKIT_LOG=debug:ai.generate()boxes unexpected exceptions behind'internal error'and spans do not store Python stack frames, so droppingexc_infoeverywhere would leave SDK or plugin bugs with no stack trace. Genkit also emitslogger.debug('%s failure details', culprit, exc_info=exc, **fields), which structlog filters out at no rendering cost under defaultinfologging and prints whenGENKIT_LOG=debugis set.PublicError(andGenkitErrorwithout a foreign cause) already surfaces its message onresponse.error.message, solog_dropped_failurestill skips it, and each boxed internal failure logs once at the originating tool or model.Breaking changes
None.