Skip to content

fix: preserve consumer slot compatibility - #2781

Merged
stranske merged 7 commits into
mainfrom
fix/sync-llm-registry-review-debt
Jul 15, 2026
Merged

fix: preserve consumer slot compatibility#2781
stranske merged 7 commits into
mainfrom
fix/sync-llm-registry-review-debt

Conversation

@stranske

@stranske stranske commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Fix shared review debt from the current consumer sync wave. Preserves current, unblocked legacy model pins when no profile is declared; treats a present slot config as an allowlist; falls through from unavailable GitHub Models to OpenAI; normalizes benchmark model IDs; and uses GitHub v3 diff media type.\n\nValidation: python3.12 -m pytest -q tests/tools/test_llm_registry_selection.py tests/tools/test_langchain_client.py tests/tools/test_ci_failure_triage.py tests/tools/test_evaluate_model_benchmark.py tests/scripts/test_api_client.py (110 passed); template sync and completeness checks passed.

Summary by CodeRabbit

  • Bug Fixes
    • Improved pull request diff downloads by requesting the correct GitHub v3 diff content type.
    • Updated CI failure triage so provider selection no longer stops prematurely when GitHub is partially configured.
    • Trimmed model IDs during benchmark evaluation to prevent whitespace-related mismatches.
  • Model Selection
    • Honored explicitly pinned models only when they’re current and unblocked.
    • Treated slot configuration as a fail-closed allowlist (no fallback when slots resolve empty/invalid).
    • Adjusted legacy (profile-less) pin override detection for better compatibility.
  • Tests
    • Updated and expanded coverage for diff media type, provider fallback behavior, and slot/pin override rules.

Copilot AI review requested due to automatic review settings July 15, 2026 20:30
@cursor

cursor Bot commented Jul 15, 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-keepalive

Copy link
Copy Markdown
Contributor

Workflow source needed

PR #2781 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 temporarily deployed to agent-standard July 15, 2026 20:30 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger 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

Run ID: 2de16b9f-bc01-430e-b287-c72632bd0ee2

📥 Commits

Reviewing files that changed from the base of the PR and between cc319aa and 6634d13.

📒 Files selected for processing (1)
  • tests/tools/test_ci_failure_triage.py

📝 Walkthrough

Walkthrough

The pull request updates GitHub diff media headers, permits provider fallback when GitHub model selection is unavailable, changes slot allowlist and pin resolution, adjusts freshness validation, trims benchmark model identifiers, and updates worker metadata.

Changes

API and model-selection maintenance

Layer / File(s) Summary
Diff media type requests
scripts/api_client.py, templates/consumer-repo/scripts/api_client.py, tests/scripts/test_api_client.py
Pull request diff requests and their test assertion now use application/vnd.github.v3.diff.
LLM provider fallback
tools/ci_failure_triage.py, templates/consumer-repo/tools/ci_failure_triage.py, tests/tools/test_ci_failure_triage.py
Missing GitHub models no longer terminate client selection before OpenAI configuration is checked; tests cover both fail-closed behavior and OpenAI fallback.
Slot resolution and freshness validation
tools/llm_registry.py, templates/consumer-repo/tools/llm_registry.py, tools/check_model_registry_freshness.py, tests/tools/test_llm_registry_selection.py, tests/test_check_model_registry_freshness.py
Eligible current profile-less pins are honored, present unusable slot configurations fail closed, and compatible current legacy pins do not produce selection overrides.
Benchmark normalization and run metadata
tools/evaluate_model_benchmark.py, langsmith-fleet-worker-attempt.json
Candidate model identifiers are trimmed before evaluation, and worker execution metadata is updated.

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

Sequence Diagram(s)

sequenceDiagram
  participant Triage as _get_llm_client
  participant Registry as configured_model_for_provider
  participant GitHub as GitHub provider
  participant OpenAI as OpenAI provider
  Triage->>Registry: Resolve GitHub model
  Registry-->>Triage: Empty model
  Triage->>Registry: Resolve OpenAI model
  Registry-->>Triage: OpenAI model
  Triage->>OpenAI: Create ChatOpenAI client
Loading

Possibly related PRs

Suggested labels: sync

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 is concise and accurately summarizes the main change: preserving consumer slot compatibility.
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/sync-llm-registry-review-debt

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

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

agents-workflows-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Automated Status Summary

Head SHA: 48b3cbf
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.69%
Baseline 85.00%
Delta -9.31%
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

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 adjusts the LLM registry/selection and supporting tooling to preserve compatibility with legacy consumer slot pins, enforce stricter slot allowlisting behavior, improve provider fallback behavior in CI triage, normalize benchmark model IDs, and update GitHub diff media type usage.

Changes:

  • Update slot-config resolution to honor legacy explicit model pins when no profile is declared, and to treat presence of a slot config as an allowlist (fail-closed semantics).
  • Make CI failure triage fall through from GitHub Models to OpenAI when GitHub Models is unavailable/unconfigured.
  • Normalize benchmark model_id values (trim whitespace) and request PR diffs using the GitHub v3 diff media type.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/llm_registry.py Adjusts slot resolution rules, including legacy pin compatibility and allowlist/fail-closed behavior.
