Skip to content

Auto-open the sandbox browser preview and follow the agent's tab - #506

Merged
xfgong merged 4 commits into
mainfrom
feat/2026-08-19-auto-open-browser-preview
Aug 19, 2026
Merged

Auto-open the sandbox browser preview and follow the agent's tab#506
xfgong merged 4 commits into
mainfrom
feat/2026-08-19-auto-open-browser-preview

Conversation

@xfgong

@xfgong xfgong commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

What

When the agent uses the sandbox browser, the conversation side panel now opens on the Browser tab by itself. After each agent-browser command, Chromium's visible tab is brought to the front so the Neko live view matches the page the agent is operating on.

Why

Users currently have to click Browser themselves, and CDP can drive a background tab while the live desktop still shows a different one. Both make takeover and watching the agent harder than they should be.

How

  • Stream tool_call events that load the browser skill or run agent-browser / start-browser.sh open the sandbox Browser panel (same chat-surface gate as artifact auto-open). User-picked artifacts, attachments, and tool panels are not replaced.
  • start_browser installs a PATH wrapper for agent-browser that activates the session's current page via CDP /json/activate/<id>. No sandbox image rebuild is required; existing sandboxes pick it up on the next live-view start.

Theater / maximize is still manual.

Tests

  • autoOpenPreview + messageStore.autoOpenBrowser unit tests
  • sandbox tab-follow + start_browser unit tests

Open the sandbox Browser panel when the agent loads the browser skill or
runs agent-browser, and wrap agent-browser so Chromium's visible tab
follows the page the agent is operating on.
@github-actions github-actions Bot added documentation Improvements or additions to documentation enhancement New feature or request backend Backend code frontend Frontend code labels Aug 19, 2026
@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
backend/cubeplex/sandbox/base.py 72.72% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

xfgong added 3 commits August 19, 2026 01:48
… exactly

Install the PATH wrapper first so the agent's first connect is already
wrapped, replace a stale .real with the current CLI, and activate only
an exact URL match so a parent tab is not stolen.
Image attachments are read from ObjectStore via view_images. Staging
them onto a LazySandbox before the turn starts cold-provisions a
container and can stall the run past the Playwright timeout. Skip
hydrate for kind=image, and skip sandbox.download until the FS is
already live.
The chip is a permanent per-conversation count ("1 memories" /
"1 条记忆"), not the old 已记住 / 已更新 verbs.
@xfgong
xfgong merged commit 8b9b061 into main Aug 19, 2026
18 checks passed
xfgong added a commit that referenced this pull request Aug 20, 2026
…r.sh

The sandbox image bakes NEKO_WEBRTC_ICESERVERS_* (TURN at
192.168.1.208:3478) into Config.Env so Neko can relay WebRTC media.
When start-browser.sh runs as the agent (uid 1000), it re-execs
through sudo; /etc/sudoers sets Defaults env_reset and does not
include NEKO_* in env_keep, so sudo strips the TURN config. Neko
falls back to Google STUN only, ICE has no relay, and the live view
white-screens.

Preserve the NEKO_* vars across the re-exec via a temp file the
root branch sources back. NEKO_ENV_FILE is set on the sudo command
line (not the inherited env), so it survives env_reset.

Surfaced by PR #506 (auto-open browser preview) once the Browser
panel started opening on its own and the agent-started browser
path became user-visible. The backend's as_root=True path is
unaffected.

Requires rebuilding the cubeplex-sandbox image with a new tag and
deploying it for the fix to land in running sandboxes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend code documentation Improvements or additions to documentation enhancement New feature or request frontend Frontend code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant