Repository navigation
#903 Session Chat: corner slots for floating pills - #918
Conversation
Top left holds context (todos "2/5", branch), at most two. Bottom left holds live activity: one pill by priority (needs input > error > btw answer ready > running > queued > finished) plus "+N" that springs up the rest. Bottom right shows a round ↓ away from the end, "↓ N new" once rows arrive. With the keyboard up the activity pill goes compact unless it needs input, and "+N" and the other corners hide. The rules live in a pure SessionChatPillSlots on both platforms. btw, the queued strip, the collapsed permission/question pills and scroll to end move onto OpenCodeFloatingPill in the slots. A new "Request failed" pill scrolls to the failure and flashes it; ✕ dismisses it. The top-centre pill is gone; Syncing becomes a running item. The timeline reserves the pill row so no pill covers the last message. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Automated review: no finding that 2+ of 2 passes agreed on.
5 finding(s) from a single pass, not posted
ios/OpenCode Mobile/OpenCode Mobile/UI/Scroll/MessageListTimelineHost.swift:808medium: Reveal flash sticks to reused cell (muse-spark-1.3-contributor)ios/OpenCode Mobile/OpenCode Mobile/UI/Scroll/MessageListTimelineHost.swift:791medium: Reveal settles on fixed 0.4s delay (muse-spark-1.3-contributor)android/app/src/main/java/dev/opencode/mobile/ui/sessionchat/view/SessionChatTimelineView.kt:723medium: Failure tap dead while timeline hold is active (muse-spark-1.3-contributor)android/app/src/main/java/dev/opencode/mobile/ui/sessionchat/view/SessionChatTimelineView.kt:201medium: Android drops activity pills while not ready (muse-spark-1.3-contributor)ios/OpenCode Mobile/OpenCode Mobile/UI/Scroll/MessageListTimelineHost.swift:787medium: Reveal settle/flash uses a fixed 0.4 s delay, recording a mid-flight offset and flashing the wrong row (glm-5.3-flash)
opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.182 · 1 pass(es) failed
ivanfenenko
left a comment
There was a problem hiding this comment.
Review of #918 against #903 / #899. No blocking findings. Four should-fix and one nit are inline.
Ran: Android SessionChatPillSlotsTest (16), HiddenRequestPillTest (4), SessionBranchPillVisibilityTest (3): all pass. iOS SessionChatPillSlotsTests, SessionChatBranchPillTests, TimelineScrollControllerTests: 37/37 pass. No emulator or real-app run on my side.
Checked, no issue:
- The slot rules match the issue on both platforms and between them: stable priority sort,
+Noverflow, keyboard compaction (a needs-input pill keeps its label), and the finished fade with anextFadetimer keyed by.task(id:)/LaunchedEffect, so it is cancelled and doesn't leak. - The stack closes when
+Ndisappears (keyboard up, overflow emptied), and re-sorts in place when items change while it is open. N newcounts rows after the baseline, ignores history loaded above, and resets on reaching the end.latestFailureignores neutral marks, failures before a user row, and failures while retrying.- btw Retry/✕/open,
N queued→ Up next (iOS keeps the analytics screen view), and the collapsed permission/question taps are all wired the same as before. - The snackbar inset from #897 stays below the pill row (visible in the evidence).
Merge interplay
- #916 will conflict, though not hard. It edits the branch-pill call inside the top-pill
ZStack/AnimatedContentthat this PR deletes. It also modifiesSessionChatTopPillTest(s), which this PR deletes (modify/delete), and it threads a newonSessionBranchCopied. After the rebase, that callback has to go throughSessionChatContextSlotView(newonBranchCopiedparam) on both platforms, and #916'sSessionChatTopPillTestedits can be dropped. - #917: the extension point fits. Priority comes from the case, so a
.backgroundWork(...)case with an associated value can switch between needs-input and running. Its pulsing-dot needs-input layout must exist as anOpenCodeFloatingPillLayoutvariant to map inlayout(item)/SessionChatActivityPillCopy.layout. No API gap that forces rework.
Dead code: OpenCodeSideQuestionPill, OpenCodePendingPromptsStrip, OpenCodeSessionTodosPill and OpenCodeSyncingPill are now used only by the Component Gallery. Leaving them for a follow-up is fine, since removing them touches gallery entries unrelated to this slice. Please track it as an issue rather than only in the PR body.
Privacy: the code, tests and the evidence screenshots I opened show harness data only (seeded project, sk-test-****, temporary harness path).
Minor parity note, pre-existing and not inline: iOS shows /btw items even when a permission/question panel owns the composer. Android gates them on composerKind == Prompt, as both did before this PR.
| /** Extra bottom inset so the timeline can scroll under a floating composer. */ | ||
| val bottomOverlayInset: Dp = 0.dp, | ||
| /** Bottom-left live activity from the screen (requests, btw, queued). The timeline adds syncing and request failed. */ | ||
| val activityItems: List<SessionChatActivityItem> = emptyList(), |
There was a problem hiding this comment.
should-fix: Android drops every activity pill while the timeline is not Ready.
The slot only renders inside SessionChatTimelineReadyView. Creating, Loading, Error and Empty have no slot. iOS covers those states with SessionChatTimelineActivityOnlySlot. Before this PR, Android drew the collapsed-request pill, /btw chips and the queued strip in the composer column, so they showed in every timeline state.
Failure scenario: the user collapses a permission panel, then the timeline reload fails (Error) or the session is still Empty/Loading. Review permission is gone, and the composer shows the prompt because the dock is hidden. The request can't be reopened until the timeline loads. The same happens to N queued and /btw answer ready on a new session.
Fix: mirror iOS. Wrap the when (props.timeline) in a Box and, for the non-Ready branches, overlay SessionChatActivitySlotView with SessionChatPillSlots.activity(props.activityItems, props.keyboardVisible, now) at BottomStart, using the same rowBottom(props.bottomOverlayInset) padding.
There was a problem hiding this comment.
Fixed in 825311d. SessionChatTimelineView now wraps every non-ready state (Creating, Loading, Empty, Error) in a Box with SessionChatTimelineActivityOnlySlot, matching iOS. Added the instrumented test SessionChatTimelineActivitySlotTest: in each of the four states, "Review permission request" shows and taps through, and "+1" (queued) is present. It passes on the emulator.
| delay((fadeAt - System.currentTimeMillis()).coerceAtLeast(0L)) | ||
| activityClockMs = System.currentTimeMillis() | ||
| } | ||
| val listBottomInset = |
There was a problem hiding this comment.
should-fix: on Android, reserving the pill row moves the reading position when away from the end. iOS does not.
listBottomInset is the LazyColumn's contentPadding.bottom, and with reverseLayout that is the before-content padding. LazyList keeps firstVisibleItemIndex/ScrollOffset across a padding change, so every visible row moves by the delta (36 + 8 dp) when an activity pill appears or disappears. On iOS the same reserve goes through additionalSafeAreaInsets.bottom, which leaves contentOffset alone when unpinned.
Failure scenario: the user is reading mid-history during a busy run. A catch-up shows Syncing (400 ms delay, 600 ms minimum), a /btw answer lands, or they ✕ the failure pill. The text under their eye jumps about 44 dp, and with Syncing it jumps back within a second.
Fix: animate the reserve (animateDpAsState, as animatedSnackbarOverlayHeight does for #897). Or only grow the reserve while pinned to the end, which is the only time a pill can cover the last message.
There was a problem hiding this comment.
Fixed in 825311d. The reserve no longer follows the pill directly. SessionChatPillSlots.reservesActivityRow(reserved, hasActivity, pinnedToEnd) updates it only at the end of the chat and holds it while scrolled away, so a pill coming or going (Syncing, a dismissed Request failed) no longer moves the rows. At the end it still follows the pill, so the last message stays clear, the same as the iOS inset re-pin. Unit test: reservedRowFollowsThePillOnlyAtTheEnd. Checked in the real app: dismissing the pill while scrolled up leaves the visible rows at identical positions. Screenshots are in the new evidence comment.
| } | ||
| }, | ||
| ) { message, isNewestMessage, onContentSizeSettled -> | ||
| val revealAlpha = rememberREVEAL_HIGHLIGHT_ALPHA(revealed?.takeIf { it.messageId == message.id }?.token) |
There was a problem hiding this comment.
should-fix: the failure row flashes again every time it scrolls back into view (plus a naming nit).
revealed is never cleared, and rememberREVEAL_HIGHLIGHT_ALPHA keeps its Animatable in item-scoped remember. When the row leaves the LazyColumn and comes back, it recomposes with a fresh Animatable(0f), and LaunchedEffect(token) runs again with the same non-null token.
Failure scenario: tap Request failed, the row flashes. Scroll up a few screens and back down, and the row flashes red again with no tap, every time.
Fix: clear revealed after the animation, e.g. keep the flash in the parent (revealed plus one Animatable hoisted next to it) and set revealed = null when it ends. Or store the reveal time and skip the animation once it is older than about 2 s. Nit: the function name rememberREVEAL_HIGHLIGHT_ALPHA looks like a rename accident and should be rememberRevealHighlightAlpha (ktlint function-naming).
There was a problem hiding this comment.
Fixed in 825311d. rememberRevealHighlightAlpha(token, onFinished) (renamed) reports when its flash ends, and the view then clears revealed if the token still matches. A row that leaves the list and comes back recomposes with no token and stays untinted. Checked in the real app: flash on tap, then scrolled away and back, no second flash.
| ? (props.sessionTodoCompletedCount, props.sessionTodoTotalCount) | ||
| : nil, | ||
| branch: props.sessionBranchPill, | ||
| keyboardVisible: props.keyboardVisible |
There was a problem hiding this comment.
should-fix: the keyboard now zeroes the top inset in every session, which may be the cause of the overlap the PR calls pre-existing.
context(..., keyboardVisible:) returns [] with the keyboard up. Then showTopOverlayStack turns false, updateMeasuredTopOverlayInset(0) runs, and additionalSafeAreaInsets.top drops from the measured pill height to 0. On main the top pill ignored the keyboard, so any session with a branch or todos kept that inset while typing. The risk note says the overlap showed up with no activity pill, but the activity pill is at the bottom and doesn't affect the top inset. With this PR, every keyboard-up state has a top inset of 0, which on main only happened in sessions without a branch/todos pill.
Fix / ask: compare against main on a session that has a branch pill, keyboard up. If the overlap only shows here, keep the reserved top inset while the keyboard is up (hide the pills but keep topOverlayInset, or freeze it to the last measured value until the keyboard goes down). If it also shows on main, file it separately and drop the claim that this PR doesn't touch keyboard layout.
There was a problem hiding this comment.
You were right that this PR caused it; it wasn't pre-existing. On main (same session, keyboard up) there is no overlap. The main cause turned out to be the bottom pill row, not the top inset. It was a ZStack child whose bottom padding (composer + keyboard) set a minimum height taller than the keyboard-shrunk area, so keyboardOverlapPadding's bottom-aligned frame pushed the timeline up under the top bar. It also happened with no pill showing. Fixed in 825311d: the row is now an .overlay(alignment: .bottom), so it can't size the timeline. As asked, the keyboard now hides the top-left pills (opacity 0, no hit testing, hidden from VoiceOver) instead of removing them, so the top inset stays (SessionChatPillSlots.showsContext). Android does the same: the measured inset stays. Before (main) / after screenshots are in the new evidence comment.
|
|
||
| /// Brief tint behind a revealed row so the eye finds it. | ||
| private func flashItem(at indexPath: IndexPath) { | ||
| guard let cell = collectionView.cellForItem(at: indexPath) else { return } |
There was a problem hiding this comment.
nit: the flash can land on the wrong row.
The tint UIView goes into the cell's contentView and lives for about 1.9 s. If the user flicks during that time, the cell can be reused for another row, which then shows the red tint until the animation ends. revealItem also gives up silently if the cell is off-screen after the fixed 0.4 s (e.g. a long smooth scroll from far up), so there is no flash.
Fix: remove the flash in prepareForReuse/didEndDisplaying (tag the view), or drive the tint from row state the way Android does. Optional: flash from scrollViewDidEndScrollingAnimation instead of a fixed delay.
There was a problem hiding this comment.
Fixed in 825311d. The reveal keeps a pendingRevealID. If the row is already fully visible it flashes at once; otherwise it flashes in scrollViewDidEndScrollingAnimation, when the scroll lands, instead of after a fixed 0.4 s. A user drag cancels it. The tint is a view in the collection view at the row's layout frame, not in the reusable cell, so cell reuse can't carry it to another row. Checked in the real app with both an on-screen and a scrolled-away failure.
- Android: show the activity slot in every timeline state, so a collapsed request or queued prompts stay reachable while loading, empty or failed. - Android: the pill row reserve follows the pill only at the end of the chat; away from it, it holds, so a pill coming or going no longer moves the rows. - Android: a revealed failure flashes once; scrolling back does not flash it again. - iOS: the bottom pill row is an overlay, so its composer + keyboard padding no longer sets a minimum height that pushed the timeline under the top bar with the keyboard up. The keyboard hides the top-left pills without dropping their inset (both platforms). - iOS: the failure flash is keyed to the row id, drawn in the collection view rather than a reusable cell, and runs when the scroll lands. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes: real-app evidence (scenario harness, v2)iOS: keyboard up, timeline vs top bar. Same session as before; the pre-fix capture is
iOS: tapping Request failed while scrolled away. It scrolls, then flashes when the scroll lands. Android: a pill leaving while scrolled up does not move the rows.
Android: the reveal flashes once.
Android: keyboard up. The top-left pills are hidden and the inset is kept. Activity slot in non-ready states (Android): covered by the instrumented |




















Fixes #903 (part of #899)
What
Session Chat places its floating pills in three corner slots, all on
OpenCodeFloatingPill.2/5(opens the todos sheet), then the branch pill. The branch pill is today'sOpenCodeSessionBranchPill, called from the new slot; its internals are left to Session Chat: branch pill with changes popover #905.+N, which springs up the rest in priority order: needs input > error > btw answer ready > running > queued > finished. Finished items fade after 3 s, so beside other work they only show in the stack.↓ N newonce rows arrive below where the reader left.+Nand the other corners hide.Migrations:
N queued, opens the existing Up next sheet.Request failederror pill with ✕. It shows for the last turn's non-neutral failure, unless the session is retrying (the countdown stays in the chat). Tapping it scrolls to the failure and flashes the row; ✕ dismisses it.runningactivity item, with the same show delay and minimum time.needs inputitems (Review permission,Answer question, amber, no ✕), with the same tap (bring the panel back). This also makes the keyboard rule real: a needs-input pill keeps its label. Android used to show only one of the two when both were collapsed; it now shows both, like iOS. Session Chat: connect needs-input pill and prompt pills #906 can add paging and the pulse on top.The timeline reserves the pill row: the list's bottom inset grows by pill height + gap while an activity pill shows. That is
additionalSafeAreaInsetson iOS and LazyColumn bottom padding on Android, on top of the composer + snackbar inset from #897. The navigation pill only shows away from the end, so it reserves nothing.Design for #904 / #906
The rules live in a pure
SessionChatPillSlots(Swift enum / Kotlin object):activity(items, keyboardVisible, now): priority sort, overflow, keyboard compaction and finished fade.context(...),navigation(...),newMessageCount(...)andlatestFailure(...).A new kind of live work is one new case in
SessionChatActivityItemwith itspriority, plus its layout/copy entry in the slot view. For example, #904'sgeneral needs input · 2 runningcounter is a.backgroundWork(...)case at.needsInputor.running. TheFinishedcase and fade timer are in place for #904's completions; nothing in this PR produces one yet.Screen-owned items (requests, btw, queued) come from the screen. The timeline adds the ones it owns (syncing, request failed) and handles scroll and reveal.
Checks
SessionChatPillSlotsTests(16), plus the existingTimelineScrollControllerTests,MessageListTimelineHostTests,SessionChatViewModelTestsandSessionChatBranchPillTests. 258/259 passed in one run.sendPrompt_postSendReloadMatchingUser_dropsOptimisticfailed once and passed when rerun alone; it is not related to this change.SessionChatPillSlotsTest(17) and the instrumentedSessionChatTimelineActivitySlotTest(pills reachable while loading, empty or failed) andHiddenRequestPillTest(4, rewritten for the activity items) pass.assembleDebugbuilds. ktlint shows no new violations in the touched files.+Nstack, keyboard, scrolled up + new messages, and tapping the failure to reveal it. Screenshots for both platforms are in a comment below.SessionChatTopPilland its tests on both platforms (replaced by the slot rules).Risks / follow-ups
2/5was not seen in the real app (todo-list-progressis v1-only). It is covered by unit tests.OpenCodeSideQuestionPill,OpenCodePendingPromptsStrip,OpenCodeSessionTodosPillandOpenCodeSyncingPillare no longer used by Session Chat. They stay in the Component Gallery for now; they can be removed in a follow-up.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.