Skip to content

Add Chat and Agent mode switch#641

Merged
marksftw merged 1 commit into
masterfrom
codex/chat-agent-mode-switch
Jul 17, 2026
Merged

Add Chat and Agent mode switch#641
marksftw merged 1 commit into
masterfrom
codex/chat-agent-mode-switch

Conversation

@marksftw

@marksftw marksftw commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add an accessible Chat/Agent mode switch below the Maple logo, replacing the standalone Agent Mode action
  • animate the selected surface while keeping hover, focus, light/dark, and reduced-motion behavior consistent
  • preserve the exact Chat location and sidebar state, and restore the last Agent session when switching modes
  • keep feature availability stable and guard Agent async state across route remounts
mode-switch.mov

Testing

  • bun test — 131 passing
  • bun run typecheck
  • bun run lint — 0 errors (12 existing warnings)
  • bun run build
  • git diff --check

Closes #638

Summary by CodeRabbit

  • New Features

    • Added a streamlined switch between Chat and Agent modes.
    • Agent sessions now remember and restore the most recently selected session when available.
    • Sidebar open/closed state persists across navigation and mode changes.
    • Added smoother workspace transitions, including reduced-motion support.
    • Improved mobile and landscape layouts by automatically closing the sidebar when appropriate.
  • Bug Fixes

    • Prevented deleted sessions from being restored.
    • Reduced duplicate navigation and stale state during workspace transitions.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 569562d5-e81e-41d3-8562-08fc3af20dad

📥 Commits

Reviewing files that changed from the base of the PR and between 9d90eaf and 6d69b51.

📒 Files selected for processing (12)
  • frontend/src/components/AgentMode.tsx
  • frontend/src/components/AuthenticatedHomeContent.tsx
  • frontend/src/components/ProjectDetailView.tsx
  • frontend/src/components/Sidebar.tsx
  • frontend/src/components/UnifiedChat.tsx
  • frontend/src/components/WorkspaceModeSwitch.test.tsx
  • frontend/src/components/WorkspaceModeSwitch.tsx
  • frontend/src/contexts/PersistentHomeNavigationContext.ts
  • frontend/src/services/agentSessionSelection.test.ts
  • frontend/src/services/agentSessionSelection.ts
  • frontend/src/services/flags.test.ts
  • frontend/src/services/flags.ts

📝 Walkthrough

Walkthrough

Changes

Workspace navigation and session persistence

Layer / File(s) Summary
Persistence contracts and cache reads
frontend/src/contexts/PersistentHomeNavigationContext.ts, frontend/src/services/agentSessionSelection.*, frontend/src/services/flags.*
Adds persistent sidebar context, per-user agent-session memory, and synchronous settled feature-flag reads with coverage.
Provider and persistent sidebar integration
frontend/src/components/AuthenticatedHomeContent.tsx, frontend/src/components/AgentMode.tsx, frontend/src/components/UnifiedChat.tsx, frontend/src/components/ProjectDetailView.tsx
Stores user-scoped navigation state and reuses sidebar state across workspace remounts, including compact-layout transitions and serialized project-root persistence.
Workspace mode switch and navigation
frontend/src/components/WorkspaceModeSwitch.*, frontend/src/components/Sidebar.tsx
Replaces the standalone Agent Mode action with an accessible Chat/Agent switch, guarded navigation, transition completion, reduced-motion handling, and cached flag gating.
Agent session restoration and deletion
frontend/src/components/AgentMode.tsx
Remembers selected sessions, restores them after history readiness, guards asynchronous updates after unmount, and broadcasts session deletion events.

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

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant WorkspaceModeSwitch
  participant Sidebar
  participant AgentMode
  participant AgentSessionSelectionMemory
  User->>WorkspaceModeSwitch: select workspace mode
  WorkspaceModeSwitch->>Sidebar: request mode change
  Sidebar->>AgentMode: navigate to agent workspace
  AgentMode->>AgentSessionSelectionMemory: resolve remembered session
  AgentSessionSelectionMemory-->>AgentMode: return available session
  AgentMode->>AgentMode: load and remember selected session
Loading

Possibly related PRs

Suggested reviewers: anthonyronning

Poem

I’m a rabbit with a sidebar bright,
Chat and Agent hop into sight.
Sessions remember where they’ve been,
Flags peek softly, fresh and keen.
Deleted trails fade from view—
A tidy burrow, tried and true.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding a Chat/Agent mode switch.
Linked Issues check ✅ Passed The changes implement the requested Chat/Agent sidebar switch, accessibility, history restoration, and removal of the old Agent Mode action.
Out of Scope Changes check ✅ Passed The additional persistence, session-selection, and flag updates all support the mode-switch behavior and do not appear unrelated.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/chat-agent-mode-switch

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

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 16, 2026

Copy link
Copy Markdown

Deploying maple with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6d69b51
Status: ✅  Deploy successful!
Preview URL: https://efceaf44.maple-ca8.pages.dev
Branch Preview URL: https://codex-chat-agent-mode-switch.maple-ca8.pages.dev

View logs

@marksftw
marksftw force-pushed the codex/chat-agent-mode-switch branch from 9954ad2 to 5854a3a Compare July 16, 2026 21:44
@marksftw
marksftw force-pushed the codex/chat-agent-mode-switch branch from 5854a3a to 6d69b51 Compare July 16, 2026 22:10
@marksftw
marksftw marked this pull request as ready for review July 16, 2026 22:15

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@AnthonyRonning AnthonyRonning left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks much better!

@marksftw
marksftw merged commit c0368ea into master Jul 17, 2026
17 of 18 checks passed
@marksftw
marksftw deleted the codex/chat-agent-mode-switch branch July 17, 2026 18:52
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.

Add mode switch between Chat & Agent to the desktop sidebar

2 participants