Repository navigation
Handle typing generics in skill API method annotations - #571
Merged
NeonDaniel merged 1 commit intoSep 25, 2026
Merged
NeonDaniel merged 1 commit into
NeonDaniel merged 1 commit into
Conversation
_register_public_api called issubclass() on every parameter and return annotation. Typing generics such as Optional[str] are not classes, so issubclass raised TypeError and the whole skill failed to initialize. Only check annotations that are classes. Adds tests for the typed public API (published schemas, kwargs coerced into the request model) and a regression test for generic annotations.
mikejgray
force-pushed
the
fix/api-method-generic-annotations
branch
from
September 25, 2026 21:01
5b2446d to
3a0ffe9
Compare
NeonDaniel
approved these changes
Sep 25, 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.
Description
NeonSkill._register_public_apicallsissubclass()on each API method's parameter and return annotations. Typing generics such asOptional[str],List[str], ordict[str, str]are not classes, soissubclassraisesTypeError. The error is not caught (onlyImportErroris), so the whole skill fails to initialize:The fix checks that an annotation is a class before
issubclass, for both parameters and return values. Methods typed with pydantic models behave the same as before.Tests added to
tests/neon_skill_tests.py:test_typed_api_method:<skill_id>.public_apipublishes the request and response JSON schemas, and JSON kwargs from the bus arrive as the request model.test_generic_annotations: regression test. A method withOptional[str]parameter and return initializes, publishes no schemas, and is callable. Fails on currentdevwith theTypeErrorabove; passes with this change.Issues
None filed. Found while evaluating the typed skill API (as used in
skill-date_time) for exposing skill methods as LLM tools.Other Notes
Locally, 6 existing tests in
neon_skill_tests.pyfail withOSError: File name too longfrom combo_lock on macOS with a long checkout path. They fail the same way on cleandevand are unrelated to this change.