(bug) Model picker shows a false "not available" badge for vault-managed models - #5522
(bug) Model picker shows a false "not available" badge for vault-managed models#5522mannietech15 wants to merge 6 commits into
Conversation
…redential failures hang instead of failing fast - fixed
|
@mannietech15 is attempting to deploy a commit to the agenta projects Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe change extends harness model compatibility checks with custom-provider secrets and connection slugs. It validates provider reachability for custom models and adds regression tests for provider compatibility, explicit connection matching, missing secrets, and slug mismatches. ChangesCustom-provider model reachability
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 628c99f8-fa2c-4ae2-a5ff-5401798d0666
📒 Files selected for processing (5)
CONTRIBUTING.mdfix-agenta-setup.shweb/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsxweb/packages/agenta-entity-ui/src/DrillInView/SchemaControls/connectionUtils.tsweb/packages/agenta-entity-ui/tests/unit/connectionUtils.test.ts
bekossy
left a comment
There was a problem hiding this comment.
Hi @mannietech15, thanks for tracking this down. The root cause diagnosis is right, but the fix needs one more pass.
Ordering issue in harnessAllowsModel: the generic catalog/model check (connectionUtils.ts:369-374) runs before the slug-scoped vault check. A vault model id that collides with an existing catalog/model id (easy to hit, e.g. a bare alias like "opus") will return true without ever validating that this specific connection is reachable. When slug is provided, please resolve and validate that connection first, and only fall back to the generic check when no slug is given. A test with a colliding id would lock this in.
Please drop from this PR (unrelated to the fix, and fix-agenta-setup.sh runs sudo to rewrite /etc/docker/daemon.json and restart the Docker daemon, which we don't want in the repo):
fix-agenta-setup.shCONTRIBUTING.md
|
@bekossy , sorry for the delay! Thanks for the great feedback and for catching the name collision edge case. I've updated the logic to check the slug-scoped vault first, added the collision test you requested, and cleaned up those stray files from the PR. |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/connectionUtils.ts (1)
367-369: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReduce this in-code comment to one short line.
Lines 367-369 add a multi-line explanatory comment. This is not a bug, race, or ordering constraint. Move the detail to external documentation or reduce it to one short line. As per coding guidelines, “Keep in-code comments to at most one short line; use longer comments only for genuinely surprising constraints such as bugs, races, or ordering requirements.”
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ea135f4b-689f-4d75-afe2-e8ac8e354c6a
📒 Files selected for processing (4)
CONTRIBUTING.mdweb/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsxweb/packages/agenta-entity-ui/src/DrillInView/SchemaControls/connectionUtils.tsweb/packages/agenta-entity-ui/tests/unit/connectionUtils.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx
- web/packages/agenta-entity-ui/tests/unit/connectionUtils.test.ts
- eslint --fix on connectionUtils.test.ts (prettier formatting only, no logic change) - CONTRIBUTING.md: reverted to main; the added Quickstart section told contributors to run pnpm from the repo root, which has no package.json (the workspace lives under web/) and would fail immediately
Summary
The "model not available" compatibility badge in the harness picker incorrectly flagged
vault-managed custom-provider models as unavailable, even when the backend accepted and ran them
successfully.
harnessAllowsModelinconnectionUtils.tsalready acceptscustomSecretsandslugparametersto check vault connections before concluding a model is unreachable. The function itself was correct
and unit-tested. The bug was at the call site in
useModelHarness.tsx:selectedKeepsModelcalledharnessAllowsModelwithout those arguments, so the vault path was never consulted.Before:
After:
Both
customSecrets(fromcustomSecretsAtom) andconnection.slug(decoded fromconfig.llm)were already in scope at the call site; they just weren't being passed through.
Testing
Verified locally
pnpm testinweb/packages/agenta-entity-ui— 12 test files, 210 tests, all passed.Added or updated tests
Added
"selectedKeepsModel regression: vault model flagged unavailable without secrets, available with them"toconnectionUtils.test.ts. The test explicitly asserts the broken pre-fix behaviour(no secrets passed →
false) against the fixed behaviour (secrets + slug passed →true) andincludes a slug-mismatch case (a credential for a different connection must not grant availability).
QA follow-up
encode a recognizable provider family (for example a bare slug like
custom-bedrock-model-id-123).it showed "model not available" in amber.
under their respective harnesses.
Demo
N/A — badge label and colour change only, no structural UI change. The QA steps above describe
where to look.
Checklist
Contributor Resources
agenta-2.mp4