Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[IAB] Agent 创建的标签固定 1280×720 视口,非 16:9 窗格被黑边框死,建议默认继承窗格尺寸

Open
#110 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
desktop

Research direction

Start by reading packages/shared/src/browser-use/command-metadata.ts and the agent tab creation path that applies DEFAULT_AGENT_BROWSER_VIEWPORT; compare it with the free-size path for user-opened tabs. Check docs/viewport.md and control-browser/SKILL.md for the stated viewport behavior. Done when agent-created tabs adapt to the pane as proposed while screenshots retain a deterministic 1280×720 fallback.

Written by the indexing model from the issue text.

Description

环境
  • ZCode Desktop(macOS arm64,darwin 27.0.0)
  • browser-use 插件 v0.5.1(官方内置)
现象

在 ZCode 内置浏览器(IAB)里:

  • 用户手动打开的标签:free-size,视口跟随窗格尺寸,拖动分隔条实时自适应 ✅
  • agent 通过 browser-use tabs.new() 创建的标签:一律固定 1280×720(16:9),在非 16:9 的窗格(实测 1186×984)中上下出现大片黑边,且不随窗格拖动变化 ❌

同一面板、同一会话内两种来源的标签行为不一致,用户观感是"面板比例被写死了"。

根因(源码已定位)

packages/shared/src/browser-use/command-metadata.ts:

/** Agent 创建或打开的新页面使用的固定逻辑 viewport;不属于人类浏览器显示偏好。 */
export const DEFAULT_AGENT_BROWSER_VIEWPORT = {
  width: 1280,
  height: 720,
} as const;

agent 建标签即套用该常量。注释表明这是刻意设计(给自动化一个确定性逻辑视口),但显示层没有做适配,导致逻辑视口的宽高比直接变成视觉上的黑边框死。

与官方文档矛盾
  1. browser-use 插件自带文档 docs/viewport.md:"Use an explicit viewport only for responsive or device-size testing. Otherwise keep the normal IAB viewport." —— 正常 IAB 视口恰恰不是 1280×720。
  2. browser-use skill 文档(control-browser/SKILL.md):"IAB automatically opens the target tab in free-size mode" —— 实际 agent 建的标签并非 free-size。
影响
  • agent 打开页面给用户看(调研结果、仓库、文档)是该插件的核心日常场景,黑边观感差;
  • 现有 workaround 是 agent 每次 setViewportSize() 对齐窗格实测尺寸,但那是固定值,用户拖动窗格后即失配,需反复手动对齐;
  • tab.close() 后重开仍会回到 1280×720,无法从外部根治。
建议

保留 1280×720 作为截图/自动化的确定性 fallback,但显示层二选一:

  1. agent 标签默认继承窗格逻辑尺寸(与用户手开标签行为一致);或
  2. 保持固定逻辑视口,但渲染时按窗格比例 fit(避免黑边),仅 screenshot 走 1280×720 逻辑坐标。
备注

ZCode 主仓库(zai-org/ZCode)issues 已关闭,故投递至本仓库,烦请维护者转交对应团队。如需更多实测数据(视口读数、页面 innerWidth/innerHeight 对照)可随时补充。


TL;DR: Tabs created by the agent via browser-use get a hardcoded 1280×720 logical viewport (DEFAULT_AGENT_BROWSER_VIEWPORT), which letterboxes the pane at any non-16:9 size, while user-opened tabs are free-size. Suggest inheriting the pane's logical size by default (or fit-rendering) and keeping 1280×720 only as the deterministic screenshot fallback.

Dominant language
Python
Stars
103
Forks
78
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from zai-org/zcode-plugins

All issues in zai-org/zcode-plugins

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.