Skip to content

feat(httpapi): surface declared browser origins in the live view — ADR 0195 Phase 4 tail(含 OCR delegate 复审) - #542

Merged
Qiyuanqiii merged 5 commits into
mainfrom
feat/browser-live-view-origins
Nov 9, 2026
Merged

Qiyuanqiii merged 5 commits into
mainfrom
feat/browser-live-view-origins

Conversation

@Qiyuanqiii

@Qiyuanqiii Qiyuanqiii commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

在对话页的 Agent 浏览器卡片中展示当前会话声明的导航来源;后端 status 传递 declared_origins,空列表和不可用状态不显示这一行。标签已缩短,长地址沿用卡片换行与滚动布局。

浏览器请求能力已由 #538 合并,本 PR 基于 main。等待界面审核,暂缓合并。

更改前后

以下为真实 V2AgentBrowser 组件与生产样式,用本地 status fixture 提供会话数据;不是完整工作台或后端浏览器执行截图。浅色中文,1024×600 窗口,卡片原尺寸裁剪、未缩放。

更改前(截图基线) 更改后
更改前 更改后

390px 窄窗口与长来源

原文案 简化后
原文案窄屏 简化后窄屏

验证:25 个组件测试、TypeScript 检查通过;Edge 实际检查桌面、390px 长地址、暗色、英文,无水平溢出,停止和关闭按钮可见。原始全窗口截图、记录与复现方式。

Summary by CodeRabbit

  • New Features
    • Browser status now shows the declared navigation origins for available scoped sessions when origins are present.
  • Documentation
    • Updated browser status documentation to describe the origin information included in responses.
  • Tests
    • Added coverage for displaying declared origins and for sessions where origins are absent or the browser is unavailable.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Run browser status now exposes nonempty declared origins. The browser view displays those origins when the browser is available. API tests, UI tests, and Playwright artifacts cover the projection and display.

Changes: Browser origin visibility

Layer / File(s) Summary
API origin projection
internal/httpapi/agent_browser.go, internal/httpapi/agent_browser_test.go, internal/httpapi/openapi.go, docs/openapi.json, web/src/api/agent-browser.ts, web/src/api/schema.d.ts
The public status view includes nonempty declared origins. API descriptions and types document the optional declared_origins field. Tests check the status projection.
Browser origin display
web/src/v2/components/agent-browser.tsx, web/src/v2/components/agent-browser.test.tsx
The browser view displays declared origins when the browser is available and the list is nonempty. Tests cover scoped, unscoped, and unavailable sessions.
Browser capture and review evidence
output/playwright/pr542-origin-label/*, docs/reviews/browser-live-view-origins/README.md
A local fixture and Playwright scripts capture browser states and layout measurements. README files record capture instructions, results, and review findings.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature · Unblocks: 1 PR

Sequence Diagram(s)

sequenceDiagram
  participant RunCapabilities
  participant publicAgentBrowserStatus
  participant AgentBrowserStatusView
  participant V2AgentBrowser
  RunCapabilities->>publicAgentBrowserStatus: supply DeclaredOrigins
  publicAgentBrowserStatus->>AgentBrowserStatusView: copy nonempty origins to declared_origins
  AgentBrowserStatusView->>V2AgentBrowser: provide browser status
  V2AgentBrowser->>V2AgentBrowser: display origins when available and nonempty
Loading

Possibly related PRs

Suggested reviewers: claude

Merge Risk: Minimal · up to aeddc

No actionable merge-blocking risk is identified; the declared origins display is ready for normal merge checks.

Security architecture risk: Low · up to aeddc

This is a small, read-only extension that displays configured navigation origins without granting additional browser permissions. Existing credentials still govern access. Whether those credentials are shared across isolated users or workspaces remains unconfirmed.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — The added exposure is configured-origin metadata in the existing bearer-authenticated status response. The inspected handler checks the configured read token, not a caller-specific tenant or workspace principal. That authentication design predates this PR; deployment-level isolation and intended credential sharing remain unverified.

Security Findings and Attack Paths

  • observed — The new display sends origins to a React text child, not to an HTML, navigation, or command-execution sink. The changed projection copies capability data and does not use it to grant browser authority. No reportable attack path was established in this flow.

Trust Boundaries and Controls

  • observed — Status lookup remains keyed by the requested Run, and the public projection rejects mismatched RunIDs or status versions. Responses remain non-cacheable. Session closure still uses the separate control credential and checks the exact session identity; adding the field does not weaken those controls.
Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title identifies the main change: displaying declared browser origins in the live view.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 9 files. (6 skipped: 5 unsupported, 1 too large.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 312fd838-93bf-43bf-9299-de74d3fc4f8d
Commits

Reviewing files that changed from the base of the PR and between cfeee05 and aeddc75.

Files ignored due to path filters: 16

  • output/playwright/pr542-origin-label/after-desktop-card.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/after-desktop-dark-card.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/after-desktop-dark-viewport.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/after-desktop-english-card.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/after-desktop-english-viewport.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/after-desktop-viewport.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/after-narrow-long-origins-card.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/after-narrow-long-origins-viewport.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/base-desktop-card.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/base-desktop-viewport.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/base-narrow-long-origins-card.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/base-narrow-long-origins-viewport.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/current-desktop-card.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/current-desktop-viewport.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/current-narrow-long-origins-card.png is excluded by !**/*.png
  • output/playwright/pr542-origin-label/current-narrow-long-origins-viewport.png is excluded by !**/*.png
Files selected for processing: 15

  • docs/openapi.json
  • docs/reviews/browser-live-view-origins/README.md
  • internal/httpapi/agent_browser.go
  • internal/httpapi/agent_browser_test.go
  • internal/httpapi/openapi.go
  • output/playwright/pr542-origin-label/README.md
  • output/playwright/pr542-origin-label/capture-stage.js
  • output/playwright/pr542-origin-label/metrics.json
  • output/playwright/pr542-origin-label/pr542-browser-evidence.html
  • output/playwright/pr542-origin-label/pr542-browser-evidence.tsx
  • output/playwright/pr542-origin-label/select-stage.mjs
  • web/src/api/agent-browser.ts
  • web/src/api/schema.d.ts
  • web/src/v2/components/agent-browser.test.tsx
  • web/src/v2/components/agent-browser.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

ADR 0195 Phase 4 tail: project Capabilities.DeclaredOrigins into
AgentBrowserStatusView (omitempty, absent for unscoped Full sessions),
regenerate the OpenAPI document and the web schema, and show the
operator-declared boundary in the agent browser live view ahead of the
stream for scoped sessions. The refusal note keeps its current wording
until the Phase 3 origin-add surface provides the declaration path.
Includes the OCR delegate review record; the delegate findings (missing
component tests, run show follow-up) are addressed or recorded there.
…us type

The app build type-checks against the hand-written AgentBrowserStatus
interface, not the generated schema; the live view's declared_origins
field needs the same optional string array there.
@Qiyuanqiii
Qiyuanqiii force-pushed the feat/browser-scoped-sessions branch from 3977294 to bab65dc Compare November 5, 2026 23:44
@Qiyuanqiii
Qiyuanqiii force-pushed the feat/browser-live-view-origins branch from 5bbdc2b to d4f12cd Compare November 5, 2026 23:48
@Qiyuanqiii
Qiyuanqiii changed the base branch from feat/browser-scoped-sessions to feat/agent-browser-origin-scope November 6, 2026 12:18
@Qiyuanqiii
Qiyuanqiii changed the base branch from feat/agent-browser-origin-scope to main November 6, 2026 14:18
@Qiyuanqiii
Qiyuanqiii merged commit 35ef0a9 into main Nov 9, 2026
4 of 24 checks passed
@Qiyuanqiii
Qiyuanqiii deleted the feat/browser-live-view-origins branch November 9, 2026 15:46
Qiyuanqiii pushed a commit that referenced this pull request Nov 9, 2026
…il view

Rebased on latest main to resolve conflicts with #542 merge.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants