Skip to content

(bug) Model picker shows a false "not available" badge, and Bedrock credential failures hang instead of failing fast - Fixed - #5522

Open
mannietech15 wants to merge 2 commits into
Agenta-AI:mainfrom
mannietech15:mannietech15
Open

(bug) Model picker shows a false "not available" badge, and Bedrock credential failures hang instead of failing fast - Fixed#5522
mannietech15 wants to merge 2 commits into
Agenta-AI:mainfrom
mannietech15:mannietech15

Conversation

@mannietech15

Copy link
Copy Markdown

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.

harnessAllowsModel in connectionUtils.ts already accepts customSecrets and slug parameters
to 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: selectedKeepsModel called
harnessAllowsModel without those arguments, so the vault path was never consulted.

Before:

// vault-hosted "custom-bedrock-model-id-123" → false → badge: "model not available"
harnessAllowsModel(capabilities, harnessValue, modelId)

After:

// vault-hosted "custom-bedrock-model-id-123" → true → badge: "supports your model"
harnessAllowsModel(capabilities, harnessValue, modelId, customSecrets, connection.slug || null)

Both customSecrets (from customSecretsAtom) and connection.slug (decoded from config.llm)
were already in scope at the call site; they just weren't being passed through.

Testing

Verified locally

pnpm test in web/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" to connectionUtils.test.ts. The test explicitly asserts the broken pre-fix behaviour
(no secrets passed → false) against the fixed behaviour (secrets + slug passed → true) and
includes a slug-mismatch case (a credential for a different connection must not grant availability).

QA follow-up

  • Add a vault custom-provider connection (Bedrock or custom kind) with a model id that does not
    encode a recognizable provider family (for example a bare slug like custom-bedrock-model-id-123).
  • Open an agent config and go to the Model & harness section.
  • Select the vault model from the picker.
  • Expected: the harness detail panel shows "supports your model" in green. Before this fix
    it showed "model not available" in amber.
  • Regression: catalog models (OpenAI, Anthropic, etc.) must still show correct availability
    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

  • I have included a video or screen recording for UI changes, or marked Demo as N/A
  • Relevant tests pass locally
  • Relevant linting and formatting pass locally
  • I have signed the CLA, or I will sign it when the bot prompts me

Contributor Resources

agenta-2.mp4

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 26, 2026
@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

@mannietech15 is attempting to deploy a commit to the agenta projects Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@dosubot dosubot Bot added Bug Report Something isn't working Frontend labels Jul 26, 2026
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved model availability checks for custom-provider connections.
    • Model compatibility indicators now account for configured provider secrets and selected connection details.
    • Prevented incorrect availability results when connection providers or slugs do not match.
  • Documentation

    • Expanded contribution guidance with setup steps, branching and commit conventions, pull request requirements, and security reporting instructions.
  • Chores

    • Added a local setup repair script to help resolve Docker, permissions, and environment-file issues.

Walkthrough

The PR expands contribution guidance, adds a script for repairing local setup issues, and updates model-harness compatibility checks to account for custom-provider secrets and connection slugs, with regression tests.

Changes

Contribution guidance

Layer / File(s) Summary
Contribution workflow documentation
CONTRIBUTING.md
Adds quick links, local setup commands, branch and commit conventions, pull request requirements, contribution rules, license guidance, and private security reporting instructions.

Local setup repair

Layer / File(s) Summary
Automated local setup repair
fix-agenta-setup.sh
Configures Docker DNS, fixes ownership of web/oss/public/, verifies required environment files, and prints follow-up startup commands.

Custom-provider model reachability

Layer / File(s) Summary
Custom-provider compatibility evaluation
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/connectionUtils.ts, web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx, web/packages/agenta-entity-ui/tests/unit/connectionUtils.test.ts
Model compatibility now considers custom-provider secrets, provider reachability, and connection slugs; regression tests cover matching and mismatching contexts.

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

Possibly related issues

Possibly related PRs

  • Agenta-AI/agenta#5096 — Touches the same harness compatibility path and custom-provider connection validation.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly includes the model picker badge fix, though it also mentions an additional Bedrock issue not shown in the changeset.
Description check ✅ Passed The description matches the model availability fix and test updates, so it is clearly related to the pull request.
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 unit tests (beta)
  • Create PR with unit tests

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.

@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: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 628c99f8-fa2c-4ae2-a5ff-5401798d0666

📥 Commits

Reviewing files that changed from the base of the PR and between cb095f7 and 2cf38ea.

📒 Files selected for processing (5)
  • CONTRIBUTING.md
  • fix-agenta-setup.sh
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/connectionUtils.ts
  • web/packages/agenta-entity-ui/tests/unit/connectionUtils.test.ts

Comment thread CONTRIBUTING.md
Comment on lines +19 to +42
## Quickstart & Local Development

