Skip to content

Fix iOS chat top scroll edge blend - #6910

Merged
azooz2003-bit merged 14 commits into
mainfrom
feat-ios-top-scroll-edge
Jun 27, 2026
Merged

azooz2003-bit merged 14 commits into
mainfrom
feat-ios-top-scroll-edge

Conversation

@azooz2003-bit

@azooz2003-bit azooz2003-bit commented Jun 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Extends the iOS chat transcript under the navigation bar on iOS 26 so native top scroll-edge blending can fade content into the toolbar instead of showing a hard table boundary.
  • Centralizes top and bottom UIScrollEdgeElementContainerInteraction setup in ChatScrollEdgeCoordinator.
  • Adds UI evidence coverage that asserts the transcript underlaps the navigation bar and captures top-edge screenshot frames.

Testing

  • swift test --package-path Packages/iOS/CmuxAgentChatUI
  • python3 scripts/swift_file_length_budget.py --budget .github/swift-file-length-budget.tsv
  • ./scripts/lint-ios-package-conventions.sh
  • xcodebuild -workspace ios/cmux.xcworkspace -scheme cmux-ios -configuration Debug -destination id=C9D82663-886D-4EBD-92A0-96CF38A42FF3 -derivedDataPath /tmp/cmux-edge-ui test -only-testing:cmuxUITests/cmuxUITests/testAgentChatTopScrollEdgeUnderlapsNavigationBarEvidence
  • ./scripts/reload-cloud.sh --tag edge (fell back to local, succeeded)
  • ios/scripts/reload.sh --tag edge (simulator install/launch succeeded)

Notes

  • iPhone install was attempted but blocked locally: reload-cloud-ios is missing ASC API key, and ios/scripts/reload.sh --device-only reported MyPhone tunnel unavailable.
  • The passing UI test exported top-edge screenshot frames under /tmp/cmux-edge-top-sequence during local verification.

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Summary by cubic

Fixes iOS 26 chat scroll-edge blending at the top and bottom by underlapping the navigation bar and device bottom and coordinating native soft-edge effects. Keeps the “Today” header visible, preserves pin at top/bottom, keeps the error toast below the bar, ensures the scroll-to-bottom button clears the floating composer, and avoids double-counting the bottom safe area on iOS 26; older iOS keep legacy top padding.

  • Bug Fixes
    • Add ChatScrollEdgeCoordinator to apply soft edges, register the transcript as the top content scroll view with the nearest navigation owner (fallback to the owner), attach a bottom edge interaction to the composer, avoid unrelated roots/modals, ensure a single owner, and reset on detach.
    • Underlap nav bar and device bottom on iOS 26: the chat container ignores the top safe area and the table extends to the device bottom while the composer stays in the safe area; switch the transcript table to .automatic inset adjustment on iOS 26; add .mobileChatTopScrollEdgeLayout(legacyTopPadding:) for pre‑iOS 26 hosts; move the error toast to a ZStack sibling so it renders below the bar.
    • Update ChatTranscriptUITableView.applyTranscriptViewportInsets(topChromeInset:adjustedBottomInset:composerOverlayBottomInset:) to target the final adjusted bottom inset without double-counting UIKit’s safe-area addition, preserve pin-at-top when the bottom inset changes (and pin-at-bottom), clamp offsets, and expose adjustedTopInset, adjustedBottomInset, visibleTopY, and topChromeOverlayInset; rename isKeyboardViewportExternallyDriven to isViewportInsetsExternallyDriven.
    • Add ChatTranscriptOverlayGeometry so the scroll-to-bottom button pads above the floating composer; add accessibility IDs to ChatScrollToBottomButton and ChatDateHeader; short-circuit transcript table lookup to avoid walking hosted rows.
    • UI tests: assert top underlap and “Today” visibility/ownership, verify the scroll-to-bottom button clears the composer, confirm the table underlaps the device bottom with a matching adjusted bottom inset, and remove the test-only initial-scroll seam from production.

Written for commit 6c989bc. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features
    • iOS 26+ chat screens now coordinate transcript top scroll-edge underlap for improved blending beneath the navigation bar.
    • Added a shared mobileChatTopScrollEdgeLayout helper to preserve legacy top spacing on older iOS versions.
  • Bug Fixes
    • Improved transcript/composer viewport inset handling and scroll offset behavior, including more accurate keyboard/viewport state detection and updated clipping behavior.
    • Enhanced accessibility/debug metrics and added a reliable accessibility identifier for the “Today” date header.
  • Tests
    • Added an iOS 26+ regression UI test covering navigation bar underlap and the “Today” header during top-edge scrolling.

