Repository navigation
feat(mobile): keep attach, model and effort while typing - #352
Merged
Merged
Conversation
nixuuu
marked this pull request as ready for review
November 8, 2026 09:12
nixuuu
added a commit
that referenced
this pull request
Nov 8, 2026
…367) Folding the mobile composer changed the inverted timeline's header after the animation, moving messages independently of the reader's finger. Returning to the end revealed partly clipped controls and then moved the last message again when the reserve caught up. The composer now retains its measured expanded input reserve through both directions. Folding and opening animate only the overlay; the last message already has room throughout opening. Controls get their full row height before fading in and disappear before that height closes. Motion keeps the existing `medium`/`slow` tokens, `smoothOut`, and instant reduced-motion path. Writing still transfers the secondary row's height to the field; attach/model/effort remain available. Fixes: #359 Related: #308 Related: #352 ### Root causes 1. **Reserve changes after the motion.** #308 retained the expanded reserve. #359 changed `animate` to call `settle` in both directions and allowed folded measurements to update `height`. During a fold, `progress` moves from 1 to 0 and `measured.current` becomes the pill height, while the list still reserves the expanded height. The completion callback then clears `moving` and schedules `settle` on JS, which assigns the smaller height to the list header and `ChatKeyboard` offset. Native anchoring/scroll clamping happens in a later layout, outside the finger movement. Opening does the reverse: the overlay grows over the smaller reserve, then the header grows at completion. The new fold completion never assigns reserve height; delayed partial opening measurements cannot shrink the retained reserve. Safe area, keyboard, empty status slots and suggestions remain excluded. The deliberate tradeoff is that a folded input retains only its actual expanded input space until it reopens; this does not restore the former empty status/fade reserve. 2. **Wrong anchor index.** `minIndexForVisible: 1` was intended to skip the reserve, but RN 0.88.1 `VirtualizedList` already adds one for `ListHeaderComponent`. The resulting native index was 2, skipping the newest turn and potentially anchoring a later/offscreen turn while reading a long newest turn. Keep the following-list index at 0 so the native index becomes 1. #358 changed routing/settings, not this geometry. The supplied recording shows the large discontinuity; its exact near-screen magnitude was not instrumented on a compatible client. 3. **Controls painted while their clip was smaller than the row.** `ComposerFold` used the same progress for `height = naturalHeight * progress` and `opacity = progress`. At progress 0.5, a 52 dp toolbar had a 26 dp clip and was already half opaque, while the field and send button were moving. Keep the measured row mounted at its natural size, finish allocating its height over the first 80% of progress, then fade controls over the remaining progress. In reverse, the controls disappear before the clip shrinks. The writing height transfer remains linear. 4. **Scroll corrections could become reader intent.** Opening at `fromEnd <= 8` ran before checking `reader`; `onMomentumBegin` unconditionally enabled reader intent, and travel survived drag boundaries. Thus reserve/anchor scroll events could open the composer and feed offset changes back into fold travel. The suspected loop is supported by the code; a device trace of the recording's individual offsets is unavailable. Keep the 8/192/96 dp hysteresis, reset travel on each drag, consume intent after one transition, and never create intent from momentum alone. Content/viewport/inset changes, keyboard motion, reserve measurements and explicit anchor/programmatic scroll revisions cancel intent until a fresh drag. “Show latest” explicitly expands before scrolling in both thread and bot chat. ### Verification - Passed: `bun install`, `bun run gen:check`, `bun run typecheck`, `bun run lint`, `bun run format:check`, `bunx expo lint` in `apps/mobile`, and `bun run --filter @canopy/web build`. Ran `bun run format` and the approved spacing autofix. No UI tests added, per repository policy. - `bun run check:tmp`: **1817 passed, 161 skipped, 0 failed**, 324 files; exited 0 and reported no test-owned temporary files left. Opt-in live tests were skipped. - Reviewed the supplied Android recording/contact sheets, relevant #308/#352/#358/#359 history, RN's installed header-index adjustment and native anchor code, and the pinned keyboard-controller adapter. The fixed 32 dp fade, keyboard frame handling, safe-area normalization and native dependency/config files are unchanged. - Visual verification is **not completed**. Through T3 device tools, the installed Android client failed with `The package 'react-native-keyboard-controller' doesn't seem to be linked`; the installed iOS client failed with `Cannot find native module 'ExpoUpdates'`. Neither can run the current checkout. Used an isolated Metro port and stopped it; no native/EAS build, APK, OTA publication or dependency change was made. No incompatible-client workaround is included. Physical-device parity, light/dark transitions, reduced-motion behavior and frame-by-frame motion remain to be checked on a compatible runtime. ### OTA fingerprints Generated before and after using EAS CLI **27.4.1**, profile **production**, for each platform: ```text bunx [email protected] fingerprint:generate --platform ios --build-profile production --json --non-interactive bunx [email protected] fingerprint:generate --platform android --build-profile production --json --non-interactive ``` | Platform | Before | After | Result | | --- | --- | --- | --- | | iOS | `2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3` | `2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3` | Unchanged | | Android | `c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d` | `c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d` | Unchanged | ### Manual device checks 1. On compatible Android and iOS runtimes, open a thread with a newest turn taller than the viewport and an empty composer. Drag toward older messages through 192 dp with at least 96 dp travel. Follow a line under the finger: it must move only with the gesture, with no blank frame or extra movement at completion. Repeat with a fling and several shorter drags. 2. Return to within 8 dp of the end. Controls must appear whole at natural size as the composer grows. The last message must remain fully above it, and its position must not change when opening completes. Repeat with slow drags and flings, and use “Show latest”. 3. Make small back-and-forth drags near the bottom during and after opening. One gesture must not reverse a transition. After opening completes, folding again must require a fresh drag reaching the distance/travel thresholds. Repeat while content streams and after toggling a timeline fold; those corrections must not collapse/open the composer on their own. 4. Repeat in light/dark, phone/unfolded widths, and system reduced motion. Include short and long model/worker names. Check typing, a long draft, clearing/sending, attachments, synchronous questions, opening/hiding the keyboard and interactive dismissal. Attach/model/effort must remain usable, the writing handoff must keep its size, and the fade must stay 32 dp. Smoke-check bot chat folding and “Show latest” because it shares the hook. Copy audit: no UI text changed.
This was referenced Nov 13, 2026
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.
Keep the attachment, model, reasoning effort and send/stop toolbar visible while the mobile composer has focus. Only the secondary worker/goal/permission row folds, and the text field takes over that row's measured height. The toolbar still folds when reading older messages.
The existing shared UI-thread animation, motion tokens, reduced-motion handling, feed reserve, Android blur-on-keyboard-close, mounted picker state and attachment draft remain in use. The goal action now belongs to the secondary row; its worker/goal area scrolls horizontally for long labels. The one-line trigger hint and subagent summary are unchanged. docs/mobile.md describes the new writing mode.
On both iOS and Android, tapping model, effort or attach dismisses the keyboard as the sheet opens. Attachment changes are limited to that keyboard dismissal; photo-picker presentation and intake are left to the separate freeze fix.
Verification:
Copy audit: no UI text changed.
Related: #308