fix(providers): remove type: ignore suppressions from registry.py and resolve underlying type errors #3459
No reviewers
Labels
No labels
auto/needs-reevaluation
controller-managed
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
cleveragents/cleveragents-core!3459
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/providers-registry-type-ignore-suppressions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Removes all 11
# type: ignoresuppressions fromsrc/cleveragents/providers/registry.py, which violated the CONTRIBUTING.md code standard that forbids# type: ignoreusage.Changes
New type stubs (
typings/directory):typings/langchain_groq/__init__.pyi— stub forChatGroqclasstypings/langchain_together/__init__.pyi— stub forChatTogetherclasstypings/langchain_cohere/__init__.pyi— stub forChatCohereclassThese follow the existing pattern established for
langchain_anthropic,langchain_openai, andlangchain_google_genaistubs already in thetypings/directory.src/cleveragents/providers/registry.py:# type: ignore[import-untyped]fromlangchain_groq,langchain_together,langchain_cohereimports (now resolved via type stubs)# type: ignore[arg-type]from all LLM constructor call sites (unnecessary givenpyrightconfig.jsonreportUnknown*settings)# type: ignore[arg-type]onllm_factoryclosure by capturing the narrowedProviderTypein a local variableresolved_provider_type: ProviderType, allowing Pyright to verify the type without suppressionVerification
nox -e typecheck→ 0 errors, 3 warnings (warnings arereportMissingModuleSourcefor optional packages not installed in dev env — not errors)nox -e lint→ All checks passedCloses #3421
Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker
# type: ignoresuppressions in providers/registry.py violate CONTRIBUTING.md code standards #3421Code Review — PR #3459
Focus areas: code-maintainability, architecture-alignment, type-safety
Summary
This PR removes all 11
# type: ignoresuppressions fromsrc/cleveragents/providers/registry.py, bringing the file into compliance with the CONTRIBUTING.md standard that strictly forbids type suppression. The approach is clean and well-executed across three categories of fixes:langchain_groq,langchain_together, andlangchain_coherepyrightconfig.jsonsettingsProviderTypein a local variableCode Quality Assessment
✅ Type Safety: All 11
# type: ignoresuppressions properly removed. Zero remain in the file. This directly addresses the CONTRIBUTING.md violation.✅ Architecture Alignment: The new type stubs in
typings/follow the established pattern set by existing stubs (langchain_anthropic,langchain_openai,langchain_google_genai). Each stub:BaseLanguageModel[AIMessage]__init__with common LangChain parameters**kwargs: Anyfor forward compatibility__all__✅ Closure Type Narrowing Fix: The
resolved_provider_type: ProviderType = provider_typepattern increate_ai_provideris an idiomatic solution. Pyright cannot track type narrowing into closures when the variable is reassigned in the enclosing scope, so capturing the narrowed value in a new local variable is the correct approach. The added comment explaining the rationale is helpful for maintainability.✅ Behavioral Preservation: No logic changes were made — only type annotations and import resolution. All existing code paths remain identical, minimizing regression risk.
✅ Commit Discipline: Single atomic commit with proper Conventional Changelog format (
fix(providers): ...), detailed body explaining each category of change, andCloses #3421footer.Observations
1. Missing
Type/Label (Process)Per CONTRIBUTING.md, every PR must have exactly one
Type/label. This PR currently has no labels. It should haveType/Bug(since this is afix()commit addressing a code standards violation).2. Missing Milestone (Process)
The linked issue #3421 is in the backlog with no milestone, so this may be intentional. However, CONTRIBUTING.md states PRs must be assigned to the same milestone as their linked issue. If the issue gets a milestone assigned, the PR should match.
3. Commit Footer Format (Minor)
The commit uses
Closes #3421which Forgejo recognizes for auto-closing. The CONTRIBUTING.md specifies the formatISSUES CLOSED: #N. While functionally equivalent, strict adherence would use the documented format.4. Verification Completeness
The PR description confirms
nox -e typecheck(0 errors) andnox -e lint(passed). The issue's Definition of Done also requires:nox -e unit_tests— not explicitly mentioned in verificationnox -e coverage_report(>= 97%) — not explicitly mentionednoxrun — not explicitly mentionedSince no behavioral changes were made, existing tests should pass unchanged, but explicit confirmation would strengthen the PR.
5. Minor Stub Inconsistency (Non-blocking)
The existing
langchain_openai/__init__.pyideclaresChatOpenAI(BaseLanguageModel)without the generic parameter, while the new stubs andlangchain_anthropicuseBaseLanguageModel[AIMessage]. This is a pre-existing inconsistency, not introduced by this PR, but worth noting for future cleanup.Verdict
The code changes are correct, clean, and well-motivated. This is a focused type-safety improvement that brings
registry.pyinto full compliance with project standards. The process observations above are minor and should not block the substantive review.Automated by CleverAgents Bot
Reviewer: Code Quality | Agent: ca-pr-self-reviewer