Skip to content

fix(agents): sidebar scrollbar, pane-picker overlap, Global Assistant in drive spawn - #2294

Merged
2witstudios merged 3 commits into
masterfrom
pu/agents-ui
Jul 31, 2026
Merged

2witstudios merged 3 commits into
masterfrom
pu/agents-ui

Conversation

@2witstudios

@2witstudios 2witstudios commented Jul 31, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Hide the Agents sidebar's session-list scrollbar entirely (new .scrollbar-none utility) instead of the Radix ScrollArea's always-visible overlay bar, which collided with row "+" buttons.
  • Fix PanePicker's split-pane overlap: its sub-list wrappers used min-h-0 on non-scrolling flex boxes, letting a short pane crush them while their shrink-0 buttons refused to shrink — pushing "Global Assistant" past its box and stealing clicks from "Agents" below. Switched to shrink-0.
  • Offer Global Assistant as the first pick in a drive's "+" spawn palette, landing the new session under that drive (loosened the session-spawn validation gate, which previously only allowed a driveless assistant spawn even though drive-scoped assistant conversations were already supported everywhere else — via the pane picker and the access/conversation layers).
  • Default naming: "Assistant" → "Global Assistant" for the auto-named session label, the naming-step placeholder, and the expanded-conversation fallback.
  • (Review follow-up) Thread the session's own driveId into the Global Assistant's chat request context instead of deriving it from the pathname. Turned out agents isn't a route buildContextRef/tab-title.ts recognizes as drive-scoped at all, so a Global Assistant conversation inside an agent session never got its drive's prompt/page-tree scope from any entry point (pre-existing, not introduced by this PR, but the new spawn-palette path made it reachable in one more way). See the review thread for detail.
  • Added a CHANGELOG.md entry (manual, matching this repo's convention — the changelog:generate script is known-stale).

Test plan

  • bun run typecheck (apps/web) — clean
  • route.test.ts — 34/34 passing, including new tests for the drive-scoped assistant spawn and the narrowed validation gate
  • AgentsSidebar.test.tsx — 48/48 passing, including a new test for picking Global Assistant from a drive's "+"
  • PanePicker.test.tsx, AgentPanes.test.tsx, SessionPanes.test.tsx — 65/65 passing
  • useAssistantSessionChat.test.ts (new) — covers the driveId-override and the driveless fallback
  • bun run test:unit (full monorepo lib + web suite) — 15502/15503 passing; the 1 failure (grouping.test.ts midnight-boundary case) is a pre-existing, unrelated TZ-environment flake (fails under local CDT, passes under UTC), not touched by this PR
  • bun run test:security — 44/50 suites passing; the 6 failures match this repo's known pre-existing baseline (deleted Login/Signup/Mobile-Login routes, excluded Session Service/Device Auth/Permissions suites) — confirmed identical failure set, nothing new
  • bun run lint (repo-wide build+lint) — clean
  • Verified no merge conflicts / branch fully up to date with master
  • Manual: confirm no scrollbar renders on /dashboard/agents's left sidebar, at rest or on hover
  • Manual: split a pane and confirm "Global Assistant" is clickable and doesn't collide with "Agents"
  • Manual: click "+" on a drive, pick Global Assistant, confirm the new session lands under that drive
  • Manual: from the global /dashboard/agents view, spawn Global Assistant for a specific drive and confirm the assistant has that drive's context (page tree / system prompt)

🤖 Generated with Claude Code

https://claude.ai/code/session_01MMC7fGVwuwyD7NChEaQobP

Summary by CodeRabbit

  • New Features

    • Start Global Assistant sessions scoped to a specific drive.
    • Global Assistant now uses the associated drive for conversation context.
    • Global sessions are named “Global Assistant” by default.
  • Bug Fixes

    • Improved pane picker spacing so options remain accessible in smaller panes.
    • Hidden scrollbars in the Agents session list while preserving scrolling.
    • Fixed drive context when viewing a session from a different drive.

… in drive spawn

- Hide the Agents sidebar's session-list scrollbar entirely (new
  .scrollbar-none utility) instead of the Radix ScrollArea's always-visible
  overlay bar, which collided with row "+" buttons.
