feat(web): run concurrent web sessions on one host
维护者通常 1 天内回复
已经有一个关联 PR 被合并了。
- #4191 来自 @kacper-mikolajczak —— 已合并
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 18/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
Start in packages/contracts/src/device-inventory.ts, where the fixed agent-browser-chrome web device is defined, then follow the three per-device checks in packages/daemon/src/sessions/session-lifecycle/internal/session-open-execution.ts and the device:<id> lock in packages/daemon/src/server/request-binding.ts. Done means two differently named web sessions open and run in parallel, the same name still returns DEVICE_IN_USE, and the router tests the issue lists pass. Pull request #4191 is already open against this issue, so check it before starting.
由索引模型根据 Issue 内容生成。
描述
Purpose
Let several agents drive isolated browsers on one host at the same time, the way they already can with one emulator each. Today a host runs only one agent-device web session.
The backend already supports this. agent-browser --session <name> runs isolated browsers in parallel, each with its own browser process, cookies, storage, and history. agent-device already passes the session name through as --session (agent-browser-provider.ts L430). Only agent-device's device model blocks it.
Current behavior (0.21.33)
agent-device open about:blank --platform web --session a
agent-device open https://example.com --platform web --session b
# Error (DEVICE_IN_USE): Device is already in use by session "a".
AGENT_DEVICE_STATE_DIR=$(mktemp -d) agent-device open https://example.com --platform web --session c
# Error (DEVICE_IN_USE): web device agent-browser-chrome is owned by session "a" in workspace "..."
Web inventory returns one fixed device, agent-browser-chrome (device-inventory.ts L53-L60). Three per-device rules then block a second session:
- the new-session conflict check (session-open-execution.ts L446-L461);
- the host-wide device claim (session-open-execution.ts L463-L496);
- the
device:<id>execution lock (request-binding.ts L15-L31).
Today's only workaround gives each session its own AGENT_DEVICE_STATE_DIR and AGENT_DEVICE_CLAIMS_DIR. That turns off host-wide device claims for the second daemon and needs a second managed backend install.
Required behavior
- Each web session holds its own device,
agent-browser-chrome:session:<name>. Device selection derives the id before any lock is taken. The conflict check, the claim, and thedevice:<id>lock then apply unchanged. This mirrors the app devices of ADR 0035 (#3323). - Web sessions with different names can open, run commands,
batch, andreplayin parallel in one daemon. - The same name still gets
DEVICE_IN_USE, both in one daemon and across daemons that share a claims directory. - The device id uses the same normalized session name as the backend's
--session. A name the id cannot carry unambiguously is refused with a typed reason. - Network dump, audio probe, and recording use only the request's own web provider, never another session's browser or the default one.
- Closing a web session, or expiring it when idle, closes only that session's browser.
CLI example
agent-device open https://example.com --platform web --session a
agent-device open https://www.iana.org/help/example-domains --platform web --session b
agent-device snapshot --session a # Page: https://example.com
agent-device snapshot --session b # Page: https://www.iana.org/help/example-domains
Completion conditions
- A router test opens two web sessions with different names in parallel. The same name conflicts, including from a second daemon on the same claims directory.
- A router test runs two fresh web batches and two fresh web replays with different names in parallel.
- Unit tests cover session-name normalization, teardown closing only its own browser, and network dump and audio probe refusing without a request-scoped provider.
- The web help topic documents parallel sessions.
Dependencies
None. ADR 0035 and ADR 0029 (policy admission) describe app devices only. If this is accepted, they need an amendment or a new ADR.
Related: #817, #2031, #1868.
- 主要语言
- TypeScript
- 星标
- 5.3k
- 派生
- 377
- 平均合并
- 13 小时 58 分钟
- 30 天内合并 PR
- 654
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
callstack/agent-device 的其他 Issue
-
iOS alert wait: the last poll can get ~30 ms and turns "no alert" into a failed read可能已有人在做 @pcbeingused333 于 7 天前认领。 未关闭bug ready-for-agent
难度 2/5 1-3 小时 新手友好度 77/100
callstack/agent-device#4018 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
callstack/agent-device#1869 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
callstack/agent-device#4274 ·
维护者通常 1 天内回复
-
iOS simulator: in-flight `prepare ios-runner` keeps retrying the old runner port after the runner is relaunched on a new port可能已有人在做 @twotnguyen 于 1 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
callstack/agent-device#4265 ·
维护者通常 1 天内回复
-
bug ready-for-agent
难度 4/5 3-5 天 新手友好度 48/100
callstack/agent-device#4264 · 1 条评论 ·
维护者通常 1 天内回复
查看 callstack/agent-device 的全部 Issue
相似的 Issue
-
Billion-context documentation addendum: nudge is independent of window occupancy. | billion-context 文档补充:nudge 与窗口占用无关可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 1/5 1-3 小时 新手友好度 86/100
ranxianglei/billion-context#5893 ·
维护者通常 1 天内回复
-
stringify escapes leading digits in pseudo-class arguments (:nth-child(1) becomes :nth-child(\31 ))未关闭
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
enhancement security severity:low
难度 2/5 1-3 小时 新手友好度 83/100
Battle-Cattle/BCUK-Bot-4#959 ·
维护者通常 1 天内回复
-
[Bug]: Claude account rows no longer show the email (since #8055), so "Account 1, 2, 3" cannot be told apart可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭account-pool bug gui
难度 2/5 1-3 小时 新手友好度 76/100
lidge-jun/opencodex#8286 · 2 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复