Skip to content

fix(go): eagerly resolve genkit schema references in reflection API#5221

Open
apascal07 wants to merge 2 commits intomainfrom
ap/go-schema-resolution
Open

fix(go): eagerly resolve genkit schema references in reflection API#5221
apascal07 wants to merge 2 commits intomainfrom
ap/go-schema-resolution

Conversation

@apascal07
Copy link
Copy Markdown
Collaborator

@apascal07 apascal07 commented Apr 30, 2026

Fixes #5219

ActionDef.Desc() now resolves genkit: schema references in InputSchema and OutputSchema (matching what its existing doc comment already promised). listResolvableActions also resolves descriptors returned from DynamicPlugin.ListActions, which bypass Desc().

Checklist

  • PR title is following https://www.conventionalcommits.org/en/v1.0.0/
  • Tested (unit tests added for both resolution and unresolved-fallback paths in core/action_test.go and genkit/reflection_test.go)
  • Docs updated (no docs change needed — internal behavior fix)

The Reflection API returned raw `{"$ref": "genkit:Foo"}` references in
action metadata, causing the Dev UI to render empty forms because it
doesn't perform secondary lookups for Genkit's internal registry refs.

`ActionDef.Desc()` now resolves `genkit:` references in InputSchema and
OutputSchema (matching its existing doc comment), with a best-effort
fallback that preserves the `$ref` when the registry isn't set or the
schema hasn't been defined yet, keeping the existing deferred-resolution
flow intact. `listResolvableActions` also resolves descriptors returned
by DynamicPlugin.ListActions, which bypass `Desc()`.

Fixes #5219
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces schema reference resolution for action descriptors. The Desc() method and listResolvableActions function now resolve "genkit:" schema references to their concrete definitions, facilitating easier consumption by tools like the Dev UI. A review comment identifies an opportunity to improve the deduplication logic in listResolvableActions by properly initializing the tracking map with existing actions to prevent duplicates from dynamic plugins.

Comment thread go/genkit/reflection.go
@apascal07 apascal07 requested review from huangjeff5 and pavelgj May 1, 2026 19:57
…eActions

A DynamicPlugin returning an action that is also already registered in
the global registry would previously be appended to the result a second
time, since the keys map only tracked names from plugin iteration.
Initialize keys with the names from the initial listActions(g) result
so registered actions take precedence over plugin re-listings.
@apascal07 apascal07 marked this pull request as ready for review May 1, 2026 22:49
@apascal07 apascal07 requested a review from ifielker May 1, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Go] Reflection API should eagerly resolve named schema references (genkit:)

1 participant