Uh oh!
There was an error while loading. Please reload this page.
fix(py): fix various IDE type check issues, streaming syntax, and missing default value runtime crash - #5340
Merged
Conversation
…sing default value runtime crash
Contributor
There was a problem hiding this comment.
Code Review
This pull request enhances the handling of actions with defaulted input arguments, enabling them to be called without input while skipping validation. It also improves static analysis by reordering decorator overloads and transitioning __all__ exports to string literals. A bug was identified in the logic for detecting optional arguments in methods, where the self parameter prevents the correct identification of defaulted arguments.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
i14h
approved these changes
May 21, 2026
pavelgj
approved these changes
Jun 23, 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 freeto 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.
I noticed these issues while spinning up a new sample project and coding directly in IDE:
Plugin imports flagged as private — the plugin's
__all__was built dynamically:__all__ = [GoogleAI.__name__, VertexAI.__name__, ...]. Pyright only treats a symbol as part of the public API when__all__contains string literals. Rewrote the lists to string literals across google-genai, ollama, and flask__init__.py.Defaulted flow input collapses to None — the
@ai.flow()decorator's@overloaddefinitions were ordered most-general first (0-arg → 1-arg → 2-arg). A functionasync def f(x: str = '...')is structurally callable with no args, so pyright matched the 0-arg overload, which says "input type is None". Reordered to most-specific-first so the input type stays as the caller wrote it.Streaming reported as not iterable —
ModelStreamResponseonly exposed.streamand.response. Added__aiter__delegating to the underlying channel. The explicit.stream/.responseAPI still works; the naturalasync for chunk in ai.generate_stream(...)form now works too.Runtime crash on
await greet():(A)
Action.run()validated input against the schema before checking whether the function had a Python default, so it raisedINVALID_ARGUMENTonNoneagainststr.(B) Even bypassing validation,
_invokewas callingself._fn(None), but Python only uses a parameter's default when the argument is omitted, not whenNoneis passed explicitly.Two-part fix:
FullArgSpecand remember whether the input arg has a Python default.ctxby keyword in the 2-arg form so it doesn't accidentally land in the input slot).