Problem
Several subagents can connect to the same Headless host, but Headless currently coordinates individual commands rather than their complete browser tasks. Named isolated sessions protect cookies and storage, yet a session name does not identify its owner. A second same-user client can navigate or close that session, stop its recording, or replace its active flow. Commands for all sessions use one execution queue, so a long wait or tour can delay unrelated agents until their clients time out. The timed-out command may still run later.
Evidence also shares one artifact store: artifacts list is host-wide, report create includes that list, and artifact names can be used across sessions. stop and profile clear affect every session. The current skill recommends task-specific names but does not require isolated sessions for parallel work.
Relevant code: Transport.swift (single request queue), HostCore.swift (session lookup, flows, recordings, report), Artifacts.swift (shared store), and MCP/main.swift (one shared argv tool).
Goal
Two cooperating subagents should be able to run independent browser tasks on one host without accidentally changing each other's page, evidence, recording, or lifecycle. A stalled or disconnected client must produce an explicit, recoverable outcome. This is a correctness contract for cooperating agents. It must not claim to protect against a hostile process running as the same OS user; separate OS users remain the boundary for that case.
Design work
- Define how a client claims a session, how ownership is checked on every session command, and how leases expire or are released after a client exits. Decide how this works for CLI and multiple stdio MCP processes without putting a reusable secret in logs, flows, reports, or page output.
- Specify the behavior of the implicit
default session in multi-agent use. Preserve a simple single-agent path while preventing accidental sharing.
- Define fair scheduling and timeout behavior across sessions. A queued request must not execute silently after its caller has timed out; where cancellation cannot be guaranteed, return an explicit unknown-outcome state and a way to reconcile it.
- Scope artifact listing, report references, uploads, visual comparisons, flows, and recordings to the owning task or session, with an explicit path for intentional sharing.
- Decide who may run host-wide operations such as
stop and profile clear while other sessions are active. One subagent's cleanup must not end another's work.
- Document what happens when a session is closed, a client disconnects, the host restarts, or a subagent crashes.
Acceptance criteria
- Add an architecture decision before changing the agent-facing protocol or ownership model.
- Two independent CLI clients and two MCP clients can create isolated sessions and complete interleaved visit, inspect, action, capture, and cleanup flows without cross-session effects.
- Tests cover same-session contention, name collisions, crashed clients, long waits and tours, queued timeouts, host-wide commands, and recording and flow ownership.
- A report and artifact listing for one subagent do not silently include another subagent's evidence. Intentional sharing is explicit and tested.
- Existing session isolation, credential challenge binding, private socket, no TCP listener, bounded responses, and no arbitrary JavaScript contracts remain intact.
- Update CLI help, capabilities and SDK schema where the contract changes, plus command docs, skill guidance, and macOS and Linux E2E coverage.
@yashranaway Could you review this scope, especially session ownership, queued-request outcomes, and artifact sharing? Please flag any behavior that should be split into a separate issue before implementation.
Problem
Several subagents can connect to the same Headless host, but Headless currently coordinates individual commands rather than their complete browser tasks. Named isolated sessions protect cookies and storage, yet a session name does not identify its owner. A second same-user client can navigate or close that session, stop its recording, or replace its active flow. Commands for all sessions use one execution queue, so a long wait or tour can delay unrelated agents until their clients time out. The timed-out command may still run later.
Evidence also shares one artifact store:
artifacts listis host-wide,report createincludes that list, and artifact names can be used across sessions.stopandprofile clearaffect every session. The current skill recommends task-specific names but does not require isolated sessions for parallel work.Relevant code:
Transport.swift(single request queue),HostCore.swift(session lookup, flows, recordings, report),Artifacts.swift(shared store), andMCP/main.swift(one shared argv tool).Goal
Two cooperating subagents should be able to run independent browser tasks on one host without accidentally changing each other's page, evidence, recording, or lifecycle. A stalled or disconnected client must produce an explicit, recoverable outcome. This is a correctness contract for cooperating agents. It must not claim to protect against a hostile process running as the same OS user; separate OS users remain the boundary for that case.
Design work
defaultsession in multi-agent use. Preserve a simple single-agent path while preventing accidental sharing.stopandprofile clearwhile other sessions are active. One subagent's cleanup must not end another's work.Acceptance criteria
@yashranaway Could you review this scope, especially session ownership, queued-request outcomes, and artifact sharing? Please flag any behavior that should be split into a separate issue before implementation.