Skip to content

[codex] Improve Rewind OCR quality - #8134

Merged
Git-on-my-level merged 5 commits into
mainfrom
codex/improve-ocr-quality
Jun 23, 2026
Merged

Git-on-my-level merged 5 commits into
mainfrom
codex/improve-ocr-quality

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jun 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #8130.

  • Force Rewind OCR to use Apple Vision accurate recognition with language correction.
  • Remove user-facing OCR quality controls so OCR quality is not user-degraded.
  • Replace battery OCR skipping with automatic slower screenshot capture cadence on battery.
  • Flush active video chunks before AC/battery cadence switches and load video frames by frame index so dynamic cadence does not break frame retrieval.
  • Keep legacy skippedForBattery backfill behavior for existing local rows.

Review

  • Local read-only review of the staged diff found no actionable regressions.
  • External Oracle review was not run because the private-workspace code upload was blocked by policy.

Validation

xcrun swift test --package-path Desktop --filter RewindOCRQualityTests

Result: 3 tests passed.

Review in cubic

@Git-on-my-level
Git-on-my-level marked this pull request as ready for review June 23, 2026 01:50

@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: 79af7afa75

ℹ️ 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 482 to 486
while true {
// Stop backfill if we went back to battery
if shouldPauseOCRForBattery() {
log("RewindIndexer: Backfill paused — back on battery after \(totalProcessed) screenshots")
return
}

let pending = try await RewindDatabase.shared.getBatterySkippedScreenshots(limit: batchSize)
if pending.isEmpty { break }

for screenshot in pending {

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 Keep legacy OCR backfill paused on battery

For users with existing skippedForBattery rows, plugging in starts this backfill from PowerMonitor.onACReconnected, but the loop now keeps fetching and OCRing batches without rechecking the current power source. If they unplug while a large legacy backlog is running, accurate OCR continues on battery until the queue is exhausted, undoing the battery-saving behavior; keep the old power check before each batch/item.

Useful? React with 👍 / 👎.

@cubic-dev-ai cubic-dev-ai 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.

2 issues found and verified against the latest diff

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 4 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="desktop/macos/Desktop/Sources/Rewind/Services/PowerMonitor.swift">

<violation number="1" location="desktop/macos/Desktop/Sources/Rewind/Services/PowerMonitor.swift:10">
P2: `cachedIsOnBattery` is exposed as `nonisolated(unsafe)` mutable shared state and is read/written across executors without synchronization, creating a data race risk.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

class PowerMonitor: ObservableObject {
static let shared = PowerMonitor()

nonisolated(unsafe) private static var cachedIsOnBattery = false

@cubic-dev-ai cubic-dev-ai Bot Jun 23, 2026 •

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: cachedIsOnBattery is exposed as nonisolated(unsafe) mutable shared state and is read/written across executors without synchronization, creating a data race risk.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Sources/Rewind/Services/PowerMonitor.swift, line 10:

<comment>`cachedIsOnBattery` is exposed as `nonisolated(unsafe)` mutable shared state and is read/written across executors without synchronization, creating a data race risk.</comment>

<file context>
@@ -7,6 +7,8 @@ import IOKit.ps
 class PowerMonitor: ObservableObject {
     static let shared = PowerMonitor()
 
+    nonisolated(unsafe) private static var cachedIsOnBattery = false
+
     @Published private(set) var isOnBattery: Bool = false
</file context>
Fix with cubic

@Git-on-my-level
Git-on-my-level merged commit 848ffa4 into main Jun 23, 2026
2 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/improve-ocr-quality branch June 23, 2026 02:45
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.

Desktop OCR severely corrupts screenshot text and breaks screen search

1 participant