Skip to content

[fix] Tell the user when the model catalog fails to load - #5492

Open
mmabrouk wants to merge 1 commit into
release/v0.106.1from
fix/agent-drawer-catalog-error
Open

[fix] Tell the user when the model catalog fails to load#5492
mmabrouk wants to merge 1 commit into
release/v0.106.1from
fix/agent-drawer-catalog-error

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

Context

When the playground's "Model & harness" drawer cannot reach the harness catalog, it renders its pre-catalog layout: a flat single column with a plain model dropdown, no collapsible sections, no status icons. Nothing tells the user a request failed. It reads as a stale frontend build, which is exactly how it was misdiagnosed on a self-hosted deployment (the real cause was a server-side redirect, fixed in #5487).

The fallback itself is correct for one case. A schema without x-ag-harness-ref predates the catalog, and the basic controls are the right UI for it. The problem is that a failed fetch is indistinguishable from that case: both leave capabilities null, and useModelHarness.tsx:624 branches on that single value.

Changes

harnessCatalogFailedAtom exposes the catalog query's error state, and retryHarnessCatalogAtom refetches it. The drawer now separates the two causes:

harnessRefKey present + capabilities null + query errored  ->  retry notice, then basic controls
harnessRefKey absent                                       ->  basic controls, unchanged

When the schema asked for the catalog and the fetch failed, a warning with a Retry button appears above the controls. The pre-catalog path is untouched, so schemas that never used the catalog render exactly as before.

Tests / notes

  • This box has no node_modules (the web image builds in Docker), so pnpm lint-fix and the strict package tsc did not run locally. CI is the gate here. Worth a reviewer's eye on the antd Alert usage and the write-atom signature.
  • The failure path is reachable by blocking GET /api/workflows/catalog/harnesses/ in devtools, or on any deployment carrying the redirect bug from [fix] Resolve API trailing slashes in place instead of redirecting #5487.
  • Copy is deliberately plain, no status codes or endpoint names, since this surfaces to end users.

What to QA

  • Open an agent variant's "Model & harness" drawer with the network tab blocking workflows/catalog/harnesses. A warning appears above the basic controls with a working Retry button. Retry with the block removed loads the full sectioned layout.
  • Regression: open the same drawer normally. The Harness, Model, and Provider credentials sections render as before, with no notice.
  • Regression: open a variant whose schema has no x-ag-harness-ref. The basic controls render with no warning, unchanged.

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 24, 2026
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Jul 29, 2026 8:43pm

Request Review

@CLAassistant

CLAassistant commented Jul 24, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eb3f70e9-979a-4068-ba45-3847b7cdb430

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The change exposes harness catalog failure and retry atoms through workflow exports, then uses them in useModelHarness to show a catalog-unavailable warning and trigger catalog refetching.

Changes

Harness catalog recovery

Layer / File(s) Summary
Catalog failure state and exports
web/packages/agenta-entities/src/workflow/state/inspectMeta.ts, web/packages/agenta-entities/src/workflow/state/index.ts, web/packages/agenta-entities/src/workflow/index.ts
Adds atoms for detecting harness catalog query errors and retrying the query, then re-exports them through workflow barrels.
Catalog unavailable notice
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/useModelHarness.tsx
Derives catalog unavailability and renders a warning alert with a Retry button in the capability-aware controls layout.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Query
  participant WorkflowAtoms
  participant useModelHarness
  participant User
  Query->>WorkflowAtoms: Reports catalog error
  WorkflowAtoms-->>useModelHarness: Provides failure state
  useModelHarness-->>User: Displays unavailable alert
  User->>WorkflowAtoms: Clicks Retry
  WorkflowAtoms->>Query: Calls refetch()
Loading

Possibly related PRs

🚥 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 60.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly matches the main change: showing a failure message when the model catalog cannot load.
Description check ✅ Passed The description is directly about the catalog-failure warning and retry behavior added by the PR.
✨ 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/agent-drawer-catalog-error

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.

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-production-1630.up.railway.app/w
Image tag pr-5492-d084013
Status Failed
Railway logs Open logs
Logs View workflow run
Updated at 2026-07-29T21:14:07.158Z

@mmabrouk
mmabrouk changed the base branch from main to release/v0.106.1 July 29, 2026 20:31
…egrading

A null capability map has two causes: a schema with no x-ag-harness-ref (the
pre-catalog controls are correct), or a catalog the browser could not reach.
The drawer rendered both identically, so a failed request looked like a stale
frontend build and gave the user nothing to act on.

Track the query's error state and, when the schema did ask for the catalog,
show a retry notice above the basic controls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend size:M This PR changes 30-99 lines, ignoring generated files. UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants