Skip to content

feat(agent): improve Agent Mode sidebar behavior - #745

Merged
marksftw merged 3 commits into
masterfrom
codex-agent-mode-sidebar-maple
Aug 9, 2026
Merged

feat(agent): improve Agent Mode sidebar behavior#745
marksftw merged 3 commits into
masterfrom
codex-agent-mode-sidebar-maple

Conversation

@marksftw

@marksftw marksftw commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Changelog

  • Tightened project and task row spacing, with equal spacing between a project and its first task and larger separation between projects.
  • Unified selected and hover styling, with status indicators and action buttons aligned on the right.
  • Click a project name to expand or collapse its task list.
  • Persisted project expand/collapse state per account on the current device.
  • Added project display-name renaming without renaming or moving the underlying folder.
  • Added rich status popovers for projects and tasks, showing project context, task counts, in-progress status, unread counts, and folder paths.
  • Middle-truncated long folder paths while retaining their beginning and ending segments.
  • Made folder paths in popovers open the project in the OS file browser.
  • Improved visibility of unread tasks with green indicators and project-level unread counts.
  • Shows an in-progress spinner or unread indicator on the sidebar button when the sidebar is closed.
  • Changed the Add Project icon to a folder with a plus.

Scope and behavior

This is a UI-focused Agent Mode change with one desktop capability update for the existing Tauri opener plugin and one new Radix UI dependency. It adds no Rust commands and does not change backend services, the Agent runtime, database schemas, or remote APIs. There are no intentional Chat Mode behavior changes; the shared tooltip primitive now portals its content, so its existing consumers remain part of regression review.

Project disclosure and naming

  • The folder icon and project name form one disclosure control. Activating it only expands or collapses that project's task list; it does not switch project context, create a task, or clear the active task.
  • Collapse state and project display-name overrides use versioned, account-scoped localStorage. Newly discovered projects default to expanded, malformed or stale data is ignored safely, and preferences remain local to the current device.
  • A renamed project is a Maple display-name override keyed by its canonical path. The underlying folder and native recent-project record are not renamed or moved.

Status popovers and folder paths

  • Non-compact fine-pointer project popovers show the display name, task and unread counts, in-progress count, and folder path.
  • Non-compact fine-pointer task popovers show the task title, project display name, in-progress state, and folder path.
  • Long POSIX, Windows, UNC, and extended-length Windows paths are shortened in the middle while preserving recognizable leading and trailing segments.
  • Clicking a popover path uses the existing Tauri opener plugin to reveal and select the exact project root in the OS file browser. Failures produce a non-destructive notification; no backend endpoint or new Rust command was added.
  • Popovers are hover-oriented desktop surfaces and are disabled on compact or coarse-pointer layouts. The project menu remains the keyboard-accessible route to open the folder.

Running and unread status

  • Running and unread task indicators move to the right edge. On non-compact fine-pointer layouts, the task action area replaces the indicator during hover or keyboard focus without shifting the title; compact or coarse-pointer layouts keep the larger controls visible.
  • Collapsed projects summarize running or unread work from their tasks.
  • When the sidebar is closed, its reopen button shows a running spinner while visible Agent work is running or pending; otherwise it shows an unread dot. Its accessible label reports both exact counts when both states exist.
  • A collapsed project row may show the existing transient loading spinner while a task is being selected. Project popover counts and the closed-sidebar aggregate count only actual or pending Agent runs rather than selection loading.
  • The existing Agent unread state remains transient React state. It is not stored in localStorage or Goose SQLite and resets when Agent Mode remounts or the app restarts. This PR improves its presentation and closes a race that could leave a newly selected task marked unread after an asynchronous load.

Code review focus

  • agentSidebarPreferences.ts: versioned account isolation, safe malformed-data handling, canonical-path identity, and no writes during startup projection.
  • AgentMode.tsx: disclosure versus drag/action event boundaries, status aggregation, unread clearing, and hover-card state across project/task selection.
  • AgentSidebarInfoCard.tsx and utils/path.ts: in-progress presentation, path shortening, exact-path accessibility text, and folder-action propagation.
  • agentSidebarPresentation.ts and Sidebar.tsx: count grammar, accessible labels, visible-session filtering, and running-over-unread visual priority.
  • ui/hover-card.tsx and ui/tooltip.tsx: portal layering, collision handling, dismissal, and regressions on other shared tooltip consumers.
  • agentProjectFolder.ts and the Tauri capability change: opener permission scope, exact path forwarding, and error handling.
  • Sidebar theme tokens and row states in both light and dark modes.

Manual QA

  • Verify project/task density and spacing in light and dark modes, including selected, unselected, hovered, focused, and open-menu rows.
  • Click the folder icon or project name to expand/collapse. Confirm the active task and project context do not change, action buttons do not toggle disclosure, and the last project responds immediately.
  • Reload after collapsing projects. Confirm state restores for the same account, a newly added project defaults to expanded, and signing out/remounting under another account does not inherit the preference.
  • Rename a project. Verify the dialog is prefilled, surrounding whitespace is trimmed, blank names are rejected, duplicate display names are allowed, the project row/composer selector/menus/dialogs/popovers update, and the filesystem folder name remains unchanged after reload.
  • Hover every project and task row on desktop. Verify project cards for zero/one/many tasks, unread tasks, and in-progress tasks; verify task cards for idle and in-progress states, project context, long titles, and long paths.
  • Click the folder path from both project and task popovers. Confirm the exact project root is revealed and selected in the OS file browser and the sidebar does not collapse or start a drag.
  • Verify a project whose directory name ends in whitespace forwards its exact canonical root when creating a task and opening its folder.
  • Verify idle, running, and unread task indicators. On hover/focus, confirm actions replace the indicator without moving the task title, then restore when interaction ends.
  • Collapse a project containing running or unread tasks, then close the sidebar. Verify status rolls up correctly and updates live; when running and unread coexist, running has visual priority while the accessible label reports both counts.
  • Complete a task while viewing another task, confirm it becomes unread, then open or restart it and confirm the task dot, project count/indicator, project popover count, and closed-sidebar unread indicator clear. Confirm failed/cancelled runs do not become unread and completion during task selection does not leave the selected task unread.
  • Verify a normal project click still toggles disclosure, deliberate dragging reorders, Escape cancels a drag, and edge dragging auto-scrolls without triggering project actions.
  • Traverse project/task actions by keyboard. Verify Enter/Space disclosure, menu operation, folder opening through the project menu, and that hover cards do not trap focus.
  • On compact fine-pointer and hybrid/coarse-pointer layouts, confirm actions remain visible and hover cards are suppressed.
  • With reduced motion enabled, confirm spinner/ping, hover-card, row-transition, and reorder animations are disabled while their static states remain visible.
  • Verify locked Agent controls preserve disclosure and status visibility while restricted actions remain disabled.
  • Verify the Add Project control uses the folder-plus icon and has an accessible label.
  • Confirm Chat Mode has no new status indicators or sidebar behavior changes.

Validation

  • Prettier check
  • Production frontend build
  • bun run typecheck
  • bun run lint — 0 errors; 13 existing warnings
  • bun test — 584 passed
  • git diff --check
  • Repository pre-commit hook reran formatting, production build, and the full test suite successfully

Fixes #738

@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying maple with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1d65c16
Status: ✅  Deploy successful!
Preview URL: https://b3a6bb11.maple-ca8.pages.dev
Branch Preview URL: https://codex-agent-mode-sidebar-map.maple-ca8.pages.dev

View logs

@marksftw

marksftw commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Independent code-review summary

I ran three independent read-only reviews of the latest local follow-up diff from different angles: functional/state correctness, simplicity and scope, and UI interaction/accessibility.

Scope note: the draft PR currently points to c937746. The hover-card, unread-count, and reconciliation changes reviewed below are still local and have not yet been committed or pushed.

Validated and fixed locally

  • Closed an unread-state race where a background task could finish during task selection and leave the newly active task incorrectly marked unread.
  • Pinned @radix-ui/react-hover-card to 1.1.15, aligning it with Maple's existing Radix dependency graph and reducing the lockfile delta from 87 lines to 3.
  • Removed redundant presentation helpers, six low-value tests, and feature-added source comments.
  • Kept focused coverage for middle path truncation, unread/task-count labels, and the Open Project Folder interaction.