- Fix PanePicker's split-pane overlap: its sub-list wrappers used min-h-0 on
  non-scrolling flex boxes, letting a short pane crush them while their
  shrink-0 buttons refused to shrink — pushing "Global Assistant" past its
  box and stealing clicks from "Agents" below. Switched to shrink-0.
- Offer Global Assistant as the first pick in a drive's "+" spawn palette,
  landing the new session under that drive (loosened the session-spawn
  validation gate, which previously only allowed a driveless assistant
  spawn even though drive-scoped assistant conversations were already
  supported everywhere else).
- Default naming: "Assistant" -> "Global Assistant" for the auto-named
  session label, the naming-step placeholder, and the expanded-conversation
  fallback.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMC7fGVwuwyD7NChEaQobP
@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7d434052-2bb4-4937-a794-985c5e9dc3a9

📥 Commits

Reviewing files that changed from the base of the PR and between c29af61 and 6c53223.

📒 Files selected for processing (12)
  • CHANGELOG.md
  • apps/web/src/app/api/agent-sessions/__tests__/route.test.ts
  • apps/web/src/app/api/agent-sessions/route.ts
  • apps/web/src/app/globals.css
  • apps/web/src/components/agents/chat/AssistantSessionChat.tsx
  • apps/web/src/components/agents/chat/__tests__/useAssistantSessionChat.test.ts
  • apps/web/src/components/agents/chat/useAssistantSessionChat.ts
  • apps/web/src/components/agents/panes/AgentPanes.tsx
  • apps/web/src/components/agents/panes/PaneChat.tsx
  • apps/web/src/components/agents/panes/PanePicker.tsx
  • apps/web/src/components/layout/left-sidebar/AgentsSidebar.tsx
  • apps/web/src/components/layout/left-sidebar/__tests__/AgentsSidebar.test.tsx

📝 Walkthrough

Walkthrough

The API now supports drive-scoped Global Assistant sessions. The Agents UI exposes these sessions, propagates their drive context to chat requests, updates naming, preserves pane-picker sizing, and hides session-list scrollbars.

Changes

Global Assistant sessions

Layer / File(s) Summary
Drive-only session API
apps/web/src/app/api/agent-sessions/route.ts, apps/web/src/app/api/agent-sessions/__tests__/route.test.ts
The POST route accepts drive-only sessions, rejects agent-only requests, creates a null-agent assistant conversation, and names unnamed global sessions “Global Assistant”.
Global Assistant spawn palette
apps/web/src/components/layout/left-sidebar/AgentsSidebar.tsx, apps/web/src/components/layout/left-sidebar/__tests__/AgentsSidebar.test.tsx
The sidebar exposes Global Assistant as a spawn target and passes the selected drive without an agent. Labels and test expectations use “Global Assistant”.
Session drive context propagation
apps/web/src/components/agents/panes/AgentPanes.tsx, apps/web/src/components/agents/panes/PaneChat.tsx, apps/web/src/components/agents/chat/AssistantSessionChat.tsx, apps/web/src/components/agents/chat/useAssistantSessionChat.ts, apps/web/src/components/agents/chat/__tests__/useAssistantSessionChat.test.ts
Global Assistant chat uses the session driveId when available and falls back to pathname-derived context for driveless sessions.
Agents pane layout and scrolling
apps/web/src/components/agents/panes/PanePicker.tsx, apps/web/src/components/layout/left-sidebar/AgentsSidebar.tsx, apps/web/src/app/globals.css, CHANGELOG.md
Pane-picker sub-lists retain button height. The session list uses native scrolling. The scrollbar-none utility hides scrollbar rendering while preserving scrolling.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant AgentsSidebar
  participant AgentSessionsRoute
  participant GlobalAssistantChat
  participant useAssistantSessionChat
  User->>AgentsSidebar: select Global Assistant for a drive
  AgentsSidebar->>AgentSessionsRoute: create session with driveId and null agentId
  AgentSessionsRoute-->>AgentsSidebar: return created session
  AgentsSidebar->>GlobalAssistantChat: open session with driveId
  GlobalAssistantChat->>useAssistantSessionChat: send conversation message
  useAssistantSessionChat->>useAssistantSessionChat: use session drive context
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 summarizes the Agents UI fixes and drive-scoped Global Assistant spawning implemented in the pull request.
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
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pu/agents-ui

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

