Skip to content

show recent sessions in the session switcher - #59

Closed
h3nock wants to merge 4 commits into
mainfrom
feature/recent-sessions-bottom-sheet
Closed

show recent sessions in the session switcher#59
h3nock wants to merge 4 commits into
mainfrom
feature/recent-sessions-bottom-sheet

Conversation

@h3nock

@h3nock h3nock commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Show saved inactive sessions under a Recent section in the terminal Sessions sheet.
  • Keep connected sessions under Active and preserve their existing ordering.
  • Resume Recent sessions through the existing connection path.
  • Support medium and large sheet detents with a visible drag indicator and resize-first interaction.
  • Keep New Session as the fixed sheet action.
  • Use middle truncation for session names so distinguishing suffixes remain visible.
  • Expand the Close control’s hit target to 44×44 points while preserving its 36×36 appearance.
  • Update accessibility labels, hints, traits, and stable UI-test identifiers.

Design

The implementation keeps ownership boundaries explicit:

  • activeSessions remains the source of truth for live runtime sessions.
  • ConnectionLibrarySnapshot remains the source of truth for saved sessions.
  • SessionSwitcherProjection is a value-only presentation projection.
  • Active workspace IDs are excluded from Recent by identity.
  • Recent ordering is centralized in ConnectionLibrarySnapshot and reused by the library and switcher.
  • Resuming a session uses the existing RemuxRootModel.connect(to:) path.

The sheet’s existing material, palette, tint, and terminal chrome presentation are unchanged. Presentation changes are limited to detents, the drag indicator, and resize-first interaction.

Validation

  • 20 focused projection and repository tests passed.
  • RemuxUIOnly build-for-testing passed.
  • The live switcher flow passed on the iPhone 17 Pro simulator against a configured SSH/tmux test host.
  • The live flow verified:
    • Active and Recent grouping.
    • Medium-to-large sheet expansion.
    • Scrolling to an older Recent session.
    • Recent-session resumption.
    • Sheet dismissal after resuming.
    • The specifically resumed session appearing under Active.
    • The resumed session disappearing from Recent.
    • Cleanup of generated test sessions.

Summary by CodeRabbit

  • New Features

    • Added a session switcher with separate Active and Recent sections.
    • Resume recent sessions and create new sessions directly from the switcher.
    • Improved session accessibility guidance and support for larger session lists.
  • Bug Fixes

    • Recent workspaces are now filtered and sorted consistently.
    • Session ordering is deterministic, including tie-breaking by name and identifier.
    • Increased the close button touch target for easier interaction.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 9, 2026

Copy link
Copy Markdown

Deploying remux with  Cloudflare Pages  Cloudflare Pages

Latest commit: b548239
Status: ✅  Deploy successful!
Preview URL: https://2d606596.remux-agx.pages.dev
Branch Preview URL: https://feature-recent-sessions-bott.remux-agx.pages.dev

View logs

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The session switcher now displays active sessions and recent workspaces. Users can resume recent sessions asynchronously. Workspace ordering is deterministic, and tests cover projection behavior, UI interactions, accessibility, and live SSH session transitions.

Changes

Session Switcher

Layer / File(s) Summary
Projection and workspace ordering
RemuxApp/Sources/Persistence/ConnectionProfileRepository.swift, RemuxApp/Sources/App/SessionSwitcherView.swift, RemuxAppTests/SessionSwitcherProjectionTests.swift
Recent workspaces are filtered and sorted by last access, localized name, and UUID. The projection combines active sessions with available recent workspaces. Unit tests cover ordering, exclusion, unavailable servers, and selection state.
Session switcher presentation and integration
RemuxApp/Sources/App/SessionSwitcherView.swift, RemuxApp/Sources/App/RootView.swift, RemuxApp/Sources/Ghostty/*, Remux.xcodeproj/project.pbxproj
The sheet presents Active and Recent sections, handles session selection and resumption, updates accessibility text, applies shared sheet styling, and references the renamed source and test files.
Live session-switcher validation
RemuxAppUITests/RemuxAppUITests.swift
A live SSH UI test creates multiple sessions, verifies Active and Recent sections, resumes a recent session, and confirms its return to Active.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant SessionSwitcherView
  participant RootView
  participant ConnectionLibrarySnapshot
  User->>SessionSwitcherView: Open session switcher
  SessionSwitcherView->>ConnectionLibrarySnapshot: Request recentWorkspaces(excluding:)
  ConnectionLibrarySnapshot-->>SessionSwitcherView: Return sorted recent workspaces
  User->>SessionSwitcherView: Select recent session
  SessionSwitcherView->>RootView: Invoke resume callback
  RootView->>RootView: Trace and connect asynchronously
Loading

Possibly related PRs

  • h3nock/remux#21: Introduced the active-session switcher that this change expands.
  • h3nock/remux#48: Modified the session switcher and RootView flow that this change refactors.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the primary change: adding recent sessions to the session switcher.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/recent-sessions-bottom-sheet

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.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 9, 2026

Copy link
Copy Markdown

Deploying getremux with  Cloudflare Pages  Cloudflare Pages

Latest commit: b548239
Status: ✅  Deploy successful!
Preview URL: https://3317f921.getremux.pages.dev
Branch Preview URL: https://feature-recent-sessions-bott.getremux.pages.dev

View logs

@h3nock
h3nock marked this pull request as ready for review August 9, 2026 02:41

@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

Caution

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

⚠️ Outside diff range comments (1)
Remux.xcodeproj/project.pbxproj (1)

11-33: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Regenerate and commit the Xcode project.

CI reports that xcodegen generate modifies Remux.xcodeproj. Update the XcodeGen source configuration for these renamed files, regenerate the project, and commit the complete generated diff.

🤖 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 `@Remux.xcodeproj/project.pbxproj` around lines 11 - 33, Update the XcodeGen
source configuration entries for the renamed files represented by the
PBXBuildFile references, then run xcodegen generate to refresh Remux.xcodeproj.
Include and commit the complete regenerated project diff, ensuring the generated
file and reference mappings match the source configuration.

Source: Pipeline failures

🤖 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 `@RemuxAppUITests/RemuxAppUITests.swift`:
- Around line 680-683: Update the multi-session test around
generatedLiveLatencySessionName so its eight session names remain unique when
REMUX_LIVE_SESSION_NAME_OVERRIDE is configured. Bypass the override for this
test's generated names, or skip the test when the override is present; ensure
row queries and disconnectActiveSessionFromSwitcher continue targeting distinct
sessions.

---

Outside diff comments:
In `@Remux.xcodeproj/project.pbxproj`:
- Around line 11-33: Update the XcodeGen source configuration entries for the
renamed files represented by the PBXBuildFile references, then run xcodegen
generate to refresh Remux.xcodeproj. Include and commit the complete regenerated
project diff, ensuring the generated file and reference mappings match the
source configuration.
🪄 Autofix

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0cd3e645-e6f4-42b1-9d27-268ab29cb923

📥 Commits

Reviewing files that changed from the base of the PR and between 21136b4 and b548239.

📒 Files selected for processing (9)
  • Remux.xcodeproj/project.pbxproj
  • RemuxApp/Sources/App/RootView.swift
  • RemuxApp/Sources/App/SessionSwitcherView.swift
  • RemuxApp/Sources/Ghostty/GhosttyKeyboardChrome.swift
  • RemuxApp/Sources/Ghostty/TerminalSelectionSheetStyle.swift
  • RemuxApp/Sources/Persistence/ConnectionProfileRepository.swift
  • RemuxAppTests/ActiveSessionSwitcherProjectionTests.swift
  • RemuxAppTests/SessionSwitcherProjectionTests.swift
  • RemuxAppUITests/RemuxAppUITests.swift
💤 Files with no reviewable changes (1)
  • RemuxAppTests/ActiveSessionSwitcherProjectionTests.swift

Comment on lines +680 to +683
let primarySessionName = try generatedLiveLatencySessionName("switcher-primary")
let laterSessionNames = try (1...7).map { index in
try generatedLiveLatencySessionName("switcher-\(index)")
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Generate unique session names when an override is configured.

Lines 680-683 call generatedLiveLatencySessionName eight times. That helper returns the same REMUX_LIVE_SESSION_NAME_OVERRIDE value for every call. The row queries then match duplicate labels, and disconnectActiveSessionFromSwitcher can disconnect a different session.

Generate unique names for this test without applying the override, or skip this multi-session test when the override is set.

🤖 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 `@RemuxAppUITests/RemuxAppUITests.swift` around lines 680 - 683, Update the
multi-session test around generatedLiveLatencySessionName so its eight session
names remain unique when REMUX_LIVE_SESSION_NAME_OVERRIDE is configured. Bypass
the override for this test's generated names, or skip the test when the override
is present; ensure row queries and disconnectActiveSessionFromSwitcher continue
targeting distinct sessions.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b548239914

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +681 to +683
let laterSessionNames = try (1...7).map { index in
try generatedLiveLatencySessionName("switcher-\(index)")
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Generate distinct session names when an override is active

When REMUX_LIVE_SESSION_NAME_OVERRIDE (or its fallback file) is configured, every call to generatedLiveLatencySessionName returns that same override, so primarySessionName and all seven entries created here are identical. The test then repeatedly opens the same tmux session and uses non-unique labels to select and disconnect rows, meaning it can fail or validate the wrong session in supported live-harness runs that provide an override; derive unique suffixes for this multi-session test or bypass the single-session override.

Useful? React with 👍 / 👎.

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