Skip to content

[fix] Show short agent-run errors in full instead of clamping them away - #5395

Merged
ashrafchowdury merged 3 commits into
release/v0.105.8from
fix/truncate-error-message-issue
Jul 21, 2026
Merged

[fix] Show short agent-run errors in full instead of clamping them away#5395
ashrafchowdury merged 3 commits into
release/v0.105.8from
fix/truncate-error-message-issue

Conversation

@ashrafchowdury

Copy link
Copy Markdown
Contributor

Context

When an agent run failed, the error reason in the chat could get cut off with no way to read the rest. The clamp and the "Show more" toggle used two different rules, so they could disagree: a short reason that happened to wrap past three lines got line-clamp-3, but the toggle only appeared for text over 220 chars or containing a newline. A wrapped-but-short message was clamped with no button to expand it, so part of the error was simply hidden (#5350). Multi-line reasons also lost their line breaks, since the default text block didn't preserve whitespace.

Changes

There's now one rule, isBigError, that decides everything:

const isBigError = (text) => text.length > 240 || text.split("\n").length > 4
  • An everyday reason (short, ≤4 lines) renders in full, with whitespace-pre-wrap so its line breaks survive. No clamp, no toggle.
  • A big reason (a stacktrace) clamps to three lines behind "Show more", which opens the scrollable <pre> block as before.

Because the clamp, the toggle, and the expanded view all key off the same isBigError check, they can't disagree and strand text off-screen.

Before:

  • isLong = text.length > 220 || text.includes("\n") gated the toggle.
  • line-clamp-3 was applied to every non-expanded reason regardless of isLong.
  • Result: a short reason that wrapped past 3 lines was clamped with no expand button.

After:

  • One isBigError check drives the clamp, the toggle, and the expanded block.
  • Short reasons show fully (whitespace preserved); only big ones collapse behind "Show more".

Tests / notes

  • Reviewers should check the two boundaries: a reason just under the 240-char / 4-line threshold (should show in full) and one just over it (should clamp with a working toggle).

What to QA

  • Trigger an agent run that fails with a short reason (a sentence or two). The full reason shows in the red error bubble, with no "Show more" button.
  • Trigger a run that fails with a long stacktrace. It clamps to three lines with "Show more"; clicking expands into a scrollable block, and "Show less" collapses it.
  • Regression: a short reason that spans a few lines keeps its line breaks and is not cut off.

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 19, 2026
@vercel

vercel Bot commented Jul 19, 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, Comment Jul 21, 2026 10:38am

Request Review

@ashrafchowdury ashrafchowdury linked an issue Jul 19, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Jul 19, 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: 1ee0141b-b0fb-444f-9e7e-3f948b1c300f

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

Failed-run error rendering now uses a shared size heuristic to clamp large errors and conditionally show expansion controls. Expanded errors render in a scrollable preformatted block, and the related inline comment was updated.

Changes

Error rendering

Layer / File(s) Summary
Big error display behavior
web/oss/src/components/AgentChatSlice/components/AgentMessage.tsx
isBigError determines clamping and whether the Show more / Show less control appears; expanded errors render fully in a scrollable <pre>, with updated behavior documentation.

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

Possibly related PRs

  • Agenta-AI/agenta#5194: Updates the Copy action to include run error text in the same error-rendering flow.
🚥 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.
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 summarizes the main change: showing short agent-run errors in full instead of clamping them.
Description check ✅ Passed The description is directly related to the changeset and explains the error-display refactor in detail.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/truncate-error-message-issue

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.

🧹 Nitpick comments (1)
web/oss/src/components/AgentChatSlice/components/AgentMessage.tsx (1)

181-185: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Shorten comments to a single line.

As per coding guidelines, in-code comments must be kept to at most one short line unless describing genuinely surprising constraints.

  • web/oss/src/components/AgentChatSlice/components/AgentMessage.tsx#L181-L185: condense the JSDoc component description into a single line (e.g., /** Failed-run body: everyday reasons show in full; big ones collapse behind a "Show more" block. */).
  • web/oss/src/components/AgentChatSlice/components/AgentMessage.tsx#L532-L533: combine the inline explanation into a single line (e.g., // Failed run: the bubble reads as an inline error; everyday reasons show in full, big ones collapse.).

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2e30829c-3c61-42af-8450-6ad06abee66e

📥 Commits

Reviewing files that changed from the base of the PR and between 3588f13 and cb2c085.

📒 Files selected for processing (1)
  • web/oss/src/components/AgentChatSlice/components/AgentMessage.tsx

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-production-5e12.up.railway.app/w
Project agenta-oss-pr-5395
Image tag pr-5395-bb7caa5
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-07-21T10:47:03.826Z

@ashrafchowdury
ashrafchowdury requested a review from ardaerzin July 20, 2026 11:49
@ardaerzin
ardaerzin changed the base branch from main to release/v0.105.8 July 21, 2026 10:36
@ashrafchowdury
ashrafchowdury merged commit 73c35c6 into release/v0.105.8 Jul 21, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend size:S This PR changes 10-29 lines, ignoring generated files. UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Cannot expand errors in playground

2 participants