@vercel

vercel Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment Jun 27, 2026 5:36am
cmux-staging Building Building Preview, Comment Jun 27, 2026 5:36am

@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The chat screen now uses a dedicated scroll-edge coordinator, updated transcript viewport inset handling, and iOS-versioned top-edge layout helpers. UI tests and transcript metrics were extended to capture the new top-edge behavior.

Changes

iOS chat scroll-edge coordination

Layer / File(s) Summary
Legacy top padding helper and call sites
Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/View+MobileNavigationChrome.swift, Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/AgentChatDemoScreen.swift, Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/WorkspaceDetailView.swift, Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatKeyboardTrackedRoot.swift, Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatKeyboardTrackingContainer.swift, Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatScreen.swift
mobileChatTopScrollEdgeLayout(legacyTopPadding:) preserves the legacy top padding before iOS 26 and leaves the view unchanged on iOS 26+, and the demo, workspace, screen, and tracked-root chat layouts switch to the new top-edge behavior.
Coordinator geometry and edge effects
Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatScrollEdgeCoordinator.swift
ChatScrollEdgeCoordinator stores scroll-edge state, configures edge effects and content-scroll ownership, computes top underlap from view and navigation-bar geometry, and traverses controller hierarchy to find navigation context.
Coordinator interactions and reset
Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatScrollEdgeCoordinator.swift
The coordinator attaches and resets bottom scroll-edge interaction state, clears cached top bindings, and removes interaction state when configuration changes or the view disappears.
Keyboard controller integration
Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatKeyboardTrackingViewController.swift
ChatKeyboardTrackingViewController disables clipping, stores transcript clip and height constraints, updates geometry with coordinator underlap, resets the coordinator on disappearance, and delegates viewport inset updates through the new transcript inset path.
Transcript viewport insets and metrics
Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Transcript/ChatTranscriptUITableView.swift, Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Transcript/ChatTranscriptTableView.swift
ChatTranscriptUITableView applies top and bottom viewport insets together, clamps content offset changes, and extends debug metrics; ChatTranscriptTableView uses the updated external-insets guard.
UI evidence and transcript markers
Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Transcript/Rows/ChatDateHeaderView.swift, ios/cmuxUITests/cmuxUITests.swift
The date header exposes an accessibility identifier, transcript metrics parsing and formatting include the new top inset fields, and the UI test captures top scroll-edge evidence while returning metrics from transcript scrolling helpers.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • manaflow-ai/cmux#6300: Both PRs change WorkspaceDetailView’s iOS chat-pane top spacing/padding behavior.
  • manaflow-ai/cmux#6651: Both PRs touch WorkspaceDetailView’s chat top inset path via terminalTopPadding.
  • manaflow-ai/cmux#6723: Both PRs modify iOS chat keyboard/inset handling in ChatTranscriptUITableView and related transcript coordination.

Poem

A bunny leapt where scroll-edges gleam,
Through iOS 26’s soft chrome stream.
The top gap shifted, the transcript hummed,
And little evidence frames were bummed—
then captured with a twitchy nose. 🐇

🚥 Pre-merge checks | ✅ 24 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (24 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: fixing the iOS chat top scroll-edge blend.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cmux Swift Actor Isolation ✅ Passed The PR adds only UI-bound Swift types, and the new coordinator/controller are explicitly @MainActor; no new Sendable or background-access isolation debt appears.
Cmux Swift Blocking Runtime ✅ Passed No production Swift diff adds waits, sleeps, locks, or syncs; only test-only waitFor*/UI checks appear, while ChatScreen’s Task.sleep is preexisting.
Cmux Browser Automation Off-Main ✅ Passed Diff only touches ghostty/vendor submodules; no browser.* commands or control-socket/mainActor routing changed.
Cmux Expensive Synchronous Load ✅ Passed No new synchronous agent-history/file/JSON loaders appear in the edited Swift paths; the changes only adjust chat layout, insets, and scroll-edge coordination.
Cmux Cache Substitution Correctness ✅ Passed The diff only adds transient UI/layout and scroll-edge state; no persistence/history/undo/snapshot read was replaced by a stale or cold cache.
Cmux No Hacky Sleeps ✅ Passed PASS: diff only updates submodule gitlinks; no TS/JS/shell/build/runtime files changed and no hacky sleeps/timers/polling found.
Cmux Algorithmic Complexity ✅ Passed Bounded to one transcript table and one controller tree; no new nested rescans or hot-path sorting/filtering over scalable user collections.
Cmux Swift Concurrency ✅ Passed No new DispatchQueue, Combine, completion-handler, or fire-and-forget Task patterns appear in the changed Swift files; remaining callbacks are allowed UI/XCTest boundaries.
Cmux Swift @Concurrent ✅ Passed No new @concurrent misuse or missing annotation; the added async code is UI-bound @MainActor test logic or awaits chat-session fetches from a SwiftUI task.
Cmux Swift File And Package Boundaries ✅ Passed Changes stay in package-target Swift files; new coordinator/helper are small, and oversized files were only touched incidentally or in tests.
Cmux Swiftpm Lockfiles ✅ Passed PR diff touches only Swift source/UI test files; no Package.swift, Package.resolved, Xcode project, or .gitignore lockfile paths changed.
Cmux Swift Logging ✅ Passed No added or materially changed print/debugPrint/dump/NSLog/Logger usage in the diff; the existing WorkspaceDetailView NSLog is untouched.
Cmux User-Facing Error Privacy ✅ Passed No new user-facing error copy or prohibited identifiers were added; changes are layout/scroll-edge plumbing plus tests/debug-only scaffolding.
Cmux Full Internationalization ✅ Passed PASS: The only new visible text is debug-only ('Done'); production changes are layout-only or use localized date formatting, with no catalog/i18n fan-out.
Cmux Swiftui State Layout ✅ Passed Diff only adds safe-area/view modifiers and UIKit bridge code; no new ObservableObject/@Published/GeometryReader/store-ref row subtree or render-time state mutation.
Cmux Architecture Rethink ✅ Passed No symptom-patch timing or split ownership added; scroll-edge logic is centralized in a MainActor coordinator with clear owner/invariants, and tests only use sync.
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed Touched files only change UIKit view/controller/layout code; no NSWindow/NSPanel/WindowGroup/SwiftUI.Window or cmuxAuxiliaryWindowIdentifiers changes, so the rule isn’t implicated.
Cmux Source Artifacts ✅ Passed All changed paths are intentional Swift source/test files; none are temp/log/screenshot/cache/DerivedData/artifact paths.
Cmux No Test Or Debug Seam In Production Source ✅ Passed No new production test/debug seam was added; the DEBUG accessibility path is an existing seam only extended, and the new debug demo is isolated.
Cmux No Ambient Global State ✅ Passed No new ambient globals: the scroll-edge logic lives on instance types/extensions, and I found no new file-scope funcs, mutable vars, or singletons.
Description check ✅ Passed The description covers the summary and testing sections well, but it omits the demo video, review-trigger block, and checklist from the template.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-ios-top-scroll-edge

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Implements iOS 26 native top scroll-edge blending for the chat transcript by extending the transcript and composer under the navigation bar and device bottom chrome, then centralizing all UIScrollEdgeElementContainerInteraction setup into a new ChatScrollEdgeCoordinator.

  • New ChatScrollEdgeCoordinator walks the parent chain to find the direct child of the nearest UINavigationController, registers the transcript as the top content scroll view on that controller only (not on unrelated roots or modals), and manages the bottom composer edge interaction — correctly returning nil (falling back to owner) when the owner is itself the direct nav-controller child.
  • applyTranscriptViewportInsets replaces the old applyComposerOverlayBottomInset, adding a topChromeInset parameter and subtracting UIKit's automatic safe-area bottom adjustment to avoid double-counting on iOS 26; a wasPinnedToTop guard keeps the first row anchored when the bottom inset changes.
  • trackedTranscriptTables short-circuits on the first found ChatTranscriptUITableView, avoiding an O(n) walk through every hosted cell row on every layout/keyboard update.
  • Error banner is moved to a ZStack sibling so it renders below the navigation bar even after the chat layout opts out of the top container safe area on iOS 26.

Confidence Score: 5/5

The change is safe to merge — all scroll-edge, inset, and underlap paths are guarded by iOS 26 availability checks, pre-iOS 26 behavior is unchanged, and the two previously identified coordinator bugs are correctly resolved in this revision.

The automaticBottomAdjustment subtraction correctly avoids double-counting the safe-area contribution on iOS 26. The wasPinnedToTop guard symmetrically mirrors the wasAtBottom restoration path. nearestNavigationContentViewController returns nil when no nav controller exists in the parent chain, and firstNavigationController no longer traverses presentedViewController — both previously flagged issues are fixed. The trackedTranscriptTables short-circuit prevents O(n) traversal into hosted table cells on every layout/keyboard update.

No files require special attention.

Important Files Changed

Filename Overview
Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatScrollEdgeCoordinator.swift New file centralizing iOS 26 scroll-edge setup; correctly finds the nav-controller's direct child via parent-chain walk with a nil-fallback to owner, guards modal traversal, and pairs bottom-interaction teardown with reset().
Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatKeyboardTrackingViewController.swift Delegates all edge-effect and content-scroll-view setup to ChatScrollEdgeCoordinator; adds bottom safe-area underlap via transcriptClipBottomConstraint and view.clipsToBounds = false; introduces transcriptOverlayBottomInset helper that sums composerHeight + safeAreaUnderlap correctly.
Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Transcript/ChatTranscriptUITableView.swift applyTranscriptViewportInsets replaces applyComposerOverlayBottomInset; subtracts UIKit's automatic safe-area bottom contribution to avoid double-counting on iOS 26; wasPinnedToTop branch keeps the first row anchored; setClampedContentOffsetY and clampCurrentOffset helpers are clean.
Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatScreen.swift Moves error banner to a ZStack sibling so it respects top safe area independently from the iOS 26 underlapped chat layout; chatTopBarUnderlapContainer() is a clean private View extension.
Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatKeyboardTrackingContainer.swift Introduces makeCoordinator() to own the ChatTranscriptOverlayGeometry lifetime; passes it into both makeUIViewController and updateUIViewController correctly.
Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Transcript/ChatTranscriptListView.swift scrollToBottomButtonBottomPadding now reads composerBottomInset from ChatTranscriptOverlayGeometry environment, ensuring the scroll-to-bottom button floats above the floating composer correctly.
Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/View+MobileNavigationChrome.swift Adds mobileChatTopScrollEdgeLayout(legacyTopPadding:) to conditionally apply the pre-iOS 26 safe area padding, keeping host sites clean.
ios/cmuxUITests/cmuxUITests.swift Adds three UI evidence tests covering nav-bar underlap, scroll-to-bottom button clearance, and device-bottom underlap; adds adjustedTopInset/adjustedBottomInset/visibleTopY/topChromeOverlayInset fields to ChatTranscriptMetrics matching the new debug format string.

Reviews (11): Last reviewed commit: "Fix iOS chat policy findings" | Re-trigger Greptile

@blacksmith-sh

This comment has been minimized.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatKeyboardTrackingViewController.swift`:
- Around line 381-382: The geometry update path is rescanning transcript
subtrees because trackedTranscriptTables(in:) keeps descending even after it
finds a ChatTranscriptUITableView. Update trackedTranscriptTables(in:) in
ChatKeyboardTrackingViewController to short-circuit once the table is found, or
cache the table reference so the keyboard/layout update path in the caller does
not repeatedly walk visible cells and hosted row views.

In
`@Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Transcript/ChatTranscriptUITableView.swift`:
- Around line 117-123: When updating ChatTranscriptUITableView’s viewport after
a composer or bottom-inset change, the current conditional order lets the
bottom-restoration path run even when the transcript was pinned to the top,
which moves contentOffset.y away from the top inset. In the same viewport update
logic, handle wasPinnedToTop before the snapshot.wasAtBottom || bottomChanged
branch, and force the pinned-top offset using setClampedContentOffsetY with
-adjustedContentInset.top. Keep restoreKeyboardViewport(snapshot) only for the
non-pinned cases so the top position is preserved.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a7f58844-2c5f-4cb1-8ea2-cded2ce36367

📥 Commits

Reviewing files that changed from the base of the PR and between 9f18945 and fdb72b8.

📒 Files selected for processing (6)
  • Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatKeyboardTrackingViewController.swift
  • Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatScrollEdgeCoordinator.swift
  • Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Transcript/ChatTranscriptTableView.swift
  • Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Transcript/ChatTranscriptUITableView.swift
  • Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Transcript/Rows/ChatDateHeaderView.swift
  • ios/cmuxUITests/cmuxUITests.swift
💤 Files with no reviewable changes (1)
  • Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatScrollEdgeCoordinator.swift

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatScreen.swift`:
- Line 117: The top underlap is applied too broadly in ChatScreen, which causes
the `.overlay(alignment: .top)` error banner to inherit the underlapped region.
Update the `ChatKeyboardTrackingContainer` / `.chatTopBarUnderlapContainer()`
usage so only the transcript-hosting subtree ignores the top safe area, or
explicitly restore the top safe-area offset for the overlay path, keeping the
error toast below the navigation bar.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 12419394-179a-4be0-9e32-ab6eed8224bf

📥 Commits

Reviewing files that changed from the base of the PR and between 15fa2af and f73edc9.

📒 Files selected for processing (6)
  • Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatKeyboardTrackedRoot.swift
  • Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatKeyboardTrackingContainer.swift
  • Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatKeyboardTrackingViewController.swift
  • Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatScreen.swift
  • Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Screen/ChatScrollEdgeCoordinator.swift
  • ios/cmuxUITests/cmuxUITests.swift

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Transcript/ChatTranscriptTableView.swift (1)

290-307: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Don’t expand the UI-test scroll seam in production source.

Adding the "top" mode makes CMUX_UITEST_CHAT_INITIAL_SCROLL a broader DEBUG/test-only behavior inside a production Sources/ Swift file. Drive the new evidence test to top via XCUI scrolling/metrics instead of adding another app-code test mode. As per path instructions, **/Sources/**/*.swift: “do not add test-only or debug-only seams in production Swift source files.” As per coding guidelines, production Swift changes must not add test/debug seams in production source.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Transcript/ChatTranscriptTableView.swift`
around lines 290 - 307, The initial-scroll handling in ChatTranscriptTableView
should not gain a new test-only “top” path inside production Sources code.
Remove the added CMUX_UITEST_CHAT_INITIAL_SCROLL “top” branch from the debug
initial scroll logic in ChatTranscriptTableView and keep the app code limited to
existing behavior, then update the UI test to scroll the transcript to the top
using XCUI interactions or metrics instead of relying on a new app-side seam.

Sources: Coding guidelines, Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Transcript/ChatTranscriptTableView.swift`:
- Around line 290-307: The initial-scroll handling in ChatTranscriptTableView
should not gain a new test-only “top” path inside production Sources code.
Remove the added CMUX_UITEST_CHAT_INITIAL_SCROLL “top” branch from the debug
initial scroll logic in ChatTranscriptTableView and keep the app code limited to
existing behavior, then update the UI test to scroll the transcript to the top
using XCUI interactions or metrics instead of relying on a new app-side seam.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: dcf7c513-0cd9-476f-b106-03496c04f716

📥 Commits

Reviewing files that changed from the base of the PR and between f73edc9 and f6a2dec.

📒 Files selected for processing (2)
  • Packages/iOS/CmuxAgentChatUI/Sources/CmuxAgentChatUI/Transcript/ChatTranscriptTableView.swift
  • ios/cmuxUITests/cmuxUITests.swift

Greptile P1s (ChatScrollEdgeCoordinator):
- nearestNavigationContentViewController now returns nil when no
  UINavigationController exists in the parent chain, so the caller falls
  back to `owner` instead of installing top scroll-edge state on an
  unrelated root controller.
- firstNavigationController no longer descends into presentedViewController,
  so the chat's top scroll-edge interaction can't attach to a navigation
  bar inside an unrelated modal layered above the chat.

CodeRabbit:
- trackedTranscriptTables short-circuits at the transcript table instead of
  re-walking its cells/hosted rows on every geometry update.
- applyTranscriptViewportInsets handles wasPinnedToTop first, the symmetric
  counterpart to wasAtBottom, so a composer/bottom-inset change can't drift
  the first row back under the toolbar.
- The chat error toast is now a ZStack sibling that respects the top safe
  area instead of an overlay on the underlapped layout, so on iOS 26 it
  renders below the navigation bar rather than under it.
- Removed the new test-only CMUX_UITEST_CHAT_INITIAL_SCROLL "top" seam from
  production source (restores the pre-existing "middle"-only behavior) per
  no-test-debug-seam-in-production-source; the evidence UI test now drives
  the transcript to the top with XCUI scrolling instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@austinywang

Copy link
Copy Markdown
Contributor

Addressed CodeRabbit's outside-diff note on ChatTranscriptTableView.swift (the CMUX_UITEST_CHAT_INITIAL_SCROLL "top" branch) in 6c1c9a3: the new test-only "top" seam was removed from production Sources/ (restoring the pre-existing "middle"-only behavior, per no-test-debug-seam-in-production-source), and testAgentChatTopScrollEdgeUnderlapsNavigationBarEvidence now drives the transcript to the top with XCUI scrolling (scrollTranscript(direction: .down, …)) instead of an app-side seam.

@azooz2003-bit
azooz2003-bit force-pushed the feat-ios-top-scroll-edge branch from e6235f9 to ba2251e Compare June 27, 2026 03:29
@azooz2003-bit
azooz2003-bit force-pushed the feat-ios-top-scroll-edge branch from ba2251e to 133ce84 Compare June 27, 2026 03:37

This branch was successfully deployed

1 active deployment
Preview – cmux — 6c989bc2 Deployed Jun 27, 2026 by vercel[bot]
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.

2 participants