The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(app): carry the deep link across both hops of the /webhooks redirect
M3gA-Mindd1928d378c4e
diff --git a/app/src/AppRoutes.tsx b/app/src/AppRoutes.tsxindex 5160284a21..a225414d56 100644--- a/app/src/AppRoutes.tsx+++ b/app/src/AppRoutes.tsx@@ -1,9 +1,10 @@-import { type Location, Navigate, Route, Routes, useLocation } from 'react-router-dom';+import { type Location, Navigate, Route, Routes } from 'react-router-dom';import AppRoutesIOS from './AppRoutesIOS';import DefaultRedirect from './components/DefaultRedirect';import ProtectedRoute from './components/ProtectedRoute';import PublicRoute from './components/PublicRoute';+import ForwardSearch from './components/routing/ForwardSearch';import HumanPage from './features/human/HumanPage';import { getIsMobile } from './lib/platform';import Accounts from './pages/Accounts';@@ -25,11 +26,6 @@ import WebCallbackPage from './pages/WebCallbackPage';import Welcome from './pages/Welcome';import WorkflowsRun from './pages/WorkflowsRun';-function ForwardSearch({ to }: { to: string }) {- const { search, hash } = useLocation();- return <Navigate to={`${to}${search}${hash}`} replace />;-}-interface AppRoutesProps {/*** Optional location override. Nothing passes one today — the router uses the@@ -240,7 +236,7 @@ const AppRoutes = ({ location }: AppRoutesProps = {}) => {/>{/* Webhooks retired from the UI — land on the Integrations settings. */}- <Route path="/webhooks" element={<Navigate to="/settings/integrations" replace />} />+ <Route path="/webhooks" element={<ForwardSearch to="/settings/integrations" />} />{/* Settings is a routed page like every other surface: the shared routetable renders inside `SettingsLayout`, which projects the settings navdiff --git a/app/src/AppRoutes.webhooks.test.tsx b/app/src/AppRoutes.webhooks.test.tsxnew file mode 100644index 0000000000..23489a9aac--- /dev/null+++ b/app/src/AppRoutes.webhooks.test.tsx@@ -0,0 +1,147 @@+import { render } from '@testing-library/react';+import type React from 'react';+import { MemoryRouter, useLocation } from 'react-router-dom';+import { describe, expect, it, vi } from 'vitest';++vi.mock('./lib/platform', () => ({ getIsMobile: () => false }));++vi.mock('./components/PublicRoute', () => ({+ default: ({ children }: { children: React.ReactNode }) => <>{children}</>,+}));+vi.mock('./components/ProtectedRoute', () => ({+ default: ({ children }: { children: React.ReactNode }) => <>{children}</>,+}));+vi.mock('./components/DefaultRedirect', () => ({+ default: () => <div data-testid="default-redirect" />,+}));++vi.mock('./pages/WebCallbackPage', () => ({+ default: ({ callbackKind }: { callbackKind?: string }) => (+ <div data-testid="web-callback">{callbackKind ?? 'route-param'}</div>+ ),+}));++vi.mock('./AppRoutesIOS', () => ({ default: () => <div /> }));+vi.mock('./features/human/HumanPage', () => ({ default: () => <div /> }));+vi.mock('./pages/Accounts', () => ({ default: () => <div /> }));+vi.mock('./pages/Brain', () => ({ default: () => <div /> }));+vi.mock('./pages/dev/AgentInsightsPreview', () => ({ default: () => <div /> }));+vi.mock('./pages/dev/UiGallery', () => ({ default: () => <div /> }));+vi.mock('./pages/Invites', () => ({ default: () => <div /> }));+vi.mock('./pages/Notifications', () => ({ default: () => <div /> }));+vi.mock('./pages/onboarding/Onboarding', () => ({ default: () => <div /> }));+vi.mock('./pages/PttOverlayPage', () => ({ PttOverlayPage: () => <div /> }));+vi.mock('./pages/Rewards', () => ({ default: () => <div /> }));+vi.mock('./pages/Settings', () => ({ default: () => <div data-testid="settings-page" /> }));+vi.mock('./pages/Skills', () => ({ default: () => <div data-testid="skills-page" /> }));+vi.mock('./pages/Welcome', () => ({ default: () => <div /> }));+vi.mock('./pages/WorkflowsRun', () => ({ default: () => <div /> }));++// Reads the ambient router location and passes it to a callback. Rendered as a+// sibling of AppRoutes so it sees the settled location after any Navigate fires.+function LocationSpy({+ onCapture,+}: {+ onCapture: (loc: { pathname: string; search: string; hash: string }) => void;+}) {+ const { pathname, search, hash } = useLocation();+ onCapture({ pathname, search, hash });+ return null;+}++const AppRoutes = (await import('./AppRoutes')).default;++/**+ * `/webhooks` is a TWO-HOP redirect and the deep link has to survive both.+ *+ * /webhooks -> /settings/integrations (AppRoutes.tsx)+ * /settings/integrations -> /connections (settingsRouteElements.tsx)+ *+ * The two hops are intended — the Integrations settings section was retired and+ * the OAuth grid moved to Connections. What was not intended is that both hops+ * used a bare `<Navigate>`, which discards `search` and `hash`, so+ * `/webhooks?tab=inbound#delivery-3` arrived at a bare `/connections`.+ *+ * Fixing only the first hop would not have been enough: the fragment would have+ * reached `/settings/integrations` and been dropped by the second. These tests+ * assert the end of the chain, so they fail if EITHER hop regresses.+ */+describe('/webhooks two-hop back-compat redirect', () => {+ it('lands on /connections', () => {+ const loc = { pathname: '', search: '', hash: '' };+ render(+ <MemoryRouter initialEntries={['/webhooks']}>+ <AppRoutes />+ <LocationSpy onCapture={l => Object.assign(loc, l)} />+ </MemoryRouter>+ );+ expect(loc.pathname).toBe('/connections');+ });++ it('carries a query string across both hops', () => {+ const loc = { pathname: '', search: '', hash: '' };+ render(+ <MemoryRouter initialEntries={['/webhooks?tab=inbound']}>+ <AppRoutes />+ <LocationSpy onCapture={l => Object.assign(loc, l)} />+ </MemoryRouter>+ );+ expect(loc.pathname).toBe('/connections');+ expect(loc.search).toBe('?tab=inbound');+ });++ it('carries a hash fragment across both hops', () => {+ // The reported defect (#5908). A bare `<Navigate>` on either hop loses this.+ const loc = { pathname: '', search: '', hash: '' };+ render(+ <MemoryRouter initialEntries={['/webhooks#delivery-3']}>+ <AppRoutes />+ <LocationSpy onCapture={l => Object.assign(loc, l)} />+ </MemoryRouter>+ );+ expect(loc.pathname).toBe('/connections');+ expect(loc.hash).toBe('#delivery-3');+ });++ it('carries a query string and a fragment together', () => {+ const loc = { pathname: '', search: '', hash: '' };+ render(+ <MemoryRouter initialEntries={['/webhooks?tab=inbound#delivery-3']}>+ <AppRoutes />+ <LocationSpy onCapture={l => Object.assign(loc, l)} />+ </MemoryRouter>+ );+ expect(loc.pathname).toBe('/connections');+ expect(loc.search).toBe('?tab=inbound');+ expect(loc.hash).toBe('#delivery-3');+ });++ it('produces an empty search and hash when /webhooks carries neither', () => {+ // Guards the other direction: forwarding must not invent a stray `?` or `#`.+ const loc = { pathname: '', search: '(init)', hash: '(init)' };+ render(+ <MemoryRouter initialEntries={['/webhooks']}>+ <AppRoutes />+ <LocationSpy onCapture={l => Object.assign(loc, l)} />+ </MemoryRouter>+ );+ expect(loc.pathname).toBe('/connections');+ expect(loc.search).toBe('');+ expect(loc.hash).toBe('');+ });++ it('forwards the deep link when /settings/integrations is entered directly', () => {+ // The second hop is reachable on its own, not only via /webhooks — anyone+ // holding an old Integrations settings link hits it.+ const loc = { pathname: '', search: '', hash: '' };+ render(+ <MemoryRouter initialEntries={['/settings/integrations?tab=inbound#delivery-3']}>+ <AppRoutes />+ <LocationSpy onCapture={l => Object.assign(loc, l)} />+ </MemoryRouter>+ );+ expect(loc.pathname).toBe('/connections');+ expect(loc.search).toBe('?tab=inbound');+ expect(loc.hash).toBe('#delivery-3');+ });+});diff --git a/app/src/components/routing/ForwardSearch.tsx b/app/src/components/routing/ForwardSearch.tsxnew file mode 100644index 0000000000..46ccf04664--- /dev/null+++ b/app/src/components/routing/ForwardSearch.tsx@@ -0,0 +1,24 @@+import { Navigate, useLocation } from 'react-router-dom';++/**+ * A back-compat redirect that carries the deep link with it.+ *+ * `<Navigate to="/x" />` discards the current `search` and `hash`, so a link+ * like `/webhooks?tab=inbound#delivery-3` lands on a bare destination and the+ * user loses the thing they followed the link for. This copies both onto the+ * target instead.+ *+ * Introduced for `/skills` in #5924 and lifted out of `AppRoutes.tsx` here so+ * the settings route table can use the same mechanism. It cannot simply import+ * from `AppRoutes.tsx`: `AppRoutes` → `Settings` → `settingsRouteElements`+ * already, so that import would be circular.+ *+ * Use it for a redirect whose destination takes NO query of its own. Where the+ * target already carries one — `/channels` → `/connections?tab=messaging` —+ * appending the incoming `search` would produce a second `?` and a malformed+ * URL, so those need a merge rather than a concatenation.+ */+export default function ForwardSearch({ to }: { to: string }) {+ const { search, hash } = useLocation();+ return <Navigate to={`${to}${search}${hash}`} replace />;+}diff --git a/app/src/components/settings/settingsRouteElements.tsx b/app/src/components/settings/settingsRouteElements.tsxindex 6fcedaa1b9..d0b546b4cb 100644--- a/app/src/components/settings/settingsRouteElements.tsx+++ b/app/src/components/settings/settingsRouteElements.tsx@@ -1,6 +1,7 @@import type { ReactNode } from 'react';import { Navigate, Route } from 'react-router-dom';+import ForwardSearch from '../routing/ForwardSearch';import SettingsIndexRedirect from './layout/SettingsIndexRedirect';import AboutPanel from './panels/AboutPanel';import AccountPanel from './panels/AccountPanel';@@ -126,7 +127,7 @@ export function settingsRouteElements(): ReactNode {{/* ── Connections ─────────────────────────────────────────── */}{/* The Integrations settings section was retired; the composio/OAuth gridlives on the Connections page. */}- <Route path="integrations" element={<Navigate to="/connections" replace />} />+ <Route path="integrations" element={<ForwardSearch to="/connections" />} /><Route path="tools" element={wrapSettingsPage(<ToolsPanel />)} />{/* ── System ──────────────────────────────────────────────── */}