Repository navigation
fix(mobile): open threads at their final layout - #375
Merged
Merged
Conversation
Initialize composer rows and the thread reserve at their expanded sizes. Preload local history before list navigation, share paired-client model catalogs, and retain model, effort, permission and turn-footer space as their values arrive. Preserve fold, keyboard and fixed-fade behavior. Fixes: #292 Related: #367 Related: #359
nixuuu
added a commit
that referenced
this pull request
Nov 9, 2026
Tapping Archived on mobile waited for the sidebar setting to reach the gateway. It now changes local disclosure state immediately, displays saved archive pages before the request starts, and refreshes them in the background. A cold cache displays compact row skeletons. Archive rows, pagination cursors, and project/worker labels use a separate pairing-scoped persistent cache. Archive/unarchive/delete events update it incrementally; stale requests cannot resurrect changed rows. Unpair/revocation clears it. Active and archived rows share a windowed FlatList with stable keys and the existing reduced-motion-aware row/disclosure presets. Loaded pages survive collapse and restart, and scrolling loads the next page. ### Scope and coordination - Follow-up: expose paginated archived history from linked peers in the gateway API. The existing archive endpoint is local-only. Linked-computer archive rows learned through overview events are persisted, retained through local refreshes and offline periods, and removed by explicit lifecycle/unlink events. This PR does **not** discover a peer's complete historical archive. Reconnect snapshots reconcile active rows, but an unseen peer deletion cannot be inferred from snapshot absence. - Web already toggles optimistically and prefetches archive rows, so no web component change was needed. The shared pager keeps its existing web behavior. - For `perf/client-N`: transcript `thread-cache.ts` and `thread-cache-native.ts` are unchanged. The archive uses the existing storage adapter in an independent namespace; session initialization/cleanup and overview event handling are the integration points. ### Verification - Passed: `bun install`, `bun run gen:check`, full `bun run typecheck`, `bun run lint`, `bun run format:check`, and the production web build. Mobile/integration typechecks also passed after the final cache adjustment. - Full `bun run check:tmp --timeout 30000 --retry 2`: **1921 passed, 161 skipped, 1 failed** across 343 files; temp-dir hygiene passed. The unchanged `linked-timeouts.test.ts` slow-live-read scenario failed after both retries (the test did not observe the expected peer read refresh). Earlier interrupted runs encountered plugin timeouts under concurrent exports and a config-sync cursor assertion race; both passed in this final full run. No unrelated gateway/test code was changed to suppress failures. - Initial isolated `bun run check:tmp tests/integration/linked-timeouts.test.ts --timeout 30000`: **6 passed, 1 failed** in the same slow-live-read scenario; temp-dir hygiene passed. The failing test is `linked computer read deadlines and recovery > slow live reads time out without declaring the computer dead or repeating on every poll`. Its polling assertion returned `false` where `true` was expected: the peer did not reach `readState === "stale"` within 20 seconds, or the next assertion did not observe a newer `GetComputerUpdates` request within 10 seconds (`linked-timeouts.test.ts:160–161`). Two additional isolated runs on this head both passed **7/7**, without retries (78.46s and 78.31s); temp-dir hygiene passed in both. Maintainer comparison: **7/7** on dev `4dfb2f85` and two consecutive **7/7** runs on head `5bac8ae3` under less load. Their confirmation: “on your head 5bac8ae passes 7/7 twice in a row on a less loaded run here, and 7/7 on dev. So it's load-related, not your change.” Changed code is confined to mobile cache/sidebar behavior and the shared archive pager; the gateway, linked listings, BFF transport, and this fixture are unchanged and do not import the changed archive modules. No unrelated code was changed to suppress the failure. Publication with the local load failure documented is explicitly authorized; **CI remains the merge gate**. - Eight focused disk-cache tests cover restart, local/peer ordering, cached pagination, filters, lifecycle/request races, pairing isolation, unpair write fencing, corrupt data, and bounded retention. No UI tests added. - Expo Doctor: 20/20; clean prebuild and iOS/Android JS/Hermes exports passed. No native dependency/config changes. - Fingerprints generated before/after with `bunx [email protected] fingerprint:generate --platform <ios|android> --build-profile production --json --non-interactive`: iOS `2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3`, Android `c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d`; both unchanged. - Manual web browser check on an isolated port: light/dark at desktop and phone widths, 25 archive records with short/typical/long titles, paging, truncation and no horizontal overflow. With settings writes delayed by 2 seconds, the first observed animation frame already had the disclosure expanded and 20 cached rows. No native simulator/device interaction was performed. ### Copy audit - Before: failed refresh showed `Could not load archived threads.`. After, when saved rows exist: `Showing saved threads` quietly explains their source, with `Retry` on failure; four words, sentence case, standard glossary, no punctuation or humor needed for a status. - Existing `Could not load archived threads.` + `Retry`, empty-state text, and `Load more`/`Loading…` remain. The retry action supplies the next step without exposing transport details. - Status is announced politely; disclosure exposes expanded state and an accessible label. The new note follows pagination controls so its appearance does not move them. No new terms, duplicate status facts, or color-only meaning. Short/typical/long thread titles checked on web at desktop and phone widths; mobile device layout remains unverified. Related: #375
nixuuu
added a commit
that referenced
this pull request
Nov 9, 2026
## What changed Switching Threads ↔ Bots used to change the height of the centred Bots block when its loading text disappeared. The new-thread editor could also scroll its ancestors during autofocus, clipping the headline. Its Send slot started at the phone width and then measured the desktop width, moving both model pills by 4 px. - Share safe flex centring between the new-thread, Bots and new-side-thread screens. Short windows scroll downward with the heading visible. - Reserve one overlapping cell for Bots loading, setup and error messages, including their wrapped height. - Prevent editor autofocus from scrolling ancestors. Reserve responsive Send width, model/effort slots and the workspace/ref row before delayed Git data arrives. Existing thread composers use the same controls. Fixes: #93 Related: #375 ## Verification Passed `bun install`, `bun run typecheck`, `bun run lint`, `bun run format:check`, `bun run --filter @canopy/web build`, and `git diff --check`. No UI test suite was added. Full `check:tmp` is left to CI as requested. Checked the actual SvelteKit app in Chromium against a private disposable gateway/database. The catalog, provider availability, empty/populated bot list and Git refs used controlled browser response fixtures, with 500 ms catalog/list and 800 ms Git delays. Bot-chat and existing-thread routes loaded their real seeded history from the gateway. Preview automation could not connect, so the captures use local Chromium. Captured screenshots, Playwright trace screencasts and requestAnimationFrame geometry across three repeated round trips per viewport, cold and warm catalogs, light/dark, phone/desktop, reduced motion, absent providers, load errors and long project/worker/model/branch names. No media or diagnostic scripts are committed. | Viewport/theme | New-thread heading top | Bots heading top | Model/effort movement during reload and remount | | --- | --- | --- | --- | | 1440×600, light | 175 px | 218 px | 0 px | | 1440×450, dark | 100 px | 143 px | 0 px | | 390×600, dark | 145 px | 196 px | 0 px | | 390×450, light, reduced motion, delayed Git | 72 px | 121 px | 0 px | Each heading value stayed constant across its captured frames, including Bots loading → loaded. The 390×450 delayed-Git capture kept a 450 px scroll area inside the 402 px available pane, starting at scrollTop 0. New-side-thread scrolling was also checked with the mouse wheel: its narrow pane scrolled from 0 to 4 px without horizontal overflow. Bots ↔ a bot chat and Threads ↔ an existing thread retained their route positions and stable composer slots. Model popovers and long labels were visually inspected at both widths. Evidence retained outside the repository: `1440x600-light-no-preference-trace.zip`, `1440x450-dark-no-preference-worktrees-trace.zip`, `390x600-dark-no-preference-trace.zip`, `390x450-light-reduce-worktrees-trace.zip`, matching frame JSON files and screenshots. These are local handoff artifacts, not GitHub attachments. Browser verification covers the shared web build; Electron itself was not launched. ## Copy audit Before → after: all UI strings remain unchanged. Loading, setup and error feedback now share a reserved status cell; the error appears below Create bot. Checked sentence case, glossary, action wording, error recovery, one primary action, non-colour status cues and truncation/wrapping with typical and long labels on desktop and phone. No new terms or “soul” copy.
nixuuu
added a commit
that referenced
this pull request
Nov 9, 2026
The composer model and effort pills now hug their labels with the normal 4 px gap. #450 introduced permanent 192/96 px web slots; a short model label left a large blank area before effort. #375 introduced the matching 160/96 dp model/effort slots on mobile. - Web keeps a maximum width for truncating long model names, removes permanent slot widths, and removes the effort wrapper entirely for models without effort. New-thread, existing-thread, and side-thread composers share these controls. - Mobile removes the 160/96/128 dp model/effort/permission widths. Only cold model/effort skeletons reserve compact 128/72 dp widths. The toolbar aligns right so loading changes grow away from Send. New-thread pills already sized to content; bot chat composers have no model/effort pills. - Existing synchronous catalog reads remain in place. Web waits for the initial catalog read before mounting the composer; mobile reads the pairing's external-store snapshot synchronously. No native, dependency, or runtime configuration changes. Fixes: #450 Fixes: #375 ### Verification Passed `bun install`, `bun run gen:check`, `bun run typecheck`, `bun run lint`, `bun run format`, `bun run format:check`, the web build, focused ESLint for both changed mobile files, and `git diff --check`. No UI tests added. Full local `check:tmp` was not run as requested; CI remains the gate. Checked the actual SvelteKit app in Chromium with disposable HTTP/SSE response fixtures, without connecting to a live stack. New-thread and existing-thread composers were measured at 1440, 768, and 390 px in light/dark with `o3`, `GPT-6.1-Sol`, `Claude Opus 5.5`, a long model name, and Low/Default/High/Max effort. Every pair retained a 4 px gap with no page overflow. Desktop model widths were 73.5/130/159.5 px, capped at 192 px for the long name. Phone labels truncate within the available space. Inspected the model sheet, effort popover, and the no-effort case; no empty effort slot remains. Cold browser loads used a 1,000 ms catalog delay. Frame sampling from the first composer frame showed one final catalog label and one fixed pair of pill coordinates throughout each captured load: phone dark (`GPT-6.1-Sol`), desktop dark (`o3`), and desktop light (`Claude Opus 5.5`). Warm navigation between new-thread and existing-thread routes also retained the cached label without an intermediate alias. These checks cover the shared desktop/web UI; Electron was not launched. Both mobile fingerprints were generated before and after using `bunx [email protected] fingerprint:generate --platform <ios|android> --build-profile production --json --non-interactive`: | Platform | Before and after | | --- | --- | | iOS | `6ddec9ef559ee0095ac33e94ff9418a942053b17` | | Android | `5f6eae3ab278f1cd543e9ed763f923a319b65ec9` | Native visual verification remains incomplete. Launched this checkout through Metro in an installed iOS simulator client; it fails before rendering with “The package 'react-native-keyboard-controller' doesn't seem to be linked.” A compatible native development client is needed for mobile visual/cold-cache/scroll checks. No native build or publication was attempted. Android device visuals were not verified. Copy audit (§8): no UI strings changed. Existing model/effort labels, accessible names, and truncation remain; the change only removes excess reserved space. No new terminology or actions.
This was referenced Nov 13, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 29, 2026
## Change On a phone, a tap on a thread could leave the thread list on screen while an outstanding cache write, a directory scan or protobuf decoding finished. Push or replace the route immediately and use the screen's existing cache reader. An in-memory thread still renders on entry. A disk-only thread can display its overview header while the reader restores its saved cursor. Returning to the list schedules retention accounting and persistence in an idle callback. Backgrounding an open conversation still flushes its checkpoint. Root rows mount their action sheets on first use, and the covered phone list skips looking up the selected thread and expanding its side threads. Layout context stays stable across unrelated thread updates. Fixes: #375 ## Verification - Mobile and benchmark-script TypeScript checks and scoped oxlint passed. - All seven mobile thread cache tests passed, including disk restart, retained-view eviction, a pending write during revocation and a real paired gateway. - Android 16 emulator in portrait, actual navigation with synthetic data and a deliberately stalled 5 s disk read. Time from the press handler to mounting the thread screen was 5.57 s before / 0.34 s after for a disk hit, 5.20 s / 0.14 s for a miss and 0.33 s / 0.34 s for a retained memory hit. The title and composer appeared while disk was pending. History populated afterward. Returning mid-read and selecting a different thread kept the second thread on screen. - Verified idle persistence ran on return, both Working indicators rotated on the list, and long press opened the actions on first use, including Rename and Snooze and their dismissal. - The original multi-second spinner stall did not reproduce on the baseline Android emulator. The recording is from iOS. No physical iPhone profile or on-device iOS verification.
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 a mobile thread could show
opus, add the effort and permission controls, then move the last answer while the push was still running. Initialize the composer at its expanded size, preload cached history before list navigation, and keep model/effort slots and the ended-turn footer stable as their values arrive.Fixes: #292
Related: #367
Related: #359
Causes and changes
ComposerFoldmeasured an absolutely positioned child after mount; until that callback, its clip had height 0.useFloatingComposeralso initialized the inverted-list reserve to 0. This path was introduced with the floating composer in feat(mobile): float composers and extend layouts edge to edge #292 and remained through fix(mobile): fold and open the composer without moving the timeline #367. Both control rows now start at their expanded heights, and thread screens reserve 186 dp immediately: input 64 + toolbar 56 + secondary row 36 + gap 8 + padding 20 + borders 2. The toolbar's attach button is 36 dp plus 20 dp padding, so its actual expanded height is 56, despite the old 52 dp minimum. Native measurements still handle real content changes. fix(mobile): fold and open the composer without moving the timeline #367's retained expanded reserve, gesture rules and partial-opening guard remain intact; keyboard motion, safe areas, accessories and the 32 dp fade remain separate.useModelCatalogstarted empty on every mount,MessageComposerfell back tothread.model, and effort existed only after finding the model's supported efforts. Catalogs now belong to the current paired client, preload from the overview's available workers, share in-flight requests and supply a synchronous external-store snapshot. Model, effort and permission slots retain widths of 160/96/128 dp. An unavailable catalog shows same-size skeletons; a model without effort leaves its slot empty. The raw thread model id is never the temporary label. The permission pill was already unconditional; allocating its secondary fold's height makes it present from the first frame.TurnDetailsreturnednulluntil both timestamps existed. An authoritative turn update could insert that line underneath an already visible answer. Ended turns now retain the line height while awaiting a duration, matching web's permanentTurnDetailsrow. Existing snapshot encoding already preserves turn timestamps; no protocol or cache-format change is needed.useThreadSnapshotcan initialize synchronously only frompeek; a disk-only entry previously arrived from an effect after the push began. Thread-list rows, including side/archived rows, now load that local entry before push/replace. They never wait for network data. Later navigation, another tap or a pairing change invalidates a pending open. Cache misses retain the existing timeline skeleton.Syncing…is already an accessory outside the measured composer and list header; its appearance/disappearance changes neither the reserve nor composer position, so it stays there.The supplied recording's frames 37–40 support the label/row/footer sequence. They do not isolate how much of the large jump comes from the footer versus the reserve. No recording, frames, logs or machine-specific paths are included in this change.
Verification
bun install,bun run gen:check,bun run typecheck,bun run lint,bun run format:check, andbun run --filter @canopy/web build. Ranbun run format. ESLint for every changed mobile file is also clean. No UI tests added.bun run check:tmp: 1,842 passed, 161 skipped, 0 failed, 327 files, exit 0; nothing left in the test-owned temp directory. Opt-in live tests were skipped. Earlier full runs each had 1,841 passed, 161 skipped and one failure: unchangedlinked-list-retention.test.ts:118(awayReason(...)was undefined), then unchangedconfig-sync-projects.test.ts:308(response.attachedwas false). Other agents were running full suites on the same machine with shared memory; load-related timing is suspected. Both tests passed in the final full run. No gateway or test workaround is included.check:tmp:linked-list-retention1/1,config-sync-projects11/11, both with clean temp directories. The maintainer independently reported the same separate-file results on currentdev: 1/1 and 11/11. CI remains the gate; the final full run passed without needing the maintainer's exception for these two load-sensitive failures.state/gateway-departure.ts(react-hooks/purity,react-hooks/set-state-in-effect) and an existingreact-hooks/exhaustive-depswarning infeatures/updates/state.tsx. The required root lint and changed-file ESLint pass.OTA compatibility: JS/TS and documentation only; no dependencies, native modules or runtime configuration changed. Before and after, from
apps/mobile, ranbunx [email protected] fingerprint:generate --platform <ios|android> --build-profile production --json --non-interactivefor both platforms:2a0ef03a2a0fda8e7fad2e3df8609803d2edbda32a0ef03a2a0fda8e7fad2e3df8609803d2edbda3c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07dc5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07dManual checks on compatible iOS and Android clients
opusfrom the list. Record the push: the model display name (or reserved skeleton), effort and permission row must already occupy their final slots; composer height and the last answer must remain fixed. Return and reopen, then repeat after restarting the app so the history is disk-only. Repeat offline with cached history, and with a cache miss online. Rapidly tap different threads or navigate elsewhere during a disk read; no delayed extra push should occur.Syncing…must not change the list reserve or composer position. Check that the fade remains 32 dp.Copy audit (§8): temporary raw model id → catalog display name or same-size skeleton; no new UI strings. Existing “Model”, effort and permission labels retain their copy. Single-line truncation and full accessibility labels are preserved in code; device/width checks are explicitly pending above.