Skip to content

chore(event formatter): add new event formatter to rpc - #119938

Open
shayna-ch wants to merge 7 commits into
shayna-ch/formatter-backend-2from
shayna-ch/format-seer-rpc
Open

chore(event formatter): add new event formatter to rpc#119938
shayna-ch wants to merge 7 commits into
shayna-ch/formatter-backend-2from
shayna-ch/format-seer-rpc

Conversation

@shayna-ch

@shayna-ch shayna-ch commented Jul 17, 2026

Copy link
Copy Markdown
Member

to be merged after #119862

Extends the existing get_event_details Seer RPC (src/sentry/seer/agent/tools.py) to optionally return shared-formatter output, so Seer can drop its own EventDetails.format_event. Adds three optional params:

  • format (markdown | xml | None) — when set, the RPC renders the serialized event through the shared formatter.
  • format_limits ("default" | "low") — selects the truncation limits (adds LIMITS_LOW to mirror Seer's low-limit profile).
  • include_breadcrumbs (default True) — drops the breadcrumbs section when False.

The rendered text comes back in a new optional formatted field on EventDetailsResponse.

No behavioral change on merge. behind the issues.standardized-markdown-for-llm option. Rollout will happen gradually via feature flag.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 17, 2026
@shayna-ch shayna-ch changed the title rpc chore(event formatter): add new event formatter to rpc Jul 20, 2026
@shayna-ch

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 2b3a837. Configure here.

@shayna-ch
shayna-ch marked this pull request as ready for review July 20, 2026 19:44
@shayna-ch
shayna-ch requested review from a team as code owners July 20, 2026 19:44

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d82bf51. Configure here.

max_single_breadcrumb_chars=500,
max_request_chars=2_000,
max_spans_chars=5_000,
)

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.

Low limits uncap contexts

Medium Severity

LIMITS_LOW omits max_contexts_chars, so format_limits="low" leaves the Contexts section uncapped while format_limits="default" truncates at 5,000 characters. Token-constrained RPC callers can get larger formatted output under the low profile than under default on context-heavy events.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d82bf51. Configure here.

Comment on lines +33 to +40
LIMITS_LOW = Limits(
max_exceptions_chars=50_000,
max_stacktrace_chars=10_000,
max_breadcrumbs_chars=5_000,
max_single_breadcrumb_chars=500,
max_request_chars=2_000,
max_spans_chars=5_000,
)

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.

Bug: The LIMITS_LOW constant omits max_contexts_chars, causing it to default to None. This results in no character limit for the contexts section, contrary to its intended purpose.
Severity: MEDIUM

Suggested Fix

Add the max_contexts_chars field to the LIMITS_LOW constant in src/sentry/issues/formatting/limits.py. Set its value to be equal to or less than the corresponding value in LIMITS_DEFAULT to ensure it provides a stricter cap.

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: src/sentry/issues/formatting/limits.py#L33-L40

Potential issue: The `LIMITS_LOW` constant, intended to provide tighter character caps,
omits the `max_contexts_chars` field. This causes the value to default to `None`. When
formatting an issue's context section with `format_limits="low"`, the `_truncate`
function receives `None` and does not apply any character limit. This results in
unbounded output for the contexts section, which is contrary to the feature's goal of
providing a more restrictive limit profile than the default. This can cause issues for
token-constrained callers, such as LLMs, which expect a capped output size.

Also affects:

  • src/sentry/issues/formatting/sections.py:166-170
  • src/sentry/seer/agent/tools.py

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant