feat(transport): TUS upload for large attachments#1545
Merged
Conversation
da2ce2d to
0946169
Compare
Collaborator
Author
|
@sentry review |
Collaborator
Author
|
@cursor review |
Collaborator
Author
|
@cursor review |
Collaborator
Author
|
@cursor review |
Collaborator
Author
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed:
copy_file_rangefallback misses common filesystem errors- Expanded the
copy_file_rangefallback condition to also break onEXDEV,EOPNOTSUPP, andEINVALso the read/write fallback handles these recoverable cases.
- Expanded the
Or push these changes by commenting:
@cursor push 76476611c4
Preview (76476611c4)
diff --git a/src/path/sentry_path_unix.c b/src/path/sentry_path_unix.c
--- a/src/path/sentry_path_unix.c
+++ b/src/path/sentry_path_unix.c
@@ -362,7 +362,8 @@
goto done;
} else if (errno == EAGAIN || errno == EINTR) {
continue;
- } else if (errno == ENOSYS) {
+ } else if (errno == ENOSYS || errno == EXDEV || errno == EOPNOTSUPP
+ || errno == EINVAL) {
break;
} else {
rv = 1;a69528d to
44d6ecc
Compare
Collaborator
Author
|
@cursor review |
3bc1ee2 to
37004bf
Compare
Collaborator
Author
|
@cursor review |
eb0ead2 to
4ad89c0
Compare
b133fd6 to
93db900
Compare
6d860cd to
a07948d
Compare
c3f7b7f to
bd32f9e
Compare
Separate retry enqueue handling from final cache_keep storage so client reports are only preserved as retry state when an envelope is actually queued for retry. Keep attachment-ref files only when the persisted envelope still references them. Prune any attachment-ref paths recovered from malformed raw envelopes before dropping them to avoid leaving staged cache siblings behind. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Remove cache siblings by event id when a raw attachment-ref envelope cannot be materialized. This avoids depending on partially parsed items, which may miss attachment-ref paths from the corrupted part of the envelope. Keep the UUID-based sibling cleanup in the cache layer alongside the existing cache sibling removal code. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Keep cache_prune_siblings focused on the synchronous cleanup path. Enabling cache_keep during init schedules transport cleanup in transport-enabled unit runs, which can race with the test's direct cache setup. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Delete the destination path when staging an attachment-ref fails. Copy and buffer-write failures can leave partial files behind, and those should not remain as unreferenced cache siblings. Co-Authored-By: OpenAI Codex <noreply@openai.com>
174dcb1 to
a54f799
Compare
mujacica
reviewed
Apr 29, 2026
Remove the global TUS availability flag. A failed TUS create request should drop only the affected attachment-ref while still allowing later attachment refs to try uploading. This keeps upload errors local to each attachment-ref now that large uploads are controlled by the explicit enable_large_attachments option. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Move TUS-specific unit tests from test_envelopes.c to test_tus.c so envelope tests stay focused on envelope behavior. Rename the TUS integration tests to shorter test_tus_* names and cover small inline attachments in the upload happy path instead of a separate test. The "no TUS at all" -case is already covered by the normal HTTP tests. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Mention the Relay upload endpoint feature required for out-of-band large attachments and link to the attachment placeholder docs. Co-Authored-By: OpenAI Codex <noreply@openai.com>
mujacica
approved these changes
Apr 30, 2026
When the shutdown timeout interrupts an in-flight TUS upload, keep the attachment-ref cache siblings with the envelope dumped by the transport. This lets the next startup retry the upload instead of losing the large attachment. Track timeout-caused send failures in curl and WinHTTP so normal upload errors still drop the attachment-ref and send the envelope without it. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Treat attachment-ref resolution failures after a successful TUS upload as a transport error instead of discarding the reference. This keeps the event and uploaded attachment reference together for retry or cache handling. Co-Authored-By: OpenAI Codex <noreply@openai.com>
6500ab3 to
af0a8f5
Compare
Fall back to the existing retry/cache/discard handling when persisting a TUS shutdown envelope fails. This restores the saved client report and keeps discard accounting consistent with other network errors. Co-Authored-By: OpenAI Codex <noreply@openai.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 730b3a2. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


attachment-refenvelope itemsdb/cache/<uuid>-*attachment-refto the server via TUS before sending the envelopeExamples:
Large user attachment (inproc, macOS):

https://sentry-sdks.sentry.io/issues/7447018402/?environment=playground&project=4506178389999616
Inflated minidump (breakpad, Windows):

https://sentry-sdks.sentry.io/issues/7447288704/?environment=playground&project=4506178389999616
See also: