Skip to content

Sanitize user-facing error messages and log to console - #762

Open
ngoiyaeric wants to merge 1 commit into
mainfrom
sanitize-user-error-logs-18229616373475075857
Open

Sanitize user-facing error messages and log to console#762
ngoiyaeric wants to merge 1 commit into
mainfrom
sanitize-user-error-logs-18229616373475075857

Conversation

@ngoiyaeric

Copy link
Copy Markdown
Collaborator

Audit and update client UI components, toast notifications, server action streamable values, and tool execution to ensure technical codebase/stack error details are suppressed from user-facing views while remaining logged in dev console for debugging.


PR created automatically by Jules for task 18229616373475075857 started by @ngoiyaeric

Ensure all codebase error details and raw exceptions are hidden from
user UI components, toasts, and streamable values while logging detailed
errors to console.error for debugging.
Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercelBot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentActionsUpdated (UTC)
qcxReadyReadyPreviewAug 27, 2026 3:19pm

@coderabbitai

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 28 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c29bad1e-dc56-4436-baaa-d173a68ad352

📥 Commits

Reviewing files that changed from the base of the PR and between 4b1b9a7 and fd90f86.

📒 Files selected for processing (13)
  • app/actions.tsx
  • components/chat-share.tsx
  • components/clear-history.tsx
  • components/copilot-optimized.tsx
  • components/copilot.tsx
  • components/download-report-button.tsx
  • components/message.tsx
  • components/settings/components/settings.tsx
  • components/settings/components/system-prompt-form.tsx
  • components/settings/components/user-management-form.tsx
  • components/sidebar/chat-history-client.tsx
  • components/skyfi-section.tsx
  • lib/agents/tools/retrieve.tsx

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.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Sanitize user-facing errors while preserving console diagnostics

🐞 Bug fix✨ Enhancement🕐 20-40 Minutes

Grey Divider

AI Description

• Replaces raw exception details with clear, actionable user-facing messages.
• Preserves technical diagnostics through contextual console error logging.
• Applies consistent error handling across actions, streams, tools, settings, and chat UI.
Diagram

