Skip to content

feat(agents): render html visuals in the mobile sandbox - #719

Merged
nixuuu merged 1 commit into
feat/agents-html-renderersfrom
feat/agents-html-mobile
Nov 14, 2026
Merged

nixuuu merged 1 commit into
feat/agents-html-renderersfrom
feat/agents-html-mobile

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

HTML visuals now start as an inert warning card with an explicit Run action. No HTML compilation or WebView mount occurs before Run. Watchdog failure requires explicit Retry; revisiting/remounting starts inert again. The existing WebView shell and per-mount token envelope use the same hash-only CSP, lockdown and explicit denied-feature permissions as web. Existing fullscreen, version picker, citations and save/share HTML use the shared visual pipeline.

No native modules, native patches or WebView upgrade. Baseline/current fingerprints match exactly: iOS 138e0c6b171c82b4933e86808cdfef56da73b8c6, Android 906dc944f94eb8333fa384ed9f198834fdd30d13. Both platform exports passed.

Platform evidence and accepted gaps

Platform Evidence
Web Chromium 155 hostile-document probes on the renderer PR: opaque isolation, hash/eval restrictions, denied known networking APIs, nested realm tests and responsive host under an infinite loop. Matching-SRI external-script request remains an accepted exfil path.
Desktop Electron 45.2.1 separate browser process with resolver denial: runtime dns-prefetch/preconnect produce no canary resolver events; image/fetch/RTC/matching-SRI attempts produce no canary HTTP requests; canvas PiP throws SecurityError. Production sidecar loop recovery and >2MB compiled-document probes passed. Measurement details and limitations are on #718.
iOS / Android Device probes not run. device_open failed with “Device list failed: Could not communicate with device support. Try refreshing devices.” One refresh returned the same error. JS exports and shared shell tests do not substitute for WKWebView/Android WebView runtime probes.

As explicitly agreed, mobile accepts the browser residual network risk. RN WebView 14.0.1 exposes neither Android subresource interception nor iOS WKContentRuleList. File/universal access off, incognito, blocked navigation, no shared cookies/storage/windows and the token envelope are retained. iOS mediaCapturePermissionGrantType denies capture. On Android the library can auto-grant camera/microphone permissions already granted by the OS; lockdown mediaDevices and the opaque iframe permissions boundary are the available defenses without a native change. A hard network block and complete native permission denial require a later native build. These gaps are documented in Polish in docs/agent-visuals.md.

Focused security/gateway/three-harness checks passed 38/38. iOS/Android exports passed after review fixes; fingerprints above remain unchanged. Validation is recorded on #718. The independent security re-check recommended merge. Native hostile-document probes and native light/dark/phone-width acceptance remain unverified. No hard renderer memory quota is claimed. Same-process WebViews can freeze the app after Run, preventing the watchdog from firing; click-to-run prevents automatic re-entry on later visits. DNS hints, matching-SRI exfiltration, pastejacking and exported-file execution remain documented browser/mobile risks.

Copy audit (§8): Run explicitly starts execution. “Custom HTML from the agent. Don't enter passwords or secrets.” gives source plus a direct instruction, plain English, no jargon or humor. “This visual stopped responding.” reuses the existing Retry action. Theme-aware text colors and app-owned framing preserve meaning without depending on color. Device layout/accessibility review remains blocked, not claimed as passed.

Previous-head full check:tmp was green in CI run 43605016001, head cc18c0b7d86ae78ddd7d1cdff1af221107910367.

Pre-merge update: rebased onto origin/dev including #723, #725 and #730, with render_html migration 0144 after the provider migration 0143. The shell executable now starts with shared network lockdown while retaining its trusted native message bridge; the native/web relay regression passes in both modes. Markup stripping is best-effort and CSP remains the boundary against mXSS; foreign MathML/SVG style nodes are discarded. No native change. Final-head schema/compiler tests: 51/51; gateway/three-harness visuals integration: 16/16, both temp checks clean. Generation, full typecheck, lint and formatting passed. New-head full CI is pending. All four PRs are ready; no merge performed.

@nixuuu
nixuuu added this pull request to stack #720 November 14, 2026 12:58
@nixuuu
nixuuu force-pushed the feat/agents-html-mobile branch from 841891c to e3c64e1 Compare November 14, 2026 13:10
@nixuuu
nixuuu force-pushed the feat/agents-html-mobile branch 3 times, most recently from 4e0f67e to cc18c0b Compare November 14, 2026 14:28
@nixuuu
nixuuu force-pushed the feat/agents-html-mobile branch from cc18c0b to dc837f6 Compare November 14, 2026 14:53
@nixuuu
nixuuu marked this pull request as ready for review November 14, 2026 14:55
@nixuuu
nixuuu force-pushed the feat/agents-html-mobile branch from dc837f6 to 2529c3f Compare November 14, 2026 15:04
@nixuuu
nixuuu force-pushed the feat/agents-html-mobile branch from 2529c3f to a32a5d1 Compare November 14, 2026 15:15
@nixuuu
nixuuu force-pushed the feat/agents-html-mobile branch from a32a5d1 to 71b33ab Compare November 14, 2026 15:32
@nixuuu
nixuuu merged commit f8b994d into dev Nov 14, 2026
23 of 29 checks passed
@nixuuu
nixuuu deleted the feat/agents-html-mobile branch November 14, 2026 16:01
nixuuu added a commit that referenced this pull request Nov 14, 2026
Android thread cards can lose their Run choice when virtualized, discard
loaded thumbnail URIs when leaving the viewport, and move the feed as
the composer folds. Thread details also share entrance progress with
drag position and have no intermediate resting position.

