Skip to content

feat(nav): first-class navigation behind the nav_v2 org flag - #6117

Open
rafavalls wants to merge 11 commits into
mainfrom
rafavalls/first-class-agent-nav
Open

feat(nav): first-class navigation behind the nav_v2 org flag#6117
rafavalls wants to merge 11 commits into
mainfrom
rafavalls/first-class-agent-nav

Conversation

@rafavalls

@rafavalls rafavalls commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

What is this contribution about?

Behind a new nav_v2 org flag, the sidebar becomes a destination list (Home · Reports · Tasks · Library, plus one row per GitHub-backed coding agent, labelled by repo) instead of a chat list, and the chat list moves into a titled dropdown at the top of the chat panel. Reports only appears once the org actually has a Commerce Discovery report and opens that report's MCP app in place. Home / Automations / Settings leave the top tab bar (the latter two already live under Settings), each panel gains an explicit collapse control, and the agent switcher is gone since this navigation is single-teammate. The flag defaults on for reports_only orgs — an explicit nav_v2: false still wins — and the flag-off layout is byte-for-byte untouched.

How did you verify your code works?

Added packages/e2e/tests/nav-v2.spec.ts (3 specs, all passing): flag-off keeps the chat list in the sidebar; flag-on shows the destinations, routes them to ?main=files|board|overview, asserts Overview/Automations left the top bar and no agent is named anywhere, and round-trips both collapse controls through ?sidepanel=0 / ?main=0; and a third spec stands up a stub Commerce Discovery MCP to prove Reports is absent before the connection exists and present + opening ?main=…get_my_diagnostic after. bun run check, bun run lint (0 errors), bun run fmt:check and knip are clean; bun test is unchanged against the pre-branch baseline (107 pre-existing jsdom failures before and after, verified via git stash). Also driven manually in Chromium end-to-end against a local stub report.

Screenshots/Demonstration

Sidebar: Home · Reports · Tasks · Library with the collapse trigger beside the org selector; chat header: threads dropdown showing the current thread title, |← collapse-chat at the start of the main header and the right-panel toggle at its end.

How to Test

  1. Open Settings → General → Navigation and switch on First-class navigation (already on for reports-only orgs).
  2. Return to /$org — the sidebar now lists destinations; click each and confirm the URL moves to ?main=overview|board|files with the row highlighted.
  3. Open the threads dropdown at the top of the chat, pick a thread, and confirm the trigger shows its title truncated.
  4. Use the |← and right-panel icons to collapse/restore each panel; neither can hide both.
  5. Reports appears only for an org with a Commerce Discovery report; import a GitHub repo and confirm it appears below Library by repo name.

Migration Notes

No DB migration. nav_v2 is a new key in the existing organization_settings.flags jsonb bag (OrgFlagsSchema); tool contracts were regenerated. Nothing is enabled for existing non-reports orgs until the flag is set.

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • Documentation is updated (if needed)
  • No breaking changes

🤖 Generated with Claude Code


Summary by cubic

Introduces first-class navigation behind the nav_v2 org flag. Old: sidebar showed chats and the top bar carried Overview/Automations/Settings; New: the sidebar lists destinations (Home, Reports, Tasks, Library) plus GitHub-backed coding agents, the chat list moves to a Threads menu in the chat header, panels are full-height cards with paired collapse toggles, and under nav_v2 the main panel’s controls no longer relocate into the chat header.

  • Sidebar and routing: destination clicks set ?main=overview|board|files (Reports opens its MCP app by pinned tab id). Opening a destination from a coding agent’s thread returns to the Super Agent via setTaskId/createNewTask and preserves search params; an absent ?main highlights Home only on the Super Agent.

  • Threads: moved to a titled menu (ThreadsMenu) in the chat header with search and View/Type/Scope filters; shared state and actions are consolidated in useThreadsPanel. The classic sidebar thread list is unchanged when the flag is off.

  • Layout and controls: both columns render as full-height cards with in-card headers; new collapse buttons (“Hide/Show chat/panel”) sit at opposite ends of the headers and sync with ?sidepanel=0|chat and ?main=0. Overview/Automations/Settings are removed from the top bar (Library/Tasks overlay tabs are hidden under nav_v2). No agent switcher under the single‑teammate navigation.

  • Settings and copy: add an org-level switch at Settings → General → Navigation; includes a dedicated error toast key. E2E coverage in packages/e2e/tests/nav-v2.spec.ts validates flag behavior, Reports visibility/opening, reports_only precedence, and Super Agent handoff.

  • Rollout

    • No DB migration. Add nav_v2 to OrgFlagsSchema; update @decocms/shared tool IO.
    • Default: on for reports_only orgs; set nav_v2: false to force off. Others opt in via Settings → General → Navigation.
    • “Reports” appears only after connecting Commerce Discovery.

Written for commit 242adcc. Summary will update on new commits.

Review in cubic

The sidebar becomes a destination list (Home, Reports, Tasks, Library, plus
one row per GitHub-backed coding agent) instead of a chat list, and the chat
list moves into a titled dropdown at the top of the chat panel. Reports only
appears once the org actually has a Commerce Discovery report, and opens that
report's MCP app in place.

Home, Automations and Settings leave the top tab bar (Settings owns the latter
two); each panel gains an explicit collapse control. The navigation is
single-teammate, so the agent switcher is gone from the shell.

Defaults on for reports_only orgs; an explicit nav_v2:false still wins. The
flag-off layout is untouched.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the claude PR authored by a coding agent label Aug 14, 2026
rafavalls and others added 10 commits August 14, 2026 16:37
Home / Reports / Tasks / Library only set `?main=`, so opening one from a
coding agent's thread left `virtualmcpid` on that agent: the panel showed the
destination while the header kept the agent's Preview / Publish controls, and
both sidebar rows highlighted at once. They now hand back to the Super Agent,
reusing its empty "New chat" when there is one.

Also stabilises nav-v2.spec.ts under load: the sidebar helper retries with a
reload (ORGANIZATION_SETTINGS_GET degrades to empty flags on a failed read,
which renders the flag-off sidebar), and the timeouts allow for cold-Vite
route compiles across the three lazy routes this spec crosses.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
An absent `?main=` was always read as Home, but only the Super Agent defaults
to Overview — a coding agent's thread has no `main` because its default view is
Preview, so both Home and the agent's own row highlighted at once. An absent
`main` now means Home only on the Super Agent; anywhere else no destination is
active, which is the truth.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… thread-panel wiring

Opening an org destination from a coding agent's thread now reuses the same
setTaskId/createNewTask path as every other thread switch instead of a
hand-built navigate() call that dropped search params and skipped
resolveTaskSwitchSearch. Also folds the search-dialog state and the
MyThreadsSection prop-plumbing (duplicated across the sidebar list and the
chat panel's threads menu) into useThreadsPanel, and adds e2e coverage for
the reports_only/nav_v2 flag precedence and the destination-from-other-agent
fix, none of which had a test before.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…-agent-nav

# Conflicts:
#	apps/web/src/hooks/use-organization-settings.ts
…card

Both columns were a top bar on the sidebar background plus a card below it, so
the cards started ~48px down and the two edges read differently. Under the
first-class navigation each panel is now a single full-height card that owns
its own header, giving chat and main an identical surface.

Scoped to nav_v2 via PanelCard's `headerInside`; the flag-off layout keeps the
header-above-card shape exactly as before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Rows were 32px tall on a 6px gap; drop to 4px (the SidebarMenu default) and
scale the coding-agents separator to match.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
SidebarMenuButton only hides its tooltip on mobile, so an expanded row showed a
tooltip repeating the label already next to the icon. Pass it only for the
collapsed icon rail, where it is the sole label.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The panel group had pb-1 but pt-0, so the full-height cards sat flush against
the top edge while leaving 4px below.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
View tabs, branch selector and publish relocated into the chat header whenever
the main panel was closed. They belong to the main panel, and the chat header's
right-panel toggle already reopens it, so under the first-class navigation they
just go away instead. The classic layout keeps the relocation — it has no other
way back to the views.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
navigation-settings borrowed the review section's toast copy; give it its own
key. workspace-panel-group's header comment only described the classic layout,
which no longer matches the first-class navigation's full-height cards.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude PR authored by a coding agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant