Skip to content

feat(mobile): keep attach, model and effort while typing - #352

Merged
nixuuu merged 1 commit into
devfrom
fix/mobile-composer-typing-controls
Nov 8, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/mobile-composer-typing-controls

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

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:

  • Passed: bun install, bun run gen:check, bun run typecheck, bun run lint, bun run format:check, web build, mobile typecheck and bunx expo lint.
  • CI passed for this exact head: static checks, all four complete check:tmp shards (with full test-file coverage verified), web/Linux builds and the aggregate gate. The local full run reported an unrelated linked-bot checkpoint gRPC UNAVAILABLE/disconnect on the heavily loaded shared machine; it was stopped after the complete isolated CI run passed. Earlier local attempts exposed temporary-directory Git discovery and timeout failures. The last local run used worktree temp data, a Git discovery ceiling and a 30-second timeout; the project-discovery failure cleared.
  • Native QA is blocked: both existing Android devices are held by other sessions; a temporary Android AVD failed to boot with the Mac nearly out of disk space and was deleted. The free iOS simulator's installed dev client lacks ExpoClipboard; no usable replacement artifact was available. The Mac had less than the required 12 GB free, so no iOS build was started. No native build was produced on Linux, where neither Android SDK nor JDK is installed.
  • The requested phone/Fold, light/dark, repeated focus/blur, multiline drafts, picker selection, reduced motion, pending attachment preservation and Paste image runtime matrix remains unverified. This PR stays draft pending device verification.
  • The isolated PostgreSQL/gateway/scripted-worker fixture started successfully; no device completed pairing. The fixture, Metro, SSH forwards and local test processes were stopped, their containers removed, and the temporary AVD deleted. No native build output was generated.

Copy audit: no UI text changed.

Related: #308

@nixuuu
nixuuu marked this pull request as ready for review November 8, 2026 09:12
@nixuuu
nixuuu merged commit 9cfc682 into dev Nov 8, 2026
12 checks passed
@nixuuu
nixuuu deleted the fix/mobile-composer-typing-controls branch 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.
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