We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
SDK Crash Detection: Store Project ID and Event ID
Store project ID and event ID in the SDK crash detection context to find the original SDK crash event, which is only possible with admin Sentry rights.

https://github.com/getsentry/sentry/blob/2c31ee009b44964f78b9e7e8282e602b7ef849b0/src/sentry/utils/sdk_crashes/sdk_crash_detection.py#L40C2-L42

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/sentry/utils/sdk_crashes/sdk_crash_detection.py`
Content:
```
1 from __future__ import annotations
2 
3 from typing import Any, Mapping, Optional
4 
5 from sentry.eventstore.models import Event
6 from sentry.issues.grouptype import GroupCategory
7 from sentry.utils.safe import get_path, set_path
8 from sentry.utils.sdk_crashes.cocoa_sdk_crash_detector import CocoaSDKCrashDetector
9 from sentry.utils.sdk_crashes.event_stripper import strip_event_data
10 from sentry.utils.sdk_crashes.sdk_crash_detector import SDKCrashDetector
11 
12 
13 class SDKCrashReporter:
14     def report(self, event_data: Mapping[str, Any], event_project_id: int) -> Event:
15         from sentry.event_manager import EventManager
16 
17         manager = EventManager(dict(event_data))
18         manager.normalize()
19         return manager.save(project_id=event_project_id)
20 
21 
22 class SDKCrashDetection:
23     def __init__(
24         self,
25         sdk_crash_reporter: SDKCrashReporter,
26         sdk_crash_detector: SDKCrashDetector,
27     ):
28         self.sdk_crash_reporter = sdk_crash_reporter
29         self.cocoa_sdk_crash_detector = sdk_crash_detector
30 
31     def detect_sdk_crash(self, event: Event, event_project_id: int) -> Optional[Event]:
32         should_detect_sdk_crash = (
33             event.group
34             and event.group.issue_category == GroupCategory.ERROR
35             and event.group.platform == "cocoa"
36         )
37         if not should_detect_sdk_crash:
38             return None
39 
40         context = get_path(event.data, "contexts", "sdk_crash_detection")
41         if context is not None and context.get("detected", False):
42             return None
43 
44         # Getting the frames and checking if the event is unhandled might different per platform.
45         # We will change this once we implement this for more platforms.
46         is_unhandled = (
47             get_path(event.data, "exception", "values", -1, "mechanism", "handled") is False
48         )
49         if is_unhandled is False:
50             return None
51 
52         frames = get_path(event.data, "exception", "values", -1, "stacktrace", "frames")
53         if not frames:
54             return None
55 
56         if self.cocoa_sdk_crash_detector.is_sdk_crash(frames):
57             sdk_crash_event_data = strip_event_data(event.data, self.cocoa_sdk_crash_detector)
58 
59             set_path(
60                 sdk_crash_event_data, "contexts", "sdk_crash_detection", value={"detected": True}
61             )
62 
63             return self.sdk_crash_reporter.report(sdk_crash_event_data, event_project_id)
64 
65         return None
66 
67 
68 _crash_reporter = SDKCrashReporter()
69 _cocoa_sdk_crash_detector = CocoaSDKCrashDetector()
70 
71 sdk_crash_detection = SDKCrashDetection(_crash_reporter, _cocoa_sdk_crash_detector)
72
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/sentry/utils/sdk_crashes/sdk_crash_detection.py b/src/sentry/utils/sdk_crashes/sdk_crash_detection.py
--- a/src/sentry/utils/sdk_crashes/sdk_crash_detection.py
+++ b/src/sentry/utils/sdk_crashes/sdk_crash_detection.py
@@ -57,7 +57,14 @@
             sdk_crash_event_data = strip_event_data(event.data, self.cocoa_sdk_crash_detector)
 
             set_path(
-                sdk_crash_event_data, "contexts", "sdk_crash_detection", value={"detected": True}
+                sdk_crash_event_data,
+                "contexts",
+                "sdk_crash_detection",
+                value={
+                    "detected": True,
+                    "original_project_id": event.project.id,
+                    "original_event_id": event.event_id,
+                },
             )
 
             return self.sdk_crash_reporter.report(sdk_crash_event_data, event_project_id)