templates/consumer-repo/tools/llm_registry.py Mirrors the slot resolution behavior changes for consumer templates.
tools/ci_failure_triage.py Enables fallback from GitHub Models to OpenAI when the GitHub Models selection can’t be made.
templates/consumer-repo/tools/ci_failure_triage.py Mirrors CI triage fallback behavior for consumer templates.
tools/evaluate_model_benchmark.py Trims model_id strings to avoid whitespace mismatches during benchmark evaluation.
scripts/api_client.py Uses application/vnd.github.v3.diff for PR diff fetches.
templates/consumer-repo/scripts/api_client.py Mirrors GitHub v3 diff media type usage for consumer templates.
tests/tools/test_llm_registry_selection.py Updates/extends tests to reflect revised slot pin and allowlist semantics.
tests/scripts/test_api_client.py Updates expected Accept header for PR diff requests.

Comment thread tools/llm_registry.py Outdated
Comment thread templates/consumer-repo/tools/llm_registry.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e3ebfd89e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/ci_failure_triage.py
Comment thread tools/llm_registry.py Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tools/llm_registry.py (1)

322-367: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Treat slots: [] as an explicit allowlist

_slot_entries() maps both a missing "slots" key and {"slots": []} to [], so return slots if slot_entries else fallback_slots still falls back to default providers when an operator explicitly declares zero slots. Base the final return on key presence instead of list truthiness in both tools/llm_registry.py and templates/consumer-repo/tools/llm_registry.py.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/llm_registry.py` around lines 322 - 367, Update the final return logic
in _slot_entries in both tools/llm_registry.py (lines 322-367) and
templates/consumer-repo/tools/llm_registry.py (lines 322-367) to distinguish a
missing slots key from an explicitly empty slots list. Return fallback_slots
only when the configuration omits the slots key; preserve an explicit slots: []
as an empty allowlist.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@tools/llm_registry.py`:
- Around line 322-367: Update the final return logic in _slot_entries in both
tools/llm_registry.py (lines 322-367) and
templates/consumer-repo/tools/llm_registry.py (lines 322-367) to distinguish a
missing slots key from an explicitly empty slots list. Return fallback_slots
only when the configuration omits the slots key; preserve an explicit slots: []
as an empty allowlist.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: fb1d800a-4699-4252-b7f0-65a98962ba69

📥 Commits

Reviewing files that changed from the base of the PR and between b1c7bcc and 9e3ebfd.

📒 Files selected for processing (9)
  • scripts/api_client.py
  • templates/consumer-repo/scripts/api_client.py
  • templates/consumer-repo/tools/ci_failure_triage.py
  • templates/consumer-repo/tools/llm_registry.py
  • tests/scripts/test_api_client.py
  • tests/tools/test_llm_registry_selection.py
  • tools/ci_failure_triage.py
  • tools/evaluate_model_benchmark.py
  • tools/llm_registry.py

@stranske

stranske commented Jul 15, 2026

Copy link
Copy Markdown
Owner Author

Runner dispatch state for autofix on PR #2781. Do not edit.

@github-actions github-actions Bot added the autofix Opt-in automated formatting & lint remediation label Jul 15, 2026
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Runner dispatch state for codex on PR #2781. Do not edit.

@stranske
stranske temporarily deployed to agent-standard July 15, 2026 20:45 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Autofix updated these files:

  • tests/tools/test_ci_failure_triage.py

@stranske
stranske temporarily deployed to agent-standard July 15, 2026 21:25 — with GitHub Actions Inactive
@stranske

Copy link
Copy Markdown
Owner Author

Addressed the four inline findings in c0c8b35: readable slot configs now remain strict allowlists (including empty/invalid-only entries), CI triage cannot fall through to an unlisted provider, and the freshness gate accepts current unblocked legacy pins without weakening explicit-profile checks. Focused validation: 133 passed; template sync and completeness validation passed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/tools/test_ci_failure_triage.py`:
- Around line 40-57: The test
test_llm_triage_does_not_fall_back_outside_slot_allowlist currently leaves both
providers unavailable and does not exercise fallback. Configure GitHub to
resolve to an empty model and OpenAI to resolve to a valid model, then assert
_get_llm_client() returns the OpenAI provider and expected model while verifying
ChatOpenAI receives that model.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 899b92c1-3cba-4a97-a873-dc72adb3ffd9

📥 Commits

Reviewing files that changed from the base of the PR and between 740a29e and c0c8b35.

📒 Files selected for processing (6)
  • templates/consumer-repo/tools/llm_registry.py
  • tests/test_check_model_registry_freshness.py
  • tests/tools/test_ci_failure_triage.py
  • tests/tools/test_llm_registry_selection.py
  • tools/check_model_registry_freshness.py
  • tools/llm_registry.py

Comment thread tests/tools/test_ci_failure_triage.py
@stranske
stranske temporarily deployed to agent-standard July 15, 2026 22:24 — with GitHub Actions Inactive
@stranske

Copy link
Copy Markdown
Owner Author

Addressed the remaining CodeRabbit finding in 6634d13: added a focused regression that verifies GitHub Models resolving empty falls through to the configured OpenAI model, constructs ChatOpenAI with that model, and reports provider openai. Validation: 113 focused tests passed; template sync and manifest completeness passed; git diff --check passed.

@stranske
stranske merged commit 7452d5a into main Jul 15, 2026
56 checks passed
@stranske
stranske deleted the fix/sync-llm-registry-review-debt branch July 15, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autofix:patch autofix Opt-in automated formatting & lint remediation codex codex-automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants