Skip to content

feat: add hosted diagnostics uploads - #221

Merged
Quick104 merged 12 commits into
mainfrom
agent/hosted-diagnostics
Aug 12, 2026
Merged

Quick104 merged 12 commits into
mainfrom
agent/hosted-diagnostics

Conversation

@Quick104

@Quick104 Quick104 commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add the hosted Silo Diagnostics destination to Android phone and TV without adding any Silo Server dependency
  • capture offline, require exact live collector capabilities and live account ownership before first upload, and freeze byte-identical hosted envelopes for retry
  • apply hosted-only privacy transformations across manifests, logs, breadcrumbs, crash artifacts, device snapshots, URLs, identifiers, decoder names, and release-obfuscated frames
  • retain processing/rejected evidence and persist READY receipts plus deletion intents for durable Delete and Turn Off behavior
  • fence uploads, capture, refresh, sign-out, account changes, and active/inactive server removal so evidence cannot cross identity boundaries
  • update phone/TV consent, destination, report, retention, and privacy UI

Validation

  • forced Android diagnostics unit-test matrix
  • shared diagnostics contract/API test matrix
  • phone and TV debug assemblies
  • release/minification assemblies
  • independent cross-client contract review against the collector

Related changes

No production collector deployment is included in this PR.

Summary by CodeRabbit

  • New Features

    • Added hosted diagnostics collection alongside explicitly configured self-hosted destinations.
    • Added destination selection, hosted report processing status, deletion, retention, and automatic-upload availability.
    • Improved Android and TV diagnostics screens with destination-specific guidance and consent controls.
  • Privacy & Reliability

    • Hosted reports now omit or sanitize sensitive profile, playback, network, and identifier data.
    • Improved crash recovery, evidence cleanup, durable storage, and identity-transition safeguards.
  • Documentation

    • Updated diagnostics documentation describing hosted and self-hosted collection, consent, retention, identity, and deletion behavior.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ee9e9fa5-f9d3-4e9b-833e-f7225a7697b7

📥 Commits

Reviewing files that changed from the base of the PR and between 859adf7 and bd3d758.

📒 Files selected for processing (8)
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsCoordinator.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsModule.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsSettingsStore.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/PendingReportStore.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsSettingsStoreTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/PendingReportStoreTest.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/auth/TvLoginViewModel.kt
  • docs/superpowers/specs/2026-08-12-android-hosted-diagnostics-design.md
📝 Walkthrough

Walkthrough

Diagnostics now support hosted and self-hosted destinations. The change adds hosted upload, privacy filtering, durable evidence cleanup, identity-transition guards, destination-aware UI, and atomic account-session replacement.

Changes

Hosted diagnostics

