Skip to content

fix(webui): let a failed run's error bubble capture a trace - #7370

Merged
serrrfirat merged 1 commit into
mainfrom
fix/failed-run-trace-capture-7369
Aug 10, 2026
Merged

serrrfirat merged 1 commit into
mainfrom
fix/failed-run-trace-capture-7369

Conversation

@sergeiest

Copy link
Copy Markdown
Contributor

Summary

  • A terminal run failure renders as a role: "error" chat message. That message never carried a turnRunId, and the existing "download run artifact" action was gated on role === assistant && isFinalReply, so it never appeared for a failed run — matching the report: no button to capture a trace when the agent errors.
  • The action-button row itself was also gated on showActions || showRetryAction, both false for an error bubble, so relaxing the role check alone would still have been a no-op.
  • Threaded turnRunId onto the run-failure message at creation, at in-place update, and through the unknown→known-run-id promotion path (err-unknown → err-<runId>), and let showArtifactAction/the button row fire for error messages that carry a turnRunId. The existing downloadArtifact handler needed no changes — it was already keyed only on threadId/turnRunId, never role.

Fixes #7369.

Test plan

  • Added regression coverage in message-bubble.test.ts (button renders for a failed-run error bubble with a known run id, respects the deployment gate, and stays hidden with no run id yet) and useChatEvents.test.ts (three mutation paths: fresh creation, in-place update, and unknown→known-run-id promotion all set turnRunId).
  • Verified all 4 new/extended assertions fail red against the pre-fix code, and pass green with the fix restored.
  • npx vitest run — full frontend suite: 1139 passed, 1 pre-existing unrelated failure (theme.test.tsx, a localStorage mocking issue, confirmed to fail identically on main before this change).
  • pnpm lint (conventions + tsc --noEmit) — clean.
  • pnpm build — production build succeeds, bundle budgets pass.

🤖 Generated with Claude Code

A terminal run failure renders as a `role: "error"` chat message, which
never carried a `turnRunId` and was excluded from the existing
"download run artifact" action (gated on `role === assistant`). The
action-button row itself was also gated on `showActions ||
showRetryAction`, neither true for an error bubble, so the button
stayed hidden even once its role check was relaxed. Net effect: a
failed run had no way to capture a trace for it (#7369).

Thread `turnRunId` onto the run-failure message at creation, in-place
update, and through the unknown-to-known-run-id promotion path, and
let `showArtifactAction` fire for error messages that carry one. The
existing download handler needed no changes — it was already keyed
only on `threadId`/`turnRunId`, not role.

Fixes #7369.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@railway-app

railway-app Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the ironclaw-pr-7370 environment in ironclaw-ci-preview

Service Status Web Updated (UTC)
ironclaw ✅ Success (View Logs) Web Aug 7, 2026 at 7:25 pm

@railway-app
railway-app Bot temporarily deployed to ironclaw-ci-preview / ironclaw-pr-7370 August 7, 2026 19:16 Destroyed
@github-actions github-actions Bot added the size: S 10-49 changed lines label Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added run-artifact downloads to terminal error messages when a run ID is available.
    • Restricted failed-run messages to relevant artifact downloads while preserving existing actions.
  • Bug Fixes

    • Run identifiers are now retained on failure messages, including failures initially received without a known run ID.
    • Downloads are hidden when no run ID is available.
  • Tests

    • Added coverage for failed-run downloads and run ID propagation.

Walkthrough

Failed run messages now retain turnRunId values. The chat UI displays eligible run-artifact download actions for terminal errors and validates deployment, thread-artifact, and missing-ID conditions.

Changes

Failed-run artifact downloads

Layer / File(s) Summary
Run ID propagation
crates/product/ironclaw_webui/frontend/src/pages/chat/lib/message-types.ts, crates/product/ironclaw_webui/frontend/src/pages/chat/lib/useChatEvents.ts, crates/product/ironclaw_webui/frontend/src/pages/chat/lib/useChatEvents.test.ts
Error message types accept turnRunId. Run failure creation, updates, and unknown-run promotion preserve the associated ID.
Artifact action rendering
crates/product/ironclaw_webui/frontend/src/pages/chat/components/message-bubble.tsx, crates/product/ironclaw_webui/frontend/src/pages/chat/components/message-bubble.test.ts
Terminal errors with a run ID can show run-artifact downloads. Tests cover deployment gating, thread-artifact exclusion, and missing run IDs.

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

Possibly related PRs

Suggested reviewers: benkurrek

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the fix and validation, but it omits most required template sections, including change type, test strategy, security, database, blast radius, and rollback. Complete the required description sections and mark non-applicable sections with explicit reasons.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title uses Conventional Commits style and clearly describes enabling trace capture for failed run error bubbles.
Linked Issues check ✅ Passed The changes satisfy issue #7369 by preserving run IDs and showing artifact download actions for failed-run error messages.
Out of Scope Changes check ✅ Passed All changes directly support failed-run trace capture, run-ID propagation, deployment gating, and regression coverage for issue #7369.

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 added risk: low Changes to docs, tests, or low-risk modules contributor: regular 2-5 merged PRs labels Aug 7, 2026
@ironloopai

ironloopai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

🧭 IronLoop Run · Review

This comment updates in place as the Run moves through its stages.

🟥 Final result · Could not complete

🟨 Queued → 🟦 Working → 🟥 Could not complete

Automatic trigger · attempt 1 of 3 · failed after 5m 49s

The generated review did not pass diff verification, so IronLoop did not publish it.

Inspect the current pull request and start a new Review Run if appropriate.

Failure details

  • Failure reference: 639eb46b-9b2e-4adb-9a4d-12f1b8625761
Run details

Run: 389cc8a8-4ec3-4f8c-a754-6920f43cbcd9
Base: main at df90072
Head: fix/failed-run-trace-capture-7369 at 1f37555
Created: 2026-08-07 19:16 UTC
Updated: 2026-08-07 19:22 UTC

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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@crates/product/ironclaw_webui/frontend/src/pages/chat/components/message-bubble.tsx`:
- Around line 320-324: Restrict showArtifactAction in message-bubble.tsx to
errors with a normalized terminal failureStatus such as failed or
recovery_required, while preserving the existing assistant final-reply
conditions. In message-bubble.test.ts, set failureStatus to failed for the
eligible error case and add coverage confirming a nonterminal error does not
render the artifact action.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: af6e9eae-679f-4b6e-a82c-9fd4727df894

📥 Commits

Reviewing files that changed from the base of the PR and between df90072 and 1f37555.

📒 Files selected for processing (5)
  • crates/product/ironclaw_webui/frontend/src/pages/chat/components/message-bubble.test.ts
  • crates/product/ironclaw_webui/frontend/src/pages/chat/components/message-bubble.tsx
  • crates/product/ironclaw_webui/frontend/src/pages/chat/lib/message-types.ts
  • crates/product/ironclaw_webui/frontend/src/pages/chat/lib/useChatEvents.test.ts
  • crates/product/ironclaw_webui/frontend/src/pages/chat/lib/useChatEvents.ts

Comment on lines 320 to +324
const showArtifactAction = Boolean(
role === CHAT_MESSAGE_ROLES.ASSISTANT &&
message.isFinalReply === true &&
!isOptimistic &&
(isError ||
(role === CHAT_MESSAGE_ROLES.ASSISTANT &&
message.isFinalReply === true &&
!isOptimistic)) &&

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

Restrict run-artifact downloads to terminal run failures.

isError accepts every error message. A generic or nonterminal error with turnRunId can display the run-artifact action. Require a normalized terminal failureStatus, such as failed or recovery_required, before rendering the action.

  • crates/product/ironclaw_webui/frontend/src/pages/chat/components/message-bubble.tsx#L320-L324: add a terminal failure-status check to showArtifactAction.
  • crates/product/ironclaw_webui/frontend/src/pages/chat/components/message-bubble.test.ts#L394-L439: set failureStatus: "failed" for the eligible error case, and add a nonterminal error case that does not render the action.
📍 Affects 2 files
  • crates/product/ironclaw_webui/frontend/src/pages/chat/components/message-bubble.tsx#L320-L324 (this comment)
  • crates/product/ironclaw_webui/frontend/src/pages/chat/components/message-bubble.test.ts#L394-L439
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@crates/product/ironclaw_webui/frontend/src/pages/chat/components/message-bubble.tsx`
around lines 320 - 324, Restrict showArtifactAction in message-bubble.tsx to
errors with a normalized terminal failureStatus such as failed or
recovery_required, while preserving the existing assistant final-reply
conditions. In message-bubble.test.ts, set failureStatus to failed for the
eligible error case and add coverage confirming a nonterminal error does not
render the artifact action.

@serrrfirat

Copy link
Copy Markdown
Collaborator

@ironloopai review

@ironloopai

ironloopai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

🧭 IronLoop Run · Review

This comment updates in place as the Run moves through its stages.

🟩 Final result · Completed

🟨 Queued → 🟦 Working → 🟦 Posting results → 🟩 Completed

Manual command by serrrfirat · attempt 1 of 3 · completed in 6m 9s

IronLoop completed the review and posted it to GitHub.

🔗 Result

Open submitted review →

Run details

Run: 0e2f84dc-927a-4680-af36-5f0d2dfc6a54
Base: main at d27dba3
Head: fix/failed-run-trace-capture-7369 at 1f37555
Created: 2026-08-07 20:05 UTC
Updated: 2026-08-07 20:11 UTC

@ironloopai ironloopai 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.

🔍 IronLoop review

Completed review of the exact merge-base-to-head diff. Found one medium-severity gap in the failed-run artifact flow.

Findings: 🟠 Medium 1

🟠 Medium · Backfill IDs on connection-loss failure bubbles

Inline on crates/product/ironclaw_webui/frontend/src/pages/chat/lib/useChatEvents.ts:868. See the inline comment for details.

Validation

  • ✅ Diff hygiene — `git diff --check refs/ironloop/merge-base refs/ironloop/head` passed.
  • ✅ Frontend lint — `pnpm lint` passed using Node 22.22.0 and pnpm 11.7.0.
  • ✅ Focused frontend tests — Changed message-bubble and useChatEvents suites passed: 81 tests.
  • ✅ Full frontend tests — `pnpm test` passed: 132 files, 1,140 tests.
  • ✅ Frontend build — `pnpm build` passed.
Review details
  • Run: 0e2f84dc-927a-4680-af36-5f0d2dfc6a54
  • Workflow: Review
  • Attempts: 1

failureStatus: status,
failureCategory,
failureSummary,
turnRunId: runId,

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.

🔍 IronLoop review · Inline finding

🟠 Medium · Backfill IDs on connection-loss failure bubbles

This assignment is unreachable when a known-run connection-loss bubble already exists and the later terminal `failed` projection has neither `failure_category` nor `failure_summary` (both are optional). `upsertConnectionLostRunFailure` creates `err-<runId>` without `turnRunId`; then `hasUsefulUpdate` is false and the early return preserves that bubble before this assignment runs. The newly enabled artifact action requires `turnRunId`, so a run that disconnects and then fails still has no trace-download button. Backfill the ID even when the visible failure content does not change (and preserve it on the connection-loss-created bubble), with a regression test for that sequence.

@serrrfirat
serrrfirat added this pull request to the merge queue Aug 10, 2026
Merged via the queue into main with commit 4e05a03 Aug 10, 2026
43 checks passed
@serrrfirat
serrrfirat deleted the fix/failed-run-trace-capture-7369 branch August 10, 2026 08:21
Kampouse pushed a commit to Kampouse/ironclaw that referenced this pull request Aug 13, 2026
)

A terminal run failure renders as a `role: "error"` chat message, which
never carried a `turnRunId` and was excluded from the existing
"download run artifact" action (gated on `role === assistant`). The
action-button row itself was also gated on `showActions ||
showRetryAction`, neither true for an error bubble, so the button
stayed hidden even once its role check was relaxed. Net effect: a
failed run had no way to capture a trace for it (nearai#7369).

Thread `turnRunId` onto the run-failure message at creation, in-place
update, and through the unknown-to-known-run-id promotion path, and
let `showArtifactAction` fire for error messages that carry one. The
existing download handler needed no changes — it was already keyed
only on `threadId`/`turnRunId`, not role.

Fixes nearai#7369.

Co-authored-by: Sergey <sergey@Mac.attlocal.net>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Kampouse pushed a commit to Kampouse/ironclaw that referenced this pull request Aug 13, 2026
)

A terminal run failure renders as a `role: "error"` chat message, which
never carried a `turnRunId` and was excluded from the existing
"download run artifact" action (gated on `role === assistant`). The
action-button row itself was also gated on `showActions ||
showRetryAction`, neither true for an error bubble, so the button
stayed hidden even once its role check was relaxed. Net effect: a
failed run had no way to capture a trace for it (nearai#7369).

Thread `turnRunId` onto the run-failure message at creation, in-place
update, and through the unknown-to-known-run-id promotion path, and
let `showArtifactAction` fire for error messages that carry one. The
existing download handler needed no changes — it was already keyed
only on `threadId`/`turnRunId`, not role.

Fixes nearai#7369.

Co-authored-by: Sergey <sergey@Mac.attlocal.net>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
l3ocifer pushed a commit to l3ocifer/frick-ironclaw that referenced this pull request Sep 3, 2026
)

A terminal run failure renders as a `role: "error"` chat message, which
never carried a `turnRunId` and was excluded from the existing
"download run artifact" action (gated on `role === assistant`). The
action-button row itself was also gated on `showActions ||
showRetryAction`, neither true for an error bubble, so the button
stayed hidden even once its role check was relaxed. Net effect: a
failed run had no way to capture a trace for it (nearai#7369).

Thread `turnRunId` onto the run-failure message at creation, in-place
update, and through the unknown-to-known-run-id promotion path, and
let `showArtifactAction` fire for error messages that carry one. The
existing download handler needed no changes — it was already keyed
only on `threadId`/`turnRunId`, not role.

Fixes nearai#7369.

Co-authored-by: Sergey <sergey@Mac.attlocal.net>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>

This branch was successfully deployed

No deployments
ironclaw-ci-preview / ironclaw-pr-7370 — 1f375555 Deployed Aug 7, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: regular 2-5 merged PRs risk: low Changes to docs, tests, or low-risk modules size: S 10-49 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No way to capture traces when agent gets an error

2 participants