1. **Clone the Repository**:
```bash
git clone https://github.com/agenta-ai/agenta.git
cd agenta
```

2. **Install Dependencies**:
```bash
pnpm install
```

3. **Start Development Server**:
```bash
pnpm dev
```

4. **Lint & Test**:
```bash
pnpm lint
pnpm test
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
python - <<'PY'
import json
from pathlib import Path

for path in [Path("package.json"), Path("web/package.json")]:
    if path.exists():
        data = json.loads(path.read_text())
        print(path, sorted(data.get("scripts", {})))
PY

Repository: Agenta-AI/agenta

Length of output: 517


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "tracked manifests/workspaces:"
fd -a 'package\.json$' . | sed 's#^\./##' | sort

echo
echo "root package.json:"
if [ -f package.json ]; then cat -n package.json | sed -n '1,160p'; fi

echo
echo "related docs and workflow references:"
for f in CONTRIBUTING.md README.md; do
  if [ -f "$f" ]; then
    echo "--- $f lines 1-90 ---"
    cat -n "$f" | sed -n '1,90p'
  fi
done

echo
echo "search pnpm package scripts references:"
rg -n "pnpm (install|dev|lint|test|install:(workspace-)?force)|test:apps|dev-oss|dev-ee" -S .github CONTRIBUTING.md README.md package.json web/package.json 2>/dev/null || true

Repository: Agenta-AI/agenta

Length of output: 11742


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "root pnpm files:"
fd -a '^(pnpm-workspace\.yaml|pnpm-lock\.yaml)$' . | sed 's#^\./##'

echo
echo "root tracked files around top-level manifests/workspaces:"
git ls-files | awk '/(^|\/)(package\.json|pnpm-workspace\.yaml|pnpm-lock\.yaml|package-lock\.json|yarn\.lock|bun\.lockb|bun\.lock)$/{print}' | head -100

echo
echo "web/package.json relevant scripts:"
python3 - <<'PY'
import json
from pathlib import Path
p = Path("web/package.json")
data = json.loads(p.read_text())
for k in ["scripts", "private", "repository", "packageManager"]:
    print(k, data.get(k))
PY

echo
echo "test workflow command references:"
while IFS=: read -r file line rest; do
  [ -z "$file" ] && continue
  echo "--- ${file}:${line} ---"
  sed -n "$((line-6)),$((line+10))p" "$file"
done < <(rg -n "cd web|pnpm (install|lint|test|.*-oss|.*-ee)|dev-oss|dev-ee|test:apps|turbo run|pnpm test" .github/workflows -S)

Repository: Agenta-AI/agenta

Length of output: 4006


Use web workspace commands in the quickstart and PR checklist.

There is no root package.json or root pnpm install, while the web workspace defines dev-oss/dev-ee, lint, and test:datalayer under web/. Update lines 19-42 and 51-60 to document the correct cd web && pnpm … commands, such as pnpm dev-oss and pnpm test:datalayer.

Comment thread fix-agenta-setup.sh
Comment on lines +10 to +18
sudo tee /etc/docker/daemon.json > /dev/null <<'EOF'
{
"ipv6": false,
"dns": ["8.8.8.8", "8.8.4.4"]
}
EOF
echo "Restarting Docker daemon..."
sudo systemctl restart docker
sleep 3

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Do not overwrite the entire Docker daemon configuration.

This heredoc deletes any existing Docker settings, such as registry mirrors, storage configuration, logging, proxies, or runtime options. Merge only the intended DNS/IPv6 changes, preserve a backup, validate the resulting JSON, and restart only after validation succeeds.

Comment thread fix-agenta-setup.sh
Comment on lines +28 to +30
echo "=== Fix 3: Verify env files ==="
[[ -f "hosting/docker-compose/oss/.env.oss.dev" ]] && echo "✓ .env.oss.dev exists" || echo "✗ .env.oss.dev MISSING"
[[ -f "hosting/docker-compose/oss/.env.oss.gh" ]] && echo "✓ .env.oss.gh exists" || echo "✗ .env.oss.gh MISSING"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fail when no usable environment file exists.

These checks only print warnings, so the script continues to advertise commands that will fail later. Also, .env.oss.dev and .env.oss.gh are alternatives for different compose modes, not universally required files. Validate the selected mode, or exit nonzero when neither file exists.

Suggested validation
+dev_env="hosting/docker-compose/oss/.env.oss.dev"
+gh_env="hosting/docker-compose/oss/.env.oss.gh"
+
+if [[ ! -f "$dev_env" && ! -f "$gh_env" ]]; then
+  echo "✗ No usable environment file found"
+  exit 1
+fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo "=== Fix 3: Verify env files ==="
[[ -f "hosting/docker-compose/oss/.env.oss.dev" ]] && echo "✓ .env.oss.dev exists" || echo "✗ .env.oss.dev MISSING"
[[ -f "hosting/docker-compose/oss/.env.oss.gh" ]] && echo "✓ .env.oss.gh exists" || echo "✗ .env.oss.gh MISSING"
dev_env="hosting/docker-compose/oss/.env.oss.dev"
gh_env="hosting/docker-compose/oss/.env.oss.gh"
if [[ ! -f "$dev_env" && ! -f "$gh_env" ]]; then
echo "✗ No usable environment file found"
exit 1
fi
echo "=== Fix 3: Verify env files ==="
[[ -f "hosting/docker-compose/oss/.env.oss.dev" ]] && echo "✓ .env.oss.dev exists" || echo "✗ .env.oss.dev MISSING"
[[ -f "hosting/docker-compose/oss/.env.oss.gh" ]] && echo "✓ .env.oss.gh exists" || echo "✗ .env.oss.gh MISSING"

Comment on lines 369 to +383
if (hasCatalog && catalog!.some((e) => e.id === modelId)) return true
if (
hasModels &&
Object.values(models!).some((ids) => Array.isArray(ids) && ids.includes(modelId))
)
return true

if (customSecrets?.length) {
for (const secret of customSecrets) {
const secretSlug = secret.name?.trim()
const kind = secret.provider?.toLowerCase() || null
const secretModels = (secret.models ?? []).filter(Boolean)
if (!secretModels.includes(modelId)) continue
if (slug && secretSlug !== slug) continue
if (!kind || harnessReachesCustomProviderKind(capabilities, harness, kind)) return true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Prioritize the selected custom connection over generic model/provider matches.

With a connection slug, Lines 369-374 can accept a colliding catalog model before validating that connection, and Line 529 can accept an unreachable deployment through its provider family. For example, a bedrock connection using an Anthropic-shaped model ID appears supported on pi_core because it supports anthropic, despite not consuming Bedrock.

  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/connectionUtils.ts#L369-L383: when slug is present, resolve the exact vault secret and return its deployment reachability before checking generic catalog/models.
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx#L526-L529: only apply the provider-family fallback when connection.slug is absent.
  • web/packages/agenta-entity-ui/tests/unit/connectionUtils.test.ts#L260-L329: add a colliding-ID test and a selected-status assertion for a slug-bound Bedrock connection on a harness that supports the model family but not Bedrock.
Proposed direction
+    if (slug) {
+        const secret = customSecrets?.find(
+            (candidate) =>
+                candidate.name?.trim() === slug &&
+                (candidate.models ?? []).includes(modelId),
+        )
+        if (!secret) return false
+        const kind = secret.provider?.toLowerCase() || null
+        return !kind || harnessReachesCustomProviderKind(capabilities, harness, kind)
+    }
+
     if (hasCatalog && catalog!.some((e) => e.id === modelId)) return true
-        (!!connection.provider && selectedProviders.includes(connection.provider))
+        (!connection.slug &&
+            !!connection.provider &&
+            selectedProviders.includes(connection.provider))
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (hasCatalog && catalog!.some((e) => e.id === modelId)) return true
if (
hasModels &&
Object.values(models!).some((ids) => Array.isArray(ids) && ids.includes(modelId))
)
return true
if (customSecrets?.length) {
for (const secret of customSecrets) {
const secretSlug = secret.name?.trim()
const kind = secret.provider?.toLowerCase() || null
const secretModels = (secret.models ?? []).filter(Boolean)
if (!secretModels.includes(modelId)) continue
if (slug && secretSlug !== slug) continue
if (!kind || harnessReachesCustomProviderKind(capabilities, harness, kind)) return true
if (slug) {
const secret = customSecrets?.find(
(candidate) =>
candidate.name?.trim() === slug &&
(candidate.models ?? []).includes(modelId),
)
if (!secret) return false
const kind = secret.provider?.toLowerCase() || null
return !kind || harnessReachesCustomProviderKind(capabilities, harness, kind)
}
if (hasCatalog && catalog!.some((e) => e.id === modelId)) return true
if (
hasModels &&
Object.values(models!).some((ids) => Array.isArray(ids) && ids.includes(modelId))
)
return true
if (customSecrets?.length) {
for (const secret of customSecrets) {
const secretSlug = secret.name?.trim()
const kind = secret.provider?.toLowerCase() || null
const secretModels = (secret.models ?? []).filter(Boolean)
if (!secretModels.includes(modelId)) continue
if (slug && secretSlug !== slug) continue
if (!kind || harnessReachesCustomProviderKind(capabilities, harness, kind)) return true
📍 Affects 3 files
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/connectionUtils.ts#L369-L383 (this comment)
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx#L526-L529
  • web/packages/agenta-entity-ui/tests/unit/connectionUtils.test.ts#L260-L329

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Report Something isn't working Frontend size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants