Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(app): carry the deep link across both hops of the /webhooks redirect\n\n`/webhooks?tab=inbound#delivery-3` arrived at a bare `/connections`.\n\nThe two-hop path is intended and unchanged — the Integrations settings section\nwas retired and the OAuth grid moved to Connections:\n\n /webhooks -> /settings/integrations AppRoutes.tsx:243\n /settings/integrations -> /connections settingsRouteElements.tsx:129\n\nBOTH hops used a bare `<Navigate>`, which discards `search` and `hash`. Fixing\nonly the first would not have fixed the bug: the fragment would have reached\n`/settings/integrations` and been dropped by the second. The issue names only\nthe first hop; the second is the same defect at the sibling call site.\n\nReuses `ForwardSearch` from #5924 rather than inventing a second mechanism. It\nwas local to `AppRoutes.tsx` and the settings route table cannot import from\nthere — `AppRoutes` -> `Settings` -> `settingsRouteElements` already, so that\nimport would be circular — so it is lifted to\n`components/routing/ForwardSearch.tsx` unchanged and both call sites use it.\n\nDeliberately NOT applied to every other bare `<Navigate>` redirect. Where the\ndestination already carries a query — `/channels` -> `/connections?tab=messaging`\n— appending the incoming `search` yields a second `?` and a malformed URL. Those\nneed a merge, not a concatenation, and that is a different change. The new\ncomponent's doc comment says so.\n\n`useLocation` is dropped from the `AppRoutes.tsx` import: moving `ForwardSearch`\nout left it with no remaining use, which would fail `tsc` under `noUnusedLocals`.\n\nTests: `AppRoutes.webhooks.test.tsx`, mirroring `AppRoutes.skills.test.tsx` from\n#5924. They assert the END of the chain, so they fail if either hop regresses,\nand one drives `/settings/integrations` directly because that hop is reachable\non its own. Also covers the other direction — no stray `?` or `#` when the\nsource URL carries neither.\n\nVerified by reading AppRoutes.tsx:243, settingsRouteElements.tsx:129 and the\nexisting route-classifier tests (AppRoutes.redirects.test.tsx:133,\nAppRoutes.guards.test.tsx:227 already match `<ForwardSearch` as a redirect, so\nthis change does not disturb them). NOT EXECUTED — local test runs are\nforbidden by standing rule; CI is the check.\n

M3gA-Mind2e0f39dcc49a
diff --git a/app/src/AppRoutes.tsx b/app/src/AppRoutes.tsx
index 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 route
table renders inside `SettingsLayout`, which projects the settings nav
diff --git a/app/src/AppRoutes.webhooks.test.tsx b/app/src/AppRoutes.webhooks.test.tsx
new file mode 100644
index 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.tsx
new file mode 100644
index 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.tsx
index 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 grid
lives 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 ──────────────────────────────────────────────── */}