mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 13:53:15 +00:00
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 commit f32e492ab4)
This commit is contained in:
parent
36b15b6b87
commit
e3c3ce3f8a
2 changed files with 16 additions and 10 deletions
|
|
@ -126,10 +126,11 @@ test.describe("Plan review (HTTP comments)", () => {
|
|||
await addComment(collab, "Reviewer: please also add a docstring.");
|
||||
await expect(collab.getByTestId("plan-comment")).toHaveCount(2);
|
||||
|
||||
// 5. The owner sees the collaborator's comment (polled), then approves.
|
||||
// 5. The owner sees the collaborator's comment (polled), then approves and
|
||||
// returns to the main conversation while implementation starts.
|
||||
await expect(owner.getByTestId("plan-comment")).toHaveCount(2, { timeout: 30_000 });
|
||||
await owner.getByTestId("approve-plan").click();
|
||||
await expect(owner.getByTestId("plan-decision")).toContainText(/implementing/i);
|
||||
await expect(owner).toHaveURL(new RegExp(`/agents/${threadId}$`));
|
||||
|
||||
// 6. The agent implements, opens a PR, and links it back in the Slack thread,
|
||||
// echoing the reviewers' feedback — which proves the comments were stored
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { useCallback, useEffect, useState } from "react"
|
||||
import { useNavigate } from "@tanstack/react-router"
|
||||
|
||||
import type { PlanComment, PlanData } from "@/lib/plan"
|
||||
import {
|
||||
|
|
@ -47,6 +48,7 @@ async function copyToClipboard(text: string): Promise<boolean> {
|
|||
}
|
||||
|
||||
export function PlanReview({ plan }: { plan: PlanData }) {
|
||||
const navigate = useNavigate()
|
||||
const resolvedTheme = useResolvedTheme()
|
||||
const [comments, setComments] = useState<Array<PlanComment>>([])
|
||||
const [draft, setDraft] = useState("")
|
||||
|
|
@ -108,20 +110,23 @@ export function PlanReview({ plan }: { plan: PlanData }) {
|
|||
setBusy(kind)
|
||||
setError(null)
|
||||
try {
|
||||
if (kind === "approve") await approvePlan(plan.threadId)
|
||||
else await rejectPlan(plan.threadId)
|
||||
setDecision(
|
||||
kind === "approve"
|
||||
? "Plan approved — the agent is implementing it."
|
||||
: "Changes requested — the agent is revising the plan."
|
||||
)
|
||||
if (kind === "approve") {
|
||||
await approvePlan(plan.threadId)
|
||||
await navigate({
|
||||
to: "/agents/$threadId",
|
||||
params: { threadId: plan.threadId },
|
||||
})
|
||||
return
|
||||
}
|
||||
await rejectPlan(plan.threadId)
|
||||
setDecision("Changes requested — the agent is revising the plan.")
|
||||
} catch (e) {
|
||||
setError((e as Error).message)
|
||||
} finally {
|
||||
setBusy(null)
|
||||
}
|
||||
},
|
||||
[plan.threadId]
|
||||
[navigate, plan.threadId]
|
||||
)
|
||||
|
||||
const copyPlan = useCallback(async () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue