Skip to content

Live-stream WebSocket client disconnect intermittently resets the active page to about:blank #1476

Description

@chaithanya-zluri

Summary

When a live-stream WebSocket client (stream enable) disconnects, the session's active page is intermittently reset to about:blank. The graceful stream disable command does not do this — it stops streaming while preserving the page. A socket-level client disconnect should behave like stream disable (stop streaming, leave the page intact).

Environment

  • agent-browser 0.25.0 (npm global)
  • Linux arm64 (Docker node:22-bookworm-slim), Chromium 149 via --executable-path /usr/bin/chromium
  • Headless

Reproduction

agent-browser --session repro open https://www.iana.org
agent-browser --session repro wait 1200
agent-browser --json --session repro eval "location.href"   # => https://www.iana.org/

# Connect any WS client to the stream port, then drop the socket:
PORT=$(cat ~/.agent-browser/repro.stream)
( printf 'GET / HTTP/1.1\r\nHost: localhost\r\nConnection: Upgrade\r\nUpgrade: websocket\r\nSec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==\r\nSec-WebSocket-Version: 13\r\n\r\n'; sleep 2 ) | nc 127.0.0.1 $PORT

agent-browser --json --session repro eval "location.href"   # => frequently about:blank

Observations

  • Intermittent: the page resets on roughly 3 of every 5 connect→disconnect cycles (not deterministic — looks like a race in the screencast/page lifecycle).
  • Graceful stream disable never resets the page; only socket-level client disconnects do.
  • Reset fires on any client disconnect, not only the last one: with one client held open, a second client disconnecting still resets the page.
  • Not memory/OOM, not /dev/shm, not idle-timeout (AGENT_BROWSER_IDLE_TIMEOUT_MS disabled).

Expected

A stream client disconnecting should stop/cleanup streaming without mutating page state, matching stream disable.

Impact

Any live-view UI that reconnects (e.g., on tab focus, re-render, or transient network blips) loses the user's page to about:blank on each reconnect, since every disconnect risks the reset.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions