Repository navigation
Fix five robustness issues in networking, pairing, saved servers and dictation - #1075
Merged
Merged
Conversation
Forward everything on the main thread, plain socket errors and timeouts, and rejections outside OkHttp threads to the previous handler.
3 tasks done
ivanfenenko
marked this pull request as ready for review
November 16, 2026 12:14
Collaborator
Author
|
@cursor review |
There was a problem hiding this comment.
Automated review: no finding that 2+ of 3 passes agreed on.
4 finding(s) from a single pass, not posted
ios/OpenCodeKit/Sources/OpenCodeKit/Domain/Connection/ConnectionProfileStore.swift:347medium: First-only unreadable backup loses servers saved in between (muse-spark-1.3-contributor)android/hexcode/src/main/java/dev/opencode/hexcode/home/HomeViewModel.kt:155medium: Closing dictation dispatchers makes a late end() crash (muse-spark-1.3-contributor)ios/OpenCodeKit/Sources/OpenCodeKit/Domain/Connection/ConnectionProfileStore.swift:105medium: Per-record decode recovery fails for wrong-typed fields: one bad record still empties the rest of the list (glm-5.3-flash)ios/OpenCodeKit/Sources/OpenCodeKit/Domain/Connection/ConnectionProfileStore.swift:94low: Top-level activeId still empties the whole saved-server list (muse-spark-1.3-contributor)
opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.080 · 1 pass(es) stopped early
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 030be41. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Five independent robustness fixes from a code audit, one commit each. No issue exists for these.
Dictationgainsclose(); the home view model calls it fromonCleared(), which cancels both dictation scopes and shuts down thehex-audioandhex-vadexecutors.CleartextPolicybefore probing, as Android Hex Code already does, with a new "This address isn't encrypted" failure (copy matches Android).longOperationsession, so the REST session's 60 s resource timeout no longer ends them early. Ordinary REST calls keep the 60 s cap.Checks
./gradlew :opencode-kit:testDebugUnitTest :hexcode:testDebugUnitTest :opencode-kit:ktlintCheckpassed. opencode-kit 330 tests, hexcode 716 tests, 0 failures.OpenCodeURLSessionsTests,ConnectionProfileStoreTests,CleartextPolicyTests,ServerPairingTests.OpenCode MobileTestsfailed on different timing-based tests each time (MessageSyncTests,PermissionLiveStoreTests,DisplayMessagePipelineCharacterizationTests) and restarted after a hang.Hex CodeTestsfailed twice onaStalledAttemptIsStoppedAndTriedAgain, which passed when its suite ran alone. None of those files are touched here; CI is the reference.node scripts/check-string-keys.mjsexits 0.Risks / Follow-ups
VoiceEngineDictation.close()andClipDictation.close()have no direct tests; the sharedDictationThreadsthey use does.clearAll()also deletes the catalog backup key.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Changes touch uncaught-exception handling, persistent connection profiles, and pairing security policy; misclassification could hide real crashes or block legitimate pairings, though behavior is heavily unit-tested.
Overview
This PR bundles five robustness fixes across Android and iOS.
Android — dictation teardown:
Dictationgainsclose(); live dictation uses a sharedDictationThreadshelper that cancels coroutine scopes and shuts downhex-audio/hex-vadin order (mic release runs last on the audio thread).HomeViewModel.onCleared()drops an in-flight take and callsclose().Android — HTTP uncaught exceptions: The process-wide guard is tightened: nothing is swallowed on the main thread; Ktor engine-closed errors are logged off-main;
RejectedExecutionExceptionis only swallowed on OkHttp-named threads. Plain socket errors and timeouts always reach the previous handler.iOS — pairing cleartext: Before probing, pairing URLs are filtered with
CleartextPolicy, matching Android. If only untrusted plain HTTP remains, pairing fails with "This address isn't encrypted" and no network requests run.iOS — long HTTP operations: Summarize, v2 compact, and v2 generate use a dedicated
longOperationURLSession(long resource timeout) so the 60s REST pool cap does not cut them off; routine calls still userest.iOS — saved server catalog: Loading decodes profiles one record at a time so one bad entry does not wipe the list; unreadable catalog bytes are backed up once before overwrite, with logging on partial skips and write failures.
Reviewed by Cursor Bugbot for commit 030be41. Bugbot is set up for automated code reviews on this repo. Configure here.