Skip to content

chore: sync workflow templates - #627

Merged
stranske merged 1 commit into
mainfrom
sync/workflows-189df65808d0
Jun 22, 2026
Merged

chore: sync workflow templates#627
stranske merged 1 commit into
mainfrom
sync/workflows-189df65808d0

Conversation

@stranske

@stranske stranske commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Sync Summary

Files Updated

  • llm_provider.py: LLM provider configuration - GitHub Models and OpenAI client setup
  • langchain_client.py: LangChain client builder - multi-provider client with slot-based fallback and configuration

Files Skipped

  • pr-00-gate.yml: File exists and sync_mode is create_only
  • ci.yml: File exists and sync_mode is create_only
  • renovate.json: File exists and sync_mode is create_only
  • cross-repo-smoke.yml: File exists and sync_mode is create_only
  • llm_slots.json: None

Review Checklist

  • CI passes with updated workflows
  • No repo-specific customizations were overwritten

Source: stranske/Workflows
Source SHA: 9eda7b48d198b4559dcde7d25deec18a6a917468
Template hash: 189df65808d0
Sync branch: sync/workflows-189df65808d0
Consumer repo: stranske/Inv-Man-Intake
Manifest: .github/sync-manifest.yml

Summary by CodeRabbit

  • Bug Fixes
    • Improved resilience when LangChain provider modules are unavailable, preventing premature failures.
    • Added validation for model configuration during client initialization to ensure valid model names are used.

Automated sync from stranske/Workflows
Template hash: 189df65808d0

Changes synced from sync-manifest.yml
@stranske stranske added sync Automated sync from Workflows automated Automated sync from Workflows labels Jun 22, 2026
@stranske
stranske temporarily deployed to agent-standard June 22, 2026 13:59 — with GitHub Actions Inactive
@stranske
stranske temporarily deployed to agent-standard June 22, 2026 13:59 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ed757e6e-1d46-4d33-9d17-12d59bb9daa8

📥 Commits

Reviewing files that changed from the base of the PR and between c6927dd and 9db8779.

📒 Files selected for processing (2)
  • tools/langchain_client.py
  • tools/llm_provider.py
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • stranske/Workflows (auto-detected)
  • stranske/Template (auto-detected)
📜 Recent review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Record autofix metrics
  • GitHub Check: Update keepalive summary
🧰 Additional context used
🔀 Multi-repo context stranske/Workflows, stranske/Template

Perfect! I now have sufficient context. Let me document my findings:

Linked repositories findings

stranske/Workflows (Source repository)

[::stranske/Workflows::]

This is the source template repository containing the original implementations being synced. Key findings:

Provider Module Import Handling:

  • tools/langchain_client.py (lines 204-216): Both build_chat_client() and build_chat_clients() now gracefully handle missing langchain_openai and langchain_anthropic packages by setting class variables to None on ImportError, rather than propagating the exception. This allows provider-unavailable fallback chains to work.
  • Lines 236, 389: GitHub and OpenAI client construction now depends on chat_openai_cls being non-None (not just the token being present).

Model Configuration Fallback:

  • tools/llm_provider.py (lines 47-53): _configured_langchain_model() now explicitly returns the fallback when configured_model_for_provider() yields None, replacing the implicit or fallback pattern.
  • Lines 604-606, 677-680: OpenAIProvider._get_client() and AnthropicProvider._get_client() now check if not model_name: before calling build_chat_client(), preventing empty model strings from being passed.

Consumers in this repo:

  • tools/llm_provider.py calls build_chat_client(provider="openai", model=model_name) and build_chat_client(provider="anthropic", model=model_name) with fallback model names. The new guard ensures invalid empty strings won't reach the builder.
  • scripts/langchain/_llm_client.py wraps both functions and returns None/[] on ImportError, already handling provider unavailability gracefully.
  • Extensive test coverage in tests/tools/test_langchain_client.py (636 lines) and tests/tools/test_llm_provider.py (1962 lines) validates the new behavior with partial provider availability.

stranske/Template (Consumer template)

[::stranske/Template::]

This is the consumer template repository that mirrors code from Workflows:

