Skip to content

[4366] fix(frontend): exclude annotations from raw span view#4505

Closed
ashrafchowdury wants to merge 2 commits into
mainfrom
code/flamboyant-cori-c08768
Closed

[4366] fix(frontend): exclude annotations from raw span view#4505
ashrafchowdury wants to merge 2 commits into
mainfrom
code/flamboyant-cori-c08768

Conversation

@ashrafchowdury
Copy link
Copy Markdown
Contributor

Summary

Closes #4366.

When a user opened the Raw Data tab on a parent span, the JSON payload still appeared to contain its child spans even after PR #4417 stripped spans / children / key / invocationIds / aggregatedEvaluatorMetrics.

The remaining leak comes from annotations. An annotation's evaluator inputs often embed a full snapshot of the trace subtree, e.g.:

annotations[0].data.inputs.trace.spans.completion_v0.spans.litellm_client.*

That snapshot reads visually as "child spans are showing up in the parent's raw view."

The fix

Add annotations to the strip list in getRawTraceSpanData.

Annotations:

  • are not part of the backend span schema (not in traceSpanSchema, not in TraceSpan / TraceSpanNode),
  • are bolted onto trace nodes by the frontend in attachAnnotationsToTraces,
  • are already rendered in their own dedicated Annotations tab in the trace drawer (TraceContent/index.tsx).

So dropping them from Raw Data removes the embedded trace snapshot with no UX loss.

Test plan

  • Open a parent span in observability that has annotations whose evaluator inputs include the trace
  • Switch to the Raw Data tab
  • Confirm the JSON no longer contains an annotations field (and therefore no nested spans / parent_id from child spans)
  • Switch to the Annotations tab and confirm annotations still render correctly
  • pnpm lint-fix in web passes (already verified locally)

🤖 Generated with Claude Code

Annotations are a frontend sidecar attached to trace nodes by
attachAnnotationsToTraces, not part of the backend span payload. Their
evaluator inputs often embed a snapshot of the trace subtree, which made
a parent span's Raw Data tab visually surface as if it contained its
children. Annotations are already rendered in their own dedicated tab.

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

vercel Bot commented May 31, 2026

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

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment May 31, 2026 7:20pm

Request Review

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working Frontend labels May 31, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 31, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9d0e2826-e6ce-4767-9da4-4b14f6058bf8

📥 Commits

Reviewing files that changed from the base of the PR and between a269527 and ae41a6b.

📒 Files selected for processing (1)
  • web/oss/src/components/SharedDrawers/TraceDrawer/components/TraceContent/assets/helpers.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added support for annotations in trace span data.

Walkthrough

A single helper file is updated to support an optional annotations field on trace span nodes. The internal type TraceSpanNodeWithRawViewFields adds the field, and the getRawTraceSpanData function destructures it alongside other span properties.

Changes

Trace Span Annotations Field Support

Layer / File(s) Summary
Trace span annotations field support
web/oss/src/components/SharedDrawers/TraceDrawer/components/TraceContent/assets/helpers.ts
Internal type TraceSpanNodeWithRawViewFields adds optional annotations?: unknown field. Function getRawTraceSpanData destructures annotations from span input to align with the expanded type contract.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • Agenta-AI/agenta#4417: Both PRs modify the same helpers.ts file and update getRawTraceSpanData to extend raw-span field handling—this PR adds annotations while the retrieved PR introduces the baseline raw-span field-stripping behavior.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main change: excluding annotations from the raw span view in the frontend, matching the primary objective of issue #4366.
Description check ✅ Passed The description is comprehensive and clearly explains the problem, solution, and testing approach, all directly related to the changeset.
Linked Issues check ✅ Passed The PR successfully addresses issue #4366 by adding annotations to the strip list in getRawTraceSpanData, preventing child-span data from appearing in the parent's Raw Data view.
Out of Scope Changes check ✅ Passed All changes are scoped to the stated objective of excluding annotations from the raw span view with no extraneous modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch code/flamboyant-cori-c08768

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 and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 31, 2026

Railway Preview Environment

Status Destroyed (PR closed)

Updated at 2026-06-01T07:11:35.703Z

@mmabrouk
Copy link
Copy Markdown
Member

mmabrouk commented Jun 1, 2026

Thanks @ashrafchowdury but I actually kept it intentionally. The idea is that we would allow a user to add the traces including the annotation to a test set directly (and show thereby the annotations in the raw view).

@mmabrouk mmabrouk closed this Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Frontend size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parent raw span view shows child spans

2 participants