ADFA-2801 | Prevent oversized feedback email payloads#925
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdded a public MAX_EMAIL_BODY_CHARS and sanitizeEmailBody to FeedbackEmailHandler to truncate long email bodies; FeedbackManager now uses exception-based startActivity handling (distinguishing ActivityNotFoundException and TransactionTooLargeException) when launching the email intent; added string resource msg_feedback_log_too_long. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant FeedbackMgr as FeedbackManager
participant EmailHandler as FeedbackEmailHandler
participant System as Email App / OS
User->>FeedbackMgr: Request send feedback
FeedbackMgr->>EmailHandler: Build email intent (body, attachments)
EmailHandler->>EmailHandler: sanitizeEmailBody(body, hasLogAttachment) -> safeBody
EmailHandler-->>FeedbackMgr: Return intent with safeBody
FeedbackMgr->>System: startActivity(emailIntent)
alt Email app opens
System-->>User: Email composer shown
else ActivityNotFoundException thrown
System--X FeedbackMgr: ActivityNotFoundException
FeedbackMgr->>User: Show "no email app" toast
else TransactionTooLargeException thrown
System--X FeedbackMgr: TransactionTooLargeException
FeedbackMgr->>System: Log error
FeedbackMgr->>User: Show "log too large" toast
else Other exception
System--X FeedbackMgr: Exception
FeedbackMgr->>System: Post ReportCaughtExceptionEvent
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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. Comment |
c307d7d to
ba9252d
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@common/src/main/java/com/itsaky/androidide/utils/FeedbackEmailHandler.kt`:
- Around line 42-44: The truncation footer currently always says "See attached
file." even when getLogUri failed and no attachment exists; update the
truncation text generation in FeedbackEmailHandler (the append(...) block
building the footer) to conditionally include "See attached file." only when a
log attachment is actually present (e.g., based on a hasLogAttachment flag or by
checking attachmentUris contains the log URI), otherwise produce a generic
message like "(Log truncated: X chars omitted.)"; also update the call site that
builds the email to pass a boolean hasLogAttachment (or to set/track log
attachment presence separately when calling the builder), and ensure getLogUri
failure leaves attachmentUris empty so the condition is reliable.
common/src/main/java/com/itsaky/androidide/utils/FeedbackEmailHandler.kt
Outdated
Show resolved
Hide resolved
6f95c8d to
b3265ab
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@common/src/main/java/com/itsaky/androidide/utils/FeedbackManager.kt`:
- Around line 344-362: The exception handling block in FeedbackManager is
missing cases where e is a TransactionTooLargeException (not just wrapped), and
the fallback branch provides no user feedback; update the when block to treat
both "e is TransactionTooLargeException" and "e is RuntimeException && e.cause
is TransactionTooLargeException" the same way (log via logger.error and show
Toast with R.string.msg_feedback_log_too_long), and in the else branch add a
user-facing Toast (e.g., generic "feedback failed" message) before posting
ReportCaughtExceptionEvent and calling EventBus.getDefault().post; reference the
existing variables/methods e, logger.error, Toast.makeText,
ReportCaughtExceptionEvent, and getCurrentScreenName(activity) when making these
changes.
🧹 Nitpick comments (1)
common/src/main/java/com/itsaky/androidide/utils/FeedbackEmailHandler.kt (1)
157-162: ParameterattachmentUrisshould beList<Uri>instead ofMutableList<Uri>.The function only reads from this list. Accepting
MutableListunnecessarily widens the contract.Suggested change
fun getIntentBasedOnAttachments( emailRecipient: String, subject: String, body: String, - attachmentUris: MutableList<Uri> + attachmentUris: List<Uri> ): Intent {
e763a16 to
4a33126
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@common/src/main/java/com/itsaky/androidide/utils/FeedbackEmailHandler.kt`:
- Line 163: The sanitized body is computed before checking attachments so
sanitizeEmailBody(body) uses the default hasLogAttachment=true and may mention
an attachment that doesn't exist; fix by deriving hasLogAttachment from the
actual inputs (e.g., attachmentUris.isNotEmpty() or whether getLogUri succeeded)
or by moving the safeBody calculation into the branch that knows if an
attachment exists, and update prepareEmailIntent (and its callers) to accept and
pass that hasLogAttachment flag so sanitizeEmailBody(body, hasLogAttachment) is
called with the correct value; locate usages in FeedbackEmailHandler.kt
(sanitizeEmailBody, prepareEmailIntent, attachmentUris, getLogUri) and adjust
accordingly.
common/src/main/java/com/itsaky/androidide/utils/FeedbackEmailHandler.kt
Outdated
Show resolved
Hide resolved
f68203a to
9d270ed
Compare
9d270ed to
f73ceb5
Compare
…d user feedback for unknown failures.
f73ceb5 to
c4034aa
Compare
Description
This PR prevents
TransactionTooLargeExceptionwhen sending feedback by truncating oversized email body content before building the intent, while keeping full logs available via file attachments. It also removes the pre-flightresolveActivity()check and relies on a safestartActivity()call with a user-facing fallback.Details
Sentry showed
TransactionTooLargeException(~15 MB parcel) triggered during intent resolution/start due to an oversizedIntent.EXTRA_TEXTpayload; the email body is now bounded to a safe size to avoid Binder limits.Before changes
Screen.Recording.2026-02-04.at.11.04.59.AM.mov
After changes
Screen.Recording.2026-02-04.at.11.13.09.AM.mov
Ticket
ADFA-2801
Observation
The issue was caused by large diagnostic text being included directly in the email body; limiting
EXTRA_TEXTkeeps the intent payload within Binder limits without changing attachment behavior.