Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(views): confirm before the board card assignee picker hands an issue to an agent (MUL-9365) (#10707)

Jiayuan Zhange4de9f9e3f2d
diff --git a/apps/desktop/src/renderer/src/components/desktop-layout.search-workspace.test.tsx b/apps/desktop/src/renderer/src/components/desktop-layout.search-workspace.test.tsx
index 2f782689ca..17def03aef 100644
--- a/apps/desktop/src/renderer/src/components/desktop-layout.search-workspace.test.tsx
+++ b/apps/desktop/src/renderer/src/components/desktop-layout.search-workspace.test.tsx
@@ -132,7 +132,7 @@ async function mountShell() {
<ReadyShell />
</CoreProvider>,
);
- await waitFor(() => expect(document.querySelector('[data-slot="title-bar-actions"]')).toBeInTheDocument());
+ await waitFor(() => expect(document.querySelector('[data-slot="app-rail"]')).toBeInTheDocument());
}
beforeAll(async () => {
diff --git a/packages/views/issues/components/board-card-assignee-picker.test.tsx b/packages/views/issues/components/board-card-assignee-picker.test.tsx
index 3c0670c05e..e712072261 100644
--- a/packages/views/issues/components/board-card-assignee-picker.test.tsx
+++ b/packages/views/issues/components/board-card-assignee-picker.test.tsx
@@ -1,5 +1,6 @@
import { fireEvent, render, screen } from "@testing-library/react";
-import { describe, expect, it, vi } from "vitest";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { useModalStore } from "@multica/core/modals";
import type { Issue, IssueAssigneeType } from "@multica/core/types";
import { AppLink, NavigationProvider, type NavigationAdapter } from "../../navigation";
import {
@@ -8,9 +9,13 @@ import {
} from "../surface/actions-context";
import { BoardCardContent } from "./board-card";
+const queryData = vi.hoisted(() => new Map<string, unknown[]>());
+
vi.mock("@tanstack/react-query", async (importOriginal) => ({
...(await importOriginal<typeof import("@tanstack/react-query")>()),
- useQuery: () => ({ data: [] }),
+ useQuery: ({ queryKey }: { queryKey: readonly unknown[] }) => ({
+ data: queryData.get(queryKey.join("/")) ?? [],
+ }),
}));
vi.mock("@multica/core/hooks", () => ({
@@ -218,3 +223,60 @@ describe("BoardCardContent assignee picker", () => {
viewState.cardProperties.priority = false;
});
});
+
+// The card picker is a single-issue write like the right-click menu on the
+// same card, so handing the issue to an agent routes on the run-confirm gate
+// (MUL-6463). The gate's matrix lives in ../actions/run-confirm-gate.test.ts.
+describe("BoardCardContent assignee picker run confirmation", () => {
+ afterEach(() => {
+ queryData.clear();
+ vi.mocked(actions.updateIssue).mockClear();
+ useModalStore.getState().close();
+ });
+
+ function renderAndPick(name: string) {
+ queryData.set("workspaces/ws-1/members", [
+ { user_id: "viewer-1", name: "Viewer", role: "member" },
+ { user_id: "member-2", name: "Teammate", role: "member" },
+ ]);
+ queryData.set("workspaces/ws-1/agents", [
+ { id: "agent-2", name: "Builder", owner_id: "viewer-1", archived_at: null },
+ ]);
+ const issue = makeIssue("member");
+ const { container } = render(
+ <NavigationProvider value={navigation}>
+ <IssueSurfaceActionsProvider actions={actions}>
+ <BoardCardContent issue={issue} editable />
+ </IssueSurfaceActionsProvider>
+ </NavigationProvider>,
+ );
+ fireEvent.click(container.querySelector('[data-slot="avatar"]')!);
+ fireEvent.click(screen.getByRole("button", { name: new RegExp(name) }));
+ return issue;
+ }
+
+ it("confirms before handing the issue to an agent", () => {
+ const issue = renderAndPick("Builder");
+
+ const { modal, data } = useModalStore.getState();
+ expect(modal).toBe("issue-run-confirm");
+ expect(data).toMatchObject({
+ issueIds: [issue.id],
+ mode: "assign",
+ assigneeType: "agent",
+ assigneeId: "agent-2",
+ });
+ expect(actions.updateIssue).not.toHaveBeenCalled();
+ });
+
+ it("applies a member reassignment directly", () => {
+ const issue = renderAndPick("Teammate");
+
+ expect(useModalStore.getState().modal).toBeNull();
+ expect(actions.updateIssue).toHaveBeenCalledWith(
+ issue.id,
+ { assignee_type: "member", assignee_id: "member-2" },
+ expect.anything(),
+ );
+ });
+});
diff --git a/packages/views/issues/components/board-card.tsx b/packages/views/issues/components/board-card.tsx
index 1cffcb19bf..4da1437ae7 100644
--- a/packages/views/issues/components/board-card.tsx
+++ b/packages/views/issues/components/board-card.tsx
@@ -8,6 +8,8 @@ import { CSS } from "@dnd-kit/utilities";
import type { Issue, IssueProperty, Project, UpdateIssueRequest } from "@multica/core/types";
import { useQuery } from "@tanstack/react-query";
import { useWorkspaceId } from "@multica/core/hooks";
+import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
+import { useModalStore } from "@multica/core/modals";
import { propertyListOptions } from "@multica/core/properties";
import { CustomPropertyValueDisplay } from "./pickers/custom-property-picker";
import { descriptionPreview } from "./description-preview";
@@ -27,6 +29,7 @@ import { propertyIdFromViewKey } from "@multica/core/issues/stores/view-store";
import { ProgressRing } from "./progress-ring";
import type { ChildProgress } from "./list-row";
import { IssueActionsContextMenu } from "../actions";
+import { runConfirmIntent } from "../actions/run-confirm-gate";
import { LabelChip } from "../../labels/label-chip";
import { IssueAgentActivityIndicator } from "./issue-agent-activity-indicator";
import { CustomStatusChip, useIsCustomStatus } from "./custom-status-chip";
@@ -82,13 +85,22 @@ export const BoardCardContent = memo(function BoardCardContent({
const labels = issue.labels ?? [];
const surfaceActions = useIssueSurfaceActionsOptional();
+ const { entryOf } = useIssueStatuses(cardWsId);
+ const openModal = useModalStore((s) => s.open);
+ // Card pickers are single-issue writes like the right-click menu on this same
+ // card, so handing the issue to an agent confirms first (MUL-6463).
const handleUpdate = useCallback(
(updates: Partial<UpdateIssueRequest>) => {
+ const intent = runConfirmIntent(issue, updates, { entryOf });
+ if (intent) {
+ openModal("issue-run-confirm", intent);
+ return;
+ }
surfaceActions?.updateIssue(issue.id, updates, {
errorMessage: t(($) => $.card.update_failed),
});
},
- [issue.id, surfaceActions, t],
+ [issue, entryOf, openModal, surfaceActions, t],
);
const canEdit = editable && !!surfaceActions;