{"golden_diff": "diff --git a/src/sentry/utils/sdk_crashes/sdk_crash_detection.py b/src/sentry/utils/sdk_crashes/sdk_crash_detection.py\n--- a/src/sentry/utils/sdk_crashes/sdk_crash_detection.py\n+++ b/src/sentry/utils/sdk_crashes/sdk_crash_detection.py\n@@ -57,7 +57,14 @@\n             sdk_crash_event_data = strip_event_data(event.data, self.cocoa_sdk_crash_detector)\n \n             set_path(\n-                sdk_crash_event_data, \"contexts\", \"sdk_crash_detection\", value={\"detected\": True}\n+                sdk_crash_event_data,\n+                \"contexts\",\n+                \"sdk_crash_detection\",\n+                value={\n+                    \"detected\": True,\n+                    \"original_project_id\": event.project.id,\n+                    \"original_event_id\": event.event_id,\n+                },\n             )\n \n             return self.sdk_crash_reporter.report(sdk_crash_event_data, event_project_id)\n", "issue": "SDK Crash Detection: Store Project ID and Event ID\nStore project ID and event ID in the SDK crash detection context to find the original SDK crash event, which is only possible with admin Sentry rights.\r\n\r\nhttps://github.com/getsentry/sentry/blob/2c31ee009b44964f78b9e7e8282e602b7ef849b0/src/sentry/utils/sdk_crashes/sdk_crash_detection.py#L40C2-L42\n", "before_files": [{"content": "from __future__ import annotations\n\nfrom typing import Any, Mapping, Optional\n\nfrom sentry.eventstore.models import Event\nfrom sentry.issues.grouptype import GroupCategory\nfrom sentry.utils.safe import get_path, set_path\nfrom sentry.utils.sdk_crashes.cocoa_sdk_crash_detector import CocoaSDKCrashDetector\nfrom sentry.utils.sdk_crashes.event_stripper import strip_event_data\nfrom sentry.utils.sdk_crashes.sdk_crash_detector import SDKCrashDetector\n\n\nclass SDKCrashReporter:\n    def report(self, event_data: Mapping[str, Any], event_project_id: int) -> Event:\n        from sentry.event_manager import EventManager\n\n        manager = EventManager(dict(event_data))\n        manager.normalize()\n        return manager.save(project_id=event_project_id)\n\n\nclass SDKCrashDetection:\n    def __init__(\n        self,\n        sdk_crash_reporter: SDKCrashReporter,\n        sdk_crash_detector: SDKCrashDetector,\n    ):\n        self.sdk_crash_reporter = sdk_crash_reporter\n        self.cocoa_sdk_crash_detector = sdk_crash_detector\n\n    def detect_sdk_crash(self, event: Event, event_project_id: int) -> Optional[Event]:\n        should_detect_sdk_crash = (\n            event.group\n            and event.group.issue_category == GroupCategory.ERROR\n            and event.group.platform == \"cocoa\"\n        )\n        if not should_detect_sdk_crash:\n            return None\n\n        context = get_path(event.data, \"contexts\", \"sdk_crash_detection\")\n        if context is not None and context.get(\"detected\", False):\n            return None\n\n        # Getting the frames and checking if the event is unhandled might different per platform.\n        # We will change this once we implement this for more platforms.\n        is_unhandled = (\n            get_path(event.data, \"exception\", \"values\", -1, \"mechanism\", \"handled\") is False\n        )\n        if is_unhandled is False:\n            return None\n\n        frames = get_path(event.data, \"exception\", \"values\", -1, \"stacktrace\", \"frames\")\n        if not frames:\n            return None\n\n        if self.cocoa_sdk_crash_detector.is_sdk_crash(frames):\n            sdk_crash_event_data = strip_event_data(event.data, self.cocoa_sdk_crash_detector)\n\n            set_path(\n                sdk_crash_event_data, \"contexts\", \"sdk_crash_detection\", value={\"detected\": True}\n            )\n\n            return self.sdk_crash_reporter.report(sdk_crash_event_data, event_project_id)\n\n        return None\n\n\n_crash_reporter = SDKCrashReporter()\n_cocoa_sdk_crash_detector = CocoaSDKCrashDetector()\n\nsdk_crash_detection = SDKCrashDetection(_crash_reporter, _cocoa_sdk_crash_detector)\n", "path": "src/sentry/utils/sdk_crashes/sdk_crash_detection.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom typing import Any, Mapping, Optional\n\nfrom sentry.eventstore.models import Event\nfrom sentry.issues.grouptype import GroupCategory\nfrom sentry.utils.safe import get_path, set_path\nfrom sentry.utils.sdk_crashes.cocoa_sdk_crash_detector import CocoaSDKCrashDetector\nfrom sentry.utils.sdk_crashes.event_stripper import strip_event_data\nfrom sentry.utils.sdk_crashes.sdk_crash_detector import SDKCrashDetector\n\n\nclass SDKCrashReporter:\n    def report(self, event_data: Mapping[str, Any], event_project_id: int) -> Event:\n        from sentry.event_manager import EventManager\n\n        manager = EventManager(dict(event_data))\n        manager.normalize()\n        return manager.save(project_id=event_project_id)\n\n\nclass SDKCrashDetection:\n    def __init__(\n        self,\n        sdk_crash_reporter: SDKCrashReporter,\n        sdk_crash_detector: SDKCrashDetector,\n    ):\n        self.sdk_crash_reporter = sdk_crash_reporter\n        self.cocoa_sdk_crash_detector = sdk_crash_detector\n\n    def detect_sdk_crash(self, event: Event, event_project_id: int) -> Optional[Event]:\n        should_detect_sdk_crash = (\n            event.group\n            and event.group.issue_category == GroupCategory.ERROR\n            and event.group.platform == \"cocoa\"\n        )\n        if not should_detect_sdk_crash:\n            return None\n\n        context = get_path(event.data, \"contexts\", \"sdk_crash_detection\")\n        if context is not None and context.get(\"detected\", False):\n            return None\n\n        # Getting the frames and checking if the event is unhandled might different per platform.\n        # We will change this once we implement this for more platforms.\n        is_unhandled = (\n            get_path(event.data, \"exception\", \"values\", -1, \"mechanism\", \"handled\") is False\n        )\n        if is_unhandled is False:\n            return None\n\n        frames = get_path(event.data, \"exception\", \"values\", -1, \"stacktrace\", \"frames\")\n        if not frames:\n            return None\n\n        if self.cocoa_sdk_crash_detector.is_sdk_crash(frames):\n            sdk_crash_event_data = strip_event_data(event.data, self.cocoa_sdk_crash_detector)\n\n            set_path(\n                sdk_crash_event_data,\n                \"contexts\",\n                \"sdk_crash_detection\",\n                value={\n                    \"detected\": True,\n                    \"original_project_id\": event.project.id,\n                    \"original_event_id\": event.event_id,\n                },\n            )\n\n            return self.sdk_crash_reporter.report(sdk_crash_event_data, event_project_id)\n\n        return None\n\n\n_crash_reporter = SDKCrashReporter()\n_cocoa_sdk_crash_detector = CocoaSDKCrashDetector()\n\nsdk_crash_detection = SDKCrashDetection(_crash_reporter, _cocoa_sdk_crash_detector)\n", "path": "src/sentry/utils/sdk_crashes/sdk_crash_detection.py"}]}