Skip to content

fix: consume blocked llm override before fallback - #2499

Merged
stranske merged 1 commit into
mainfrom
fix/llm-blocked-override-fallback
Jun 22, 2026
Merged

fix: consume blocked llm override before fallback#2499
stranske merged 1 commit into
mainfrom
fix/llm-blocked-override-fallback

Conversation

@stranske

@stranske stranske commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • consume blocked global LLM overrides before moving to fallback providers
  • add regression coverage for missing first-provider credentials
  • keep the consumer template LangChain client copy aligned

Validation

  • UV_CACHE_DIR=/tmp/uv-cache-workflows-sync-fix uv run pytest tests/tools/test_langchain_client.py tests/scripts/test_runner_lib.py tests/scripts/test_check_agents_md_freshness.py -q
  • UV_CACHE_DIR=/tmp/uv-cache-workflows-sync-fix uv run ruff check tools/langchain_client.py templates/consumer-repo/tools/langchain_client.py tests/tools/test_langchain_client.py
  • UV_CACHE_DIR=/tmp/uv-cache-workflows-sync-fix uv run black --check tools/langchain_client.py templates/consumer-repo/tools/langchain_client.py tests/tools/test_langchain_client.py
  • UV_CACHE_DIR=/tmp/uv-cache-workflows-sync-fix uv run --extra dev python scripts/validate_template_sync.py
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes

    • Improved model selection logic to properly fall back to default models when overrides are unavailable or blocked.
  • Refactor

    • Streamlined provider availability detection for more efficient chat client initialization.

@stranske stranske added automation Automation and workflow automation maintenance Maintenance tasks github:actions GitHub Actions related sync codex codex-automation labels Jun 22, 2026
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a7860ea0-4337-431d-9232-1d0419824f0d

📥 Commits

Reviewing files that changed from the base of the PR and between 8211687 and 89c5a4d.

📒 Files selected for processing (3)
  • templates/consumer-repo/tools/langchain_client.py
  • tests/tools/test_langchain_client.py
  • tools/langchain_client.py
🔗 Linked repositories identified

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

  • stranske/Template (auto-detected)
  • stranske/Ready (auto-detected)
  • stranske/Workflows-Integration-Tests (auto-detected)

📝 Walkthrough

Walkthrough

build_chat_client's slot-iteration loop is updated in both tools/langchain_client.py and its template copy to detect blocked model overrides per slot, log and consume the override, fall back to the slot's default model, and remove the prior slot_available pre-check. A new test validates that a blocked override is consumed without retrying against subsequent providers.

Changes

Blocked override handling and slot_available removal

Layer / File(s) Summary
Blocked override handling and slot_available removal in build_chat_client
tools/langchain_client.py, templates/consumer-repo/tools/langchain_client.py
Both copies of the loop now assign slot_model from the first unused model override, check if that override is blocked for the current slot provider, and if so log a warning, mark the override as used, and fall back to slot.model before applying the general blocked-model skip. The slot_available pre-check block that gated slot entry on provider credentials is removed; per-provider token-guarded construction handles availability implicitly.
Test for blocked override consumed across providers
tests/tools/test_langchain_client.py
The existing test_build_chat_client_env_model_override test sets ENV_MODEL_REGISTRY_CONFIG to a missing path. A new test test_build_chat_client_blocked_override_consumed_when_first_provider_unavailable writes a registry marking the OpenAI model as blocked, clears OpenAI/GitHub env vars, provides Anthropic credentials, and asserts the returned client uses the Anthropic provider, model, and expected kwargs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: consume blocked llm override before fallback' directly and clearly describes the main change in the PR: how blocked LLM overrides are now consumed before the system falls back to alternative providers.
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 fix/llm-blocked-override-fallback

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

@stranske-keepalive

Copy link
Copy Markdown
Contributor

Workflow source needed

PR #2499 needs either a linked GitHub issue or one valid non-issue Workflow Source before PR metadata automation can manage it safely.

