Skip to content

Add hide browser page commands for agents - #536

Merged
yansfil merged 10 commits into
mainfrom
feat/hide-browser-cli
Oct 5, 2026
Merged

yansfil merged 10 commits into
mainfrom
feat/hide-browser-cli

Conversation

@yansfil

@yansfil yansfil commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Closes #159
Related: PRD agents/prd/hide-browser-cli/prd.md

Summary

  • 에이전트가 운영자가 보고 있는 hide 브라우저 디스플레이를 읽고 조작합니다: hide browser snapshot|click|fill|type|press|hover|drag|scroll|wait|screenshot|eval|console|network <display>, 안내는 hide browser help.
  • CLI는 scoped /ws에 browser_relay를 요청하고, hided가 체크아웃과 디스플레이를 검사한 뒤 데스크톱 게이트웨이에 직접 붙어 CDP를 중계합니다. capability URL은 CLI에 오지 않고, 디바이스 pane도 같은 경로를 씁니다.
  • 명령 하나가 연결 하나, 디버거 lease 하나이고 끝나면 풀립니다. 다른 디버거가 쥔 디스플레이는 display_busy입니다.
  • 페이지 쪽 코드는 chromux(MIT)의 snapshot/dom/render/overlay 자산입니다. ref는 @N, cross-origin frame은 @<tag>:N입니다.
  • 운영자 화면에는 에이전트 커서가 보이고, 마우스, 키보드 포커스, 앞에 보이는 View는 바뀌지 않습니다.

에이전트가 hide browser fill/click을 실행하는 동안 운영자 화면에 보이는 커서와 클릭 리플 (hide browser screenshot으로 캡처)

Review

  • 판단해 주세요: 입력과 스크린샷 거부 기준을 페이지 visibilityState가 아니라 core의 selected로 정했습니다. 가려진 창의 selected View는 hidden으로 읽히면서도 입력을 받는 것을 native QA로 확인했기 때문입니다. PRD D-14의 "시도한 뒤 실패" 문구와 달리, 선택되지 않은 View는 미리 거부합니다.
  • 판단해 주세요: cross-origin frame 하나가 8초 동안 답하지 않으면 읽기 전체가 dialog_open으로 실패합니다(조용히 건너뛰지 않음). 바쁜 광고 frame이 있는 페이지는 읽기가 막힐 수 있습니다.
  • 조심해서 볼 파일: hided/src/browser_relay.rs, hided/src/server.rs - failure path와 자원 상한: 릴레이는 hided 클라이언트 8개 중 최대 4개, 수명 5분, idle 60초(CDP text만 셈), send 5초.
  • 조심해서 볼 파일: hided/src/browser_control.rs - ownership: 체크아웃/디스플레이 검사와 capability URL 경계.
  • 조심해서 볼 파일: hided/src/browser_page/{page,actions}.rs - failure path: dialog, hidden, timeout이 어떤 reason이 되는지.
  • 조심해서 볼 파일: hided/assets/browser/*.js, browser_page/mod.rs printable - 페이지 텍스트가 터미널에 닿는 경로와 비밀값 마스킹.
  • 비용 검토: 상시 작업이 없습니다. 명령이 도는 동안만 연결 하나이고, Mutex<Runtime> 밖 자체 task이며 core 상태와 snapshot wire는 그대로입니다. 이벤트 버퍼 16 MiB, frame 24개, wait 폴링 간격은 frame 수에 비례해 게이트웨이 600회/분 아래로 둡니다.
  • 질문: 게이트웨이(browserCdp.ts)가 Input.dispatchDragEvent의 data.files를 그대로 통과시키는 기존 gap이 있습니다. 이 PR은 게이트웨이를 건드리지 않으므로 후속 이슈로 열어도 될까요?

Evidence

  • 확인한 것: desktop e2e browser-agent.spec.ts 3개, 후보 앱과 격리 Herdr에서 실행: 한글 fill과 click, cross-origin frame 입력, --diff/--grep, console/network/eval/screenshot, frame이 이동한 뒤의 ref_stale, 실행 후 앞 View 불변, top과 frame의 dialog 보고와 dialog_open, busy/hidden/file/missing 거부. 마지막 3회 연속 통과, dialog 테스트 4회 반복 통과.
  • 확인한 것: remote-browser-agent.spec.ts, 격리 sshd와 Herdr 두 개: 디바이스 pane에서 snapshot과 click, 데스크톱이 없을 때 Workspace 명령과 같은 reason.
  • 확인한 것: web e2e browser-agent-assets.spec.ts 8개(plain Chromium): 마스킹, 줄 위조 방지, ref, 오버레이 등. 심은 결함 3개를 잡았습니다.
  • 확인한 것: hided 단위 테스트(릴레이 4009 close 2개, 출력 sanitize), cargo lint, verify-web.sh, CI가 도는 check 스크립트.
  • 확인한 것: native QA로 가려진 창의 selected View가 hidden으로 읽히면서도 입력과 스크린샷을 받는 것을 확인했고, 그래서 gate를 selected로 바꿨습니다.
  • 확인하지 못한 것: 앞에 있지 않은 Workspace의 selected View(입력 timeout 뒤 display_hidden)는 native로 관찰하지 못했습니다. timeout된 입력이 나중에 전달되는지도 재지 않았습니다.
  • 확인하지 못한 것: 이 Mac에서 전체 cargo test의 hide-platform a_burst_is_bounded_and_ends_in_an_overflow_rather_than_silence가 실패합니다(7425 changes). 이 PR은 hide-platform을 바꾸지 않습니다.
  • 확인하지 못한 것: remote spec 한 번에서 focus guard가 앱 활성화를 보고했고, 이후 3회는 재현되지 않았습니다. sasu sealed suite는 비어 있어 CONTRIBUTING 레인을 직접 돌렸습니다.
Verification record
  • PRD: agents/prd/hide-browser-cli/prd.md (sha256 ac4eca6987b61529ef266cae34b86d5c12642cf994540a31e81e29b023f9652d)
  • Base 356c5db → head 38b3c70, verified 2026-10-05T14:43:40.951Z: PASS
  • Verification report: agents/runs/hide-browser-cli/verification-report.json and agents/runs/hide-browser-cli/verification-report.md; source fingerprint 9a929b94373a2d505366da11d8a818bb1aa5ef7cb750bce28aa4594928afc456
  • Suites: none configured or detected.
  • Reviews (native, advisory):
    • Fidelity @ ecce9e0: frame dialog, screenshot display_hidden, B8 stale frame ref test, relay caps, D-14 wording. All fixed in 719d315..f806941 except D-14 wording (PRD sealed; raised under Review).
    • Code @ ecce9e0: Help in Command enum, missing next_action entries, wait poll cost, event buffer cap, fill comparison, image-space mapping. Fixed in 6201e90.
    • Security @ ecce9e0: relay held by pings or stalled sends, terminal escapes and line forging from page text, forgeable frame tags. Fixed in 719d315, 6201e90, 38b3c70; not taken: gateway data.files drag gap (browserCdp.ts out of scope), axum pre-buffer, page-world spoofing beyond tag checks, grep ReDoS, screenshot symlink, post-claim revocation poll.
    • Follow-up @ f806941 and @ 38b3c70: hung frame fails the read as dialog_open (kept on purpose); otherwise clean.
  • Evidence: none registered separately.
  • Changed paths: 23 against origin/main (the 58 counted from the run baseline 356c5db include main commits taken by the rebase)

yansfil added 10 commits October 5, 2026 23:20
hide browser snapshot, click, fill, type, press, hover, drag, scroll,
wait, screenshot, eval, console and network read and drive a browser
display of the caller's checkout. hided relays CDP frames from a
claimed one-shot workspace socket to the desktop's scoped gateway,
capped at eight relays, 4 MiB messages and a 60 s idle limit. The
page-side code is ported from chromux (MIT) and embedded as assets.
A desktop e2e runs hide browser from an isolated Herdr pane against the
candidate app: snapshot, fill and click in the page and in a cross-site
frame, --diff and --grep, the overlay the operator sees, console,
network, eval and screenshot; a dialog reported and holding the display
until it is answered; busy, file, missing displays and stale refs.
The help text now shows the snapshot lines as they print.
The snapshot, dom, render and overlay assets run as the CLI runs them:
masking and state suffixes, refs that survive a re-snapshot, --diff and
--grep, clickable divs and covering overlays, reach into same-origin
frames and open shadow roots, fill on controlled inputs and selects,
refusals of hidden, covered, stale and unfillable targets, click --text,
changed ignoring a scroll, and the overlay staying out of snapshots.
A device pane's hide reaches the relay through the reverse Workspace
forward, snapshots and clicks its display like a local pane, and fails
with the Workspace commands' renderer_unavailable when no desktop is
attached. Runs against the isolated SSH server like
remote-workspace.spec.ts.
A selected View in a window another app covers reads visibilityState
hidden yet takes input and screenshots, so the page's own visibility
refused agents whenever the operator's window was behind another app.
hided now answers the relay with whether the display is its area's
selected View, and input and screenshots refuse display_hidden from
that; a View in a Workspace not in front still fails display_hidden when
its input goes unanswered. The desktop journey proves the refusal.
Session guidance lists the hide browser page commands beside browser
open and points at hide browser help. BROWSER_DISPLAYS.md describes the
agent page commands, their state, frames, overlay, dialogs, hidden
displays and limits; ARCHITECTURE.md the hided relay path.
Four relays at most, so half of the gateway's clients stay free; a relay
ends after five minutes, idle time counts only CDP text frames, and every
send has a five-second deadline. Tests cover the oversized and binary frame
closes.
Page text is sanitized before it reaches the terminal, a command has a
two-minute deadline, dialogs are detected per frame session, frame tags are
validated, the event buffer is capped by bytes, and the failure table and
next actions cover every reason a command can return.
A frame a dialog holds answers no script, so its dialog check now runs
before its tag is read; the read timed out first and reported
page_unresponsive. The desktop e2e covers a frame's confirm, a ref from a
frame that navigated, and the View in front staying put after a journey.
A line break in an element's id, role or text no longer starts a line of
its own, and api tokens and similar fields are masked. Printing replaces
control and bidirectional characters but keeps joiners, the failure reason
on stderr is sanitized too, and wait polls once more at its deadline.
@yansfil
yansfil merged commit 9bb7a76 into main Oct 5, 2026
31 checks passed
@yansfil
yansfil deleted the feat/hide-browser-cli branch October 5, 2026 16:51
HyunjunJeon pushed a commit to HyunjunJeon/hide that referenced this pull request Nov 12, 2026
Closes with-hide/hide-private#526
Closes with-hide/hide-private#599
Refs with-hide/hide-private#395, with-hide/hide-private#530,
with-hide/hide-private#117, with-hide/hide-private#586
Refs with-hide/hide-private#832

## Summary

- Start the checkout PR flow on Main after its setup has focused another
workspace.
- Prevent Windows test browsers from losing local page or resource
requests during shell startup.
- Retain the failed row and pointer state for a separate, unreproduced
late card-hover failure.

## Review

- **Risky files**: browser-launch.cjs merges installed runner defaults;
the desktop preload extends effective flags.
- **Risky files**: checkout-pr.spec.ts retains discovery's connection,
then resets first-run selection before Main.
- **Risky files**: desktop browser.spec.ts uses the shared arguments for
its plain Chromium launch and checks the applied features through CDP.
- **Decide**: The narrow upstream fix uses the locked runner's internal
argument API; a changed shape fails startup.
- An entire runner upgrade would also replace the browser revision and
is outside this stabilization change.
- **Cost**: The hover observer exists only for one test phase, retains
32 transitions, and is removed on every exit.
- **Cost**: Splitting the plain-browser notice from the native-view
lifecycle adds one isolated fixture start so Windows CI checks that
launcher too; its existing notice assertions are retained.
- [Windows run
41016473655](https://github.com/with-hide/hide/actions/runs/41016473655/job/123933953907),
tracked by [private
with-hide#130](with-hide/hide-private#130), records the
same document-load error.
- [with-hide#832](with-hide/hide-private#832) tracks
one later card-hover failure; this PR does not claim its cause is fixed.

## Tests

- **Layer**: Unit feature merging; real browser startup and desktop
recovery cross the actual host launch boundary.
- The desktop plain-browser case checks the effective final
disabled-feature list, retained runner defaults and the Windows loopback
fix before opening the shell.
- It passed its first Windows CI attempt on the final head in [the
desktop
lane](https://github.com/with-hide/hide/actions/runs/42860546110/job/129985854339).
- Units cannot observe which feature list the launched browser applies;
the startup check reads that applied state.
- **Catches**: Removing the Windows feature fix failed two merge checks;
restoring it passed all three.
- **Repeat**: Linux/macOS: five flows x20, [100 passed
each](https://github.com/with-hide/hide/actions/runs/42832076296).
- Desktop recovery/relaunch: each x10 on macOS/Windows, retries 0, [40
passed](https://github.com/with-hide/hide/actions/runs/42831271844).
- Final Windows: five flows x20, retries 0, [100
passed](https://github.com/with-hide/hide/actions/runs/42844846265/job/129929485236).
- **Waits**: No new wait, delay, retry, timeout or threshold; the
existing Main assertion follows explicit state setup.

## Evidence

- **Verified**: Local startup/checkout flows, desktop recovery/relaunch,
unit 3, lint, types, builds and policy checks.
- **Verified**: The split desktop plain-browser and native-view flows
passed locally without retries; desktop lint and typecheck passed.
- **Verified**: A controlled trigger replacement preserved the original
failure and captured mounts=2 before teardown.
- **Verified**: [Required
CI](https://github.com/with-hide/hide/actions/runs/42860546110) and
independent review passed on final head c532660.
- **Not verified**: The historical reference-only causes and the late
hover cause.

<details><summary>Failure evidence and review boundaries</summary>

- with-hide#526's run 42780431716 drew Workspace while the test expected Main
after setup focused its agents.
- with-hide#599's run 42080456072 had an unmounted shell, a successful document
and a failed entry script with ERR_NO_BUFFER_SPACE.
- Private with-hide#130 is handled separately by public PR with-hide#2372; its Windows
host log recorded window.load_failed ERR_NO_BUFFER_SPACE after a normal
daemon start.
- The test-only startup fix follows [the upstream
fix](microsoft/playwright#43605) and [the
browser defect](https://issues.chromium.org/issues/572515601).
- The locked runner 1.63 lacks that fix.
The helper reads its installed defaults rather than copying a
version-specific list.
- with-hide#395's run 42140863283 attached its daemon before its shell wait
failed, with no page-side or failed-load signature for that exact wait.
Its initial report used the retired fixture startup path; neither
identifies this PR's connection cause.
- with-hide#530's original failure drew Main with a failed sidebar boundary.
A controlled stylesheet abort reproduced that screen and a missing
CSS-token diagnostic, but the original artifact retained no
asset-failure signature.
- with-hide#117's latest retained record has only a whole-test timeout.
  Its historical lost step remains unidentified.
- with-hide#586's run 42359435922 explicitly reports the loopback error, but its
initial whole-test timeout and its separate focus flow were not resolved
by the targeted repetitions.
- For those next failures, inspect pageSide screen/project state,
request status, failed requests, renderFailures and renderDiagnostics.
The dump now retains failed regions and the newest eight relevant render
diagnostics.
Each reference-only issue has a comment with its confirmed facts,
remaining gaps and next dump.
- with-hide#536 was closed separately because commit 8be1505 deleted its Home
collision test.
  The current no-project startup spec does not replace that behavior.
- The first Windows repetition had 99/100 passes:
checkout-pr.spec.ts:273 failed at the final light-theme hover after the
shell, row, PR glyph and browser display had already drawn.
- A diagnostic-only repeat at 5eefccb passed 100/100: all 20 checkout
attempts retained one trigger mount, had PR facts ready and hit that row
with the pointer.
  The card opened after its normal hover delay.
  This did not reproduce or establish the cause of the earlier failure.
- The replacement diagnostic captures the failing state inside that
step, before teardown can add a disconnected banner and move the row.
It records the checkout key, mounts, pointer hit, geometry, focus,
visibility, drag marks and tooltip state, preserves the original error,
and reports independent cleanup failures.
- The old conversation-date fixture also caused automatic sleep of the
Main setup agent in the failed run.
A current-clock proposal removes that sleep locally, but its
relationship to the hover failure is unconfirmed.
  It remains an uncommitted local patch documented in with-hide#832.
- No product input, runtime mutex, snapshot wire or rendering path
changes.
  The operator's installed application was untouched.

</details>

<details><summary>Verification record</summary>

- Final head: c532660.
- Startup repeat candidate 4231d60:
Linux/macOS each five flows x20, no retry.
- Desktop repeat candidate ce0dffe:
JSON reports on each OS show expected=20, unexpected=0, skipped=0,
flaky=0, repeatEach=10 and retries=0.
- Diagnostic-only Windows candidate
5eefccb: run 42838637529, five flows
x20, no retry, 100 passed.
  The temporary early observer and trace flag were reverted.
- Final Windows repeat candidate
49b560a: run 42844846265, five flows
x20, retries=0, 100 passed; job log confirms the exact tested commit.
- All temporary workflow changes are reverted.
The repeated specs, shared startup fixtures and guide match the final
Windows repeat candidate; the later desktop browser.spec.ts regression
and its smaller size baseline are the only differences in those test
trees.
- Head 1933d66 is a source-identical verification commit after
f45c106, added to regenerate the synthetic merge against the corrected
base.
- Review follow-up c532660 applies the shared launch settings to the
desktop plain browser and separates that existing notice contract into a
Windows-covered case.
- Local current source: checkout hover flow passed without retries; a
controlled browser replacement captured the original failure and two
mounts; web lint and test-size budget passed.
- Earlier unchanged-source checks: web build; web/desktop lint; desktop
typecheck; startup/checkout 3; desktop recovery/relaunch 2; merge unit
3; design contract and policy checks passed.
- Manual repeat dispatches that skipped every test and draft-only verify
failures are excluded from verification evidence.
- Independent review and required CI 42860546110 passed on
c532660.
- Ready run 42849933157 checked synthetic merge
83a0f35 against base
8284fb6, which predates with-hide#2398.
- That merge still waited on the retired status.herdr field; current
main uses status.engine.
  All hard web failures were at that restart boundary.
  One required failed-job rerun was started.
- The regenerated merge f4ed9d1
includes the corrected status.engine wait.
- Final run 42860546110 tests merge
6b977ba containing c532660; completed
job logs confirm that checkout.
- Its Linux suite has 412 passes and eight Windows-only skips, the
retry-free changed-spec repeat has 80 passes, Windows web has 85 passes,
and Windows desktop has 24 passes and one existing platform skip.
The new plain-browser startup case passed its first attempt in 6.9
seconds.

</details>
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.

hide browser: agent page commands built from chromux's page logic

1 participant