Skip to content

fix: repair main CI after PR #37 (Python 3.8 runtime + mypy)#42

Merged
plutoless merged 8 commits into
mainfrom
fix/pr37-ci
Jun 17, 2026
Merged

fix: repair main CI after PR #37 (Python 3.8 runtime + mypy)#42
plutoless merged 8 commits into
mainfrom
fix/pr37-ci

Conversation

@plutoless

Copy link
Copy Markdown
Collaborator

Summary

PR #37 (CN vendor support) merged into main and broke all three gating CI jobs (test, compat-build, compile). CI never ran on the PR branch, so the failures landed on main. 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.py used PEP 585 builtin generics (list[...]) inside pydantic models. On Python 3.8 pydantic eval's the annotation string at model-build time and list[...] isn't subscriptable → TypeError on import. → switched to typing.List (identical to type-checkers/IDEs, evaluatable on 3.8).

Cause 2 — mypy (breaks compile, 32 errors):

  • agent.py / pool_client.py: @overload stubs were gated inside if TYPE_CHECKING: while the real impls lived outside → no-overload-impl / no-redef / name-defined. Moved the overloads adjacent to their implementations (reordered in pool_client.py); broadened the overload implementation area param to Any (callers still see precise overloads).
  • regional_agent.py: CNAgent/GlobalAgent builder 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_detection accepted a dict at runtime since 583eccc but was typed model-only. Widened to Union[TurnDetectionConfig, Dict[str, Any]] to match shipped behavior.
  • __init__.py: imported AgentClient/AsyncAgentClient from .agentkit; they live in .pool_client.
  • Two test-only type fixes (typing.List, guard Optional indexing).

No public runtime behavior changes beyond turn_detection now also typing a dict (already accepted at runtime).

Test Plan

  • mypy . --python-version 3.8Success: no issues found in 303 source files (was 32 errors)
  • pytest on real Python 3.8.20 → 190 passed, 4 skipped (was 14 collection errors)
  • CI on this branch: compile, compat-build, test all green

🤖 Generated with Claude Code

plutoless and others added 8 commits June 17, 2026 16:05
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>
@plutoless plutoless merged commit 1264c89 into main Jun 17, 2026
4 checks passed
@plutoless plutoless deleted the fix/pr37-ci branch June 17, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant