Skip to content

refactor: rename onTrace to onError - #2121

Merged
suhasdeshpande merged 4 commits into
mainfrom
suhas/rename-on-error
Jul 7, 2025
Merged

suhasdeshpande merged 4 commits into
mainfrom
suhas/rename-on-error

Conversation

@suhasdeshpande

@suhasdeshpande suhasdeshpande commented Jul 7, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Introduced a dedicated error event handler (onError) for enhanced error reporting and observability.
  • Refactor

    • Replaced all references to the previous trace event system with the new error event system across components, hooks, runtime logic, and shared types.
    • Updated internal and public interfaces, replacing onTrace with onError and related type names for clarity.
  • Documentation

    • Revised documentation to reflect the new error handling approach, updating examples and descriptions to use onError and CopilotErrorHandler.

- Rename CopilotTraceEvent to CopilotErrorEvent and CopilotTraceHandler to CopilotErrorHandler
- Update CopilotRuntime class to use onError instead of onTrace
- Update all React core components and hooks to use onError terminology
- Update GraphQL resolver to use errorGraphQLError method name
- Rename test files from *-trace.test.* to *-error.test.* and update content
- Update documentation to reference onError instead of onTrace
- Fix linter errors in example files (Next.js Image components, useEffect dependencies)
- Fix Jest type configuration in react-core package

This refactor provides better semantic clarity by using 'error' terminology
instead of 'trace' for error handling throughout the CopilotKit codebase.
- Update CopilotRuntime.mdx to use CopilotErrorHandler instead of CopilotTraceHandler
- Update CopilotKit.mdx to use CopilotErrorHandler instead of CopilotTraceHandler
- Update documentation terminology from 'tracing' to 'error handling'

These changes were auto-generated during the precommit hook after the
onTrace to onError refactor.
@vercel

vercel Bot commented Jul 7, 2025 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
copilotkit-feature-viewer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 5:49pm
demo-viewer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 5:49pm
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 5:49pm
examples-coagents-ai-travel-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 5:49pm
examples-coagents-research-canvas-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2025 5:49pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
examples-coagents-ai-researcher-ui ⬜️ Ignored (Inspect) Visit Preview Jul 7, 2025 5:49pm

@coderabbitai

coderabbitai Bot commented Jul 7, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes systematically rename and refocus all tracing-related types, handlers, props, methods, and documentation from "trace" to "error" semantics throughout the CopilotKit codebase. This affects shared types, runtime, React components, hooks, context, tests, and documentation, shifting the observability and debugging interface from tracing events to error events.

Changes

File(s) Change Summary
.../src/types/error.ts, .../src/types/index.ts Renamed CopilotTraceEvent/CopilotTraceHandler to CopilotErrorEvent/CopilotErrorHandler; updated exports.
.../src/components/copilot-provider/copilotkit-props.ts, .../src/context/copilot-context.tsx Changed prop/context from onTrace?: CopilotTraceHandler to onError?: CopilotErrorHandler; updated imports and docs.
.../src/components/copilot-provider/copilotkit.tsx, .../copilot-messages.tsx Replaced all internal usage and passing of onTrace with onError.
.../src/hooks/use-chat.ts, .../hooks/use-copilot-runtime-client.ts Updated to use onError callback instead of onTrace; changed types and event handling accordingly.
.../src/lib/runtime/copilot-runtime.ts Refactored runtime to use error event system: renamed methods, handler, and event types from trace to error.
.../src/graphql/resolvers/copilot.resolver.ts Changed error reporting from traceGraphQLError to errorGraphQLError.
.../src/lib/runtime/tests/copilot-runtime-error.test.ts, .../tests/copilotkit-error.test.tsx Updated tests to use error event/handler types and semantics instead of trace.
.../tsconfig.json Added Jest types to TypeScript config; simplified test file exclusion.
docs/content/docs/reference/classes/CopilotRuntime.mdx, docs/content/docs/reference/components/CopilotKit.mdx Updated documentation to describe onError and error handling instead of onTrace/tracing.

Sequence Diagram(s)

