Repository navigation
fix(mobile): anchor disclosures to their tapped row - #730
Merged
Merged
Conversation
Compute absolute scroll targets from cell-relative header geometry so delayed Fabric scroll checkpoints cannot compound corrections. Keep native cell anchoring configured through manual toggles to avoid stale checkpoints on re-enable. Fixes: #554
This was referenced Nov 14, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
Adds `render_html` beside `render_visual`, storing HTML as an immutable, owner-scoped visual version. The existing item, GetVisual, expected_version, citation and export pipeline remains the source of truth. Old clients reject kit version 2; workers and gateways negotiate `thread_html_v1` additively. The shared compiler rebuilds untrusted HTML, attempts to remove embedded documents, navigation attributes, inline handlers and external/module scripts, and prefixes each classic script with lockdown before hashing it. Removal is best-effort: parser differences and reparsing can restore markup (mXSS); CSP is the execution/resource boundary. Foreign MathML/SVG style elements are additionally discarded. Script CSP is hash-only; there is no unsafe-eval or unsafe-hashes. The trusted shell also restricts child navigation. Web/mobile residual network risk is explicitly accepted: matching-SRI external scripts and DNS hints can still send data. Desktop adds a separate network-denied browser process in #718. Validation: install, generation, typecheck, lint and formatting passed. The focused compiler/inbox/migration/gateway/harness run passed 58 tests. Tests cover pre-parse/UTF-8 limits, CSP hashes, stripped permissive metas, script-only sandbox, cyclic/invalid/flooded messages, owner scoping, version conflicts and format preservation. Migration is now **0144_thread_html** (file, index and schema expectation), following dev's 0143 from #725. The CLIProxyAPI stack moves to 0145; this stack merges first. Protocol remains additive. Security review fixes: the CSP meta, style and bootstrap scripts are inserted as parse5 tree nodes. Regression tests cover `<html data-x="<head>">`, a leading `<!-- <head> -->`, and `</body>` text in attributes/comments: exactly one CSP meta is first in the real head and every executable script has an authorized hash. Gateway publishing applies the same depth100/script64 limits as clients; rejected documents leave no stored version. The shell relay forwards only `JSON.parse(text).message`; an 8 MiB ArrayBuffer regression proves the original clone is not forwarded. Shared iframe permissions explicitly deny PiP and clipboard features. The focused security/gateway/three-harness run passed 38/38; channel identity tests passed 3/3. Per-platform probe evidence is recorded on #718, including the DNS positive control and protected result. The independent security re-check recommended merge. Copy audit: no new UI copy in this layer; tool instructions state inline-only code, addEventListener, size/script/depth limits, theme variables and no secrets. Previous-head full check:tmp was green in [CI run 43605016001](https://github.com/itsoltech/canopy/actions/runs/43605016001), head `cc18c0b7d86ae78ddd7d1cdff1af221107910367`. Pre-merge update: rebased onto origin/dev including #723, #725 and #730, preserving the new visual kit/gallery compiler and provider migration. The shell's own hash-authorized script now starts with the shared network lockdown, including when copied into a fresh realm. Only the trusted mobile shell retains its own message bridge; opaque agent realms have none and also remove ReactNativeWebView. Regression tests exercise web/native relay, locked RTC/fetch properties, the shell hash prefix and MathML/SVG reparsing with script-src-attr none. Final-head checks: schema/compiler 51/51, visuals/three-harness integration 16/16, both with empty temp directories; gen:check, full typecheck, lint and format:check passed. Immediately before the final push, origin/dev was re-fetched at d2af937 and its highest migration confirmed as 0143. New-head full CI is pending. All four PRs are ready, as requested; no merge performed.
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
Offers `render_html` through the shared tool catalog on Claude Agent SDK, Codex app-server and Grok ACP. The worker announces `thread_html_v1`; an older gateway gets an actionable update response instead of an unknown-tool call. Validation: fake adapters for all three harnesses publish HTML through WorkerLink into PostgreSQL. Existing component-tool coverage is retained. The focused compiler/inbox/migration/gateway/harness run passed 58 tests; install, generation, typecheck, lint and formatting passed. Security/gateway/three-harness run passed 38/38, including fake adapters publishing through WorkerLink. Platform probes are recorded on #718. Gateway depth100/script64 errors reach the tool before storage. The independent security re-check recommended merge. Copy audit: model-facing description prefers components for standard charts/cards/tables, requires addEventListener rather than inline handlers/eval, inline libraries/assets, no network or secrets, bounded documents and Canopy theme variables. No UI copy changes in this layer. Previous-head full check:tmp was green in [CI run 43605016001](https://github.com/itsoltech/canopy/actions/runs/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 shared compiler/shell P3 fixes and regression evidence are described in #716 and #718. Final-head schema/compiler tests: 51/51; gateway/three-harness visuals integration: 16/16; both temp checks clean. Generation, typecheck, lint and formatting passed. New-head full CI is pending. All four PRs are ready; no merge performed.
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
HTML visuals run inside an opaque `sandbox="allow-scripts"` iframe, with hash-only scripts prefixed by lockdown. The card identifies agent content and warns against entering passwords or secrets. Web and mobile require an explicit **Run**; desktop requires opening a separate viewer. The main window CSP is unchanged. ### Independent security review fixes - CSP and bootstrap insertion now uses parse5 tree nodes. Regression tests cover `<head>` inside an HTML attribute and a leading comment, and misleading `</body>` text. Exactly one CSP meta is first in the actual head; every executable script is hashed. Downloads include CSP and lockdown. - The shell forwards only the JSON-checked copy, never the original structured-clone object. A regression test sends an 8 MiB ArrayBuffer and verifies it cannot reach the parent relay. - Gateway publishing rejects depth >100 and >64 scripts before storing a version. Both frames deny PiP, clipboard, capture and other permissions explicitly. - HTML does not auto-run on web/mobile. A watchdog failure persists across reactive updates; explicit Retry is required. Revisiting/remounting starts at Run again. Same-process engines can still freeze their host after Run; the watchdog cannot guarantee recovery there. - Desktop fixes the native title, compiles in a worker thread with bounded heap/time, and serves the compiled document at a private session protocol URL rather than a size-limited data URL. ### Desktop DNS boundary The DNS finding reproduced: runtime `dns-prefetch` escaped CSP, proxy and webRequest. A renderer additionalArguments Blink flag did not reliably reach the renderer and did not stop it. The viewer therefore runs in a **separate Electron browser process**, configured before ready with `host-resolver-rules=MAP * ~NOTFOUND`. The network boundary is the resolver rules plus the refusing proxy plus webRequest cancellation. The unsupported `disable-network-prediction` switch has been removed. This applies to every viewer frame without changing the main app's flags, session or CSP. The independent security re-check verified the resolver block and judged it sufficient. The child retains a dedicated ephemeral session with deny proxy, request cancellation, denied permissions/devices/downloads/navigation/popups and `disable_non_proxied_udp`. It receives only bounded source, title and theme through private process IPC and a curated OS/display environment. It has no app services, app profile or credentials. One viewer is allowed; parent exit closes it and its temporary profile is removed. ### Review-fix probes Electron 45.2.1, Linux, headless Ozone; actual viewer/compiler implementation: | Probe | Observed result | |---|---| | Runtime dns-prefetch and preconnect via rel/href properties, setAttribute, innerHTML and template insertion | Positive control recorded speculative HOST_RESOLVER_MANAGER_REQUEST/JOB events for a unique canary. Final protected run: `DNS_CANARY_EVENTS []`. | | Matching-hash/SRI external script, remote image, fetch, RTC | `HTTP_CANARY_REQUESTS []`; image CSP violation; fetch/RTC undefined and calls throw TypeError. | | canvas.captureStream → video.requestPictureInPicture with user activation | SecurityError: disallowed by Permissions Policy. | | Agent document.title mutation | Native title stays `Custom HTML from the agent — Canopy`. | | 524236-byte source expanding beyond 2 MB when compiled | Actual production sidecar renders 524188 text characters, first head child is CSP, RTC undefined, protocol URL length 63. Healthy frame survives 11 seconds without a false watchdog. | | while(true) in actual production sidecar | Watchdog terminates all owned frame renderer PIDs, including the hung OOPIF, destroys the old window and opens one safe warning window. CDP returns `This visual stopped responding.` | DNS evidence uses Chromium netlog with a positive control, **not packet capture**: tcpdump was unavailable and privileged capture was not available. It demonstrates no canary resolver events in the protected run; it is not a claim of observing port 53. The direct diagnostic harness used `--no-sandbox`; the actual production sidecar startup/large-document/loop probes ran without that flag in the child. ### Earlier compiler/shell probes retained Chromium 155.0.8059.84 against the actual compiler/shell: | Attempt | Observed result | |---|---| | fetch, XHR, WebSocket, EventSource, WebTransport, beacon, mediaDevices, listed RTC constructors | Removed/locked; fetch and RTC calls throw TypeError. | | cookie, top navigation, popup | SecurityError, SecurityError, null. | | Remote image, form submit, self navigation | No canary HTTP request; trusted parent's frame-src blocks self navigation. | | eval, Function, string timer, inline handler, blob import | EvalError / no execution / TypeError. | | Worker | CSP blocks execution. | | object/embed, data/blob frames | CSP blocks loading. | | Nested srcdoc and empty srcdoc/about:blank | Realms can exist; parent access throws SecurityError and arbitrary unapproved scripts do not execute. | | Exact authorized script copied into nested srcdoc | Lockdown runs in that realm; RTC is undefined. | | document.write into nested realm | SecurityError. | | Agent permissive CSP meta | Does not widen policy. | | parent.postMessage spam | No host action; inbox tests validate rate limits and invalid/cyclic messages. | | Matching hash + SRI external script on ordinary web | **Accepted residual risk reproduced:** GET containing user-input canary reaches the server. | Web/mobile also retain DNS-hint, pastejacking, file-export and same-process engine risks, documented in Polish in docs/agent-visuals.md §9. Source, cache and live-frame counts are bounded; no hard browser renderer memory quota is claimed. Exported HTML includes CSP/lockdown but executes JS outside the Canopy iframe sandbox when opened as a file. ### Validation Install, gen:check, full typecheck (Svelte: zero errors/warnings), lint, format:check, focused security/gateway/three-harness tests (38/38), channel identity tests (3/3), web build and iOS/Android exports passed. Fingerprints remain iOS `138e0c6b171c82b4933e86808cdfef56da73b8c6`, Android `906dc944f94eb8333fa384ed9f198834fdd30d13`. **Previous-head full check:tmp was green in [CI run 43605016001](https://github.com/itsoltech/canopy/actions/runs/43605016001)** on `cc18c0b7d86ae78ddd7d1cdff1af221107910367`: all four check:tmp shards passed, and the final job verified that every test file actually ran exactly once. Static checks and web/Linux build were green too. The redundant local full run was interrupted after this complete CI result; it is not claimed as a local full-suite success. Actual VisualFrame fixture reviewed in Chromium at 1280px/390px, light/dark: no iframe before Run; counter increments after Run; warning wraps within the card. A button-triggered infinite loop shows the stopped warning; resizing does not remount, and remounting the component shows Run with no iframe. Screenshots were inspected. The fixture is isolated from a gateway; this does not certify an authenticated timeline, long-title header, or version-picker flow. Native iOS/Android hostile-document probes remain unverified; mobile exports do not establish native runtime behavior. The independent security re-check recommended merge. Pre-merge update: rebased onto origin/dev including #723, #725 and #730, with render_html migration 0144 after the provider migration 0143. The shell's hash-authorized executable now begins with network lockdown, preventing its inherited hash from authorizing an unlocked fresh realm. Markup removal is best-effort: MathML/SVG and browser reparsing can recreate removed elements/attributes (mXSS), so CSP, not sanitization completeness, is the boundary. Foreign-content style nodes are additionally stripped. Regression tests check the retained restrictive policy, absence of reparsed handlers, shell prefix/hash, immutable RTC/fetch removal in a fresh VM realm and preserved trusted native relay. Final-head schema/compiler: 51/51; gateway/three-harness visuals integration: 16/16, both temp checks clean. Generation, full typecheck, lint and formatting passed. The pinned Electron binary contains the host-resolver-rules switch token, with no disable-network-prediction token found. New-head full CI is pending. All four PRs are ready; no merge performed. Copy audit (§8): **Run** is the explicit action that starts agent JS. “Custom HTML from the agent. Don't enter passwords or secrets.” identifies the source and gives one concrete instruction. “This visual stopped responding.” names the failure and retains an explicit Retry. Desktop's action describes opening a separate window. No jargon, humor or color-only meaning in these strings.
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
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](https://github.com/itsoltech/canopy/actions/runs/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
added a commit
that referenced
this pull request
Nov 17, 2026
## Change Early mobile messages can end up behind the composer, repeated keyboard focus cycles can inflate the input, and tray popovers leave little room for queued messages and subagents. - Correct native anchor displacement on iOS while following latest, using the negative composer/keyboard inset. Keep intentional reading and disclosure anchoring intact, and make the latest button's pressed background round. - Measure text independently of the space transferred into the composer while writing. Recompute the resting height on focus, blur after keyboard dismissal, and keep blank input space tappable. - Open queue and subagent lists in shared scrollable sheets, with a centered card on wide windows. Show **Steer** beside its icon, keep actions beneath previews, and preserve selected subagent navigation when the last active agent disappears during dismissal. - Let the overlay body shrink to its height limit so the final list actions stay above the system navigation bar. Update the mobile behavior documentation. Fixes: #730 ## Verification - Mobile typecheck, targeted oxlint/ESLint, scoped formatting and diff checks passed locally. Final code review found no actionable issues. The remaining repository checks and builds run in CI. - Android emulator: actual application components with isolated fixture data, light/dark themes, phone and wide layouts, long queue/subagent lists, menus and editor handoff. Verified four keyboard dismissal cycles, long draft growth/clearing, delayed early-message insertion, latest navigation and its round pressed state, and removal of the last subagent during dismissal. Rechecked the visible Steer label in phone light/dark and wide dark layouts. - No iOS simulator was available. iOS native scrolling still needs device validation. Fixture checks do not verify real gateway mutations, durable drafts or production destination rendering. Copy audit (`docs/copy.md` §8): passed. Icon-only steer → icon plus **Steer** makes the action readable; the existing accessible description remains. Sheet titles and close labels use sentence case and established terms. Short and long text were checked at phone and wide widths; no new errors, empty states, dependencies or decorative copy.
nixuuu
added a commit
that referenced
this pull request
Nov 26, 2026
## Changes - Update the thread list in one layout pass when Working or Snoozed expands or collapses. Keep the rows virtualized and mount side threads at their natural height with a short fade on manual open. - On iOS, adjust the scroll offset relative to the tapped timeline header in the Fabric mount transaction that changes the fold height. Preserve that anchor when the same fold is rapidly reversed. - Build React Native from source on iOS so the scroll view change is included. The timeline fix requires a new iOS build. ## Verification - On an Android emulator, opened and closed Working, Snoozed and side threads. Verified five rapid Snoozed toggles and checked that clearing search restores the saved section state. - Mobile typecheck, lint and formatting for edited files, `git diff --check`, and the three mobile disclosure anchor tests passed locally. - Expo iOS prebuild generated the source-build setting. A native iOS build and frame-by-frame verification on an iPhone or simulator remain pending. GitHub Actions runs the full repository gate. Fixes: #1246 Related: #730
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opening or closing mobile tool details, tool groups and work segments can jump to unrelated history. This change computes an absolute scroll target from the tapped header's position within its actual inverted FlatList cell, so repeated measurements keep the header under the finger instead of accumulating scroll corrections.
Fixes: #554
Related: #689, #701, #721
Root cause and evidence
getItemLayoutor fold-dependent turn keys. fix(mobile): retain loaded threads across warm fallbacks #689 retains fold choices outside virtual cells. fix(settings): smooth scheduled task details expand and collapse #701'sui/Accordionis used by scheduled-task settings, not the timeline. Timeline work/groups use the height animation from fix(mobile): expand turn summaries smoothly without scroll jumps #554; individual item details mount directly and share its anchor hook.measurereadsUIManager::getRelativeLayoutMetrics, whose page coordinates include the Fabric scroll-state checkpoint. NativescrollToand the checkpoint are not one atomic measurement. The old frame callback subtractedpageY - originalPageYfrom an optimistically updated offset every frame. Re-reading an unchanged checkpoint therefore compounded the same correction. This is a code-established failure path consistent with the recording, not a device reproduction.Implementation
Measure both header and actual cell on UI. Their page-coordinate difference cancels the common scroll checkpoint; cell layout Y/height locate the header within inverted content. Preserve the session's initial offset/position and derive each target from that origin. Identical layout always gives an identical target, even if scroll events are delayed or native cell anchoring also adjusts the offset. Changes before the turn are included; height added above a nested header cancels naturally.
Use
createAnimatedComponent(FlatList)with a stable component identity, since Reanimated's convenienceAnimated.FlatListunconditionally replacesCellRendererComponent. Preserve inversion styles, focus and list layout notifications. Keep disclosure animation, retained children, turn keys, manual choices and drag/new-tap cancellation. The physical scroll range still limits anchoring when the remaining content is shorter than the viewport.Validation
nice bun install,nice bun run gen:check, fullnice bun run typecheck,nice bun run lint,nice bun run formatandnice bun run format:check: passed. All temporary files use a private/var/tmpdirectory.nice bun test tests/integration/mobile-disclosure-anchor.test.ts tests/integration/thread-scroll.test.ts: 7 passed, 40 assertions. Three new pure geometry tests cover stale/repeated scroll checkpoints, expansion/collapse, nested/preceding-cell changes, reversal and iOS/Android lower bounds. No UI suites.nice.devand the implementation: unchanged. iOS83794f069934a7374461427d89b8d008cec19d97; Android141ef4e8c825ee4fc5d22c499402b284741b0970. iOS also matches the last delivered nightly store build. No dependencies, native configuration or native sources changed.Re-test on iPhone and Android
Published directly to nightly by the implementing agent without authorization, from
0601f2ea4bf96feb70c1f920420ae6d3730cc31b, for both existing runtimes. The OTA keeps the last delivered JS release version0.3.0-nightly.12; its message isCanopy v0.3.0-nightly.12 + disclosure anchor fix (0601f2ea4bf96feb70c1f920420ae6d3730cc31b). Publishing reported success and returned the same runtime fingerprints checked above:01a1daa3-fa24-7e7d-8bed-1b03e10041a7, group62c3742a-aabb-4860-9a44-6bcc754df97b.01a1daa3-fa24-7f83-a58e-e0cd0ce3ed78, groupe0c51f88-99a6-4b60-937e-02c19a9257dc.No native build, new release tag or release-version commit was created. Release preparation files were restored afterward. Merge this PR so subsequent scheduled nightly releases retain the fix.
On the phone, use Settings → Updates to fetch/apply the new nightly OTA before these checks:
Copy audit (docs/copy.md §8): no UI text changed. Relevant Polish docs updated. Temporary frames, exports and logs are removed after delivery.