Skip to content

fix(frontend): show why the agent config failed instead of a skeleton forever - #6431

Merged
ashrafchowdury merged 2 commits into
release/v0.114.7from
fix/agent-config-chunk-error-boundary
Sep 3, 2026
Merged

fix(frontend): show why the agent config failed instead of a skeleton forever#6431
ashrafchowdury merged 2 commits into
release/v0.114.7from
fix/agent-config-chunk-error-boundary

Conversation

@ardaerzin

Copy link
Copy Markdown
Contributor

Context

The agent's Configuration panel can sit on its loading skeleton forever with no error anywhere, when the chunk behind it fails to load.

AgentTemplateControl is the heaviest control in the registry, so it is code-split:

const AgentTemplateControl = lazy(() => import("./AgentTemplateControl").then(...))
...
<Suspense fallback={<AgentConfigSkeleton />}>

There is no error boundary on it. A lazy() import that rejects suspends until something catches it, so the panel holds AgentConfigSkeleton indefinitely, indistinguishable from a slow network. The only trace is a console error nobody is looking at.

Found while chasing a different infinite skeleton in this same panel (#6424, a stalled IndexedDB read). That one was not the chunk, but the two fail identically from the outside, and telling them apart cost real time.

Changes

Wraps the control in a boundary that renders the failure instead of the skeleton, and names two cases the import could otherwise swallow:

  • A rejected chunk. Logged with its error, then rethrown to the boundary.
  • A chunk that resolves without its named export. A circular import that has not finished initialising resolves the module with holes, so m.AgentTemplateControl is undefined. React would render that as undefined rather than reject, so it is turned into a named error listing the keys the module did expose.

Tests

@agenta/entity-ui: 598 tests pass. tsc --noEmit, eslint and prettier clean.

The failure path itself is not covered by a test. Reproducing a chunk-load failure in jsdom means mocking the dynamic import, which tests the mock more than the boundary. The value here is that a silent hang becomes a visible message.

What to QA

  • Normal path: open an agent playground. The Configuration panel renders as before, with no extra wrapper visible.
  • Failure path (optional, devtools): block the AgentTemplateControl chunk request in the Network tab and reload. Instead of an endless skeleton you get a red "The agent configuration could not load" box naming the cause.

… forever

`AgentTemplateControl` is code-split behind `lazy()`, with `AgentConfigSkeleton`
as its Suspense fallback and no error boundary. A chunk that fails to load, or
resolves without its named export, therefore suspends indefinitely: the panel
shows its loading skeleton for good, indistinguishable from a slow network, and
the only trace is a console error nobody is looking at.

Wraps it in a boundary that renders the failure, and names two cases the import
could otherwise swallow: a rejected chunk, and one that resolves with the export
missing (a circular import mid-initialisation resolves the module with holes,
which React would render as `undefined` rather than reject).

Found while chasing a different infinite skeleton in this panel. That one turned
out to be a stalled IndexedDB read, not the chunk — but it took hours partly
because this path fails the same way, and the two were indistinguishable from
the outside.
@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
agenta-documentation Ready Ready Preview Sep 3, 2026 7:27am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: 946bc3ff-00d5-422d-9463-22a424c080a9

📥 Commits

Reviewing files that changed from the base of the PR and between 3739328 and 730f010.

📒 Files selected for processing (1)
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/SchemaPropertyRenderer.tsx

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling when loading agent-template controls.
    • Displayed a clear error message when agent-template content fails to load or render, instead of leaving a loading state indefinitely.

Walkthrough

The agent template loader validates its named export and reports load failures. A local error boundary catches render failures and displays an error message around the suspended agent-template control.

Changes

Agent template error handling

Layer / File(s) Summary
Loader validation and render boundary
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/SchemaPropertyRenderer.tsx
The lazy loader validates AgentTemplateControl, logs and rethrows load failures, and the render path wraps the suspended control in an error boundary that displays failures.

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

Merge Risk: ⚪ Minimal · up to 347cf

The PR makes the configuration failure visible instead of leaving users on an indefinite loading skeleton. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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 and concisely describes the main change: showing a visible error when the agent configuration fails instead of displaying the loading skeleton indefinitely.
Description check ✅ Passed The description directly explains the chunk-loading failure, the added error boundary, the handled failure cases, validation results, and QA steps.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

✨ 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-config-chunk-error-boundary

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
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: 2ddbd812-1714-445a-b22f-1960e38b5f9c

📥 Commits

Reviewing files that changed from the base of the PR and between 500d970 and 347cfa4.

📒 Files selected for processing (1)
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/SchemaPropertyRenderer.tsx

Included review availability: Your plan provides up to 8 included reviews per hour; 1 remains after this review.

Comment on lines +42 to +44
// Resolved, but the named export is missing (a circular import that has not
// finished initialising resolves the module with holes). React would then render
// `undefined` rather than reject, so name it here instead of failing opaquely.

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.

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

Keep each new source comment to one short line.

The added comments at Lines 42-44, 54-55, 61-67, and 491-494 span multiple lines. Replace each block comment with one concise line or remove comments that only restate the code.

Proposed cleanup
-                // Resolved, but the named export is missing (a circular import that has not
-                // finished initialising resolves the module with holes). React would then render
-                // `undefined` rather than reject, so name it here instead of failing opaquely.
+                // Validate the named export before rendering.

-            // A rejected lazy import leaves the Suspense fallback up forever when nothing
-            // catches it, which reads as "the config panel never loads" with no error anywhere.
+            // Log and rethrow lazy-load failures.

-/**
- * Renders WHY the agent config did not load, instead of leaving its skeleton up forever.
- *
- * A `lazy()` import that rejects suspends until something catches it. With no boundary here the
- * panel sat on `AgentConfigSkeleton` indefinitely, indistinguishable from a slow network, and the
- * only trace was a console error nobody was looking at.
- */
+// Show agent-template failures instead of an indefinite skeleton.

-            // Render the whole agent config (instructions, model, tools, runtime) as one
-            // composite control that reuses the model selector, tool picker, and enums.
-            // The Suspense fallback is the SAME skeleton the schema-loading gate shows,
-            // so the two gates read as one continuous frame while the chunk loads.
+            // Render the agent configuration with the shared loading skeleton.

As per coding guidelines: “Hard rule. At most ONE short line per comment.”

Also applies to: 54-55, 61-67, 491-494

Source: Coding guidelines

@ashrafchowdury
ashrafchowdury changed the base branch from main to release/v0.114.7 September 3, 2026 07:25
@ashrafchowdury
ashrafchowdury merged commit ab4f95f into release/v0.114.7 Sep 3, 2026
18 of 19 checks passed
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-pr-6431.up.railway.app/w
Project agenta-oss-clone-spike
Image tag pr-6431-d56bccf
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-09-03T07:38:11.698Z

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.

2 participants