Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions apps/server/src/client/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BrowserRouter, Route, Routes } from "react-router-dom"
import { BrowserRouter, Navigate, Route, Routes, useLocation } from "react-router-dom"
import ContainerDetailPage from "@/client/pages/container-detail"
import DashboardPage from "@/client/pages/dashboard"
import EventDetailPage from "@/client/pages/event-detail"
Expand Down Expand Up @@ -26,9 +26,10 @@ function App() {
<Route index element={<DashboardPage />} />
<Route path="events" element={<EventsPage />} />
<Route path="events/:id" element={<EventDetailPage />} />
<Route path="containers" element={<SessionsPage />} />
<Route path="containers/detail" element={<ContainerDetailPage />} />
<Route path="containers/:entityKey" element={<ContainerDetailPage />} />
<Route path="runs" element={<SessionsPage />} />
<Route path="runs/detail" element={<ContainerDetailPage />} />
<Route path="runs/:entityKey" element={<ContainerDetailPage />} />
<Route path="containers/*" element={<ContainersRedirect />} />
<Route path="*" element={<NotFoundPage />} />
</Route>
</Routes>
Expand All @@ -37,4 +38,11 @@ function App() {
)
}

// Redirect legacy /containers/* URLs (bookmarks, shared links) to /runs/*.
function ContainersRedirect() {
const location = useLocation()
const target = location.pathname.replace(/^\/containers/, "/runs")
return <Navigate to={`${target}${location.search}${location.hash}`} replace />
}

export default App
2 changes: 1 addition & 1 deletion apps/server/src/client/pages/container-detail.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function renderRun(messages: SessionMessage[], extra: Partial<SessionDetailRespo
{ client },
createElement(
MemoryRouter,
{ initialEntries: ["/containers/detail?key=acme%2Fapp%2342"] },
{ initialEntries: ["/runs/detail?key=acme%2Fapp%2342"] },
createElement(ContainerDetailPage),
),
),
Expand Down
10 changes: 5 additions & 5 deletions apps/server/src/client/pages/container-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -803,8 +803,8 @@ function SessionSidebarItem({
export default function ContainerDetailPage() {
const { entityKey: rawKey } = useParams<{ entityKey: string }>()
const [searchParams] = useSearchParams()
// Prefer the query-param form (/containers/detail?key=...) which is refresh-safe;
// the path-param form (/containers/:entityKey) breaks on reload because the
// Prefer the query-param form (/runs/detail?key=...) which is refresh-safe;
// the path-param form (/runs/:entityKey) breaks on reload because the
// encoded slash (%2F) in the entity key isn't matched by SPA asset fallback.
const entityKey = searchParams.get("key") ?? (rawKey ? decodeURIComponent(rawKey) : "")
const navigate = useNavigate()
Expand Down Expand Up @@ -909,7 +909,7 @@ export default function ContainerDetailPage() {
onSuccess: () => {
toast.success("Container destroyed")
setDestroyOpen(false)
navigate("/containers")
navigate("/runs")
},
onError: () => toast.error("Failed to destroy container"),
})
Expand Down Expand Up @@ -1032,7 +1032,7 @@ export default function ContainerDetailPage() {
return (
<div className="space-y-4">
<div className="flex items-center justify-between gap-2">
<Button variant="ghost" size="sm" onClick={() => navigate("/containers")}>
<Button variant="ghost" size="sm" onClick={() => navigate("/runs")}>
<ArrowLeft className="size-3.5" />
Back to agent runs
</Button>
Expand Down Expand Up @@ -1105,7 +1105,7 @@ export default function ContainerDetailPage() {
<div className="shrink-0 border-b px-4 py-3">
<div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3">
<div className="flex min-w-0 flex-1 items-center gap-2 sm:gap-3">
<Button variant="ghost" size="sm" className="shrink-0 px-2" onClick={() => navigate("/containers")}>
<Button variant="ghost" size="sm" className="shrink-0 px-2" onClick={() => navigate("/runs")}>
<ArrowLeft className="size-3.5" />
<span className="hidden sm:inline">Back</span>
</Button>
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/client/pages/event-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default function EventDetailPage() {
<Button
variant="outline"
size="sm"
onClick={() => navigate(`/containers/detail?key=${encodeURIComponent(event.entityKey)}`)}
onClick={() => navigate(`/runs/detail?key=${encodeURIComponent(event.entityKey)}`)}
>
<Cube className="size-3.5" />
Open run
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/client/pages/sessions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ export default function SessionsPage() {
const parsed = parseEntityKey(session.entityKey)
const chatRepo = chatEntityRepo(session.entityKey)
const repoName = parsed ? `${parsed.owner}/${parsed.repo}` : chatRepo
const detailHref = `/containers/detail?key=${encodeURIComponent(session.entityKey)}`
const detailHref = `/runs/detail?key=${encodeURIComponent(session.entityKey)}`
const openDetail = () => navigate(detailHref)

return (
Expand Down Expand Up @@ -482,7 +482,7 @@ export default function SessionsPage() {
const chatRepo = chatEntityRepo(session.entityKey)
const repoName = parsed ? `${parsed.owner}/${parsed.repo}` : chatRepo
const openDetail = () =>
navigate(`/containers/detail?key=${encodeURIComponent(session.entityKey)}`)
navigate(`/runs/detail?key=${encodeURIComponent(session.entityKey)}`)

return (
<TableRow
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/components/clear-sessions-feedback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ it("shows partial counts and links only failed runs for deliberate per-run retry
),
)
expect(html).toContain("2 deleted; 1 could not be fully deleted")
expect(html).toContain("/containers/detail?key=acme%2Fapp%2342")
expect(html).toContain("/runs/detail?key=acme%2Fapp%2342")
expect(html).not.toContain("deleted1")
expect(html).toContain("Review each remaining run before retrying Destroy")
})
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/components/clear-sessions-feedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function ClearSessionsFeedback({ result, error }: { result?: ClearSession
<ul className="flex max-h-40 flex-col gap-1 overflow-y-auto">
{result.failed.map((entityKey) => (
<li key={entityKey}>
<Link className="break-all underline" to={`/containers/detail?key=${encodeURIComponent(entityKey)}`}>
<Link className="break-all underline" to={`/runs/detail?key=${encodeURIComponent(entityKey)}`}>
{entityKey}
</Link>
</li>
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { authClient } from "@/lib/endpoint"
const NAV_ITEMS = [
{ to: "/", label: "Dashboard", icon: House },
{ to: "/events", label: "Webhook Events", icon: Lightning },
{ to: "/containers", label: "Agent runs", icon: Robot },
{ to: "/runs", label: "Agent runs", icon: Robot },
]

const THEME_OPTIONS = [
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/components/new-chat-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function NewChatDialog({ trigger }: { trigger?: ReactElement }) {
setRepo("")
setCustomRepo(false)
setOpen(false)
navigate(`/containers/detail?key=${encodeURIComponent(entityKey)}`)
navigate(`/runs/detail?key=${encodeURIComponent(entityKey)}`)
},
},
)
Expand Down
Loading