This change keeps HTML consent and measured heights per visual/version
for the pairing session, uses a compact 112 dp gate, preserves thumbnail
Image instances and synchronously restores cached file URIs on remount,
retains the composer scroll reserve, and separates sheet entrance from
drag offset. Thread details snap fully open or 40% down; dragging beyond
65% closes them. The scroll viewport remains usable at both positions.
Visual resize updates use the existing feed anchor, and Android clipping
no longer detaches native WebViews inside retained inverted cells.
Distant turns remain virtualized. Web behavior is unchanged.

Fixes: #719

The linked regression is specifically the per-mount HTML Run state
introduced in #719; the other behavior is pre-existing. Related: #758,
#419, #425. Rebased onto #758 and retained its notice removal and
`Custom HTML from the agent.` gate label.

### Original recording

Reviewed at 12 fps; timestamps are seconds from the start, with
approximately 0.08 s precision.

| Problem | Evidence | Change |
| --- | --- | --- |
| Tall blank HTML card; Run does not reveal content | 00.00–12.50 and
21.00–24.67; taps around 09.50/10.17 | Compact gate; session consent
across row/slot/fullscreen remounts; explicit non-flex WebView sizing;
token-validated height updates and anchored resize. Failure/watchdog
revokes consent, so failed code does not automatically run again. |
| Composer flips between compact/full | 01.00–01.50, 06.17–06.50,
10.75–11.17, 22.75–23.17 | Folding no longer releases the native list
reserve; only active finger travel can change fold state, and expansion
requires deliberate travel toward the end. Momentum interrupted by a tap
cannot inherit drag intent. |
| Details sheet jumps/rebounds; content also shifts | Opening
12.83–13.33; dragging 13.75–20.75; inner content 18.25–18.83 | Explicit
surface height and seeded modal safe areas; separate entrance/drag
values; two resting positions; bottom-only scroll viewport resize and no
native scroll bounce. Re-grabbing an opening/settling sheet retains its
position. |
| Thumbnail disappears and reloads | 22.00–24.17 | Visibility cancels
unfinished work without clearing a loaded URI. Cache peek restores the
same immutable local URI before the first remount frame, allowing native
decoded bitmap reuse. Existing memory/disk LRU budgets and pairing
cleanup remain in force. |
| Feed displacement during interactions/card changes | 06.17–06.50,
10.75–11.17 | Stable composer reserve; no Android autoscroll-to-zero
threshold; existing disclosure anchor also wraps Run and visible WebView
height changes. The recording alone cannot separate every gesture
movement from layout correction. |

### Validation

- Passed with `nice`: `bun install`, `bun run gen:check`, workspace `bun
run typecheck`, mobile typecheck, repository `bun run lint`, `bun run
format`, `bun run format:check`, and integration-test workspace
typecheck.
- Passed 10 unit tests: existing private image cache and pure sheet
gesture tests, plus session consent isolation/revocation coverage. These
are local unit tests under the existing tests directory; no UI suite or
E2E tests were added or run.
- Additional Expo lint remains failing on existing repository findings:
clean dev has **116 errors / 25 warnings**, this change has **112 errors
/ 25 warnings**. Changed image/watchdog code removes some existing
findings; the remaining Expo failures are not claimed as passed.
- Native fingerprints match clean dev before/after, including explicit
`CANOPY_CHANNEL=nightly`, using `bunx expo-updates fingerprint:generate
--platform ...`. Nightly Android:
`141ef4e8c825ee4fc5d22c499402b284741b0970`; Nightly iOS:
`83794f069934a7374461427d89b8d008cec19d97`. Default-channel Android:
`906dc944f94eb8333fa384ed9f198834fdd30d13`; iOS:
`138e0c6b171c82b4933e86808cdfef56da73b8c6`. No dependencies, native
modules, plugins, or native config changed.
- **Device acceptance is unverified.** T3 device discovery found no
local Android SDK. MacStudio device hub timed out twice (no device
returned). EAS `device_open` failed: “frameAncestors and corsOrigins are
supported on Production and Enterprise plans,” while this account has
Starter. No emulator or physical device could be opened, so first-tap
rendering, Android WebView height/gesture handling, decoded bitmap
retention, snap motion, keyboard transitions, light/dark, and TalkBack
still need device review. No after-shots are claimed. Draft PR preserves
this outstanding gate.

No web files changed; web build was not run. Full
`check:tmp`/integration runs, native prebuilds/exports, EAS
builds/updates, tags, and releases were not run. Original frame strips
are retained outside the repository; raw extracted frames were removed.
No servers, device processes, or reserved ports were used.

### Copy audit (§8)

No new UI wording. `Run`, `Retry`, and `Custom HTML from the agent.`
remain unchanged from #758; no secrets notice was reintroduced. Changes
are session behavior, geometry, cache lifetime, and motion. Device
layout/accessibility checks remain unverified.
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