Skip to content

fix(gui): use the GPUI executor timer, not tokio::time::interval, for camera scans - #686

Merged
AprilNEA merged 1 commit into
AprilNEA:masterfrom
charliecai01:fix/gui-startup-crash-tokio-interval
Aug 20, 2026
Merged

fix(gui): use the GPUI executor timer, not tokio::time::interval, for camera scans#686
AprilNEA merged 1 commit into
AprilNEA:masterfrom
charliecai01:fix/gui-startup-crash-tokio-interval

Conversation

@charliecai01

Copy link
Copy Markdown
Contributor

This app crashes on every launch on macOS: the GUI opens the agent/overlay then aborts before a window ever appears.

Root cause

tokio::time::interval() in main.rs's camera-scan loop panics immediately — "there is no reactor running, must be called from the context of a Tokio 1.x runtime" — because the GUI's main task runs on GPUI's own executor. The only Tokio runtime in the process lives on the dedicated openlogi-ipc-client thread (services/ipc.rs). Since this happens on the main thread, the panic aborts the whole process (SIGABRT).

Introduced in 2d117e7 (refactor(ipc): let the agent say when its state changed).

Crash trace (macOS 26.5.2, Apple M4 Pro)

thread 'main' panicked at tokio-1.52.3/src/time/interval.rs:138:26:
there is no reactor running, must be called from the context of a Tokio 1.x runtime
fatal runtime error: failed to initiate panic, error 3, aborting

Fix

Every other timing site in openlogi-desktop already schedules through cx.background_executor().timer(...) — see platform/permissions.rs, features/camera/preview.rs, windows/settings.rs, windows/settings/about.rs, windows/settings/assets.rs. This swaps the camera-scan interval to the same primitive, re-arming it after each fire to preserve the original MissedTickBehavior::Delay semantics (a late tick just runs late instead of catching up, and a busy IPC arm in the same select! can't starve it since the timer isn't recreated per-iteration).

Testing

  • cargo build --release -p openlogi-desktop — clean
  • Ran the built binary directly and via open OpenLogi.app: agent, overlay, and desktop process all start and stay running past the point where they previously aborted; menu-bar item and input hook install successfully.

… camera scans

tokio::time::interval() panics immediately with "there is no reactor
running" when called outside a Tokio runtime context. The GUI's main
task runs on GPUI's own executor — the only Tokio runtime in the
process lives on the dedicated openlogi-ipc-client thread — so this
call aborted the process on every launch, before any window opened.

Every other timing site in openlogi-desktop already schedules through
cx.background_executor().timer(...) (see platform/permissions.rs,
features/camera/preview.rs, windows/settings.rs, windows/settings/
about.rs, windows/settings/assets.rs). Switch the camera-scan interval
to the same primitive, re-arming it after each fire to preserve the
original interval's MissedTickBehavior::Delay semantics.

Introduced in 2d117e7 (refactor(ipc): let the agent say when its state
changed).
@charliecai01
charliecai01 requested a review from AprilNEA as a code owner August 19, 2026 18:30
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown

Greptile Summary

Replaces the Tokio camera-scan interval with a GPUI background-executor timer to prevent startup panics outside a Tokio runtime.

  • Pins a one-shot GPUI timer for use in the existing select loop.
  • Re-arms the timer after each scan tick to retain delayed scheduling behavior.

Confidence Score: 5/5

The PR appears safe to merge, with the camera scan moved to the appropriate GPUI timer without an identified blocking or non-blocking defect.

The replacement timer is compatible with the GPUI-driven task, is re-armed after completion, and avoids constructing a Tokio timer where no Tokio reactor is running.

Important Files Changed

Filename Overview
crates/openlogi-desktop/src/main.rs The camera-scan loop now uses the executor that drives the GUI task, avoiding the reported missing-Tokio-reactor panic without introducing an actionable regression.

Reviews (1): Last reviewed commit: "fix(gui): use the GPUI executor timer, n..." | Re-trigger Greptile

@jhholm

jhholm commented Aug 20, 2026

Copy link
Copy Markdown

I'm getting the same error and trace on NixOS x86, with repository module flake installation method.

Otherwise my installation is 26.05, but following unstable for openlogi.

@AprilNEA
AprilNEA merged commit 9013a84 into AprilNEA:master Aug 20, 2026
17 checks passed
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.

3 participants