Current State (before sync):

  • tools/llm_provider.py (lines 595-607): OpenAIProvider._get_client() calls build_chat_client(provider="openai", model=model_name) and already handles None returns with if resolved:.
  • tools/llm_provider.py (lines 667-679): AnthropicProvider._get_client() similarly calls build_chat_client(provider="anthropic", model=model_name) with fallback handling.
  • scripts/langchain/_llm_client.py: Wrapper functions that guard imports and return graceful defaults.

Impact Assessment:

  • These changes are backward-compatible because:
    • Return types are preserved: build_chat_client() returns ClientInfo | None in both old and new code.
    • build_chat_clients() returns list[ClientInfo] in both versions.
    • All current callers already check for None returns or empty lists.
    • The new behavior is more permissive—allowing partial provider availability instead of failing completely on any missing import.

Related functionality:

  • The Template repo's llm_provider.py also defines DEFAULT_OPENAI_ANALYSIS_MODEL and DEFAULT_ANTHROPIC_ANALYSIS_MODEL which are used as fallbacks in _get_client() methods, aligning with the new explicit fallback handling.

🔇 Additional comments (2)
tools/llm_provider.py (1)

52-53: LGTM!

Also applies to: 605-606, 680-681

tools/langchain_client.py (1)

207-209: LGTM!

Also applies to: 236-240, 251-255, 297-305, 324-327, 350-352, 389-394, 409-409, 419-424, 439-439, 489-489, 505-510, 535-540


📝 Walkthrough

Walkthrough

tools/langchain_client.py converts ImportError on langchain_openai from an early-return/empty-list path into a nullable chat_openai_cls = None variable, then gates every explicit and auto-selection provider branch on that variable. tools/llm_provider.py fixes _configured_langchain_model to return fallback explicitly when the configured model is None, and adds early-None guards in OpenAIProvider._get_client and AnthropicProvider._get_client for falsy model names.

Changes

Missing provider package and falsy-model handling

Layer / File(s) Summary
Model-resolution fallback and falsy-model guards
tools/llm_provider.py
_configured_langchain_model returns fallback explicitly when configured_model_for_provider yields None. OpenAIProvider._get_client and AnthropicProvider._get_client each return None early when the resolved model name is falsy.
Nullable import variables and explicit provider branches
tools/langchain_client.py
build_chat_client and build_chat_clients replace their ImportError early-exit paths with chat_openai_cls = None. Explicit GitHub and OpenAI provider branches now gate on and pass these nullable class variables to client builders.
Auto-selection slot availability and construction guards
tools/langchain_client.py
Auto-selection slot-availability checks in both builder functions are extended to require chat_openai_cls for GitHub/OpenAI slots and chat_anthropic_cls for Anthropic slots; GitHub candidate-slot filtering and per-slot construction calls pass the nullable class variables.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • stranske/Inv-Man-Intake#607: Modifies the same build_chat_client/build_chat_clients provider-selection and construction paths in tools/langchain_client.py, adding model-registry and blocked-model enforcement.
  • stranske/Inv-Man-Intake#626: Directly modifies tools/llm_provider.py's OpenAIProvider/AnthropicProvider model-name fallback logic in _get_client, the same methods updated here.
  • stranske/Inv-Man-Intake#623: Refactors _configured_langchain_model and LangChain client construction in tools/langchain_client.py and tools/llm_provider.py, overlapping directly with this PR's changes to those same functions.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'chore: sync workflow templates' does not match the actual changes, which involve significant LLM provider and LangChain client implementation updates to two Python files, not workflow template syncing. Update the title to reflect the actual code changes, such as 'refactor: handle missing LangChain providers gracefully' or 'feat: improve LLM provider client initialization with fallback logic'.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/workflows-189df65808d0

Comment @coderabbitai help to get the list of available commands and usage tips.

@stranske
stranske temporarily deployed to agent-standard June 22, 2026 14:00 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Workflow state fingerprint for Keepalive Loop Reporter. Do not edit.

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Workflow state fingerprint for Agents Gate Followups. Do not edit.

@stranske
stranske enabled auto-merge (squash) June 22, 2026 14:03
@stranske
stranske merged commit b91b4a9 into main Jun 22, 2026
94 of 100 checks passed
@stranske
stranske deleted the sync/workflows-189df65808d0 branch June 22, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated Automated sync from Workflows sync Automated sync from Workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant