straight-sundown-84319
09/19/2025, 12:58 PMSecurityAnalyzer is now SecurityAnalyzerBase )
@chilly-france-44439 / @wide-doctor-37830 - Any chance of final ๐
I am not fully happy with the result - I have the growing suspicion that if you want to your traditional extendable polymorphism then the creators of Pydantic hate you and want nothing but sadness for your future.
You either need to:
โข Accept that certain things won't work (Like json schemas) ๐คฎ
โข Have strict layering ( Making class A that includes a Field B that includes a class A impossible)๐คฎ
โข Build 2 full sets of models - one with non polymorphic ABCs and the other with the actual implementations, and define and use your polymorphic versions only when serializing. (It is not just enough to define your polymorphic classes - you'll need to define EVERY class that may potentially be saved twice. And also a transformation layer between them - ๐คฎ
Or... You can partake the unspeakable horrors of my PR. I've tried to limit the crazy to discriminated_union.py
My biggest sins in that file are:
โข Monkey patching the __init__ method of TypeAdapter (Though I do use splat parameters to and don't access anything private to minimize the damage - it just feels gross)
โข Directly accessing the dunder values on the pydantic models in order to replace them with their polymorphic equivalents. (Kind of subverts the immutability of models)
I'd love to merge this soonwooden-umbrella-84098
09/19/2025, 1:47 PMwooden-umbrella-84098
09/19/2025, 1:47 PMwooden-umbrella-84098
09/19/2025, 1:47 PMwooden-umbrella-84098
09/19/2025, 1:50 PMTypeAdapter or `DiscriminatedFieldsMixin`or discriminated_union or factory_path I'm inclined to think we've overcomplicated things ๐
So I'd try and step back and figure out if there's some requirement we're trying to fulfill (like no repeated code, full serializability, MCP support, etc) that we might be able to relax to make this betterstraight-sundown-84319
09/19/2025, 2:08 PMstraight-sundown-84319
09/19/2025, 2:08 PMwide-doctor-37830
09/19/2025, 2:08 PMwooden-umbrella-84098
09/19/2025, 2:10 PMstraight-sundown-84319
09/19/2025, 2:12 PMstraight-sundown-84319
09/19/2025, 2:12 PMstraight-sundown-84319
09/19/2025, 2:13 PMstraight-sundown-84319
09/19/2025, 2:13 PMchilly-france-44439
09/19/2025, 2:14 PMstraight-sundown-84319
09/19/2025, 2:14 PMwooden-umbrella-84098
09/19/2025, 2:14 PMchilly-france-44439
09/19/2025, 2:14 PMstraight-sundown-84319
09/19/2025, 2:15 PMchilly-france-44439
09/19/2025, 2:15 PMstraight-sundown-84319
09/19/2025, 2:16 PMchilly-france-44439
09/19/2025, 2:17 PMstraight-sundown-84319
09/19/2025, 2:17 PMchilly-france-44439
09/19/2025, 2:19 PMwooden-umbrella-84098
09/19/2025, 2:20 PMwooden-umbrella-84098
09/19/2025, 2:20 PMwooden-umbrella-84098
09/19/2025, 2:20 PMstraight-sundown-84319
09/19/2025, 2:21 PMwooden-umbrella-84098
09/19/2025, 2:21 PMstraight-sundown-84319
09/19/2025, 2:22 PMwooden-umbrella-84098
09/19/2025, 2:22 PMstraight-sundown-84319
09/19/2025, 2:22 PMchilly-france-44439
09/19/2025, 2:38 PMstraight-sundown-84319
09/19/2025, 2:38 PMstraight-sundown-84319
09/19/2025, 2:39 PMstraight-sundown-84319
09/19/2025, 2:40 PMstraight-sundown-84319
09/19/2025, 2:40 PMchilly-france-44439
09/19/2025, 2:40 PMstraight-sundown-84319
09/19/2025, 2:41 PMstraight-sundown-84319
09/19/2025, 2:41 PMchilly-france-44439
09/19/2025, 2:41 PMstraight-sundown-84319
09/19/2025, 2:42 PMchilly-france-44439
09/19/2025, 2:48 PMstraight-sundown-84319
09/19/2025, 2:49 PMstraight-sundown-84319
09/19/2025, 2:50 PMDiscriminatedFieldMixin did not used to extend the OpenHandsModelstraight-sundown-84319
09/19/2025, 2:50 PMchilly-france-44439
09/19/2025, 2:50 PMchilly-france-44439
09/19/2025, 2:54 PMchilly-france-44439
09/19/2025, 2:54 PMโฏ make test-server-schema
Checking uv version...
uv version 0.8.13 meets requirements
set -euo pipefail;
# Generate OpenAPI JSON inline (no file left in repo)
uv run python -c 'import os,json; from openhands.agent_server.api import api; open("openapi.json","w").write(json.dumps(api.openapi(), indent=2))'
/Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/agent-sdk.worktree/worktree2/.venv/lib/python3.12/site-packages/litellm/llms/custom_httpx/async_client_cleanup.py66 DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
# Generate client from the temp schema and fail on any warnings to check
uv run openapi-python-client generate \
--path "openapi.json" \
--output-path ".client" \
--meta uv \
--overwrite \
--fail-on-warning
Generating .client
Warning(s) encountered while generating. Client was generated, but some pieces may be missing
WARNING parsing GET /conversations/search within default.
Cannot parse response for status code 200 (Could not find reference in parsed models or enums), response will be omitted from generated client
Reference(ref='#/components/schemas/ConversationPage')
WARNING parsing GET /conversations/{conversation_id} within default.
Cannot parse response for status code 200 (Could not find reference in parsed models or enums), response will be omitted from generated client
Reference(ref='#/components/schemas/ConversationInfo')
WARNING parsing GET /conversations/ within default.
Cannot parse response for status code 200 (Invalid property in union response_200_item), response will be omitted from generated client
Reference(ref='#/components/schemas/ConversationInfo')
WARNING parsing POST /conversations/ within default.
Cannot parse response for status code 200 (Could not find reference in parsed models or enums), response will be omitted from generated client
Reference(ref='#/components/schemas/ConversationInfo')
Unable to parse schema /components/schemas/LLMSummarizingCondenser-Output
Unable to parse this part of your OpenAPI document: : Attempted to generate duplicate models with name "LLMSummarizingCondenser"
Schema(title='LLMSummarizingCondenser', multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=['llm', 'kind'], enum=None, const=None, type=<DataType.OBJECT: 'object'>, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, prefixItems=[], properties={'llm': Reference(ref='#/components/schemas/LLM'), 'max_size': Schema(title='Max Size', multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=0.0, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, const=None, type=<DataType.INTEGER: 'integer'>, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, prefixItems=[], properties=None, additionalProperties=None, description=None, schema_format=None, default=120, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None), 'keep_first': Schema(title='Keep First', multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=0.0, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, const=None, type=<DataType.INTEGER: 'integer'>, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, prefixItems=[], properties=None, additionalProperties=None, description=None, schema_format=None, default=4, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None), 'kind': Schema(title='Kind', multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, const=None, type=<DataType.STRING: 'string'>, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, prefixItems=[], properties=None, additionalProperties=None, description='Property to create kind field from class name when serializing.', schema_format=None, default=None, nullable=False, discriminator=None, readOnly=True, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None)}, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None)
Unable to parse schema /components/schemas/NoOpCondenser-Output
Unable to parse this part of your OpenAPI document: : Attempted to generate duplicate models with name "NoOpCondenser"
Schema(title='NoOpCondenser', multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=['kind'], enum=None, const=None, type=<DataType.OBJECT: 'object'>, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, prefixItems=[], properties={'kind': Schema(title='Kind', multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, const=None, type=<DataType.STRING: 'string'>, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, prefixItems=[], properties=None, additionalProperties=None, description='Property to create kind field from class name when serializing.', schema_format=None, default=None, nullable=False, discriminator=None, readOnly=True, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None)}, additionalProperties=None, description='Simple condenser that returns a view un-manipulated.\n\nPrimarily intended for testing purposes.', schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None)
Unable to parse schema /components/schemas/PipelineCondenser-Output
Unable to parse this part of your OpenAPI document: : Attempted to generate duplicate models with name "PipelineCondenser"
Schema(title='PipelineCondenser', multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=['condensers', 'kind'], enum=None, const=None, type=<DataType.OBJECT: 'object'>, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, prefixItems=[], properties={'condensers': Schema(title='Condensers', multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, const=None, type=<DataType.ARRAY: 'array'>, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=Schema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, const=None, type=None, allOf=[], oneOf=[Reference(ref='#/components/schemas/PipelineCondenser-Output'), Reference(ref='#/components/schemas/LLMSummarizingCondenser-Output'), Reference(ref='#/components/schemas/NoOpCondenser-Output')], anyOf=[], schema_not=None, items=None, prefixItems=[], properties=None, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None), prefixItems=[], properties=None, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None), 'kind': Schema(title='Kind', multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, const=None, type=<DataType.STRING: 'string'>, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, prefixItems=[], properties=None, additionalProperties=None, description='Property to create kind field from class name when serializing.', schema_format=None, default=None, nullable=False, discriminator=None, readOnly=True, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None)}, additionalProperties=None, description='A condenser that applies a sequence of condensers in order.\n\nAll condensers are defined primarily by theirmethod, which takes a\n`View` and returns either a newcondenseor aViewevent. That means we can\nchain multiple condensers together by passing `View`s along and exiting early if any\ncondenser returns aCondensation.\n\nFor example:\n\n # Use the pipeline condenser to chain multiple other condensers together\n condenser = PipelineCondenser(condensers=[\n CondenserA(...),\n CondenserB(...),\n CondenserC(...),\n ])\n\n result = condenser.condense(view)\n\n # Doing the same thing without the pipeline condenser requires more boilerplate\n # for the monadic chaining\n other_result = view\n\n if isinstance(other_result, View):\n other_result = CondenserA(...).condense(other_result)\n\n if isinstance(other_result, View):\n other_result = CondenserB(...).condense(other_result)\n\n if isinstance(other_result, View):\n other_result = CondenserC(...).condense(other_result)\n\n assert result == other_result', schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None)Condensation
Unable to process schema /components/schemas/ConversationInfo:
Invalid property in union condenser
Failure to process schema has resulted in the removal of:
/components/schemas/ConversationInfo
/components/schemas/ConversationPage
Schema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, const=None, type=None, allOf=[], oneOf=[Reference(ref='#/components/schemas/PipelineCondenser-Output'), Reference(ref='#/components/schemas/LLMSummarizingCondenser-Output'), Reference(ref='#/components/schemas/NoOpCondenser-Output')], anyOf=[], schema_not=None, items=None, prefixItems=[], properties=None, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None)
If you believe this was a mistake or this tool is missing a feature you need, please open an issue at https://github.com/openapi-generators/openapi-python-client/issues/new/choose
make: * [test-server-schema] Error 1
wide-doctor-37830
09/19/2025, 2:54 PMstraight-sundown-84319
09/19/2025, 2:55 PMchilly-france-44439
09/19/2025, 2:58 PMchilly-france-44439
09/19/2025, 2:59 PMmake test-server-schema locallystraight-sundown-84319
09/19/2025, 3:00 PMstraight-sundown-84319
09/19/2025, 3:10 PMopenapi.json
It looks pydantic / model related.
It is related to the kind field.
So in this case:
โข Output includes a kind
โข Input does not accept a kind (Which is weird and the root of the problem)
So the json schema resolves this to 2 different LLMSummarizingCondenser types with the same title:
โข LLMSummarizingCondenser-Input
โข LLMSummarizingCondenser-Outputstraight-sundown-84319
09/19/2025, 3:11 PMwide-doctor-37830
09/19/2025, 3:21 PMchilly-france-44439
09/19/2025, 3:22 PMstraight-sundown-84319
09/19/2025, 3:23 PMwide-doctor-37830
09/19/2025, 3:23 PMchilly-france-44439
09/19/2025, 3:27 PMโฏ repomix --ignore '**/*.json'
๐ฆ Repomix v1.4.2
No custom config found at repomix.config.json5, repomix.config.jsonc, repomix.config.json or global config at /Users/xingyaow/.config/repomix/repomix.config.json5, /Users/xingyaow/.config/repomix/repomix.config.jsonc, /Users/xingyaow/.config/repomix/repomix.config.json.
You can add a config file for additional settings. Please check https://github.com/yamadashy/repomix for more information.
โ๏ธ Packing completed successfully!
๐ Top 5 Files by Token Count:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1. openhands/sdk/llm/mixins/fn_call_converter.py (8,323 tokens, 39,911 chars, 2.1%)
2. tests/tools/execute_bash/test_bash_session.py (7,816 tokens, 35,666 chars, 2%)
3. tests/tools/str_replace_editor/test_basic_operations.py (7,072 tokens, 30,035 chars, 1.8%)
4. tests/sdk/context/test_view.py (6,924 tokens, 30,632 chars, 1.8%)
5. openhands/sdk/llm/llm.py (6,856 tokens, 32,732 chars, 1.8%)
๐ Security Check:
โโโโโโโโโโโโโโโโโโ
โ๏ธ No suspicious files detected.
๐ Pack Summary:
โโโโโโโโโโโโโโโโ
Total Files: 310 files
Total Tokens: 390,871 tokens
Total Chars: 1,787,654 chars
Output: repomix-output.xml
Security: โ๏ธ No suspicious files detected
๐ All Done!
Your repository has been successfully packed.Our repo is now 310 files, so this PR touches 1/3 of the file lolsob
calm-artist-7206
09/19/2025, 4:14 PMI have the growing suspicion that if you want to your traditional extendable polymorphism then the creators of Pydantic hate you and want nothing but sadness for your future.Ouchy ๐ I remember Pydantic had plastered on its home site something like: Pydantic is a VERY opinionated framework and totally proud of it! Itโs that thing, if you do things its way, fine, it makes some things easier. But if you fight it, specially on the fundamentals, you will cry.
straight-sundown-84319
09/19/2025, 4:15 PMcalm-artist-7206
09/19/2025, 4:16 PMchilly-france-44439
09/19/2025, 4:40 PMstraight-sundown-84319
09/19/2025, 4:41 PMstraight-sundown-84319
09/19/2025, 4:41 PMstraight-sundown-84319
09/19/2025, 4:41 PMwide-doctor-37830
09/19/2025, 4:55 PMstraight-sundown-84319
09/19/2025, 6:18 PMchilly-france-44439
09/19/2025, 7:08 PMTraceback (most recent call last):
File "/Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/agent-sdk.worktree/worktree2/examples/10_persistence.py", line 109, in <module>
conversation = Conversation(
^^^^^^^^^^^^^
File "/Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/agent-sdk.worktree/worktree2/openhands/sdk/conversation/conversation.py", line 65, in init
self.state = ConversationState.create(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/agent-sdk.worktree/worktree2/openhands/sdk/conversation/state.py", line 138, in create
state = cls.model_validate(json.loads(base_text))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/agent-sdk.worktree/worktree2/openhands/sdk/utils/models.py", line 67, in model_validate
return super().model_validate(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/agent-sdk.worktree/worktree2/.venv/lib/python3.12/site-packages/pydantic/main.py", line 705, in model_validate
return cls.__pydantic_validator__.validate_python(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for ConversationState
agent.kind
Input should be 'Condensation', 'CondensationRequest', 'MessageEvent', 'PauseEvent', 'FinishAction', 'ActionEvent', 'FinishObservation', 'AgentErrorEvent', 'ObservationEvent', 'ThinkAction', 'Tool', 'ThinkObservation', 'CondensationSummaryEvent', 'SystemPromptEvent' or 'UserRejectObservation' [type=literal_error, input_value='AgentBase', input_type=str]
For further information visit https://errors.pydantic.dev/2.11/v/literal_errorfacepalm some how got this when running
examples/10_persistence.py in my PR (https://github.com/All-Hands-AI/agent-sdk/pull/342)
seems like there's still some weird edge casesstraight-sundown-84319
09/19/2025, 7:12 PMchilly-france-44439
09/19/2025, 7:16 PMchilly-france-44439
09/19/2025, 7:17 PMconversation = Conversation(
^^^^^^^^^^^^^
File "/Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/agent-sdk.worktree/worktree2/openhands/sdk/conversation/conversation.py", line 65, in init
self.state = ConversationState.create(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/agent-sdk.worktree/worktree2/openhands/sdk/conversation/state.py", line 148, in create
resolved = agent.resolve_diff_from_deserialized(state.agent)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/agent-sdk.worktree/worktree2/openhands/sdk/agent/base.py", line 177, in resolve_diff_from_deserialized
raise ValueError(
ValueError: Cannot resolve from deserialized: persisted agent is of type AgentBase, but self is of type Agent.
/Users/xingyaow/Projects/All-Hands-AI/openhands-v1-dev/agent-sdk.worktree/worktree2/.venv/lib/python3.12/site-packages/litellm/llms/custom_httpx/async_client_cleanup.py66 DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()But when i serialize and save
Agent - it is saved as kind=AgentBasestraight-sundown-84319
09/19/2025, 7:18 PMchilly-france-44439
09/19/2025, 7:19 PMkind=Agent is correct, but just when we load it back and do .model_validate, some how it got tranformed to AgentBasechilly-france-44439
09/19/2025, 7:19 PMstraight-sundown-84319
09/19/2025, 7:19 PMchilly-france-44439
09/19/2025, 8:06 PMstraight-sundown-84319
09/19/2025, 8:06 PMstraight-sundown-84319
09/19/2025, 8:33 PMstraight-sundown-84319
09/19/2025, 8:33 PMstraight-sundown-84319
09/19/2025, 9:48 PMstraight-sundown-84319
09/19/2025, 9:48 PMchilly-france-44439
09/19/2025, 11:11 PMstraight-sundown-84319
09/19/2025, 11:20 PMstraight-sundown-84319
09/19/2025, 11:21 PMstraight-sundown-84319
09/19/2025, 11:22 PMstraight-sundown-84319
09/19/2025, 11:22 PMstraight-sundown-84319
09/19/2025, 11:22 PMchilly-france-44439
09/19/2025, 11:30 PMchilly-france-44439
09/19/2025, 11:30 PMchilly-france-44439
09/19/2025, 11:30 PMchilly-france-44439
09/19/2025, 11:54 PMlen(subclasses)<2
https://github.com/All-Hands-AI/agent-sdk/pull/364/commits/3420a818ad3bace6416c58fee3a42266379cdd94chilly-france-44439
09/19/2025, 11:54 PMchilly-france-44439
09/20/2025, 12:04 AMlen(subclasses)<2 is the only fixes that's required. I've reverted your change and all sdk tests seems passing toochilly-france-44439
09/20/2025, 12:04 AMchilly-france-44439
09/20/2025, 10:56 PMactually, thisturns out this was wrong too ๐ the schema generation test is flaky... I've brought most of the content back in this PR: https://github.com/All-Hands-AI/agent-sdk/pull/374 Issues: It turns out that somehowis the only fixes that's required. I've reverted your change and all sdk tests seems passing toolen(subclasses)<2
TypeAdapter.__init__ hacks at the bottom were causing the issue, and yet CI passes (bc things are breaking randomly ๐
):
1. get_known_concrete_subclasses returns a set, and the order is non-deterministic, so sometimes make test-server-schema works and sometimes they don't
2. TypeAdapter.__init__ alters the schema mid-traversal, breaking the schema generation ๐
Applied some fixes suggested by GPT-5:
1. make get_known_concrete_subclasses return a sorted list based on qualname to get rid of the nondeterministic issue
2. In __init_subclass__ when a concrete subclass is defined, we stamp a stable kind: Literal["ClassName"], check for duplicate kinds, and proactively rebuild the abstract โownerโ unions so their schemas include the new subclass immediately
The good news is that we can get rid of the TypeAdapter fix and everything still works now!
Would like to get these fixes in ๐ https://github.com/All-Hands-AI/agent-sdk/pull/374
Want to get this unblocked myself, but do want to let you take a look whenever you have time next Monday to make sure I'm not doing weird things!
All tests pass now & local schema generation works!straight-sundown-84319
09/20/2025, 10:58 PMstraight-sundown-84319
09/20/2025, 10:58 PMstraight-sundown-84319
09/20/2025, 11:05 PMstraight-sundown-84319
09/20/2025, 11:05 PMchilly-france-44439
09/20/2025, 11:06 PM