Skip to content

feat(snuba): Add AI_CONVERSATION trace item type - #372

Draft
pbhandari wants to merge 1 commit into
mainfrom
feat/ai-conversation-trace-item-type
Draft

feat(snuba): Add AI_CONVERSATION trace item type#372
pbhandari wants to merge 1 commit into
mainfrom
feat/ai-conversation-trace-item-type

Conversation

@pbhandari

Copy link
Copy Markdown
Contributor

Summary

Adds TRACE_ITEM_TYPE_AI_CONVERSATION to the TraceItemType enum in snuba/v1.

AI conversations can be queried through the existing TraceItemTable endpoint by setting RequestMeta.trace_item_type to this new value. TraceItemTable already supports everything the use case needs:

  • Arbitrary field selection via columns (each Column may be a plain attribute)
  • Aggregation (sum, count, …) via Column.aggregation
  • Conditional aggregation (sumIf / countIf) via Column.conditional_aggregation
  • Filtering via filter, ordering via order_by, and HAVING via aggregation_filter

So no new endpoint is required — a dedicated GetAiConversations request/response would have been a strict subset of TraceItemTableRequest. Adding an enum value is backwards compatible.

Test plan

  • buf lint / buf format pass (pre-commit)
  • protoc compiles the package cleanly

🤖 Generated with Claude Code

@pbhandari
pbhandari requested a review from a team as a code owner July 20, 2026 15:28
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow ci / buf-checks (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJul 20, 2026, 3:33 PM

@pbhandari
pbhandari marked this pull request as draft July 20, 2026 15:28
TRACE_ITEM_TYPE_PROCESSING_ERROR = 13;
TRACE_ITEM_TYPE_AI_CONVERSATION = 14;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The auto-generated Rust code in rust/src/sentry_protos.snuba.v1.rs is out of sync with the updated protobuf definition, missing the new TRACE_ITEM_TYPE_AI_CONVERSATION enum variant.
Severity: CRITICAL

Suggested Fix

Run the code generation script to update the auto-generated Rust files. Based on the CI configuration, this can be done by running make build-rust locally. Commit the updated rust/src/sentry_protos.snuba.v1.rs file to ensure the Rust code is synchronized with the protobuf definition before merging.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: proto/sentry_protos/snuba/v1/request_common.proto#L80

Potential issue: The protobuf definition in `request_common.proto` was updated to
include `TRACE_ITEM_TYPE_AI_CONVERSATION`, but the corresponding auto-generated Rust
code in `rust/src/sentry_protos.snuba.v1.rs` was not regenerated. As a result, the Rust
`TraceItemType` enum is missing the `AiConversation` variant. This will cause
deserialization failures when any Rust service attempts to process a protobuf message
containing `trace_item_type = 14`. The value may be incorrectly interpreted as
`Unspecified` or cause a runtime error, preventing the new feature from working in
Rust-based consumers.

Did we get this right? 👍 / 👎 to inform future reviews.

@pbhandari
pbhandari force-pushed the feat/ai-conversation-trace-item-type branch from 031916c to 61fe235 Compare July 20, 2026 15:33
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.

1 participant