feat: add sentry conversation command group#1020
Conversation
Add `sentry ai-conversations list` and `sentry ai-conversations view` commands for browsing AI conversations from Sentry Explore. - list: paginated conversation list with tokens, tool calls, errors - view: full transcript with turns, user/assistant messages, tool calls - Transcript parsing ported from sentry-mcp get-ai-conversation-details Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
- Forward start/end params for absolute date ranges (GGA-VPD) - Guard against Infinity timestamps on empty spans (5RV-D34) - Consolidate view formatter into formatTranscriptResult - Fix tsc strict null check on span index lookup Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Addressed both Warden findings in 3021223: GGA-VPD (absolute date ranges silently ignored): 5RV-D34 (Infinity timestamps on empty spans): Also consolidated the duplicate view formatter into AI-generated, verified against tsc and updated code. |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add docs/src/fragments/commands/ai-conversations.md (required by CI) - Fix generate-sdk.ts to quote hyphenated route names in generated TS Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use schema option in apiRequestToRegion for proper Zod validation with Sentry context instead of bare .parse() (silent-failure-hunter) - Use MAX_PAGINATION_PAGES instead of hardcoded 10 (silent-failure-hunter) - Log warning when pagination limit exhausted (silent-failure-hunter) - Use reduce instead of Math.min/max spread for large arrays (silent-failure-hunter) - Guard formatEpoch against NaN/zero timestamps (silent-failure-hunter) - Re-export types from src/types/index.ts barrel (type-design-analyzer) - Export ConversationTurn and ToolCall types (type-design-analyzer) - Use barrel imports in commands (code-reviewer) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix lint: use Number.POSITIVE/NEGATIVE_INFINITY, reorder imports - Fix formatTimestamp treating unix seconds as milliseconds (showed 1970 dates) - Preserve --query filter in pagination hints - Surface truncation warning when transcript exceeds pagination limit - Make view command org optional with resolveOrg fallback - Register ai-conversations commands in ORG_ONLY_COMMANDS for completions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Results 📊✅ Patch coverage is 92.18%. Project has 4301 uncovered lines. Files with missing lines (2)
Generated by Codecov Action |
- Filter out messages with null content instead of JSON-stringifying them - Align DEFAULT_PERIOD (14d) with LIST_PERIOD_FLAG default (7d) - Widen view span lookup from 30d to 90d to cover older conversations Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
90d causes performance issues (sentry#7253568394). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Validate conversation-id is present before API call (zero-arg case) - Sanitize user/assistant content and tool names to prevent terminal injection from stored AI responses containing ANSI/control characters Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Follow CLI convention of singular resource names (issue, trace, replay). Command is now `sentry conversation list` / `sentry conversation view`. Renames all files, imports, pagination keys, usage hints, docs fragments, completions sets, and AGENTS.md architecture tree. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
sentry ai-conversations command groupsentry conversation command group
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ddcb856. Configure here.
- Fix sanitize() removing newlines before split (multi-line content) - Sanitize conversationId in list table output - Mark conversation-id positional as optional for Stricli compatibility - Add formatter tests covering table, turns, transcript, and edge cases Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- list command: org resolution, query/time params, pagination hints, empty results (14 tests) - view command: positional parsing, resolveOrg fallback, truncation, errors (11 tests) - API module: listConversations params/pagination, getConversationSpans multi-page/truncation (20 tests) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Sanitize turn.model, turn.agentName, and tc.status in terminal output - Extract appendContentBlock to reduce cognitive complexity - Add 19 more formatter tests covering content extraction edge cases, tool calls, metadata rendering, and operation type detection Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Sanitize conversationId, org, and projects in formatTranscriptResult - Sanitize org in list command human output - Update docs fragment to use `conversation` instead of old `ai-conversations` - Fix inaccurate "List last 10" comment (default limit is 25) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Summary
sentry conversation list— paginated list of AI conversations for an org (tokens, tool calls, errors, first input, user)sentry conversation view [org] <conversation-id>— full transcript with turns, user/assistant messages, tool callsget-ai-conversation-detailstool for feature paritybuildListCommand/buildCommand, pagination,resolveOrg, formattersNew files
src/commands/conversation/— route map, list, view commandssrc/lib/api/conversations.ts— API functions (list + detail endpoints)src/lib/formatters/conversation.ts— table formatter + transcript parsersrc/types/conversation.ts— Zod schemas for list items and conversation spansTest plan
sentry conversation listshows recent conversationssentry conversation list my-orgwith explicit orgsentry conversation list --jsonoutputs JSON envelopesentry conversation list -c nextpagination workssentry conversation view my-org conv-123shows transcriptsentry conversation view conv-123with auto-detected orgsentry conversation view my-org conv-123 --jsonoutputs structured JSONnpx tsc --noEmit— no errors in new files)🤖 Generated with Claude Code