Layer / File(s) Summary
Diagnostics capture, storage, and upload
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/*
Adds hosted destination handling, deterministic archives, sanitized envelopes, durable evidence ledgers, capability and credential management, processing polling, and asynchronous deletion.
Identity and authenticated transport
shared/src/commonMain/kotlin/org/siloserver/silo/network/*, shared/src/androidMain/kotlin/org/siloserver/silo/network/*, shared/src/commonMain/kotlin/org/siloserver/silo/repository/AuthRepository.kt
Adds generation-guarded transitions, atomic account replacement, scoped diagnostics authorization, hosted API operations, and durable registry commits.
Validation and presentation
android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/*, shared/src/commonTest/*, androidApp/src/*, androidTvApp/src/*, README.md, docs/*
Adds coverage for privacy filtering, cleanup recovery, upload races, hosted API behavior, consent restrictions, destination presentation, and hosted diagnostics documentation.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DiagnosticsViewModel
  participant DiagnosticsCoordinator
  participant DefaultDiagnosticsUploader
  participant PendingReportStore
  participant HostedDiagnosticsApi
  DiagnosticsViewModel->>DiagnosticsCoordinator: request upload
  DiagnosticsCoordinator->>DefaultDiagnosticsUploader: upload report
  DefaultDiagnosticsUploader->>PendingReportStore: load or persist sanitized envelope
  DefaultDiagnosticsUploader->>HostedDiagnosticsApi: create and upload hosted report
  HostedDiagnosticsApi-->>DefaultDiagnosticsUploader: receipt or processing state
  DefaultDiagnosticsUploader->>PendingReportStore: record report state
  DefaultDiagnosticsUploader-->>DiagnosticsCoordinator: upload decision
  DiagnosticsCoordinator-->>DiagnosticsViewModel: processing or completion result
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.03% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the pull request's primary change: adding hosted diagnostics uploads.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/hosted-diagnostics

Comment @coderabbitai help to get the list of available commands.

@Quick104
Quick104 marked this pull request as ready for review August 12, 2026 12:38

@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: 65b8c40faf

ℹ️ 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".

@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: dd13bb92ca

ℹ️ 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".

@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: 6a6b240a6c

ℹ️ 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".

@coderabbitai coderabbitai 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.

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/pairing/PairingAuthPort.kt (1)

52-72: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Roll back a newly created registry entry when a second server was already registered.

addOrUpdate can create a new entry. If previousServerId != null and replaceAccountSession fails before it activates the target, the active server is unchanged, so neither recovery branch runs. The new entry stays in the registry as an orphan with no credentials.

Do not call remove(serverId) unconditionally: addOrUpdate may have updated an existing entry, and remove purges that server's credential namespace. Record whether the entry existed before the call.

🛠️ Proposed rollback fix
             val previousServerId = serverRegistry.activeServerId.value
+            val existedBefore = serverRegistry.entries.value.any {
+                it.url == serverRegistry.entries.value.firstOrNull { entry -> entry.id == it.id }?.url &&
+                    it.id == AndroidServerRegistry.idFor(AndroidServerRegistry.normalizeUrl(serverUrl))
+            }
             val serverId = serverRegistry.addOrUpdate(serverUrl, fetchedName = serverName)
             try {
                 // Same-server approval is still an A -> B account boundary.
                 // The token manager activates the registry and replaces the
                 // complete profile/token identity inside one destructive gate.
                 tokenManager.replaceAccountSession(
                     serverId = serverId,
                     accessToken = accessToken,
                     refreshToken = refreshToken,
                     expiresIn = expiresIn,
                 )
             } catch (error: Throwable) {
                 if (previousServerId != null && serverRegistry.activeServerId.value != previousServerId) {
                     serverRegistry.switchTo(previousServerId)
                     tokenManager.switchActiveServer(previousServerId)
-                } else if (previousServerId == null) {
+                }
+                if (!existedBefore) {
                     serverRegistry.remove(serverId)
                 }
                 throw error
             }

Compute existedBefore with a simple id lookup before addOrUpdate if idFor/normalizeUrl access is inconvenient here.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/pairing/PairingAuthPort.kt`
around lines 52 - 72, In the pairing flow around serverRegistry.addOrUpdate and
tokenManager.replaceAccountSession, record whether the target server entry
existed before addOrUpdate using the available server lookup. On failure, when a
prior active server exists and the target entry was newly created, remove the
new entry; otherwise restore the previous active server as appropriate. Do not
remove entries that existed before, since that would purge their credentials.
🔇 Additional comments (114)
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/di/AndroidModule.kt (1)

189-189: LGTM!

androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/AppNavigation.kt (1)

1146-1146: LGTM!

androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/diagnostics/DiagnosticsPrompt.kt (1)

20-23: LGTM!

Also applies to: 41-64, 69-77

androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/diagnostics/DiagnosticsReportScreen.kt (2)

44-44: LGTM!

Also applies to: 58-60, 72-72, 83-83, 101-111, 138-151, 210-210, 234-238, 250-251


162-173: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

⚠️ Unverified finding
Sandbox verification was unavailable.

Keep hosted processing in an explicit in-flight state.

When DiagnosticsUploadDecision.HostedProcessing returns, this branch clears uploading and stores only a notice. The report remains pending while WorkManager polls, so Send becomes available again. If the worker removes the report after ready, sentShortId is still null and the screen shows "This report is no longer on this device." instead of the reference confirmation.

Store the returned reference, disable Send while the report is processing, and render DiagnosticsSentConfirmation only after the final Uploaded/ready transition. Verify that DiagnosticsViewModel.upload does not rely on a later callback that this composable cannot retain.

The hosted diagnostics design requires the reference to remain visible during processing and local evidence to remain until ready.

docs/README.md (1)

16-19: LGTM!

Also applies to: 36-37

docs/superpowers/plans/2026-08-12-android-hosted-diagnostics.md (1)

1-33: LGTM!

docs/superpowers/specs/2026-08-12-android-hosted-diagnostics-design.md (1)

1-68: LGTM!

androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/diagnostics/DiagnosticsSettingsScreen.kt (1)

49-49: LGTM!

Also applies to: 68-83, 102-135, 248-280, 313-318

androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/navigation/TvAppNavigation.kt (1)

1245-1245: LGTM!

androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/auth/TvLoginViewModel.kt (1)

93-97: LGTM!

Also applies to: 174-178

androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsPromptScreen.kt (1)

44-44: LGTM!

Also applies to: 87-87, 120-135

androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsReportScreen.kt (1)

24-24: LGTM!

Also applies to: 38-60, 72-82, 98-133, 167-168

androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsSettingsScreen.kt (1)

50-50: LGTM!

Also applies to: 77-107, 128-159, 186-186, 238-255, 288-333

androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsStateTest.kt (1)

44-59: LGTM!

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/pairing/CompanionPairingCoordinator.kt (1)

126-126: LGTM!

Also applies to: 143-154

shared/src/androidMain/kotlin/org/siloserver/silo/network/AndroidServerRegistry.kt (2)

125-133: LGTM!


199-224: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

⚠️ Unverified finding
Sandbox verification was unavailable.

Confirm the dispatcher for the synchronous preference commit.

commitEditor defaults to SharedPreferences.Editor::commit, which performs blocking disk I/O. commitAccountReplacement and commitAccountSignOut run it while holding mutex, and these paths are reached from sign-in, pairing, and sign-out actions. On encrypted preferences the write also pays key-derivation cost. If any caller runs on Dispatchers.Main, this blocks the frame.

Move the commit into withContext(Dispatchers.IO), or confirm every caller is already off the main dispatcher.

Also applies to: 242-243

shared/src/androidMain/kotlin/org/siloserver/silo/network/EncryptedTokenManagerImpl.kt (1)

579-589: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that every refresh caller stamps a generation before this silently drops rotated tokens.

This early return discards a successful refresh result. If the server rotates refresh tokens, the client keeps the consumed refresh token and the session cannot recover without a full re-login. The doc block at lines 513-526 names the interceptor refresh fallback and remote-playback identity as scopes that carry neither an epoch nor a stamp. AuthInterceptorImpl.kt is part of this change but is not supplied here.

Confirm that AuthInterceptorImpl and the remote-playback path now build stamped scopes. If a caller cannot stamp, surface the drop instead of returning silently, so the caller can invalidate the session rather than keep a dead refresh token.

shared/src/commonMain/kotlin/org/siloserver/silo/network/IdentityTransitionBarrier.kt (2)

17-17: LGTM!

Also applies to: 26-37, 124-125


46-56: 🩺 Stability & Availability | 🔴 Critical | 🏗️ Heavy lift

⚠️ Unverified finding
Sandbox verification was unavailable.

One non-reentrant mutex now guards both identity mutation and guarded reads.

withCurrentGeneration and changing share mutationMutex, and kotlinx.coroutines.Mutex is not reentrant. Two hazards follow:

  1. Deadlock. Gates installed through installGate run inline inside changing, while the lock is held. If a gate reads or writes a scoped credential, EncryptedTokenManagerImpl.withScopeGeneration calls withCurrentGeneration and blocks forever. The diagnostics privacy gate in this stack is the likely caller.
  2. Unbounded hold. A guarded block that awaits network I/O blocks every sign-in, sign-out, account replacement, and server removal for its full duration. IdentityTransitionBarrierTest (lines 101-117) and RegistryPairingAuthPortTest (lines 101-121) both hold the lock across an external signal, which is exactly the hosted-upload fence shape.

Confirm that no installed gate touches scoped credentials. Document the reentrancy constraint on installGate, and state an upper bound for guarded blocks or apply a timeout at the call site.

Also applies to: 90-95

shared/src/commonMain/kotlin/org/siloserver/silo/network/TokenManager.kt (1)

56-69: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

⚠️ Unverified finding
Sandbox verification was unavailable.

The default implementation is not an identity boundary, and nothing enforces the override.

saveTokens opens a SIGN_IN transition only when no credentials exist. For an account swap over existing credentials the default body emits no ACCOUNT_REPLACE transition, so the privacy gates never run and the previous account's diagnostics survive the swap. The KDoc states the override requirement, but any implementation that misses it silently degrades the privacy guarantee.

Also, if a caller passes both serverId and serverUrl, lines 65-66 perform two separate switches with two transitions.

Consider making the boundary explicit rather than optional, for example by throwing NotImplementedError in the default body for implementations that persist credentials, or by keeping the default but asserting a single target argument.

shared/src/commonMain/kotlin/org/siloserver/silo/network/TokenManagerImpl.kt (1)

124-138: LGTM!

Also applies to: 233-236, 259-261

shared/src/commonTest/kotlin/org/siloserver/silo/network/IdentityTransitionBarrierTest.kt (1)

3-13: LGTM!

Also applies to: 70-91, 93-124

shared/src/commonTest/kotlin/org/siloserver/silo/repository/AuthRepositoryAccountReplacementTest.kt (1)

28-75: LGTM!

Also applies to: 87-128

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/pairing/RegistryPairingAuthPortTest.kt (1)

5-20: LGTM!

Also applies to: 85-128, 130-165, 167-202, 204-241, 243-272, 274-313

shared/src/commonMain/kotlin/org/siloserver/silo/network/AuthInterceptorImpl.kt (1)

283-287: LGTM!

Also applies to: 412-423

shared/src/commonMain/kotlin/org/siloserver/silo/network/AuthScopeSnapshot.kt (1)

38-38: 🗄️ Data Integrity & Integration

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify no positional constructor call breaks from the inserted parameter.

isIdentityGenerationStamped is inserted before credentialEpoch. Any caller that passes credentialEpoch positionally now binds the wrong argument type or silently shifts meaning. Confirm every construction site uses named arguments.

shared/src/commonMain/kotlin/org/siloserver/silo/network/DiagnosticsRequestScope.kt (1)

6-29: LGTM!

Also applies to: 53-61, 70-75

shared/src/commonMain/kotlin/org/siloserver/silo/network/api/DiagnosticsApi.kt (2)

36-47: 🩺 Stability & Availability

⚠️ Unverified finding
Sandbox verification was unavailable.

Confirm every non-test DiagnosticsApi implementation overrides the authorization overload.

The default body drops authorization and calls the three-argument upload. That path reads TokenManager through SiloAuthPlugin. The KDoc states the Android token manager uses the same identity barrier the uploader holds, so a non-overriding implementation on a real transport can block instead of failing fast. Verify that only fakes rely on the default.


62-91: LGTM!

shared/src/commonMain/kotlin/org/siloserver/silo/network/api/HostedDiagnosticsApi.kt (2)

59-76: LGTM!


231-241: 🩺 Stability & Availability

Do not flag these headers as engine-incompatible. Ktor 3.1.2 permits Content-Length; OkHttp may replace it with the ByteArray body length, which matches this value. Content-Type is also accepted, although contentType(...) is the idiomatic API.

			> Likely an incorrect or invalid review comment.
shared/src/commonMain/kotlin/org/siloserver/silo/repository/AuthRepository.kt (3)

31-45: LGTM!


132-141: 🗄️ Data Integrity & Integration

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that the invitation server becomes active, and that refreshActiveServerName targets it.

addOrUpdate registers the server but this path no longer calls switchTo/switchActiveServer. The KDoc states the app adopts the server after a successful claim. If replaceAccountSession does not switch the active server, the user keeps the previous active server while the new credentials sit in another scope, and refreshActiveServerName then refreshes the wrong entry.


160-166: 🗄️ Data Integrity & Integration

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that removing ServerRegistry.signOut still clears registry-side session state.

logout now calls only tokenManager.signOutCurrentServer(). The registry previously cleared its own per-server state, for example profileId. Confirm that signOutCurrentServer performs that registry cleanup, otherwise a stale profile id survives sign-out.

shared/src/androidUnitTest/kotlin/org/siloserver/silo/network/EncryptedTokenManagerScopeGenerationTest.kt (1)

21-40: LGTM!

Also applies to: 155-213, 314-318, 331-331, 350-351, 369-385

shared/src/commonTest/kotlin/org/siloserver/silo/network/api/DiagnosticsApiTest.kt (2)

214-235: LGTM!

Also applies to: 249-312


237-248: 📐 Maintainability & Code Quality

Confirm the pinned kotlinx.coroutines version. limitedParallelism is stable from version 1.9.0 onward. Add an opt-in if this project uses an earlier version.

shared/src/commonTest/kotlin/org/siloserver/silo/network/api/HostedDiagnosticsApiTest.kt (1)

37-144: LGTM!

Also applies to: 152-341

README.md (1)

39-39: LGTM!

Also applies to: 102-104

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/BreadcrumbJournal.kt (1)

39-41: LGTM!

Also applies to: 144-146, 167-167, 220-224

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/CrashCapture.kt (2)

248-257: 🗄️ Data Integrity & Integration

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that the marker reader tolerates markers without destination_kind.

The writer now always emits destination_kind inside binding. A marker written by the previous app version has no such field. After an app upgrade, the next-launch assembly reads that older marker. If the deserialized binding type declares destinationKind without a default, parsing of the retained marker fails and the crash evidence is dropped.


62-86: LGTM!

Also applies to: 374-393, 400-438

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsArchiveEncoder.kt (4)

31-44: LGTM!


46-91: LGTM!


93-124: LGTM!


8-29: LGTM!

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsBundleBuilder.kt (8)

52-99: LGTM!


101-125: LGTM!


251-256: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

⚠️ Unverified finding
Sandbox verification was unavailable.

Make hosted crash-identifier stripping recursive.

stripHostedCrashIdentifiersIf filters keys only at the root object. Its siblings stripHostedDeviceIdentifiers (Lines 276-284) and stripHostedForbiddenIdentifiers (Lines 286-298) recurse into nested objects and arrays. If crash/summary.json nests process, process_name, or process_hash inside any child object, those keys reach the hosted collector.

HOSTED_CRASH_IDENTIFIER_KEYS values are not present in HOSTED_FORBIDDEN_IDENTIFIER_KEYS or NETWORK_ASSIGNMENT_KEYS, so no other filter removes them by key.

🔒️ Proposed fix
-    private fun JsonElement.stripHostedCrashIdentifiersIf(strip: Boolean): JsonElement =
-        if (strip && this is JsonObject) {
-            JsonObject(filterKeys { key -> key.normalizedPrivacyKey() !in HOSTED_CRASH_IDENTIFIER_KEYS })
-        } else {
-            this
-        }
+    private fun JsonElement.stripHostedCrashIdentifiersIf(strip: Boolean): JsonElement =
+        if (strip) stripHostedCrashIdentifiers() else this
+
+    private fun JsonElement.stripHostedCrashIdentifiers(): JsonElement = when (this) {
+        is JsonObject -> JsonObject(
+            entries
+                .filterNot { (key, _) -> key.normalizedPrivacyKey() in HOSTED_CRASH_IDENTIFIER_KEYS }
+                .associate { (key, value) -> key to value.stripHostedCrashIdentifiers() },
+        )
+        is JsonArray -> JsonArray(map { value -> value.stripHostedCrashIdentifiers() })
+        is JsonPrimitive -> this
+    }

150-206: LGTM!


208-231: LGTM!


386-395: 🔒 Security & Privacy

⚠️ Unverified finding
Sandbox verification was unavailable.

Confirm that canonical UUIDs must pass through unchanged.

Line 387 returns the original value when it already matches CANONICAL_UUID. capture_session_id and the log-line run token are the two callers, and both normally hold canonical UUIDs. For those values the hashing branch never runs, so hostedAnonymousUuid only lowercases the local identifier.

If the intent is shape normalization for already-opaque per-capture identifiers, the code is correct. If the intent is to prevent the hosted collector from receiving the same identifier that local state holds, the early return defeats it.

State the intended policy in a comment, or hash unconditionally.


400-478: 🚀 Performance & Scalability

⚠️ Unverified finding
Sandbox verification was unavailable.

Confirm that hosted sanitization never runs on the main thread.

sanitizeHostedText applies about 25 regex passes plus NFKC normalization to every string. sanitizeHostedStrings calls it for each JSON string value, and redactJsonLines calls it for each log line. logs.jsonl is bounded at 256 KB, so a hosted bundle can execute tens of thousands of regex passes during one build call.

hasUnsafeHostedResidue then repeats a second pass of about 12 patterns over the result.

Confirm that build and reframeHosted execute on a background dispatcher. If a caller invokes them from a UI or WorkManager main-thread context, this blocks.


300-384: LGTM!

Also applies to: 480-604, 606-732, 734-891, 893-912, 914-1207

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsFileDurability.kt (1)

8-37: LGTM!

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsIdentityResolver.kt (3)

86-88: 🔒 Security & Privacy

⚠️ Unverified finding
Sandbox verification was unavailable.

copy() does not re-apply the sourceProfileId default.

sourceProfileId defaults to the profileId parameter. Kotlin applies that default only at construction. DiagnosticsCaptureContext.copy(profileId = newProfile) keeps the previous sourceProfileId.

sourceProfileId gates privacy decisions, so a stale value after a profile transition binds the context to the wrong source profile.


100-107: 🔒 Security & Privacy

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that a hosted resolver overrides resolveForCapture and resolveForUpload.

Both new methods delegate to resolve, and DefaultDiagnosticsIdentityResolver does not override either one. As written, capture-time and upload-time attestation are identical to the existing resolution path.

The PR objectives state that hosted diagnostics verify the live collector identity before a new capture and re-attest the source-server account before a first upload. Those checks must live in an overriding implementation. Confirm that such an override exists and that call sites use the specific methods rather than resolve.


173-173: LGTM!

Also applies to: 187-187

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsRedactor.kt (1)

59-74: LGTM!

Also applies to: 120-131, 170-176

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsRunLedger.kt (2)

111-125: 🗄️ Data Integrity & Integration

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that only one process writes the run ledger.

temporaryFile() returns a fixed path, run-ledger.json.tmp. The mutex serializes writers inside one process only. If a second process writes the ledger, both can open the same temporary file, and the atomic rename then publishes interleaved bytes.

Confirm that DiagnosticsRunLedger is constructed in a single process. If the app declares a remote-process component that touches diagnostics, use a per-writer unique temporary name.


25-25: LGTM!

Also applies to: 34-36, 64-64, 91-93

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsSettingsStore.kt (8)

391-393: 🩺 Stability & Availability

⚠️ Unverified finding
Sandbox verification was unavailable.

checkNotNull(allEvidencePurger) can throw on the upgrade path.

allEvidencePurger is an optional constructor parameter (Line 82). This branch runs once per device during the legacy-index upgrade, when a server is removed and no index entry exists. If any construction site omits the purger, purgeLocalServer throws IllegalStateException at exactly that moment, and the migration flag on Line 401 is never set. The next server removal repeats the failure.

Confirm every production construction site supplies allEvidencePurger. If the parameter must stay optional, make the legacy branch fail soft and leave the migration flag unset.


111-164: LGTM!


231-240: 🔒 Security & Privacy

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that callers compare the hosted binding owner before overwriting it.

cacheHostedBindingOwner overwrites any existing owner for the same localServerId without comparison. hostedBindingOwner only reads the value. The account-ownership fence therefore depends entirely on the caller reading first and rejecting a mismatch.

Confirm the caller performs that comparison and refuses hosted upload when the stored owner differs. If the store is meant to own the invariant, reject a conflicting owner here instead.


216-229: LGTM!


259-271: LGTM!

Also applies to: 288-314


321-360: LGTM!


378-404: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

⚠️ Unverified finding
Sandbox verification was unavailable.

Removing an unindexed server can erase another server's retained reports.

The legacy branch triggers whenever byLocalServerId has no entry for localServerId, fallbackBinding is null, and BINDING_INDEX_MIGRATION_COMPLETE_KEY is false. It then purges all diagnostics evidence and every diagnostics.binding.* key for every server.

That condition does not identify an upgraded device. It also matches a device that simply never indexed this server:

  • The index entry exists only after cacheContext runs with a non-blank localServerId (Lines 264-270). A server that never produced a diagnostics context has no entry.
  • storeBindingIndex removes BINDING_INDEX_KEY entirely when the map becomes empty (Lines 435-436), so an emptied entry is indistinguishable from a never-created one.

Sequence that loses data: the user adds server A and server B, collects diagnostics only on B, then removes A. purgeLocalServer("A") finds no entry for A, sees the migration flag unset, and deletes B's retained account reports.

Scope the legacy cleanup to devices that actually predate the index. Seed BINDING_INDEX_MIGRATION_COMPLETE_KEY to true on first run of a build that always writes the index, and require positive evidence of legacy state before the wipe.


362-377: LGTM!

Also applies to: 405-415, 432-451, 471-477, 492-498

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsRuntime.kt (2)

21-21: LGTM!


48-56: LGTM!

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsPresentationModels.kt (1)

25-25: 🗄️ Data Integrity & Integration

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that every DiagnosticsReportSummary construction sets destinationKind explicitly.

DiagnosticsReportSummary.destinationKind defaults to SELF_HOSTED, while DiagnosticsUiState.destinationKind defaults to HOSTED. The default on the summary is a silent fallback. If any mapping site omits the argument for a hosted report, the report screen shows self-hosted retention and destination text for a hosted upload.

Consider removing the default on DiagnosticsReportSummary.destinationKind so the compiler enforces the value at each construction site.

Also applies to: 61-63

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsPrivacyBarrier.kt (1)

13-18: 🩺 Stability & Availability

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that no code path acquires this barrier twice.

kotlinx.coroutines.sync.Mutex is not reentrant. DiagnosticsPrivacyBarrier is a Koin single, so DefaultDiagnosticsCoordinator and DefaultDiagnosticsUploader share one instance. If the coordinator holds a lease with withRevocation or withTransport and then calls uploader.upload(...), the uploader's privacyBarrier.withTransport { ... } suspends forever and the diagnostics actor deadlocks.

The uploader code in this PR never nests leases within itself. The coordinator source is not included here, so the combined path needs confirmation.

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsModule.kt (2)

38-38: LGTM!

Also applies to: 289-298


66-115: 🩺 Stability & Availability

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that resolving HostedDiagnosticsCapabilitiesStore cannot create a Koin cycle.

The factory at Line 68 calls get<DiagnosticsSettingsStore>() eagerly inside the definition body. DiagnosticsSettingsStore at Line 257 depends on both purgers, which depend on DiagnosticsCaptureController. If any of those transitively resolve HostedDiagnosticsCapabilitiesStore, HostedDiagnosticsCapabilitiesRepository, or DiagnosticsSettingsStore again, Koin throws a definition-cycle error at first resolution rather than at module load.

The definitions shown here do not close the loop. The capture controller, log buffer, file logger, and breadcrumb journal sources are not included in this prompt.

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsUploader.kt (3)

125-142: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

⚠️ Unverified finding
Sandbox verification was unavailable.

The hosted status-poll path returns before the retry-deadline gate.

Lines 125-137 poll a hosted report whenever hostedRemoteShortId != null. The retry-deadline check is at Line 138, after that return. So a hosted report in PROCESSING never honours the deadline that mapHostedError and pollHostedStatus persist. Every scheduled attempt issues a fresh status request, and a collector that answers 429 with Retry-After gets ignored.

There is a second inconsistency. mapHostedError writes the deadline per report with setRetryAfterDeadlineForReport(report.id, report.binding.binding, ...) at Line 797, but Line 138 reads it per binding with retryAfterDeadline(report.binding.binding). If the store keys those two values differently, the deadline is never observed for either destination.

Move the deadline gate above the poll branch.

🐛 Proposed fix
         val report = reports.load(reportId) ?: return DiagnosticsUploadDecision.KeptInvalid
+        val retryDeadline = reports.retryAfterDeadline(report.binding.binding)
+        if (retryDeadline != null && retryDeadline > nowMs()) return DiagnosticsUploadDecision.KeptRetryable
         if (
             report.binding.destinationKind == DiagnosticsDestinationKind.HOSTED &&
             report.state.hostedRemoteShortId != null
         ) {
             return try {
                 pollHostedStatus(report, operationGeneration)
             } catch (cancelled: CancellationException) {
                 throw cancelled
             } catch (_: Throwable) {
                 markRetryable(report.id, "status_unavailable")
                 DiagnosticsUploadDecision.KeptRetryable
             }
         }
-        val retryDeadline = reports.retryAfterDeadline(report.binding.binding)
-        if (retryDeadline != null && retryDeadline > nowMs()) return DiagnosticsUploadDecision.KeptRetryable

381-386: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

⚠️ Unverified finding
Sandbox verification was unavailable.

The self-hosted success path deletes evidence before recording the receipt.

Line 381 calls reports.delete(report.id). Line 382 then records the sent entry inside runCatching. If sentRecorder.record fails, the report is already gone and the sent-history row is lost with no retry path.

The hosted path solves this with one atomic store call, reports.recordHostedReadyAndDelete(report.id, report.binding) at Line 628. Consider an equivalent atomic API for self-hosted, or record the receipt before the delete.


1038-1057: LGTM!

Also applies to: 1059-1075

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/ExitInfoCollector.kt (3)

539-543: 🔒 Security & Privacy

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that DiagnosticsRunLedger persists destinationKind durably.

The hosted redactions at Lines 539-543 and Lines 557-561 both branch on binding.destinationKind. That value reaches the manifest only through DiagnosticsRunRecord.destinationKind at Line 589.

ExitInfoCollector runs after a process restart. If the ledger record does not persist destinationKind, the rebuilt binding defaults to SELF_HOSTED, both hosted branches are skipped, and a hosted crash report ships profileId and playbackSessionIds to the hosted collector.

Also applies to: 557-561, 589-589


296-305: LGTM!

Also applies to: 336-358


204-207: 📐 Maintainability & Code Quality

Keep the current link probe. Files.isSymbolicLink(Path) requires Android API 26, while this project supports API 24.

			> Likely an incorrect or invalid review comment.
android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/BreadcrumbJournalTest.kt (1)

16-16: LGTM!

Also applies to: 29-29, 60-68, 81-97

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/CrashCaptureTest.kt (1)

88-118: LGTM!

Also applies to: 185-192, 213-289, 291-401, 476-496

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsBundleBuilderTest.kt (2)

63-63: 📐 Maintainability & Code Quality

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that the self-hosted gzip OS byte is stable across the toolchain.

Line 63 asserts byte 9 of the self-hosted gzip stream equals 0xff. Byte 9 is the gzip OS field. java.util.zip.GZIPOutputStream writes a fixed header whose OS byte is 0, so 0xff must come from a different encoder path in DiagnosticsArchiveEncoder.

If the value comes from a platform default rather than an explicit write, a JDK or Android toolchain bump can change it and break this assertion. The hosted assertion at Line 79 is safe because the collector-canonical origin is written explicitly.


68-82: LGTM!

Also applies to: 140-192, 194-272, 274-309, 311-425, 427-508, 510-627, 661-738, 740-795, 813-845, 910-912

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsCoordinatorTest.kt (3)

1041-1044: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

⚠️ Unverified finding
Sandbox verification was unavailable.

This comparison depends on the order that hostedDeletionIntents() returns.

Line 1042 sorts the expected ids and compares against fixture.reports.hostedDeletionIntents() without sorting the actual value. The test passes only if the store happens to return ascending ids.

Line 1003 in the same file compares the same accessor with .toSet(). Use one approach. If the store does not document an order, compare sets.

💚 Proposed fix
             assertEquals(
-                listOf(pending.id, processing.id, ready.id).sorted(),
-                fixture.reports.hostedDeletionIntents(),
+                setOf(pending.id, processing.id, ready.id),
+                fixture.reports.hostedDeletionIntents().toSet(),
             )

1674-1683: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

⚠️ Unverified finding
Sandbox verification was unavailable.

The fixture does not wire allEvidencePurger, so no test covers that purge path.

DiagnosticsModule constructs DiagnosticsSettingsStore with both bindingPurger and allEvidencePurger. This fixture passes only bindingPurger, which means allEvidencePurger has a default. DiagnosticsAllEvidencePurger deletes every report, clears the run ledger, and purges all crash markers. No test in this file observes it.

Add a recording allEvidencePurger to the fixture and one test that asserts it runs, including the failure-then-retry path that the binding purger already covers at Lines 417-453.


72-72: LGTM!

Also applies to: 76-297, 300-574, 577-834, 891-1012, 1015-1039, 1053-1196, 1199-1359, 1362-1557, 1594-1602, 1644-1673, 1692-1740, 1746-1903, 1912-1915

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsCoordinator.kt (3)

919-919: 🩺 Stability & Availability

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that GuardedValue is declared only once.

The reviewed snippet shows the same declaration twice at this position. Two top-level declarations with the same name in one file do not compile.


155-167: 🩺 Stability & Availability

⚠️ Unverified finding
Sandbox verification was unavailable.

Confirm that targetServerId is always present for SERVER_REMOVE and ACCOUNT_REPLACE.

requireNotNull runs inside the synchronous identity gate and inside privacyBarrier.withRevocation. If a producer emits either transition without targetServerId, this throws inside the identity mutation path and can abort the transition. Verify that every producer sets targetServerId for these kinds.


64-70: LGTM!

Also applies to: 125-154, 242-294, 382-473, 650-674, 697-800, 818-828

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/PendingReportStore.kt (1)

16-22: LGTM!

Also applies to: 45-47, 68-98, 100-133, 212-293, 354-495, 511-627, 660-675, 760-819, 878-902

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/HostedDiagnostics.kt (2)

110-126: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

⚠️ Unverified finding
Sandbox verification was unavailable.

Move the blocking commit() calls off the caller's dispatcher.

save and clear are suspend functions, but SharedPreferences.Editor.commit() writes to disk synchronously on the calling thread. If any caller runs on Dispatchers.Main, this blocks the UI thread. Wrap both bodies in withContext(Dispatchers.IO). The same applies to load, because the first getString call can trigger the initial disk load.

♻️ Proposed refactor
-    override suspend fun save(credentials: HostedDiagnosticsCredentials) {
+    override suspend fun save(credentials: HostedDiagnosticsCredentials) = withContext(Dispatchers.IO) {
         check(
             encryptedPreferences.edit()
                 .putString(INSTALLATION_ID_KEY, credentials.installationId)
                 .putString(INSTALLATION_TOKEN_KEY, credentials.installationToken)
                 .commit(),
         ) { "unable to persist hosted diagnostics credentials" }
     }

Apply the same change to clear and load, and add the kotlinx.coroutines.Dispatchers and kotlinx.coroutines.withContext imports.

Run the following script to check the calling context:


23-32: LGTM!

Also applies to: 44-82, 171-193, 195-218, 220-320, 322-352, 402-439

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsSettingsStoreTest.kt (1)

12-18: LGTM!

Also applies to: 81-87, 101-109, 131-165, 167-193, 195-247, 249-261, 275-278

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsTestFileOperations.kt (1)

1-14: LGTM!

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsUploaderTest.kt (1)

3-6: LGTM!

Also applies to: 27-62, 139-198, 326-326, 382-840, 842-937, 961-996, 1020-1035, 1054-1243, 1266-1287

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/ExitInfoCollectorTest.kt (1)

3-6: LGTM!

Also applies to: 17-17, 144-224, 226-299, 301-314, 316-327, 329-358, 398-418

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/HostedDiagnosticsTest.kt (1)

28-45: LGTM!

Also applies to: 47-82, 86-102, 116-131, 133-178

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/PendingReportStoreTest.kt (1)

4-5: LGTM!

Also applies to: 114-173, 207-277, 279-365, 367-461, 463-586, 588-670, 727-810, 812-836, 876-880

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsFileLogger.kt (2)

130-144: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

⚠️ Unverified finding
Sandbox verification was unavailable.

reconcileStoredEvidence can delete a capture directory that start has just created.

start creates generation-$generation at line 62 and launches the writer at line 71, but it publishes active only at line 81. reconcileStoredEvidence is public and reads active.get(). FileDiagnosticsCaptureController.reconcileStoredEvidence() exposes it to the coordinator, so it can run on another coroutine. If it runs inside that window, activeDirectory is null, so line 142 deletes the whole root together with the new generation directory. The writer then fails and the capture loses its evidence.

Serialize reconciliation against capture start. One option is a dedicated lock that both start and reconcileStoredEvidence hold. Another option is to publish a "starting" marker in active before mkdirs.

Run the following script to list the callers that can invoke reconciliation concurrently with start:


37-39: LGTM!

Also applies to: 118-123, 147-153

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsManualCapture.kt (1)

157-172: LGTM!

Also applies to: 193-193, 210-214

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsViewModel.kt (1)

27-30: LGTM!

Also applies to: 65-65, 87-87

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsUploadWorker.kt (1)

21-22: 🩺 Stability & Availability

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that coordinator.start() is idempotent across worker executions.

The worker calls coordinator.start() on every execution, and WorkManager can execute this worker many times through Result.retry(). If start installs log sinks, registers observers, or launches collectors, repeated calls can duplicate that state.

Run the following script to inspect the coordinator lifecycle:

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsFileLoggerTest.kt (2)

106-120: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

⚠️ Unverified finding
Sandbox verification was unavailable.

The purge test may assert on cleanup that the constructor already performed.

The constructor runs reconcileStoredEvidence() at DiagnosticsFileLogger line 51. That call deletes root/raw.jsonl before purgeStoredEvidence() runs, so the assertFalse(root.exists()) assertion does not prove that purge removed the raw bytes. The test name states that it does.

Write raw.jsonl after the logger construction, then call purgeStoredEvidence(). The assertions then cover the purge path.

♻️ Proposed reordering
         val noBackup = temporaryFolder.newFolder("purge-fsync")
         val root = noBackup.resolve("client-diagnostics/logs")
-        assertTrue(root.mkdirs())
-        root.resolve("raw.jsonl").writeText("private")
         val logger = DiagnosticsFileLogger(
             noBackupFilesDir = noBackup,
             writerDispatcher = StandardTestDispatcher(testScheduler),
             directorySync = { error("injected fsync failure") },
         )
+        assertTrue(root.mkdirs())
+        root.resolve("raw.jsonl").writeText("private")
 
         assertFailsWith<IllegalStateException> { logger.purgeStoredEvidence() }
         assertFalse(root.exists())

Run the following script to confirm the deletion and sync order inside the strict helper:


24-24: LGTM!

Also applies to: 50-50, 73-73, 93-93, 122-139, 141-172, 174-197

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsPlaybackSessionTrackerTest.kt (1)

61-69: LGTM!

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsPrivacyIntegrationTest.kt (2)

144-147: 🎯 Functional Correctness

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify that DiagnosticsPlaybackSessionTracker exposes record.

Line 146 calls record(...) on the tracker inside apply. DiagnosticsPlaybackSessionTrackerTest records only through tracker.recording().record(...). If the tracker exposes no record member, this file fails to compile.

Run the following script to confirm the tracker API and the DiagnosticsCaptureContext parameters used at lines 132-143:


39-44: LGTM!

Also applies to: 78-120, 202-261, 272-288, 290-358, 363-387, 397-397, 408-413, 425-425, 444-444, 465-476, 507-507, 530-542, 556-558

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsRedactorTest.kt (1)

67-82: LGTM!

android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsRunLedgerTest.kt (1)

9-9: LGTM!

Also applies to: 22-27, 39-43, 57-58, 73-77, 87-107, 109-138


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 019d1372-3c06-42b5-835d-9ac3b41287b9

📥 Commits

Reviewing files that changed from the base of the PR and between 3efdbd9 and 6a6b240.

📒 Files selected for processing (73)
  • README.md
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/BreadcrumbJournal.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/CrashCapture.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsArchiveEncoder.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsBundleBuilder.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsCoordinator.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsFileDurability.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsFileLogger.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsIdentityResolver.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsManualCapture.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsModule.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsPresentationModels.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsPrivacyBarrier.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsRedactor.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsRunLedger.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsRuntime.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsSettingsStore.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsUploadWorker.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsUploader.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsViewModel.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/ExitInfoCollector.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/HostedDiagnostics.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/PendingReportStore.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/pairing/CompanionPairingCoordinator.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/pairing/PairingAuthPort.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/BreadcrumbJournalTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/CrashCaptureTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsBundleBuilderTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsCoordinatorTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsFileLoggerTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsPlaybackSessionTrackerTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsPrivacyIntegrationTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsRedactorTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsRunLedgerTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsSettingsStoreTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsTestFileOperations.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsUploaderTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/ExitInfoCollectorTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/HostedDiagnosticsTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/PendingReportStoreTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/pairing/RegistryPairingAuthPortTest.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/di/AndroidModule.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/downloads/AppWorkerFactory.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/AppNavigation.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/diagnostics/DiagnosticsPrompt.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/diagnostics/DiagnosticsReportScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/diagnostics/DiagnosticsSettingsScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/navigation/TvAppNavigation.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/auth/TvLoginViewModel.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsPromptScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsReportScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsSettingsScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/watchnext/TvWorkerFactory.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsStateTest.kt
  • docs/README.md
  • docs/superpowers/plans/2026-08-12-android-hosted-diagnostics.md
  • docs/superpowers/specs/2026-08-12-android-hosted-diagnostics-design.md
  • shared/src/androidMain/kotlin/org/siloserver/silo/network/AndroidServerRegistry.kt
  • shared/src/androidMain/kotlin/org/siloserver/silo/network/EncryptedTokenManagerImpl.kt
  • shared/src/androidUnitTest/kotlin/org/siloserver/silo/network/EncryptedTokenManagerScopeGenerationTest.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/AuthInterceptorImpl.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/AuthScopeSnapshot.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/DiagnosticsRequestScope.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/IdentityTransitionBarrier.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/TokenManager.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/TokenManagerImpl.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/api/DiagnosticsApi.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/api/HostedDiagnosticsApi.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/repository/AuthRepository.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/network/IdentityTransitionBarrierTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/network/api/DiagnosticsApiTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/network/api/HostedDiagnosticsApiTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/repository/AuthRepositoryAccountReplacementTest.kt
💤 Files with no reviewable changes (2)
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/watchnext/TvWorkerFactory.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/downloads/AppWorkerFactory.kt

@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: 990dd7f95e

ℹ️ 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".

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (4)
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsModule.kt (1)

223-256: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract the shared purge-attempt logic.

DiagnosticsBindingPurger and DiagnosticsAllEvidencePurger repeat the same first-failure-preserving attempt helper and the same live-capture step. Extract one private helper in this module and call it from both singletons. This keeps the two purge paths from diverging later.

♻️ Suggested shape
+private suspend inline fun purgeAll(
+    includeLiveCapture: Boolean,
+    capture: DiagnosticsCaptureController,
+    steps: List<suspend () -> Unit>,
+) {
+    var failure: Throwable? = null
+    suspend fun attempt(block: suspend () -> Unit) {
+        runCatching { block() }.onFailure { error -> if (failure == null) failure = error }
+    }
+    if (includeLiveCapture) attempt { capture.purgeCurrentEvidence() }
+    steps.forEach { step -> attempt(step) }
+    failure?.let { throw it }
+}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsModule.kt`
around lines 223 - 256, Extract the duplicated first-failure-preserving attempt
logic and conditional capture.purgeCurrentEvidence() step from
DiagnosticsBindingPurger and DiagnosticsAllEvidencePurger into one private
module helper. Have both singleton handlers reuse that helper while retaining
their existing report, ledger, and marker purge operations and final failure
propagation.
androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/diagnostics/DiagnosticsReportScreen.kt (1)

143-152: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Signal notice severity with more than color.

The notice distinguishes success from failure only by text color. Users with low vision or color-vision deficiency, and screen-reader users, get no severity cue. Add an icon or a leading label so the severity is conveyed non-visually.

♻️ Example
 uploadNotice?.let { notice ->
     Text(
-        notice,
+        if (uploadNoticeIsError) "Error: $notice" else notice,
         color = if (uploadNoticeIsError) {
             MaterialTheme.colorScheme.error
         } else {
             MaterialTheme.colorScheme.primary
         },
     )
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/diagnostics/DiagnosticsReportScreen.kt`
around lines 143 - 152, Update the uploadNotice rendering in
DiagnosticsReportScreen so success and error severity are conveyed non-visually,
not only through the color selected by uploadNoticeIsError. Add an appropriate
leading icon or explicit accessible label tied to the same severity state, while
preserving the existing notice text and color styling.
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/HostedDiagnosticsDeletionWorker.kt (1)

21-51: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Run the blocking store calls on the IO dispatcher.

PendingReportStore exposes non-suspend methods, and FilePendingReportStore performs synchronized file reads, writes, and directory syncs. CoroutineWorker.doWork runs on Dispatchers.Default by default, so these calls occupy a CPU-bound pool thread for disk I/O. Wrap the body in withContext(Dispatchers.IO), or override coroutineContext in the worker.

♻️ Proposed change
-    override suspend fun doWork(): Result {
+    override suspend fun doWork(): Result = withContext(Dispatchers.IO) {
         var completedAll = true
         val reportIds = try {
             reports.hostedDeletionIntents()
         } catch (cancelled: CancellationException) {
             throw cancelled
         } catch (_: Throwable) {
-            return Result.retry()
+            return@withContext Result.retry()
         }
@@
-        return if (completedAll) Result.success() else Result.retry()
+        if (completedAll) Result.success() else Result.retry()
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/HostedDiagnosticsDeletionWorker.kt`
around lines 21 - 51, Update HostedDiagnosticsDeletionWorker.doWork so the full
blocking workflow, including hostedDeletionIntents, deleter.delete, and
completeHostedDeletion, executes within withContext(Dispatchers.IO); preserve
the existing cancellation propagation and retry/success behavior.
android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsSettingsStoreTest.kt (1)

261-269: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Record the flag and assert outside the purger lambda.

assertTrue(includeLiveCapture) runs inside the callback that DiagnosticsSettingsStore invokes. If the store wraps purger invocation in failure handling, the AssertionError becomes a purge failure instead of a clear test failure, and the diagnosis points at the wrong cause. Capture the value and assert it after the action.

♻️ Proposed change
 var allEvidencePurges = 0
+val liveCaptureFlags = mutableListOf<Boolean>()
 val store = DiagnosticsSettingsStore(
     dataStore = dataStore,
     bindingPurger = RecordingBindingPurger(),
     allEvidencePurger = DiagnosticsAllEvidencePurger { includeLiveCapture ->
-        assertTrue(includeLiveCapture)
+        liveCaptureFlags += includeLiveCapture
         allEvidencePurges += 1
     },
 )
@@
 assertEquals(1, allEvidencePurges)
+assertEquals(listOf(true), liveCaptureFlags)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsSettingsStoreTest.kt`
around lines 261 - 269, Update the DiagnosticsAllEvidencePurger callback in
DiagnosticsSettingsStoreTest to record the includeLiveCapture value and
increment the purge count without asserting inside the lambda. After the store
action completes, assert the recorded value externally so assertion failures are
reported directly by the test rather than treated as purge failures.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/auth/TvLoginViewModel.kt`:
- Around line 185-199: Update the device-login catch block surrounding
replaceAccountSession in TvLoginViewModel so post-commit failures preserve the
successful authentication state by setting loginSuccess/authCompleted
consistently with the credential-login path, while still stopping loading and
reporting the error without instructing the user to retry an already-committed
session.

---

Nitpick comments:
In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsModule.kt`:
- Around line 223-256: Extract the duplicated first-failure-preserving attempt
logic and conditional capture.purgeCurrentEvidence() step from
DiagnosticsBindingPurger and DiagnosticsAllEvidencePurger into one private
module helper. Have both singleton handlers reuse that helper while retaining
their existing report, ledger, and marker purge operations and final failure
propagation.

In
`@android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/HostedDiagnosticsDeletionWorker.kt`:
- Around line 21-51: Update HostedDiagnosticsDeletionWorker.doWork so the full
blocking workflow, including hostedDeletionIntents, deleter.delete, and
completeHostedDeletion, executes within withContext(Dispatchers.IO); preserve
the existing cancellation propagation and retry/success behavior.

In
`@android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsSettingsStoreTest.kt`:
- Around line 261-269: Update the DiagnosticsAllEvidencePurger callback in
DiagnosticsSettingsStoreTest to record the includeLiveCapture value and
increment the purge count without asserting inside the lambda. After the store
action completes, assert the recorded value externally so assertion failures are
reported directly by the test rather than treated as purge failures.

In
`@androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/diagnostics/DiagnosticsReportScreen.kt`:
- Around line 143-152: Update the uploadNotice rendering in
DiagnosticsReportScreen so success and error severity are conveyed non-visually,
not only through the color selected by uploadNoticeIsError. Add an appropriate
leading icon or explicit accessible label tied to the same severity state, while
preserving the existing notice text and color styling.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f4e3bd58-2521-485a-87bf-5d2a18fc3099

📥 Commits

Reviewing files that changed from the base of the PR and between 6a6b240 and 859adf7.

📒 Files selected for processing (33)
  • README.md
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsBundleBuilder.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsCoordinator.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsManualCapture.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsModule.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsSettingsStore.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsUploadWorker.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsUploader.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsViewModel.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/HostedDiagnostics.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/HostedDiagnosticsDeletionWorker.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/PendingReportStore.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsBundleBuilderTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsCoordinatorTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsSettingsStoreTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsUploaderTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/HostedDiagnosticsTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/PendingReportStoreTest.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/downloads/AppWorkerFactory.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/diagnostics/DiagnosticsPrompt.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/diagnostics/DiagnosticsReportScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/diagnostics/DiagnosticsSettingsScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/auth/TvLoginViewModel.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsPromptScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsReportScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsSettingsScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/watchnext/TvWorkerFactory.kt
  • docs/superpowers/specs/2026-08-12-android-hosted-diagnostics-design.md
  • shared/src/androidMain/kotlin/org/siloserver/silo/network/AndroidServerRegistry.kt
  • shared/src/androidMain/kotlin/org/siloserver/silo/network/EncryptedTokenManagerImpl.kt
  • shared/src/androidUnitTest/kotlin/org/siloserver/silo/network/EncryptedTokenManagerScopeGenerationTest.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/IdentityTransitionBarrier.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/TokenManagerImpl.kt
🚧 Files skipped from review as they are similar to previous changes (22)
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsPromptScreen.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsViewModel.kt
  • README.md
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsUploadWorker.kt
  • docs/superpowers/specs/2026-08-12-android-hosted-diagnostics-design.md
  • shared/src/androidMain/kotlin/org/siloserver/silo/network/AndroidServerRegistry.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsManualCapture.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/PendingReportStoreTest.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/TokenManagerImpl.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsBundleBuilderTest.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/IdentityTransitionBarrier.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/diagnostics/DiagnosticsPrompt.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsSettingsStore.kt
  • shared/src/androidMain/kotlin/org/siloserver/silo/network/EncryptedTokenManagerImpl.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/diagnostics/DiagnosticsSettingsScreen.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsBundleBuilder.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/HostedDiagnostics.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsSettingsScreen.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/diagnostics/HostedDiagnosticsTest.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsUploader.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/diagnostics/TvDiagnosticsReportScreen.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/diagnostics/DiagnosticsCoordinator.kt

@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: 859adf79a5

ℹ️ 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".

@cursor

cursor Bot commented Aug 12, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@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: bd3d758108

ℹ️ 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 on lines +166 to +169
is DiagnosticsUploadDecision.HostedProcessing -> {
uploadNoticeIsError = false
uploadNotice = uploadKeptMessage(decision)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Expose persisted processing reference IDs

Fresh evidence after the prior processing-state fix is that DiagnosticsReportSummary still omits hostedRemoteShortId, while this branch exposes the reference only through a remember-backed notice. If the user leaves this screen or the process is recreated while the report remains PROCESSING, the rebuilt details show the processing state but no longer display or allow copying the collector reference; the TV screen follows the same pattern. Populate the reference from the persisted report state rather than only from the upload callback.

Useful? React with 👍 / 👎.

@Quick104
Quick104 merged commit c10e96d into main Aug 12, 2026
3 checks passed
@Quick104
Quick104 deleted the agent/hosted-diagnostics branch August 12, 2026 18:32
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