graph TD
A["Failure sources"] --> B["Error handlers"] --> C["Console logs"]
B --> D["Sanitized messages"] --> E["UI error cards"]
D --> F["Toast alerts"]
D --> G["Stream responses"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Centralized error reporting helper
  • ➕ Enforces sanitization consistently across future error paths
  • ➕ Standardizes contextual logging and recovery messages
  • ➕ Reduces repeated console-and-toast handling
  • ➖ Requires designing APIs for toast, stream, and inline rendering contexts
  • ➖ Introduces broader refactoring beyond this targeted audit
2. Production-only error filtering boundary
  • ➕ Provides a final safeguard against uncaught client error leakage
  • ➕ Centralizes fallback presentation for rendering failures
  • ➖ Does not sanitize successful responses containing backend error strings
  • ➖ Loses operation-specific recovery guidance without local handling

Recommendation: The localized approach is appropriate for this focused remediation because it preserves context-specific user guidance with minimal behavioral risk. A follow-up shared reporting helper is worthwhile to prevent regressions, while a global boundary should remain defense-in-depth rather than replace local sanitization.

Files changed (13) +63 / -34

Bug fix (13) +63 / -34
actions.tsxSanitize resolution-search stream failures+1/-1

Sanitize resolution-search stream failures

• Replaces the raw resolution-search exception message in the streamable value with generic retry guidance. Detailed parsing and initialization errors remain available through the existing console log.

app/actions.tsx

chat-share.tsxHide collaborator operation exceptions+4/-2

Hide collaborator operation exceptions

• Stops exposing invitation and removal exception messages through toasts. Adds contextual console logging and user-safe retry instructions for both operations.

components/chat-share.tsx

clear-history.tsxSanitize clear-history toast errors+2/-1

Sanitize clear-history toast errors

• Logs the server-returned history clearing error to the console and replaces it with a generic retry toast.

components/clear-history.tsx

copilot-optimized.tsxPresent safe optimized Copilot errors+10/-4

Present safe optimized Copilot errors

• Logs stream errors through an effect instead of rendering their contents. Displays a styled, generic inquiry-generation error card with retry guidance.

components/copilot-optimized.tsx

copilot.tsxPresent safe Copilot errors+10/-4

Present safe Copilot errors

• Adds effect-based console diagnostics for inquiry stream failures. Replaces raw error rendering with a styled, generic retry message.

components/copilot.tsx

download-report-button.tsxSanitize report generation failures+1/-1

Sanitize report generation failures

• Removes exception text from the report-generation toast while retaining the existing detailed console error.

components/download-report-button.tsx

message.tsxAdd safe bot stream error state+15/-1

Add safe bot stream error state

• Logs bot stream failures from an effect and replaces the minimal error output with a styled, actionable fallback. Raw stream errors are no longer shown to users.

components/message.tsx

settings.tsxHide settings save exceptions+2/-1

Hide settings save exceptions

• Adds contextual console logging when settings persistence fails. The destructive toast now always uses safe, generic retry guidance.

components/settings/components/settings.tsx

system-prompt-form.tsxSanitize prompt generation errors+4/-2

Sanitize prompt generation errors

• Logs server details for prompt-generation startup and polling failures. Both toast paths now display generic stage-specific recovery messages.

components/settings/components/system-prompt-form.tsx

user-management-form.tsxSanitize add-user validation feedback+3/-2

Sanitize add-user validation feedback

• Logs server-returned add-user failures and replaces them in both toast and field validation surfaces. Users receive concise guidance without backend details.

components/settings/components/user-management-form.tsx

chat-history-client.tsxNormalize safe chat-history errors+5/-12

Normalize safe chat-history errors

• Consolidates unknown and typed failure handling for loading and clearing history. Original errors are logged while state and toasts receive sanitized messages.

components/sidebar/chat-history-client.tsx

skyfi-section.tsxHide SkyFi stream error details+2/-1

Hide SkyFi stream error details

• Logs the SkyFi tool stream error and replaces its rendered exception text with a generic service communication message.

components/skyfi-section.tsx

retrieve.tsxSanitize retrieval tool failure output+4/-2

Sanitize retrieval tool failure output

• Removes raw retrieval exceptions from accumulated assistant responses and streamed cards. The original API failure remains logged for debugging while the requested URL retains operation context.

lib/agents/tools/retrieve.tsx

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (1)📘 Rule violations (0)📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Render repeatedly logs errors 🐞 Bug◔ Observability
Description
SkyfiSection calls console.error directly during render, so once the stream has failed every
subsequent render emits the same error again and can flood or obscure the diagnostic console. The
other changed stream consumers log on error transitions with useEffect, which avoids this
duplication.
Code

components/skyfi-section.tsx[39]

+ console.error('SkyFi tool execution error:', error)
Evidence
The component reads reactive stream state and executes the added log inside its render-time error
branch. In contrast, the PR's BotMessage and Copilot changes place the same diagnostic behavior in
effects keyed by error, demonstrating the non-repeating lifecycle intended for these logs.

components/skyfi-section.tsx[16-39]
components/message.tsx[13-20]
components/copilot.tsx[99-103]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
`SkyfiSection` logs stream errors during render, causing duplicate log entries whenever the component rerenders with the same error.
## Issue Context
Move the diagnostic side effect out of the render branch and trigger it only when `error` changes, matching the other stream-rendering components in this PR.
## Fix Focus Areas
- components/skyfi-section.tsx[16-39]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
Review mode: ⚖️ Balanced: This is a behavior-changing, user-facing error-handling update spanning 13 files and 16 independent sites, including server actions, tool execution, and authorization-related user management; it warrants a careful single-pass review but is not dense enough to justify redundant extended passes.

Grey Divider

Tip of the day
💡 Did you know, you can ask Qodo to dismiss a finding you disagree with, with your reason on record

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo


// Handle stream error explicitly
if (error) {
console.error('SkyFi tool execution error:', error)

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.

Remediation recommended

1. Render repeatedly logs errors 🐞 Bug◔ Observability

SkyfiSection calls console.error directly during render, so once the stream has failed every
subsequent render emits the same error again and can flood or obscure the diagnostic console. The
other changed stream consumers log on error transitions with useEffect, which avoids this
duplication.
Agent Prompt
## Issue description
`SkyfiSection` logs stream errors during render, causing duplicate log entries whenever the component rerenders with the same error.
## Issue Context
Move the diagnostic side effect out of the render branch and trigger it only when `error` changes, matching the other stream-rendering components in this PR.
## Fix Focus Areas
- components/skyfi-section.tsx[16-39]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Sign up for freeto 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

@ngoiyaeric@CLAassistant