Skip to content

fix: preserve slot allowlist fail-closed behavior - #2797

Merged
stranske merged 1 commit into
mainfrom
fix/restore-slot-allowlist-guard
Jul 20, 2026
Merged

fix: preserve slot allowlist fail-closed behavior#2797
stranske merged 1 commit into
mainfrom
fix/restore-slot-allowlist-guard

Conversation

@stranske

@stranske stranske commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Fixes the shared consumer-sync regression in tools/llm_registry.py:\n\n- leave compatibility quality unset rather than adding a mutable dictionary to frozen entries\n- allow LANGCHAIN_MODEL emergency bootstrap only when the bundled slot allowlist is absent\n- sync the consumer template and add regression coverage\n\nValidation: pytest -q tests/tools/test_langchain_client.py tests/tools/test_llm_registry_selection.py (82 passed); python scripts/validate_template_sync.py.

Summary by CodeRabbit

  • Bug Fixes
    • Model registry entries now leave compatibility quality unset when source data is missing or uses unsupported legacy values.
    • Slot resolution now fails closed when configured slot data is unavailable or unusable, preventing unintended fallback model selection.
    • Explicit runtime model overrides are honored only when no slot configuration is available.

Copilot AI review requested due to automatic review settings July 20, 2026 10:28
@cursor

cursor Bot commented Jul 20, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@stranske
stranske temporarily deployed to agent-standard July 20, 2026 10:28 — with GitHub Actions Inactive
@agents-workflows-bot

Copy link
Copy Markdown
Contributor

Workflow source needed

PR #2797 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.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ba5f8b93-5091-47e0-99dc-b6aa17907f4f

📥 Commits

Reviewing files that changed from the base of the PR and between 53f18ad and f04c499.

📒 Files selected for processing (4)
  • templates/consumer-repo/tools/llm_registry.py
  • tests/tools/test_langchain_client.py
  • tests/tools/test_llm_registry_selection.py
  • tools/llm_registry.py

📝 Walkthrough

Walkthrough

Changes

LLM registry hardening

Layer / File(s) Summary
Preserve unset registry quality
tools/llm_registry.py, templates/consumer-repo/tools/llm_registry.py, tests/tools/test_langchain_client.py, tests/tools/test_llm_registry_selection.py
Loaded entries now leave quality as None when registry values are absent or invalid, with updated assertions.
Fail closed for unusable slot configuration
tools/llm_registry.py, templates/consumer-repo/tools/llm_registry.py, tests/tools/test_llm_registry_selection.py
Runtime model bootstrap now requires no existing default slot configuration, and bundled configurations resolving to no usable slots return an empty list.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: sync, langchain, maintenance

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: tightening slot allowlist handling to preserve fail-closed behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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/restore-slot-allowlist-guard

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a regression in the shared LLM registry/slot resolution logic by restoring “fail-closed” behavior when a bundled slot allowlist exists but yields no usable slots, while also avoiding mutable defaults on frozen registry entries. It also synchronizes the consumer template copy and updates tests to lock in the intended behavior.

Changes:

  • Stop populating ModelRegistryEntry.quality with an empty dict during registry load; leave it unset (None) to avoid mutable state on frozen entries.
  • Restrict LANGCHAIN_MODEL emergency bootstrap to only when no bundled slot allowlist file is present (not merely when resolved slots are empty).
  • Update consumer template and adjust/add regression tests to assert the new fail-closed and quality is None expectations.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tools/llm_registry.py Removes quality={} initialization and tightens LANGCHAIN_MODEL bootstrap gating based on bundled slot allowlist presence.
tests/tools/test_llm_registry_selection.py Updates/extends regression coverage for quality is None and for failing closed despite LANGCHAIN_MODEL when a bundled slot config exists but is unusable.
tests/tools/test_langchain_client.py Aligns existing tests with the new contract that loaded registry entries leave quality unset (None).
templates/consumer-repo/tools/llm_registry.py Mirrors the llm_registry.py behavior changes in the consumer template to prevent drift.

@agents-workflows-bot

Copy link
Copy Markdown
Contributor

Automated Status Summary

Head SHA: 4d98aa5
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 75.72%
Baseline 85.00%
Delta -9.28%
Minimum 70.00%
Status ✅ Pass

Top Coverage Hotspots (lowest coverage)

File Coverage Missing
scripts/issue_dedup_smoke.py 0.0% 4
scripts/runner_lib/__main__.py 0.0% 3
scripts/validate_template_sync.py 0.0% 81
scripts/langchain/topic_splitter.py 19.1% 57
tools/codex_log_analyzer.py 19.6% 140
scripts/repo_review_round2_runner.py 25.1% 344
scripts/prune_agent_stubs.py 39.7% 26
scripts/repo_review_round1_runner.py 40.7% 133
tools/ensure_workflow_timeout_variables.py 42.1% 74
scripts/sync_label_docs.py 42.9% 64
tools/discover_model_catalog.py 44.8% 55
scripts/repo_review_backlog_scan.py 45.3% 116
scripts/repo_review_body_writer.py 46.5% 86
tools/codex_session_analyzer.py 47.9% 59
scripts/create_verifier_labels.py 48.3% 58

Low Coverage Files (<50.0%)

File Coverage Missing
scripts/issue_dedup_smoke.py 0.0% 4
scripts/runner_lib/__main__.py 0.0% 3
scripts/validate_template_sync.py 0.0% 81
scripts/langchain/topic_splitter.py 19.1% 57
tools/codex_log_analyzer.py 19.6% 140
scripts/repo_review_round2_runner.py 25.1% 344
scripts/prune_agent_stubs.py 39.7% 26
scripts/repo_review_round1_runner.py 40.7% 133
tools/ensure_workflow_timeout_variables.py 42.1% 74
scripts/sync_label_docs.py 42.9% 64
tools/discover_model_catalog.py 44.8% 55
scripts/repo_review_backlog_scan.py 45.3% 116
scripts/repo_review_body_writer.py 46.5% 86
tools/codex_session_analyzer.py 47.9% 59
scripts/create_verifier_labels.py 48.3% 58

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 aff17b0 into main Jul 20, 2026
56 checks passed
@stranske
stranske deleted the fix/restore-slot-allowlist-guard branch July 20, 2026 12:30
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.

2 participants