Validated behavior

  • Project unread counts are derived only from that project's current tasks.
  • “In progress” uses actual active/pending Agent runs rather than transient task-selection loading.
  • Project and task hover-card state remains safe across drag, menu, resize, and touch-layout transitions.
  • Clicking a card's folder path reuses the existing Open Project Folder action and cannot toggle disclosure or begin a project drag.
  • Coarse/no-hover layouts bypass Hover Card triggers, preserving the larger persistent touch controls.
  • Portalled pointer events are isolated without disabling Radix's internal pointer tracking.
  • The exact unread clear at task-selection commit is correctly ordered for both sides of the completion race.

Accepted limitation

Radix Hover Card makes descendants non-tabbable, so the folder shortcut inside a card is pointer-only. The project menu retains the same keyboard-accessible Open Project Folder action. Replacing the primitive would be substantially more invasive for no functional gain.

Verification

  • bun test: 575 passed, 0 failed
  • Typecheck: passed
  • ESLint: passed
  • Production frontend build: passed
  • Unsigned macOS Maple.app build: passed
  • git diff --check: clean

No blocker remains in the reviewed local diff.

@marksftw

marksftw commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

I would request changes before merging PR #745.

Findings

  1. P2 — Canonical project paths are mutated before use.
    AgentMode.tsx lines 1656 and 1788 assign requestedProjectRoot.trim() and forward that value. A valid POSIX directory ending in whitespace can therefore fail to open or target a different sibling directory. This affects every explicit New Task control and cold-runtime composer sends.

    Use trim() only for blank validation, then forward the original path unchanged.

  2. P2 — Hybrid touchscreen desktops get hover-only controls.
    utils.ts line 92 checks only the primary pointer/hover. On a touchscreen laptop whose mouse or trackpad is primary, the secondary coarse pointer is missed. AgentMode.tsx line 220 then leaves actions hidden behind hover, uses 28px controls, and enables HoverCard wrappers during finger operation.

    Add (any-pointer: coarse) to the existing media query.

  3. P2 — I understand that the feature is implemented as desired and that GitHub issue Agent Mode sidebar behavior changes #738 is out of date; the fix is to update the issue.
    The current implementation intentionally differs from issue Agent Mode sidebar behavior changes #738:

    • Project actions provide New Task on every project rather than only the active project.
    • The task menu contains Delete Task, while folder access is provided through project menus and rich hover cards.
    • The PR adds project/task status cards and folder-path interactions beyond the issue’s original conditional overflow-tooltip scope.

    Update issue Agent Mode sidebar behavior changes #738 to reflect these accepted behaviors so its requirements and QA checklist match the PR. No code change is needed for this finding.

  4. P3 — Canonical Windows paths are truncated incorrectly.
    path.ts line 29 does not recognize Windows extended-length paths produced by the native canonicalization flow. For example, \\?\UNC\fileserver\engineering\… becomes \\?\UNC\…, losing the server and share.

    Display-normalize \\?\C:\ to C:\ and \\?\UNC\ to ordinary UNC syntax before truncation, while retaining the original path for accessibility and the opener call.

Reconciled assessment

The overall feature implementation is coherent and appropriately scoped to the desired behavior. The persistence, unread-race handling, aggregate status, folder opener permission, and failure handling look correct. I found no added code comments or clearly low-value tests worth removing.

The remaining code fixes are narrow:

  • Preserve exact project paths.
  • Detect secondary coarse pointers.
  • Normalize extended Windows paths for display only.

The documentation fix is to update issue #738 to match the implemented and desired interaction design.

Validation completed:

  • 575 tests passed
  • Typecheck passed
  • Lint passed with 13 existing warnings
  • Production build passed
  • git diff --check clean
  • All six GitHub workflows succeeded
  • Worktree remained clean

@marksftw

marksftw commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Addressed all four findings in 74eb3d3:

  1. Canonical project roots are now trimmed only for blank validation; the original path is forwarded unchanged to runtime/session calls.
  2. Pointer detection now includes (any-pointer: coarse), so hybrid touchscreen desktops use the persistent larger controls and suppress hover cards. Added focused regression coverage for the secondary coarse-pointer case.
  3. Updated Agent Mode sidebar behavior changes #738 to match the accepted behavior in this PR, including New Task availability, menu/folder behavior, rich status popovers, unread lifecycle, compact/hybrid layouts, and the revised QA matrix.
  4. Extended Windows drive and UNC prefixes are normalized for display before middle truncation, while the exact original path remains intact for accessibility and folder-opening calls. Added focused coverage for both path forms.

Also refreshed the PR description and QA notes to reflect these changes.

Validation after the fixes:

  • bun test: 578 passed, 0 failed
  • Typecheck passed
  • Lint passed with 0 errors and 13 existing warnings
  • Production frontend build passed
  • Prettier and git diff --check passed

The branch is pushed and the worktree is clean.

@marksftw

marksftw commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Performed manual QA on latest macOS build from the artifacts. Build is good.

  • Verify project/task density and spacing in light and dark modes, including selected, unselected, hovered, focused, and open-menu rows.
  • Click the folder icon or project name to expand/collapse. Confirm the active task and project context do not change, action buttons do not toggle disclosure, and the last project responds immediately.
  • Reload after collapsing projects. Confirm state restores for the same account, a newly added project defaults to expanded, and signing out/remounting under another account does not inherit the preference.
  • Rename a project. Verify the dialog is prefilled, surrounding whitespace is trimmed, blank names are rejected, duplicate display names are allowed, the project row/composer selector/menus/dialogs/popovers update, and the filesystem folder name remains unchanged after reload.
  • Hover every project and task row on desktop. Verify project cards for zero/one/many tasks, unread tasks, and in-progress tasks; verify task cards for idle and in-progress states, project context, long titles, and long paths.
  • Click the folder path from both project and task popovers. Confirm the exact project root is revealed and selected in the OS file browser and the sidebar does not collapse or start a drag.
  • Verify a project whose directory name ends in whitespace forwards its exact canonical root when creating a task and opening its folder.
  • Verify idle, running, and unread task indicators. On hover/focus, confirm actions replace the indicator without moving the task title, then restore when interaction ends.
  • Collapse a project containing running or unread tasks, then close the sidebar. Verify status rolls up correctly and updates live; when running and unread coexist, running has visual priority while the accessible label reports both counts.
  • Complete a task while viewing another task, confirm it becomes unread, then open or restart it and confirm the task dot, project count/indicator, project popover count, and closed-sidebar unread indicator clear. Confirm failed/cancelled runs do not become unread and completion during task selection does not leave the selected task unread.
  • Verify a normal project click still toggles disclosure, deliberate dragging reorders, Escape cancels a drag, and edge dragging auto-scrolls without triggering project actions.
  • Traverse project/task actions by keyboard. Verify Enter/Space disclosure, menu operation, folder opening through the project menu, and that hover cards do not trap focus.
  • With reduced motion enabled, confirm spinner/ping, hover-card, row-transition, and reorder animations are disabled while their static states remain visible.
  • Verify locked Agent controls preserve disclosure and status visibility while restricted actions remain disabled.
  • Verify the Add Project control uses the folder-plus icon and has an accessible label.
  • Confirm Chat Mode has no new status indicators or sidebar behavior changes.
  • (Not Tested, don't have a touch-screen laptop) On compact fine-pointer and hybrid/coarse-pointer layouts, confirm actions remain visible and hover cards are suppressed.

@marksftw
marksftw marked this pull request as ready for review August 9, 2026 18:36
@marksftw

marksftw commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

ready for review

@marksftw
marksftw force-pushed the codex-agent-mode-sidebar-maple branch from 74eb3d3 to 51382ce Compare August 9, 2026 18:42

@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.

Reviewed this closely and smoke-tested it pretty thoroughly. The sidebar changes feel clean, fluid, and well scoped, and I didn’t find any blockers or high-severity concerns.

The review surfaced a couple of medium-level edge cases around menu/drag interaction and temporary keyboard access during loading. Neither needs to hold this PR or necessarily be addressed here. I also looked at how local sidebar preferences behave after account deletion, but that seems like a product-behavior decision we should make deliberately rather than changing it as a presumed bug.

Nice work—approving.

@marksftw
marksftw force-pushed the codex-agent-mode-sidebar-maple branch from 51382ce to 1d65c16 Compare August 9, 2026 19:28
@marksftw
marksftw merged commit d6334e1 into master Aug 9, 2026
18 checks passed
@marksftw
marksftw deleted the codex-agent-mode-sidebar-maple branch August 9, 2026 19:32
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.

Agent Mode sidebar behavior changes

2 participants