Skip to content

fix(desktop): only default CEF debugging port when endpoint is live#385

Open
seasidespace wants to merge 2 commits into
berabuddies:masterfrom
seasidespace:fix/cef-port-probe
Open

fix(desktop): only default CEF debugging port when endpoint is live#385
seasidespace wants to merge 2 commits into
berabuddies:masterfrom
seasidespace:fix/cef-port-probe

Conversation

@seasidespace

@seasidespace seasidespace commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Two related fixes so the desktop app reliably uses the native CEF browser (a full, non-headless Chromium) for connector logins like Gmail, instead of dropping to the managed-Chrome screencast fallback that Google blocks with "This browser or app may not be secure."

1. Launcher: only default the CEF port when the endpoint is actually live (daemon_launcher.rs)

  • Previously the launcher unconditionally injected PUFFER_CEF_REMOTE_DEBUGGING_PORT=9333 for the local daemon, even on builds without a native CEF runtime. The daemon then tried to attach to a CEF browser that wasn't there and hard-errored or split-brained against the fallback.
  • Now it probes the loopback DevTools endpoint and only advertises 9333 when CEF is serving a browser WebSocket URL.

2. Daemon: discover native CEF lazily to remove the startup race (daemon_browser/session.rs)

  • CEF warms up asynchronously at app start. A daemon spawned during that window never received the injected port and was pinned to the managed-Chrome fallback for its whole lifetime — the user-visible "Screencast fallback" Gmail failure.
  • The daemon now discovers CEF at session-spawn time: when the port isn't explicitly configured it briefly probes the default port (9333) and uses CEF if live, otherwise falls back gracefully. When the port is explicitly configured, the previous patient 30s startup wait and hard-error-on-unreachable behavior is preserved.

Test plan

  • cargo check --lib for the corbina desktop crate passes.
  • cargo test -p puffer-cli — new daemon_browser::session::tests (explicit port waits patiently; missing port probes the default briefly and falls back) pass; launcher env tests pass.
  • Reproduced live: confirmed a daemon spawned before CEF warmed had no PUFFER_CEF_REMOTE_DEBUGGING_PORT and stayed on the headless fallback; with lazy discovery it attaches to CEF on 9333.
  • Manual: cold-start npm run tauri dev and immediately open the Gmail connector — badge should read native CEF (not "Screencast fallback") and Google should allow sign-in.

🤖 Generated with Claude Code

The daemon launcher unconditionally injected
PUFFER_CEF_REMOTE_DEBUGGING_PORT=9333 for the local daemon, even on
builds where the native CEF runtime was never compiled in or had not
opened its DevTools endpoint. The daemon then honored that port,
attempted to attach to a CEF browser that was not there, and either hard
-errored ("native CEF DevTools on loopback port 9333 was not reachable")
or split-brained against a flaky managed-Chrome fallback whose
/json/new tab creation intermittently timed out.

Probe the loopback DevTools endpoint before defaulting the port, so the
launcher only advertises 9333 when CEF is actually serving a browser
WebSocket URL. Otherwise the daemon cleanly uses the managed-Chrome
screencast fallback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

@seasidespace is attempting to deploy a commit to the fuzzland Team on Vercel.

A member of the Team first needs to authorize it.

@seasidespace seasidespace marked this pull request as draft June 11, 2026 19:42
The daemon only attempted native CEF when PUFFER_CEF_REMOTE_DEBUGGING_PORT
was present in its environment. The desktop launcher injects that port,
but only if CEF is already serving on 9333 at daemon-spawn time. CEF
warms up asynchronously at app start, so a daemon that spawned during the
warmup window never received the port and was pinned to the managed-Chrome
screencast fallback for its entire lifetime -- which Google blocks during
Gmail sign-in ("This browser or app may not be secure").

Discover CEF at session-spawn time instead: when the port is not
explicitly configured, probe the default loopback port (9333) briefly and
use CEF if it is actually serving, otherwise fall back gracefully to the
managed-Chrome backend. When the port IS explicitly configured we keep the
previous patient 30s startup wait and hard-error on an unreachable
endpoint. This eliminates the race without adding latency to non-CEF
builds (1s probe) and without changing explicit-opt-in behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@seasidespace seasidespace marked this pull request as ready for review June 11, 2026 20:03
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