Add runtime stream enable/disable/status commands#951
Open
ThomasK33 wants to merge 3 commits intovercel-labs:mainfrom
Open
Add runtime stream enable/disable/status commands#951ThomasK33 wants to merge 3 commits intovercel-labs:mainfrom
ThomasK33 wants to merge 3 commits intovercel-labs:mainfrom
Conversation
Contributor
|
@ThomasK33 is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
ctate
requested changes
Mar 20, 2026
Collaborator
ctate
left a comment
There was a problem hiding this comment.
Thanks for this contribution! I found two issues to address before merging:
handle_stream_disableunconditionally resetsstate.screencasting = false, which can orphan a user-initiated screencast that was started independently. Consider only resetting this if the stream server was responsible for starting it, or leaving it untouched entirely.- In
handle_stream_disable, ifremove_stream_filefails, the?early-return leavesstream_server/stream_clientasSomepointing at a dead server. The state cleanup should be unconditional.
Author
|
Hey Chris, thanks for the quick turnaround on the review. I resolved both issues by having |
af087cf to
7c5ac85
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
stream enable,stream status, andstream disablecommands for already-running daemon sessions.streammetadata handling, and explicit shutdown behaviorValidation
cd cli && cargo test stream_ -- --nocapturecd cli && cargo test e2e_runtime_stream_enable_before_launch_attaches_and_disables -- --ignored --test-threads=1cd cli && cargo test📋 Implementation Plan
Implementation Plan: Runtime stream enablement for an already-running session
Goal
Add a supported runtime path to enable WebSocket streaming on an already-running
agent-browserdaemon/session without requiring a daemon restart, plus companion status/disable flows so the lifecycle is inspectable and reversible.Verified repo context
AGENT_BROWSER_STREAM_PORTincli/src/native/daemon.rs.DaemonStatealready models streaming as optional runtime state viastream_clientandstream_server, andupdate_stream_client()already re-wires the browser/client relationship when the browser launches or closes incli/src/native/actions.rs.cli/src/native/stream.rsalready supports starting a stream server with or without an attached CDP client viaStreamServer::start()andStreamServer::start_without_client().screencast_start/screencast_stop, but those only control frame production; they do not create the WebSocket server..streamfile management currently lives in daemon startup/shutdown code.Implementation constraints inferred from the current code
.streamfile lifecycle must stay accurate for discovery scripts and existing tooling.Arcdrops alone if the currentStreamServerlifecycle is ambiguous.Proposed product surface
User-facing CLI
Add a
streamcommand group:agent-browser stream enable [--port <port>]agent-browser stream disableagent-browser stream statusUnderlying daemon actions
stream_enablestream_disablestream_statusRecommended response shape
stream_enable→{ enabled: true, port, connected, screencasting }stream_disable→{ disabled: true }stream_status→{ enabled, port: number|null, connected, screencasting }Port behavior
Prefer allowing omitted/auto-assigned ports for the runtime command, because
StreamServeralready returns the actual bound port. If that adds unnecessary CLI complexity, MVP can require an explicit port and defer auto-assignment to a follow-up.Workstream 1: Runtime daemon lifecycle
Files / symbols
cli/src/native/actions.rscli/src/native/stream.rscli/src/native/daemon.rs(reference/consistency, likely light or no edits)cli/src/connection.rsor a small helper extraction)Changes
Add runtime handlers in
cli/src/native/actions.rshandle_stream_enable(cmd, state)handle_stream_disable(state)handle_stream_status(state)execute_command().Implement
handle_stream_enableStreamServerat runtime usingStreamServer::start_without_client(...).stream_serverandstream_clientinDaemonState.state.update_stream_client().awaitso an already-running browser is attached immediately..streamfile with the actual bound port.Implement
handle_stream_disablestate.stream_serverandstate.stream_client..streamfile.Implement
handle_stream_statusAdd deterministic stream shutdown support if needed
StreamServerdoes not already guarantee clean task teardown on drop, add an explicit shutdown mechanism incli/src/native/stream.rsand use it fromhandle_stream_disable.Defensive-programming expectations
stream_server/stream_clientpairing..streamwrite/remove errors where user-visible correctness depends on them.Quality gate after Workstream 1
Workstream 2: CLI wiring and help output
Files / symbols
cli/src/commands.rsand/orcli/src/main.rs(depending on current parser split)cli/src/output.rsChanges
--jsonsupport and machine-readable output examples.cli/src/output.rs:Quality gate after Workstream 2
agent-browser stream enable,disable, andstatusparse correctly.Workstream 3: Tests
Files / symbols
cli/src/native/e2e_tests.rsMinimum test matrix
AGENT_BROWSER_STREAM_PORT.stream statusreports disabled before enable, then enabled with the bound port after enable..streamfile and updates status.Validation commands
If the full ignored e2e suite is too slow during iteration, run a focused subset first, but finish with the full required validation before claiming success.
Workstream 4: Documentation and agent-facing docs
Required documentation updates for this user-facing feature
Per repo guidance, update all of the following:
cli/src/output.rsREADME.mdskills/agent-browser/SKILL.mddocs/src/app/streaming/page.mdxdocs/src/app/commands/page.mdxAdditional docs to consider
docs/src/app/configuration/page.mdxto clarify the difference between startup env-var streaming and runtime CLI streaming.Documentation content to add
stream enableandscreencast_start.--session.Quality gate after Workstream 4
Dogfooding and review evidence
Setup
AGENT_BROWSER_STREAM_PORTso the new runtime path is exercised.Dogfooding flow
agent-browser --session <name> stream statusand verify it reports disabled.agent-browser --session <name> stream enable [--port ...].agent-browser --session <name> stream disable..streamis gone, andstream statusreports disabled.Required evidence artifacts
Capture all of the following during implementation review:
If implementation happens in an environment that supports generated artifacts, attach the screenshots and video to the work report so a reviewer can verify the behavior without replaying the steps manually.
Risks and decisions to resolve during implementation
Command naming
streamcommand group.Auto-port behavior
Disable semantics
Shutdown mechanics
StreamServeris sufficient; if not, add explicit shutdown for deterministic cleanup.Acceptance criteria
AGENT_BROWSER_STREAM_PORTcan enable streaming at runtime without restarting the daemon..stream.stream statusaccurately reports enabled state, port, browser connectivity, and screencasting status.stream disabletears down runtime streaming cleanly and removes.stream.Generated with
mux• Model:openai:gpt-5.4• Thinking:high