Skip to content

feat: report crashes and player failures to Sentry while diagnostics are on - #332

Merged
altaywtf merged 12 commits into
mainfrom
feat/sentry-diagnostics
Oct 11, 2026
Merged

altaywtf merged 12 commits into
mainfrom
feat/sentry-diagnostics

Conversation

@altaywtf

@altaywtf altaywtf commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Change

Mobile and TV send crashes, ANRs and player failures to Sentry only while the account's Diagnostics control is on, built from an allowlist. Sentry item of #31; TV gate for #35.

flowchart LR
  L[Launch: last kept answer] --> G{diagnostics_enabled<br/>signed out = on}
  S[Sign-in, settings read,<br/>Privacy toggle] --> G
  G -- on, release build with DSN --> R[Start Sentry,<br/>no breadcrumbs]
  G -- off --> C[Close Sentry,<br/>delete pending envelopes]
  R --> B[beforeSend: drop while off<br/>or stamped before an opt-in,<br/>else copy the allowlist,<br/>drop attachments]
  B --> X[relay.put.io]
Loading
Concern Behavior
Kill switch Only a release build made with putioSentryDsn reports; none has one yet
Project Legacy Android TV project, already relayed; surface tag splits apps
Sent Exception types, stack frames, release, installation id, R8 mapping id, OS version, device model, failure codes (full list)
Known gap An opted-out period's ANR leaks if the app dies right after an opt-in, or on the first DSN build
Not yet R8 mapping upload; release stack traces stay obfuscated

Validation

  • Code changes: ./gradlew verify and all debug assembles
  • Proof map rows: mobile launch on the managed-device smoke

Leak and gate tests fail with their guard reverted.

Unverified: TV emulator launch (emulator crashes at boot); a live event (no build has a DSN).


Written by an agent (Claude Code, Claude Opus 5.5)

…are on

Both apps start Sentry only from a release build carrying putioSentryDsn and
only while the account's diagnostics_enabled allows it; an opt-out closes the
SDK and purges pending envelopes. Every event and breadcrumb passes an
on-device redaction boundary in core/telemetry, the only module that may
import Sentry.

Refs #31, #35
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T13:34:51.724423Z f7ccbc9 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 114d9d9926

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread core/telemetry/src/main/kotlin/io/putdotio/android/telemetry/SentryBoundary.kt Outdated
Comment thread core/telemetry/src/main/kotlin/io/putdotio/android/telemetry/PutioDiagnostics.kt Outdated
Comment thread core/telemetry/src/main/kotlin/io/putdotio/android/telemetry/PutioDiagnostics.kt Outdated
Comment thread mobile/src/main/kotlin/io/putdotio/android/MobileNavigation.kt Outdated
Address review: exception messages can carry media titles, so the boundary
drops them; each Sentry start gets its own on-period, so an SDK still closing
after an opt-out cannot upload through a later opt-in; Sentry starts on the
launch thread; the audio service reports its own player failures.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44171aaece

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread core/telemetry/src/main/kotlin/io/putdotio/android/telemetry/PutioDiagnostics.kt Outdated
Comment thread core/telemetry/src/main/kotlin/io/putdotio/android/telemetry/PutioDiagnostics.kt Outdated
…d models

Address review: the cache purge runs even when closing the SDK throws;
captures queue behind any pending start, so a failure right after an opt-in
reaches the new SDK; the upgrade test pins SentryThread and stack frame
fields, and frames drop source lines and local variables.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 758089b18c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread core/telemetry/src/main/kotlin/io/putdotio/android/telemetry/PutioDiagnostics.kt Outdated
Comment thread core/telemetry/src/main/kotlin/io/putdotio/android/telemetry/PutioDiagnostics.kt Outdated
Comment thread build-logic/src/main/kotlin/PutioAndroidApplicationPlugin.kt
…DSN hosts

Address review: an opt-out reaches disk before its purge is queued, so a
process killed in between still launches with diagnostics off; the build
rejects a putioSentryDsn whose host doesn't parse.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8740debbf5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread core/telemetry/src/main/kotlin/io/putdotio/android/telemetry/PutioDiagnostics.kt Outdated
Comment thread core/telemetry/src/main/kotlin/io/putdotio/android/telemetry/PutioDiagnostics.kt Outdated
Address review: a failed write of an opt-out deletes pending envelopes on
the spot instead of waiting for the queued purge, and an unchanged answer no
longer rewrites the store on the main thread.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f522934bf2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread core/telemetry/src/main/kotlin/io/putdotio/android/telemetry/PutioDiagnostics.kt Outdated
Comment thread mobile/src/main/kotlin/io/putdotio/android/MobilePlaybackService.kt Outdated
Address review: answers apply in memory first, so the gate ends the on-period
before the synchronous write and queues the purge after it.
Replace the URL, credential and filename scrubbers with a beforeSend that
copies exception types, stack frames, release metadata, the installation id,
a few OS and device facts, and put.io's tags into a new event. Exception values
come only from a reported failure's code; breadcrumbs are off. Merge the
consent state into DiagnosticsGate and drop the redaction tests for one leak
test and the gate cases.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9fc6a8417a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread core/telemetry/src/main/kotlin/io/putdotio/android/telemetry/SentryBoundary.kt Outdated
…ad checks

beforeSend now empties the hint, since Sentry sends its attachments
(screenshot, view hierarchy, thread dump, tombstone) with whatever event
beforeSend returns, and copies proguard debug images as type and uuid so a
later mapping upload can deobfuscate frames.

Removed as unreachable:
- runtime DSN parsing beyond the one shape the build accepts, and the
  build's extra host check, whose host the relay rewrite discards
- the diagnosticsAllowed opt-in clause: requestChange rejects a change that
  matches current preferences, so a pending opt-in always had it off before
- a null consent answer, which behaved exactly like true
- the synchronous purge on a failed commit and the isEnabled check before
  Sentry.close(), which is a no-op on a closed SDK
- io.sentry.auto-init, read only by the removed SentryInitProvider
- comments restating docs, detekt config or the code below them

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 719a512574

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread core/telemetry/src/main/kotlin/io/putdotio/android/telemetry/PutioDiagnostics.kt Outdated
Restore the fail-closed purge: if the commit fails and the process dies
before the queued stopAndPurge, the next launch reads the old answer and
would start Sentry over what is cached. Sentry.close() runs only on that
queue, so a killed process writes nothing after this purge.
PutioDiagnostics keeps one stored answer and starts or stops Sentry on
change; SentryBoundary owns the SDK, an on-period token, the allowlist
and the purge. The consent store, filter and runtime interfaces, the
persisted enabled-since time, session-key matching and the
TelemetryTag enum go.

- ANRs from an opted-out period: a start after launch drops events
  stamped before it, and Sentry marks a dropped exit as reported. If
  the app dies before that start, the next launch can still send one.
- Executor steps use submit, so a failing step can't crash the app.
- Apps pass a nullable answer from their auth and settings states.
- DebugSentryDsnTest pins that test variants never carry a DSN.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f7fd3b135

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

A token store that can't be read or cleared now keeps the last answer
on both surfaces, as iOS does for a failed restore: the opted-out
account's token may still be on the device, so it no longer flips
diagnostics on and saves that for the next launch.

- PutioDiagnosticsTest shadows SentryAndroid.init and checks that a
  launch with a stored opt-out opens no period; it previously passed
  with the stored answer ignored.
- SentryBoundaryTest checks the gate closes on stop itself, not only
  after a later start replaces the period.
- release goes: Sentry sets the same package@version+code by default
  before the options callback.
- diagnosticsAllowed() reuses confirmedPreferences; four narrating
  comments go.
- docs: the no-DSN-to-DSN upgrade can report an ANR from an opted-out
  period, next to the existing app-death edge.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7ccbc93e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@altaywtf
altaywtf merged commit 232a4e5 into main Oct 11, 2026
@altaywtf
altaywtf deleted the feat/sentry-diagnostics branch October 11, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant