chore(event formatter): add new event formatter to rpc - #119938
chore(event formatter): add new event formatter to rpc#119938shayna-ch wants to merge 7 commits into
Conversation
|
bugbot run |
There was a problem hiding this comment.
✅ 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.
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 d82bf51. Configure here.
| max_single_breadcrumb_chars=500, | ||
| max_request_chars=2_000, | ||
| max_spans_chars=5_000, | ||
| ) |
There was a problem hiding this comment.
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)
Reviewed by Cursor Bugbot for commit d82bf51. Configure here.
| 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, | ||
| ) |
There was a problem hiding this comment.
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-170src/sentry/seer/agent/tools.py
Did we get this right? 👍 / 👎 to inform future reviews.


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:
The rendered text comes back in a new optional formatted field on EventDetailsResponse.
No behavioral change on merge. behind the
issues.standardized-markdown-for-llmoption. Rollout will happen gradually via feature flag.