Skip to content

Add model metadata and free checks to catalog#7

Merged
dzarlax merged 1 commit into
mainfrom
codex/model-metadata-compact-catalog
Jun 15, 2026
Merged

Add model metadata and free checks to catalog#7
dzarlax merged 1 commit into
mainfrom
codex/model-metadata-compact-catalog

Conversation

@dzarlax

@dzarlax dzarlax commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • cache OpenRouter model names/descriptions in the capability store
  • replace the default model catalog cards with uniform compact rows
  • add full-web free-model checks and block routing to unverified free models

Test Plan

  • go test -count=1 ./internal/llm
  • go test -count=1 ./internal/store
  • go test -count=1 ./internal/adminapi
  • go test -count=1 ./...
  • go build ./cmd/agent

Summary by CodeRabbit

Release Notes

  • New Features

    • Added free model verification workflow with check status indicators and latency metrics
    • Model names and descriptions now displayed in the models browser
    • Compact view now set as default presentation mode
  • Improvements

    • Enhanced models browser UI layout with improved metrics display
    • Check status visibility for free model compliance before slot assignment

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Adds Name and Description fields to llm.Capabilities, persists them to SQLite and Postgres stores, and propagates them through all admin UI model structs and templates. Introduces a /models/check POST endpoint that probes free OpenRouter model availability, persists the result, and gates slot assignment on free_verified status. The catalog browser defaults to a new compact row layout.

Changes

Free Model Check + Capabilities Display

Layer / File(s) Summary
Capabilities Name/Description contract and parsing
internal/llm/capabilities.go, internal/llm/capabilities_test.go
Capabilities gains Name and Description fields; parseOpenRouterModels trims and assigns them from the OpenRouter response; test fixture and assertions updated to verify parsed values.
Store schema migration and persistence
internal/store/sqlite.go, internal/store/sqlite_test.go, internal/store/postgres.go
model_capabilities tables in both stores gain model_name and description columns with idempotent migrations; Get/Put/GetAll capability queries select, scan, and upsert the new fields; SQLite round-trip test extended.
uiModel struct extension and Name/Description propagation
internal/adminapi/handlers.go, internal/adminapi/recommend.go, internal/adminapi/model_overrides.go, internal/adminapi/tgadmin.go
uiModel adds Name, Description, and free-check result fields; all construction sites (applyPreset, appendAllowedOverrideCandidates, tgAdminBrowseModels, manual browse path) now populate these from capabilities; default view mode changes from cards to compact.
handleModelCheck endpoint, slot gate, and attachModelChecks helper
internal/adminapi/server.go, internal/adminapi/handlers.go
New POST /models/check route added; handleModelCheck validates input, restricts to free OpenRouter models, probes capability, persists result; handleSlotAssign rejects unverified free models with 400; attachModelChecks/withoutWarning helpers enrich preset and manual browse model lists.
Compact catalog row templates and CSS
internal/adminapi/templates/partials_models_browser.html, internal/adminapi/templates/partials_models_row.html, internal/adminapi/templates/partials_layout.html
View toggle button renamed from "Cards" to "Compact"; model_card restructured from catalog-card to catalog-row with name, description, decision, and check-status blocks; model_actions adds $needsFreeCheck flag and disabled assign buttons; model_row adds name/description and check-status display; CSS adds check-status classes and changes catalog-metrics to 3-column grid.
Admin API and UI tests for free-check workflow
internal/adminapi/adminapi_test.go
Fixture updated with Name/Description; compact-default, table-audit, and clear-preset rendering assertions added; four new tests cover free-check rendering, check persistence, unverified rejection, and verified assignment.

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant handleModelCheck
  participant Capabilities as llm.Capabilities probe
  participant Store

  Browser->>handleModelCheck: POST /models/check (provider=openrouter, model=X)
  handleModelCheck->>handleModelCheck: validate free + openrouter restriction
  handleModelCheck->>Capabilities: GetCapabilities(model=X)
  Capabilities-->>handleModelCheck: capabilities result + latency
  handleModelCheck->>Store: PutCapabilities (CheckStatus=free_verified, CheckedAt, CheckLatencyMS)
  handleModelCheck-->>Browser: re-rendered models page HTML

  Browser->>handleSlotAssign: POST /models/assign (provider=openrouter, model=X)
  handleSlotAssign->>Store: GetSettings → read free check status
  alt CheckStatus != free_verified
    handleSlotAssign-->>Browser: 400 Bad Request
  else CheckStatus == free_verified
    handleSlotAssign->>Store: SaveSettings (currentModel=X)
    handleSlotAssign-->>Browser: 200 OK
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Dzarlax-AI/personal_assistant#6: Modifies the same admin model catalog UI templates (models_browser, models_row) and introduces the compact vs. table ("audit") view toggle that this PR builds on.

Poem

🐇 A bunny named Check hopped into the code,
Sniffed free models down OpenRouter's road.
Name and Description now fill every row,
Compact by default — a tidy new show!
Unverified hops get a 400 rebuff,
But verified bunnies? That's more than enough. 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% 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 accurately summarizes the main changes: adding model metadata (names, descriptions) to the catalog system and implementing free model checks.
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 codex/model-metadata-compact-catalog

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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: 324c5d8471

ℹ️ 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".

{{$root := .Root}}
{{with .Model}}
{{$modelID := .ID}}
{{$needsFreeCheck := and .Free (ne .Policy "free_verified")}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict free-check gating to OpenRouter

When browsing the Gemini catalog, this predicate is also true for Gemini entries whose prices are unknown/zero, but the check action is only rendered for OpenRouter and /models/check rejects non-OpenRouter models. Those Gemini rows therefore show only disabled assignment buttons and cannot be selected from the UI, even though handleSlotAssign only enforces the verification gate for OpenRouter. Include the catalog provider in $needsFreeCheck.

Useful? React with 👍 / 👎.

@dzarlax dzarlax merged commit f86f1af into main Jun 15, 2026
5 of 6 checks passed
@dzarlax dzarlax deleted the codex/model-metadata-compact-catalog branch June 15, 2026 18:55
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.

1 participant