Please do one of:

  • Add <!-- meta:issue:123 --> or a normal Closes #123 / Related to #123 line.
  • Check one Workflow Source option in the PR body.
  • Add a hidden marker such as <!-- workflow-source:local_request -->, <!-- workflow-source:manual_remote -->, <!-- workflow-source:review_followup -->, <!-- workflow-source:sync_campaign -->, or <!-- workflow-source:dependabot -->.
  • Add a workflow source label such as workflow:source-direct-pr, workflow:source-local-request, workflow:source-review-followup, workflow:source-sync, or workflow:no-automation.

Once a valid source is present, this warning will not be reposted.

@stranske
stranske enabled auto-merge (squash) June 22, 2026 05:37
@stranske-keepalive

stranske-keepalive Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Automated Status Summary

Head SHA: 6188344
Latest Runs: ⏳ pending — Gate
Required contexts: Gate / gate, Health 45 Agents Guard / guard
Required: core tests (3.12): ⏳ pending, core tests (3.13): ⏳ pending, docker smoke: ⏳ pending, gate: ⏳ pending

Workflow / Job Result Logs
(no jobs reported) ⏳ pending

Coverage Overview

  • Coverage history entries: 1

Coverage Trend

Metric Value
Current 70.49%
Baseline 85.00%
Delta -14.51%
Minimum 70.00%
Status ✅ Pass

Top Coverage Hotspots (lowest coverage)

File Coverage Missing
scripts/check_api_wrapper_guard.py 0.0% 123
scripts/cleanup_labels.py 0.0% 127
scripts/issue_dedup_smoke.py 0.0% 4
scripts/list_registered_consumer_repos.py 0.0% 33
scripts/repo_review_backlog_scan.py 0.0% 203
scripts/repo_review_round1_runner.py 0.0% 225
scripts/repo_review_round1_schema.py 0.0% 194
scripts/runner_lib/__main__.py 0.0% 3
scripts/update_langchain_versions.py 0.0% 34
scripts/validate_dependency_test_setup.py 0.0% 112
scripts/validate_template_completeness.py 0.0% 88
scripts/validate_template_sync.py 0.0% 77
scripts/validate_workflow_yaml.py 0.0% 98
scripts/repo_review_round2_schema.py 8.8% 185
scripts/langchain/topic_splitter.py 19.1% 57

Low Coverage Files (<50.0%)

File Coverage Missing
scripts/check_api_wrapper_guard.py 0.0% 123
scripts/cleanup_labels.py 0.0% 127
scripts/issue_dedup_smoke.py 0.0% 4
scripts/list_registered_consumer_repos.py 0.0% 33
scripts/repo_review_backlog_scan.py 0.0% 203
scripts/repo_review_round1_runner.py 0.0% 225
scripts/repo_review_round1_schema.py 0.0% 194
scripts/runner_lib/__main__.py 0.0% 3
scripts/update_langchain_versions.py 0.0% 34
scripts/validate_dependency_test_setup.py 0.0% 112
scripts/validate_template_completeness.py 0.0% 88
scripts/validate_template_sync.py 0.0% 77
scripts/validate_workflow_yaml.py 0.0% 98
scripts/repo_review_round2_schema.py 8.8% 185
scripts/langchain/topic_splitter.py 19.1% 57

Updated automatically; will refresh on subsequent CI/Docker completions.


Keepalive checklist

Scope

No scope information available

Tasks

  • No tasks defined

Acceptance criteria

  • No acceptance criteria defined

@stranske
stranske merged commit 6f2b9df into main Jun 22, 2026
100 of 119 checks passed
@stranske
stranske deleted the fix/llm-blocked-override-fallback branch June 22, 2026 05:39
@stranske
stranske temporarily deployed to agent-standard June 22, 2026 05:40 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation Automation and workflow automation codex codex-automation github:actions GitHub Actions related maintenance Maintenance tasks sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants