Skip to content

Add 'Explain this error' AI CTA to all error surfaces#9221

Merged
ericokuma merged 22 commits intomainfrom
eokuma/ai-error-resolution
Apr 17, 2026
Merged

Add 'Explain this error' AI CTA to all error surfaces#9221
ericokuma merged 22 commits intomainfrom
eokuma/ai-error-resolution

Conversation

@ericokuma
Copy link
Copy Markdown
Contributor

Adds an "Explain this error" button to every error displayed in Rill Developer's code and visual editors. Clicking it opens the AI chat panel with a pre-composed prompt containing the error message, file path, resource type, line number, and surrounding code context.

  • New composeErrorPrompt() utility builds structured prompts from error metadata, with credential stripping for connector files and a 2000-char length cap
  • New ExplainErrorButton component using SparklesIcon that calls sidebarActions.startChat(prompt)
  • Button added to: WorkspaceEditorContainer (code view banner), ModelWorkspace (table errors), ExploreWorkspace (visual error page), CanvasLoadingState (canvas errors), SubmissionError (connector forms, optional)

Closes APP-850, APP-851, APP-852

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

Developed in collaboration with Claude Code

@ericokuma ericokuma force-pushed the eokuma/ai-error-resolution branch from 525568a to 6844151 Compare April 10, 2026 21:42
@ericokuma ericokuma requested a review from AdityaHegde April 10, 2026 22:33
ericokuma and others added 18 commits April 10, 2026 15:35
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bump padding from py-0.5 to py-1 and icon from 12px to 14px for
better accessibility on the "Explain this error" button.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Switch from text-accent-primary-action to text-primary-600 for WCAG AA
  compliance (5.17:1 vs 3.89:1 on bg-destructive/15)
- Move "Explain this error" button to bottom-left of error containers
  instead of right-aligned inline

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add `large` prop to ExplainErrorButton that renders a 28px-height
bordered button matching the design system's secondary button scale.
Applied to Canvas and Explore full-page error views where the inline
pill treatment was visually undersized next to the ErrorPage layout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Both inline and large variants now always show a visible primary-600
border, so the button always looks like a button rather than text
that transforms on hover.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Solid bg-primary-600 with white text instead of transparent fill.
Makes the AI action more prominent and clearly clickable in error
contexts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Neutral dark button that doesn't compete with the red error context
or imply a brand/AI-specific action color.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bg-surface-muted with text-fg-primary and a visible border for
distinction against the red error banner background. Passes WCAG AA
in both light mode (16:1) and dark mode (11.9:1).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Restructure the error banner layout so the icon and text+button are
in a flex row. The button sits in the same column as the error text,
ensuring perfect left-alignment.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… containers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ericokuma ericokuma force-pushed the eokuma/ai-error-resolution branch from d98adfa to e225a31 Compare April 10, 2026 22:36
@ericokuma
Copy link
Copy Markdown
Contributor Author

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@AdityaHegde AdityaHegde left a comment

Choose a reason for hiding this comment

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

Would be good to try a minimal version of this by just saying, Fix the errors in <file_path>

parts.push("");

// Error message
parts.push(`**Error:** ${errorMessage}`);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need to send the error? LLM can get parser errors using tool calls.

const sanitized = isConnector ? stripCredentials(fileContent) : fileContent;
const context = extractContext(sanitized, lineNumber);
if (context) {
codeBlockStart = parts.length;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same here, LLM can get the contents of the file and map the line number from errors to the relevant parts.

Address review feedback: let the LLM agent fetch parser errors and file
content via tool calls instead of pre-composing them into the prompt.
Removes `errorMessage`, `fileContent`, `lineNumber`, and
`additionalErrorCount` props from `ExplainErrorButton` and its callers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ericokuma ericokuma requested a review from AdityaHegde April 14, 2026 23:11
@ericokuma
Copy link
Copy Markdown
Contributor Author

Addressed feedback!

Copy link
Copy Markdown
Collaborator

@AdityaHegde AdityaHegde left a comment

Choose a reason for hiding this comment

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

Approving a few nits. Works great otherwise! Was able to fix issues in underlying metrics view from a canvas.

Comment thread web-common/src/features/chat/ExplainAndFixErrorButton.svelte
@@ -0,0 +1,7 @@
/**
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: this is not needed, lets move this into the button component below.

@@ -0,0 +1,9 @@
import { describe, it, expect } from "vitest";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same with this, testing the prompt generation is overkill.

- Inline the minimal "Fix the errors in <file_path>" prompt into the button; remove error-prompt-composer.ts and its spec
- Rename ExplainErrorButton to ExplainAndFixErrorButton to match what it does
@ericokuma ericokuma requested a review from AdityaHegde April 17, 2026 04:39
@ericokuma
Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

…ution

# Conflicts:
#	web-local/src/routes/(application)/(workspace)/files/[...file]/+page.svelte
@ericokuma ericokuma merged commit 1ba7aea into main Apr 17, 2026
8 of 9 checks passed
@ericokuma ericokuma deleted the eokuma/ai-error-resolution branch April 17, 2026 04:53
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