mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-01 05:03:15 +00:00
* fix: make plan view mobile friendly (#1636) Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> (cherry picked from commit7ee3e05724) * fix: return to thread after plan approval (#1637) Co-authored-by: Ramon Nogueira <270434257+ramon-langchain@users.noreply.github.com> Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> (cherry picked from commitf32e492ab4) * feat: reviews block agenda, sticky headers, accurate diff scroll (#1653) Rework the AI-sorted blocks experience on the PR reviews page into a Google-Docs-style outline: the left sidebar is now a clean number+title agenda with scroll-spy highlighting of the active block; each block shows its title + description (sticky) above its diff; and diff rows are pinned to a uniform height so scroll-to lands precisely via the virtualizer's own geometry instead of an estimate-driven correction loop. Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> (cherry picked from commit 0b76afdc955e33805c7623d1502a75a9c7c9c1b7) * fix: jump + ResizeObserver settle for review scroll-to (#1655) Replace smooth-scroll plus frame-count correction loops on the PR reviews page with an instant jump that re-asserts its target via a ResizeObserver (the real "layout settled" signal). Block/file navigation and finding/comment centering now land deterministically as off-screen cards mount, files expand, and annotation cards measure, instead of racing a smooth-scroll animation against height reconciliation. Holds bail on user wheel/touch input and after a short ceiling, and a new navigation cancels the previous hold. Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> Co-authored-by: Johannes du Plessis <johannes@langchain.dev> (cherry picked from commit 7530653bba7774d66a54b8bef0d2bbc25f519942) * fix: purge expired thread_wakeup crons (#1656) * fix: purge expired thread_wakeup crons One-shot wakeup crons set an end_time that stops re-firing but the cron row is never deleted, so dead rows accumulate (86 in prod). Add a purge that deletes thread_wakeup crons past their end_time, called opportunistically before scheduling a new wakeup, plus a one-time backfill script. Conservative: matches only kind=thread_wakeup with a past end_time. * chore: retrigger Open SWE review --------- Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> (cherry picked from commit 9e5a1924ef306269322c31342a1831e57831cfee) * fix: add top padding to sticky review block header (#1660) * fix: add top padding to sticky review block header The sticky per-block header on the reviews page had padding below but none above, so the block number badge sat glued against the top edge when pinned. Add matching top padding for breathing room. Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> * chore: use py-2 shorthand for review block header padding Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> --------- Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> (cherry picked from commit 23bd4a63fc5ba0fe853babf79ed33feb866cc8b2) * fix: use global tokens for sidebar filter popover border (#1661) The filter popover renders via base-ui Menu.Portal into document.body, outside the .agents-ui container where the --ui-* CSS variables are scoped. As a result border-[var(--ui-border)] resolved to an undefined variable and border-color fell back to currentColor, producing a strong near-black border (separators/hover/labels were similarly off). Switch the portaled popup styling to the same global shadcn tokens the theme/settings popover (SidebarUserMenu) already uses (border-border, bg-border, bg-muted, text-muted-foreground). These are defined at :root so they resolve inside portals too, and match the settings popover. Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> (cherry picked from commit 63eb9a08209f683016abf01cdcc548bc5905f158) * fix: preserve dashboard redirect after login (#1668) * fix: preserve dashboard redirect after login Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> * test: cover plan login redirect in e2e Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> --------- Co-authored-by: Ramon Nogueira <270434257+ramon-langchain@users.noreply.github.com> Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> (cherry picked from commit bc7ce59169b5350da7286164afb83a7b037b528d) * Disable React StrictMode (#1654) Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> (cherry picked from commit 6575c327a3ac2b107a6e79a04fa61168d779dbf0) * docs(upstream-sync): add cherry-pick runbook Repo-specific runbook for bringing upstream (langchain-ai/open-swe) commits into the fork: triage-sync discovery, the git cp workflow, the triage ledger, themed-branch layout, and conflict/regression handling. --------- Co-authored-by: Johannes du Plessis <johannes@langchain.dev> Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> Co-authored-by: Ramon Nogueira <ramon.nogueira@langchain.dev> Co-authored-by: Ramon Nogueira <270434257+ramon-langchain@users.noreply.github.com> Co-authored-by: Caroline di Vittorio <43390382+carolinedivittorio@users.noreply.github.com>
357 lines
12 KiB
TypeScript
357 lines
12 KiB
TypeScript
import { Link, createFileRoute } from "@tanstack/react-router"
|
|
import { CaretRightIcon } from "@phosphor-icons/react"
|
|
import { useEffect, useRef, useState } from "react"
|
|
|
|
import type { ModelOption } from "@/lib/api"
|
|
import { AppShell, SettingsRow, SettingsSection } from "@/components/AppShell"
|
|
import { Button } from "@/components/ui/button"
|
|
import { RepoSelector } from "@/components/agents/RepoSelector"
|
|
import { Input } from "@/components/ui/input"
|
|
import {
|
|
Select,
|
|
SelectContent,
|
|
SelectItem,
|
|
SelectTrigger,
|
|
SelectValue,
|
|
} from "@/components/ui/select"
|
|
import { Skeleton } from "@/components/ui/skeleton"
|
|
import { Switch } from "@/components/ui/switch"
|
|
import {
|
|
buildProfileUpdate,
|
|
useOptions,
|
|
useProfile,
|
|
useRepos,
|
|
useSaveProfile,
|
|
} from "@/lib/profile"
|
|
import { RequireLogin } from "@/lib/auth-redirect"
|
|
import { useSession } from "@/lib/session"
|
|
|
|
export const Route = createFileRoute("/cloud-agents")({
|
|
component: CloudAgentsPage,
|
|
})
|
|
|
|
function CloudAgentsPage() {
|
|
const session = useSession()
|
|
const profile = useProfile()
|
|
const options = useOptions()
|
|
const repos = useRepos()
|
|
const save = useSaveProfile()
|
|
|
|
const [modelId, setModelId] = useState("")
|
|
const [effort, setEffort] = useState("")
|
|
const [subagentModelId, setSubagentModelId] = useState("")
|
|
const [subagentEffort, setSubagentEffort] = useState("")
|
|
const [defaultRepo, setDefaultRepo] = useState("")
|
|
const [baseBranch, setBaseBranch] = useState("")
|
|
const [branchPrefix, setBranchPrefix] = useState("")
|
|
const [error, setError] = useState<string | null>(null)
|
|
const initialized = useRef(false)
|
|
|
|
const firstModel: ModelOption | undefined = options.data?.models[0]
|
|
const defaultAgentModel =
|
|
options.data?.default_agent_model ?? firstModel?.id ?? ""
|
|
const defaultAgentEffort =
|
|
options.data?.default_agent_reasoning_effort ??
|
|
firstModel?.default_effort ??
|
|
""
|
|
const defaultSubagentModel =
|
|
options.data?.default_agent_subagent_model ?? defaultAgentModel
|
|
const defaultSubagentEffort =
|
|
options.data?.default_agent_subagent_reasoning_effort ?? defaultAgentEffort
|
|
const currentModel: ModelOption | undefined =
|
|
options.data?.models.find((m) => m.id === modelId) ?? firstModel
|
|
const currentSubagentModel: ModelOption | undefined =
|
|
options.data?.models.find((m) => m.id === subagentModelId) ?? firstModel
|
|
|
|
useEffect(() => {
|
|
if (!profile.data || initialized.current) return
|
|
const hasModel = !!profile.data.default_model || !!defaultAgentModel
|
|
if (!hasModel) return
|
|
initialized.current = true
|
|
setModelId(profile.data.default_model ?? defaultAgentModel)
|
|
setEffort(profile.data.reasoning_effort ?? defaultAgentEffort)
|
|
setSubagentModelId(
|
|
profile.data.default_subagent_model ??
|
|
profile.data.default_model ??
|
|
defaultSubagentModel
|
|
)
|
|
setSubagentEffort(
|
|
profile.data.subagent_reasoning_effort ??
|
|
profile.data.reasoning_effort ??
|
|
defaultSubagentEffort
|
|
)
|
|
setDefaultRepo(profile.data.default_repo ?? "")
|
|
setBaseBranch(profile.data.base_branch ?? "")
|
|
setBranchPrefix(profile.data.branch_prefix ?? "")
|
|
}, [
|
|
profile.data,
|
|
defaultAgentModel,
|
|
defaultAgentEffort,
|
|
defaultSubagentModel,
|
|
defaultSubagentEffort,
|
|
])
|
|
|
|
useEffect(() => {
|
|
if (currentModel && !currentModel.efforts.includes(effort)) {
|
|
setEffort(currentModel.default_effort)
|
|
}
|
|
}, [currentModel, effort])
|
|
|
|
useEffect(() => {
|
|
if (
|
|
currentSubagentModel &&
|
|
!currentSubagentModel.efforts.includes(subagentEffort)
|
|
) {
|
|
setSubagentEffort(currentSubagentModel.default_effort)
|
|
}
|
|
}, [currentSubagentModel, subagentEffort])
|
|
|
|
if (session.isLoading) {
|
|
return (
|
|
<main className="p-6">
|
|
<Skeleton className="h-64 w-full" />
|
|
</main>
|
|
)
|
|
}
|
|
if (!session.data) return <RequireLogin />
|
|
|
|
const fallbackModel = defaultAgentModel
|
|
const fallbackEffort = defaultAgentEffort
|
|
|
|
const persist = (patch: Parameters<typeof buildProfileUpdate>[1]) => {
|
|
setError(null)
|
|
save
|
|
.mutateAsync(
|
|
buildProfileUpdate(profile.data, patch, fallbackModel, fallbackEffort)
|
|
)
|
|
.catch((e: Error) => setError(e.message))
|
|
}
|
|
|
|
const persistDefaults = () => {
|
|
persist({
|
|
default_model: modelId,
|
|
reasoning_effort: effort,
|
|
default_subagent_model: subagentModelId,
|
|
subagent_reasoning_effort: subagentEffort,
|
|
default_repo: defaultRepo || null,
|
|
base_branch: baseBranch || null,
|
|
branch_prefix: branchPrefix || null,
|
|
})
|
|
}
|
|
|
|
return (
|
|
<AppShell
|
|
user={session.data}
|
|
title="Open SWE Agent"
|
|
description="Configure how the Open SWE Agent picks a model, repository, and PR defaults."
|
|
>
|
|
<SettingsSection title="Defaults">
|
|
<div className="divide-y divide-border">
|
|
<SettingsRow
|
|
label="Default Model"
|
|
description="Used when no model is specified"
|
|
control={
|
|
<Select value={modelId} onValueChange={(v) => v && setModelId(v)}>
|
|
<SelectTrigger className="w-40">
|
|
<SelectValue placeholder="Pick a model" />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
{options.data?.models.map((m) => (
|
|
<SelectItem key={m.id} value={m.id}>
|
|
{m.label}
|
|
</SelectItem>
|
|
))}
|
|
</SelectContent>
|
|
</Select>
|
|
}
|
|
/>
|
|
<SettingsRow
|
|
label="Reasoning Effort"
|
|
description="How hard the model thinks before answering"
|
|
control={
|
|
<Select value={effort} onValueChange={(v) => v && setEffort(v)}>
|
|
<SelectTrigger className="w-32">
|
|
<SelectValue />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
{currentModel?.efforts.map((e) => (
|
|
<SelectItem key={e} value={e}>
|
|
{e}
|
|
</SelectItem>
|
|
))}
|
|
</SelectContent>
|
|
</Select>
|
|
}
|
|
/>
|
|
<SettingsRow
|
|
label="Default Subagent Model"
|
|
description="Used for delegated tasks launched by your agent"
|
|
control={
|
|
<Select
|
|
value={subagentModelId}
|
|
onValueChange={(v) => v && setSubagentModelId(v)}
|
|
>
|
|
<SelectTrigger className="w-40">
|
|
<SelectValue placeholder="Pick a model" />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
{options.data?.models.map((m) => (
|
|
<SelectItem key={m.id} value={m.id}>
|
|
{m.label}
|
|
</SelectItem>
|
|
))}
|
|
</SelectContent>
|
|
</Select>
|
|
}
|
|
/>
|
|
<SettingsRow
|
|
label="Subagent Reasoning Effort"
|
|
description="How hard delegated subagents think before answering"
|
|
control={
|
|
<Select
|
|
value={subagentEffort}
|
|
onValueChange={(v) => v && setSubagentEffort(v)}
|
|
>
|
|
<SelectTrigger className="w-32">
|
|
<SelectValue />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
{currentSubagentModel?.efforts.map((e) => (
|
|
<SelectItem key={e} value={e}>
|
|
{e}
|
|
</SelectItem>
|
|
))}
|
|
</SelectContent>
|
|
</Select>
|
|
}
|
|
/>
|
|
<SettingsRow
|
|
label="Default Repository"
|
|
description="Used when no repository is specified"
|
|
control={
|
|
repos.data?.repositories.length ? (
|
|
<div className="w-56">
|
|
<RepoSelector
|
|
repos={repos.data.repositories}
|
|
selectedRepo={defaultRepo || null}
|
|
onRepoChange={(repo) => setDefaultRepo(repo ?? "")}
|
|
placeholder="Pick a repository…"
|
|
emptySelectionLabel="No default repository"
|
|
triggerClassName="h-7 w-full max-w-none rounded-md border border-input bg-input/20 px-2 py-1.5 text-xs/relaxed text-foreground transition-colors hover:opacity-100 dark:bg-input/30"
|
|
dropdownClassName="w-56"
|
|
/>
|
|
</div>
|
|
) : (
|
|
<Input
|
|
className="w-56"
|
|
placeholder="owner/repo"
|
|
value={defaultRepo}
|
|
onChange={(e) => setDefaultRepo(e.target.value)}
|
|
/>
|
|
)
|
|
}
|
|
/>
|
|
<SettingsRow
|
|
label="Base Branch"
|
|
description="When empty, Cloud Agent will use a repository's default branch (recommended)"
|
|
htmlFor="base-branch"
|
|
control={
|
|
<Input
|
|
id="base-branch"
|
|
className="w-56"
|
|
placeholder="Branch name…"
|
|
value={baseBranch}
|
|
onChange={(e) => setBaseBranch(e.target.value)}
|
|
/>
|
|
}
|
|
/>
|
|
<SettingsRow
|
|
label="Branch Prefix"
|
|
description="Prefix for branch names created by Cloud Agent"
|
|
htmlFor="branch-prefix"
|
|
control={
|
|
<Input
|
|
id="branch-prefix"
|
|
className="w-56"
|
|
placeholder="open-swe/"
|
|
value={branchPrefix}
|
|
onChange={(e) => setBranchPrefix(e.target.value)}
|
|
/>
|
|
}
|
|
/>
|
|
<div className="flex justify-end px-4 py-3">
|
|
<Button
|
|
size="sm"
|
|
onClick={persistDefaults}
|
|
disabled={save.isPending}
|
|
>
|
|
{save.isPending ? "Saving…" : "Save defaults"}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</SettingsSection>
|
|
|
|
<SettingsSection title="Pull Requests">
|
|
<div className="divide-y divide-border">
|
|
<SettingsRow
|
|
label="Automatically fix CI failures"
|
|
description="Agent will attempt to fix failing CI checks and resolve reviewer comments on PRs it opens."
|
|
control={
|
|
<Switch
|
|
checked={profile.data?.auto_fix_ci ?? true}
|
|
onCheckedChange={(v) => persist({ auto_fix_ci: v })}
|
|
/>
|
|
}
|
|
/>
|
|
<SettingsRow
|
|
label="Always Create PRs"
|
|
description="Always create a pull request for code changes. When disabled, agents create PRs only when necessary or requested."
|
|
control={
|
|
<Switch
|
|
checked={profile.data?.create_prs ?? false}
|
|
onCheckedChange={(v) => persist({ create_prs: v })}
|
|
/>
|
|
}
|
|
/>
|
|
</div>
|
|
</SettingsSection>
|
|
|
|
<SettingsSection title="Rules">
|
|
<Link
|
|
to="/agents/instructions"
|
|
className="flex items-center justify-between gap-6 px-4 py-3 hover:bg-muted/40"
|
|
>
|
|
<div className="flex flex-col gap-0.5">
|
|
<span className="text-xs font-medium text-foreground">
|
|
Repository Instructions
|
|
</span>
|
|
<span className="text-xs text-muted-foreground">
|
|
Per-repo custom instructions injected into the agent's system
|
|
prompt.
|
|
</span>
|
|
</div>
|
|
<CaretRightIcon className="size-3.5 shrink-0 text-muted-foreground" />
|
|
</Link>
|
|
{session.data.is_admin && (
|
|
<Link
|
|
to="/agents/snapshots"
|
|
className="flex items-center justify-between gap-6 px-4 py-3 hover:bg-muted/40"
|
|
>
|
|
<div className="flex flex-col gap-0.5">
|
|
<span className="text-xs font-medium text-foreground">
|
|
Repository Snapshots
|
|
</span>
|
|
<span className="text-xs text-muted-foreground">
|
|
Build a per-repo sandbox image from a custom Dockerfile. Falls
|
|
back to the default image.
|
|
</span>
|
|
</div>
|
|
<CaretRightIcon className="size-3.5 shrink-0 text-muted-foreground" />
|
|
</Link>
|
|
)}
|
|
</SettingsSection>
|
|
|
|
{error && <p className="text-xs text-destructive">{error}</p>}
|
|
</AppShell>
|
|
)
|
|
}
|