Skip to content

feat(desktop): add read-only action target verification (Phase 2F-A)#8

Merged
gu87 merged 1 commit into
upstream-main-cleanfrom
codex/desktop-browser-action-safety-phase2f-a
Jun 7, 2026
Merged

feat(desktop): add read-only action target verification (Phase 2F-A)#8
gu87 merged 1 commit into
upstream-main-cleanfrom
codex/desktop-browser-action-safety-phase2f-a

Conversation

@gu87

@gu87 gu87 commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a read-only pre-action target verification IPC that checks whether a DOM element referenced by an agent action (click, type) still exists on the current page — without performing any execution.

What Changed

  • New IPC: hermes:browser:verify-action-target in main.cjs
    • Fixed-script, read-only DOM lookup via querySelector + getBoundingClientRect
    • targetRef must match /^@e\d+$/ — no agent-provided JS execution
    • Returns { found, visible, disabled, readOnly, elementFingerprint, value, ... }
    • No click, focus, type, dispatchEvent, or value mutation
  • Preload bridge: exposes verifyActionTarget only — no arbitrary execution
  • desktop-visible-provider: adds verifyDesktopActionTarget() with checks for:
    • Bridge availability
    • targetRef validity
    • Origin URL match
    • Element fingerprint match (if safetyContext had one)
    • Visibility, disabled, readonly checks
  • action-gateway-ui: click/type executor now runs pre-action verification and attaches PreActionVerification to the action log entry for user inspection
  • Snapshot/vision: now produce real data (getDesktopSnapshot() / getScreenshot()) instead of fake executed results
  • get_images / console: explicitly report unavailable on Desktop

Safety Boundary

Action Phase 2E Phase 2F-A
navigate ✅ Executable after Allow ✅ Unchanged
click, type ⚠️ Approval UI, executor fails ⚠️ + Pre-action verification attached to log
eval, press_key, scroll ❌ Permanently blocked ❌ Unchanged
snapshot, vision ✅ Auto-resolved ✅ Now produce real data
get_images, console ✅ Auto-resolved ⚠️ Explicitly reported unavailable

click/type remain non-executable — the executor still returns failed. Pre-action verification is diagnostic only.

Validation

  • npm run type-check: PASS
  • npx eslint (scoped): 0 errors, 0 warnings
  • npx vitest run --environment jsdom src/app/browser-runtime/*.test.ts: 154/154 PASS
  • npm run test:desktop:platforms: 79/79 PASS

Scope

  • Desktop Electron app + browser runtime only.
  • No backend/executor/Kanban/web dashboard changes.

🤖 Generated with Claude Code

- Add hermes:browser:verify-action-target IPC handler in main.cjs.
- IPC performs a fixed-script, read-only DOM target lookup.
- targetRef must match /^@e\d+$/. No agent-provided JS execution.
- Script uses querySelector + getBoundingClientRect only.
- No click, focus, type, dispatchEvent, or value mutation.
- Preload exposes only verifyActionTarget — no arbitrary execution.
- desktop-visible-provider adds verifyDesktopActionTarget() with:
  targetRef validation, URL/fingerprint/visibility/disabled checks.
- click/type remain non-executable — executor returns failed but
  attaches PreActionVerification for user inspection.
- eval/press_key/scroll remain permanently denied.
- snapshot/vision now produce real data via getDesktopSnapshot()/
  getScreenshot() instead of fake executed results.
- get_images/console report unavailable on Desktop.
- 154 browser-runtime tests pass. 79 platform tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gu87 gu87 merged commit 685bcac into upstream-main-clean Jun 7, 2026
7 checks passed
@gu87 gu87 deleted the codex/desktop-browser-action-safety-phase2f-a branch June 7, 2026 02:12
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.

1 participant