sequenceDiagram
    participant UI as React Component
    participant Context as CopilotContext
    participant Runtime as CopilotRuntime
    participant Handler as onError Handler

    UI->>Context: Triggers error event (e.g., UI error)
    Context->>Runtime: Passes error context
    Runtime->>Handler: Calls onError(errorEvent)
    Handler-->>Runtime: Handles error event (async/sync)
Loading

Possibly related PRs

Suggested reviewers

  • mme
  • ataibarkai
  • ranst91
  • tylerslaton

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 35f1030 and a84b897.

📒 Files selected for processing (1)
  • CopilotKit/.changeset/early-weeks-tap.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • CopilotKit/.changeset/early-weeks-tap.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
  • GitHub Check: Build Images (coagents-qa-native, ui)
  • GitHub Check: Build Images (coagents-qa-text, agent, python, local-deps)
  • GitHub Check: Build Images (next-openai, next-openai)
  • GitHub Check: Build Images (coagents-qa-text, ui)
  • GitHub Check: Build Images (coagents-research-canvas, ui)
  • GitHub Check: Build Images (coagents-routing, ui)
  • GitHub Check: Build Images (coagents-routing, agent, python, local-deps)
  • GitHub Check: Build Images (coagents-research-canvas, agent, python, local-deps)
  • GitHub Check: Test (18.x)
  • GitHub Check: Test (20.x)

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@changesets-bot-copilotkit

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a84b897

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@copilotkit/react-core Patch
@copilotkit/runtime Patch
@copilotkit/shared Patch
@copilotkit/react-textarea Patch
@copilotkit/react-ui Patch
@copilotkit/runtime-client-gql Patch
@copilotkit/sdk-js Patch

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Jul 7, 2025 •

Copy link
Copy Markdown
Contributor

Preview environments destroyed for this pull request.

@github-actions

github-actions Bot commented Jul 7, 2025 •

Copy link
Copy Markdown
Contributor

Test Results

Status: ✅ Passed (View Run)

Commit: cd78737

Duration: 234.4s

Total Tests: 20

Pass Rate: 100.0%

Failed Tests: 0

🔍 Detailed Results

coagents-research-canvas

CoAgents Research Canvas (UI) - Local Depenencies

Model Browser Status Video
OpenAI chromium ✅ PASSED -
Anthropic chromium ✅ PASSED -
CrewAI chromium ✅ PASSED -

coagents-qa-native

CoAgents QA Native (UI) - Local

Model Browser Status Video
OpenAI chromium ✅ PASSED -
Anthropic chromium ✅ PASSED -

coagents-qa-text

CoAgents QA Text (UI) - Local

Model Browser Status Video
OpenAI chromium ✅ PASSED -
Anthropic chromium ✅ PASSED -
OpenAI (LGC Python) chromium ✅ PASSED -
Anthropic (LGC Python) chromium ✅ PASSED -
OpenAI (LGC JS) chromium ✅ PASSED -
Anthropic (LGC JS) chromium ✅ PASSED -

coagents-routing

CoAgents Routing (UI) - Local

Model Browser Status Video
OpenAI chromium ✅ PASSED -
Anthropic chromium ✅ PASSED -

next-openai

Next OpenAI - Self Hosted

Model Browser Status Video
OpenAI chromium ✅ PASSED -
Anthropic chromium ✅ PASSED -
Google Generative AI chromium ✅ PASSED -
LangChain (OpenAI) chromium ✅ PASSED -
LangChain (Anthropic) chromium ✅ PASSED -
LangChain (Gemini) chromium ✅ PASSED -
Groq chromium ✅ PASSED -

This branch was successfully deployed

5 active deployments
Preview – docs — a84b8970 Deployed Jul 7, 2025 by vercel[bot]
Preview – demo-viewer — a84b8970 Deployed Jul 7, 2025 by vercel[bot]
Preview – copilotkit-feature-viewer — a84b8970 Deployed Jul 7, 2025 by vercel[bot]
Preview – examples-coagents-research-canvas-ui — a84b8970 Deployed Jul 7, 2025 by vercel[bot]
Preview – examples-coagents-ai-travel-app — a84b8970 Deployed Jul 7, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant