fix: repair main CI after PR #37 (Python 3.8 runtime + mypy)#42
Merged
Conversation
list[...] (PEP 585) is not evaluatable at runtime on 3.8, where pydantic eval's the annotation string at model-build time. typing.List is identical to type-checkers and IDEs but works on 3.8.
Overloads were gated behind TYPE_CHECKING while the implementation lived outside it, producing no-overload-impl/no-redef/name-defined. Un-gate them (runtime-safe via __future__ annotations) and import CNAgent/GlobalAgent under TYPE_CHECKING.
The runtime has accepted a dict since 583eccc (coerced to the model at parse_obj_as time). Widen the constructor, with_turn_detection, the property, and _resolve_asr_config to Union[TurnDetectionConfig, Dict].
Un-gate the overloads from TYPE_CHECKING and interleave so each overload group directly precedes its implementation, as mypy requires. Runtime-safe via __future__ annotations.
Reordering the overloads adjacent to their impls (prior commit) surfaced a latent mismatch: the impl signature area: _AreaT did not accept overload signatures binding area to Literal[Area.CN]/_GlobalArea. Per mypy convention the overload *implementation* signature uses Any; callers still see the precise overloads.
Narrowing the param types statically enforced the very vendor/area compatibility PR #37 says it does NOT enforce (and which tests exercise cross-region). Keep the -> CNAgent/-> GlobalAgent return narrowing for fluent chaining; accept the base vendor types. Valid override, no type: ignore.
They are defined in pool_client (= Agora/AsyncAgora), not agentkit. Only the TYPE_CHECKING import location was wrong.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
PR #37 (CN vendor support) merged into
mainand broke all three gating CI jobs (test,compat-build,compile). CI never ran on the PR branch, so the failures landed onmain. This fixes both root causes. Design/spec:docs/superpowers/specs/2026-06-17-fix-pr37-ci-design.md.Cause 1 — runtime (breaks
test+compat-build):vendors/cn.pyused PEP 585 builtin generics (list[...]) inside pydantic models. On Python 3.8 pydantic eval's the annotation string at model-build time andlist[...]isn't subscriptable →TypeErroron import. → switched totyping.List(identical to type-checkers/IDEs, evaluatable on 3.8).Cause 2 — mypy (breaks
compile, 32 errors):agent.py/pool_client.py:@overloadstubs were gated insideif TYPE_CHECKING:while the real impls lived outside →no-overload-impl/no-redef/name-defined. Moved the overloads adjacent to their implementations (reordered inpool_client.py); broadened the overload implementationareaparam toAny(callers still see precise overloads).regional_agent.py:CNAgent/GlobalAgentbuilder methods narrowed the parameter type (with_stt(vendor: CNSTT)), statically enforcing the very vendor/area compatibility PR feat:add CN vendor support #37 explicitly does not enforce (cross-region vendors are tested). Now narrow only the return type; accept base vendor types → valid override, no# type: ignore.agent.py:turn_detectionaccepted adictat runtime since583ecccbut was typed model-only. Widened toUnion[TurnDetectionConfig, Dict[str, Any]]to match shipped behavior.__init__.py: importedAgentClient/AsyncAgentClientfrom.agentkit; they live in.pool_client.typing.List, guardOptionalindexing).No public runtime behavior changes beyond
turn_detectionnow also typing adict(already accepted at runtime).Test Plan
mypy . --python-version 3.8→Success: no issues found in 303 source files(was 32 errors)pyteston real Python 3.8.20 →190 passed, 4 skipped(was 14 collection errors)compile,compat-build,testall green🤖 Generated with Claude Code