@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: bf68715e85

ℹ️ 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 +831 to +834
<CommandItem
value="assistant-Global Assistant"
disabled={spawning}
onSelect={() => onPickTarget({ kind: 'assistant', agentPageId: null, label: 'Global Assistant' })}

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 Pass the selected drive into the assistant chat context

When a user opens a drive's + from the global /dashboard/agents view and chooses this new item, the session is stored under that drive, but useAssistantSessionChat derives contextRef solely from the unchanged pathname via buildContextRef. That route provides no selected-session drive context, so the global assistant receives no current drive, omits its drive prompt and page-tree scope, and can resolve instructions such as “create this here” against the wrong workspace or no workspace at all. Thread the spawned session's driveId into the assistant request context rather than relying on the console URL.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Confirmed and fixed in 92b52a8. The gap was actually bigger than described: agents isn't in tab-title.ts's DRIVE_SPECIAL_ROUTES at all, so buildContextRef has never resolved a drive for any Global Assistant conversation inside an agent session (drive-scoped or global) reached from the Agents console — this predates this PR and also affects the pre-existing split-pane-picker path, not just the new spawn-palette entry point.

Fix: threaded the session's own driveId (already available on AgentPanes) through PaneChat -> AssistantSessionChat -> useAssistantSessionChat, and use it directly ({ routeType: drive, driveId }) instead of parsing the pathname whenever the session has a drive. A driveless global-assistant session keeps the pathname-derived context (unaffected — there's no session driveId to prefer there). Added useAssistantSessionChat.test.ts covering both the override and the fallback. Left useAgentSessionChat untouched: an agent conversation's drive is already anchored server-side via its agentPageId regardless of contextRef, so the same pathname imprecision there only affects incidental "this page" references, not core drive scoping — a smaller, separate, pre-existing concern I left out of scope for this PR.

Leaving this thread open for verification rather than resolving it myself.

2witstudios and others added 2 commits July 31, 2026 12:08
…xtRef

Review feedback on #2294 (chatgpt-codex-connector): when Global Assistant
is spawned for a drive from the global /dashboard/agents view, the session
correctly gets that driveId, but the chat itself derived its drive context
from the current pathname (buildContextRef), which never carries a drive
for that route.

Turns out the gap is bigger than the specific report: `agents` isn't in
tab-title.ts's DRIVE_SPECIAL_ROUTES at all, so pathname-based context has
never worked for a Global Assistant conversation in ANY agent session,
drive-scoped or global — this predates this PR and affects the existing
split-pane picker path too, not just the new spawn-palette entry point.

Fix: thread the session's own driveId (AgentPanes already has it) through
PaneChat -> AssistantSessionChat -> useAssistantSessionChat, and use it
directly ({ routeType: 'drive', driveId }) instead of parsing the pathname
whenever the session has a drive. A driveless global-assistant session
(driveId null) keeps the pathname-derived context — that path had nothing
to override with and is unaffected.

Not touched: useAgentSessionChat has the identical pathname pattern, but
an agent conversation's drive is already anchored server-side via its
agentPageId regardless of contextRef, so pathname imprecision there only
affects incidental "this page" references, not core drive scoping — a
materially smaller, pre-existing, separate concern left out of scope here.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMC7fGVwuwyD7NChEaQobP
…e spawn

Matches this repo's convention of manual user-facing changelog entries per
notable fix/feature (the automated changelog:generate script is known-stale,
per prior review — entries here are hand-written like recent precedent,
e.g. d8f882e, ebddd23, 5463797).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMC7fGVwuwyD7NChEaQobP
@2witstudios

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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