Skip to content

fix(overview): timeout hung ScreenCaptureKit calls - #129

Merged
qeude merged 8 commits into
mainfrom
t3/overview-captures
Oct 12, 2026
Merged

qeude merged 8 commits into
mainfrom
t3/overview-captures

Conversation

@qeude

@qeude qeude commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Wrap ScreenCaptureKit calls with 5-second timeout to prevent indefinite hangs that block the capture limiter
  • Release limiter slot immediately on timeout so subsequent overview sessions can proceed instead of waiting for restart
  • Apply timeout to: SCShareableContent fetch, desktop background captures, and window preview captures
  • Add withOverviewCaptureTimeout() helper using Task.sleep-based deadline with first-completion semantics
  • Add unit test verifying timeout behavior and limiter recovery
  • Add agent skill documentation for Defi feature verification (overview, navigation, workspaces, service lifecycle)

Testing

  • New test hungNativeCaptureFailsAtDeadlineInsteadOfHoldingTheSlot verifies timeout fires and limiter releases
  • Local: python3 script/verify.py local (swift build and non-desktop tests)
  • Desktop E2E: existing testOverviewShowsBothMonitorsBeforeLoadingPreviews exercises the capture flow
  • Manual: defi toggle-overview && sleep 3 && defi status should show overviewReceivedPreviews > 0

View guided diff Turn on auto-fix

Note

Timeout hung ScreenCaptureKit calls in overview capture paths

  • Adds withOverviewCaptureTimeout in OverviewPreviewCapture.swift, a main-actor wrapper that races a capture operation against a 5-second deadline and throws OverviewCaptureTimeoutError. The hung native call is not cancelled; the wrapper just stops waiting on it.
  • Wraps shareable-content discovery, desktop screenshots, and window screenshots in captureOverviewImages, and shareable-content discovery plus sample-buffer capture in OverviewSurfaceCapture.prepare. Timeout errors follow the existing error paths and release the capture limiter slot.
  • Bounds desktop background capture retries to 5 per overview session generation in OverviewController.swift; after exhaustion, window previews still schedule, and a new generation resets the count.
  • Adds tests in OverviewPreviewTests.swift covering the deadline failure and limiter release to queued captures.
  • Behavioral Change: overview captures now fail after 5 seconds instead of blocking indefinitely; the underlying ScreenCaptureKit call keeps running after the timeout, and desktop backgrounds are skipped after 5 failed retries in a session.

Macroscope summarized 44c31e1.

- Wrap SCShareableContent and SCScreenshotManager calls with 5-second timeout
- Prevents hung native calls from holding the capture limiter slot indefinitely
- Abandons stalled captures so subsequent overview sessions can proceed
- Add test for timeout behavior and recovery
- Add agent verification docs for overview, workspaces, scrolling, and service lifecycle
@greptile-apps

greptile-apps Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Overview captures now stop waiting after five seconds and release the shared capture slot.

  • Overview captures stop waiting after five seconds.
  • Desktop background retries stop after five attempts per session.
  • Agents can follow a shared guide to verify Defi features.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Acquire capture slot] --> B[Start native capture and deadline]
  B --> C{Which finishes first?}
  C -->|Capture| D[Return image or error]
  C -->|Five seconds| E[Return timeout error]
  D --> F[Release capture slot]
  E --> F
  E --> G[Native call remains running]
Loading

Reviews (6) · Last reviewed commit: "Merge branch 'main' into t3/overview-cap..." · Reviewed by Greptile

Comment thread Sources/DefiMacOS/OverviewPreviewCapture.swift
Comment thread Sources/DefiMacOS/OverviewPreviewCapture.swift
Comment thread Tests/DefiMacOSTests/OverviewPreviewTests.swift
Comment thread .agents/skills/verify-defi/SKILL.md
@macroscopeapp

macroscopeapp Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This targeted overview reliability fix changes production capture scheduling by abandoning timed-out ScreenCaptureKit calls and automatically suppressing desktop retries after five failures per session. The concurrency and limiter interactions, along with the new retry gate, warrant human review.

No code changes detected at 44c31e1. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

Comment thread Sources/DefiMacOS/OverviewController.swift Outdated
Comment thread Sources/DefiMacOS/OverviewController.swift
Comment thread Sources/DefiMacOS/OverviewController.swift Outdated
@qeude
qeude merged commit 0812c11 into main Oct 12, 2026
5 of 6 checks passed
@qeude
qeude deleted the t3/overview-captures branch October 12, 2026 18:12
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