Skip to content

Local desktop optimization#191

Merged
abonneth merged 18 commits into
mainfrom
antoine/local-control-fixes
Jul 16, 2026
Merged

Local desktop optimization#191
abonneth merged 18 commits into
mainfrom
antoine/local-control-fixes

Conversation

@abonneth

@abonneth abonneth commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Made with Cursor


Note

Medium Risk
Touches live local control (permissions, global Esc tap, session cancel on stop/exit) and default session limits; changes are guarded by tests but mis-stops or budget defaults could affect long-running local agents.

Overview
Local desktop now downscales and encodes screenshots before upload (ScaledDesktopDriver, CLI flags --max-width, --image-format, etc.), requires hai-drivers>=0.1.2, and on macOS runs preflight permission checks (Accessibility / Screen Recording) before the bridge thread starts.

Adds an out-of-band kill switch: hai local stop writes a shared stop file; on macOS desktop serve, double-Esc can trigger the same path. SDK local sessions wire a StopWatcher to cancel remote sessions and stop bridges, register atexit cancels, and apply default runaway budgets (max_steps / max_time_s) when the caller omits them.

CLI: new read-only hai doctor (login, platform, browser/desktop deps and macOS grants); Rich escape() on dynamic output; session IDs shown at full width for copy-paste.

Bridge reliability: retried, backoff command-channel setup (including 429 on ensure_channel); deferred channel recreation on SessionNotFound; startup hints when readiness times out (e.g. stale Chrome on port 9222).

Reviewed by Cursor Bugbot for commit 4b35293. Bugbot is set up for automated code reviews on this repo. Configure here.

…tput fixes

Co-authored-by: Cursor <cursoragent@cursor.com>
@abonneth abonneth requested a review from adeprezh as a code owner July 9, 2026 16:08
Comment thread src/hai_agents_local/bridge.py
Co-authored-by: Cursor <cursoragent@cursor.com>

@cm2435 cm2435 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.

adress 2 small comments but then good to merge

Comment thread src/hai_agents_local/bridge.py Outdated
Comment thread src/hai_agents_local/desktop.py Outdated
Comment thread src/hai_agents_local/bridge.py
abonneth and others added 4 commits July 9, 2026 19:04
…guard to caller, None startup_hint

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…, settings deep links

Co-authored-by: Cursor <cursoragent@cursor.com>
… flake

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/hai_agents_local/sessions.py
abonneth and others added 9 commits July 10, 2026 14:30
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…into antoine/local-control-fixes

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	src/hai_agents_cli/app.py
#	src/hai_agents_local/desktop.py
Co-authored-by: Cursor <cursoragent@cursor.com>
@abonneth abonneth changed the title Harden local control startup and CLI output Local desktop optimization Jul 16, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/hai_agents_local/desktop.py Outdated
…rtup

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ddce165. Configure here.

Comment thread src/hai_agents_local/bridge.py
Comment thread src/hai_agents_cli/app.py
…CLI setup

Co-authored-by: Cursor <cursoragent@cursor.com>
@abonneth abonneth merged commit 7f0079f into main Jul 16, 2026
7 checks passed
@abonneth abonneth deleted the antoine/local-control-fixes branch July 16, 2026 14:41
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