Skip to content

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

Go

MUL-6463: confirm the promotion that starts an agent run (#7293)

Bohan Jiangcc21d19353f1
diff --git a/apps/docs/content/docs/assigning-issues.ja.mdx b/apps/docs/content/docs/assigning-issues.ja.mdx
index 8650cbfcf0..1c469798bc 100644
--- a/apps/docs/content/docs/assigning-issues.ja.mdx
+++ b/apps/docs/content/docs/assigning-issues.ja.mdx
@@ -43,6 +43,8 @@ Multica はエージェントのために[タスク](/tasks)を作成します
`backlog` のイシューも、割り当てだけでは実行を開始しません。イシューを `backlog` から移動するか、コメントで担当者に依頼を続けたときに、はじめて後続の実行が生まれます。
+すでにエージェントまたはスカッドの担当者がいるタスクを `backlog` から移動すると、同じ確認ダイアログが開きます。実行を開始するのはこのステータス変更そのものなので、同じ引き継ぎメモを書けますし、**まだ開始しない**も同じように使えます(ステータスだけ変えて、エージェントは起こしません)。この確認ダイアログは、`backlog`・`done`・`cancelled` 以外のカテゴリへ移動するときに表示されます。
+
この挙動は `backlog` カテゴリだけで、そのカテゴリの[カスタムステータス](/issues#カスタムステータス)もまったく同じように振る舞います。すでに `done` や `cancelled` にあるイシューは、エージェントに割り当て・再割り当てすると、すぐに実行が開始されます。
## 割り当ての権限
diff --git a/apps/docs/content/docs/assigning-issues.ko.mdx b/apps/docs/content/docs/assigning-issues.ko.mdx
index d45023a1d5..37a980a82c 100644
--- a/apps/docs/content/docs/assigning-issues.ko.mdx
+++ b/apps/docs/content/docs/assigning-issues.ko.mdx
@@ -43,6 +43,8 @@ Multica가 에이전트의 [실행 태스크](/tasks)를 만듭니다. 온라인
`backlog` 상태에서도 에이전트를 할당하는 것만으로 실행이 시작되지 않습니다. 이슈를 `backlog`에서 다른 상태로 옮기거나 댓글에서 담당자에게 추가 요청을 해야 이후 실행이 생성됩니다.
+이미 에이전트나 스쿼드 담당자가 있는 태스크를 `backlog` 밖으로 옮기면 같은 확인 대화상자가 열립니다. 실행을 시작하는 것이 바로 이 상태 변경이므로 동일한 인계 메모를 남길 수 있고, **아직 시작 안 함**도 그대로 사용할 수 있습니다(상태만 옮기고 에이전트는 깨우지 않습니다). 이 대화상자는 `backlog`·`done`·`cancelled` 이외 카테고리로 옮길 때 나타납니다.
+
이 효과는 `backlog` 카테고리에만 적용되며, 그 카테고리의 [사용자 지정 상태](/issues#사용자-지정-상태)도 똑같이 동작합니다. 이미 `done` 또는 `cancelled` 상태인 이슈도 에이전트에게 할당하거나 다시 할당하면 즉시 실행이 시작됩니다.
## 할당 권한
diff --git a/apps/docs/content/docs/assigning-issues.mdx b/apps/docs/content/docs/assigning-issues.mdx
index 56b168b8be..064bdd5c81 100644
--- a/apps/docs/content/docs/assigning-issues.mdx
+++ b/apps/docs/content/docs/assigning-issues.mdx
@@ -47,6 +47,8 @@ When the assignee is a [squad](/squads), the same rule applies: Multica enqueues
`backlog` doesn't start a run on assignment either. Execution only follows after you move the issue out of `backlog`, or ask the assignee for something in a follow-up comment.
+When the issue already has an agent or squad owner, moving it out of `backlog` opens the same dialog: that status change is what starts the run, so it offers the same handoff note and the same **Don't start yet**, which moves the issue without waking the agent. The dialog appears for every target outside the `backlog`, `done`, and `cancelled` categories.
+
Only the `backlog` category works this way, and a [custom status](/issues#custom-statuses) in that category behaves identically. Issues already in `done` or `cancelled` still start a run immediately when assigned or reassigned to an agent.
## Assignment permissions
diff --git a/apps/docs/content/docs/assigning-issues.zh.mdx b/apps/docs/content/docs/assigning-issues.zh.mdx
index 5a54a7f905..7c26f30c34 100644
--- a/apps/docs/content/docs/assigning-issues.zh.mdx
+++ b/apps/docs/content/docs/assigning-issues.zh.mdx
@@ -47,6 +47,8 @@ Multica 会为智能体创建一条[执行任务](/tasks)。在线运行时领
`backlog` 也不会因为分配智能体而启动执行。把 issue 移出 `backlog`,或者在评论中继续向负责人提出要求后,才会产生后续执行。
+如果任务已经有智能体或小队负责人,把它移出 `backlog` 会弹出同一个确认窗:真正启动执行的正是这次状态变更,所以同样可以填写交接说明,也同样有**暂不开始**——只改状态,不叫醒智能体。目标状态只要不属于 `backlog`、`done`、`cancelled` 分类,都会弹这个确认窗。
+
只有 `backlog` 分类有这个效果,该分类下的[自定义状态](/issues#自定义状态)表现完全一致。已经处于 `done` 或 `cancelled` 的 issue,分配或重新分配给智能体时同样会立即开始执行。
## 分配权限
diff --git a/packages/views/issues/actions/__tests__/use-issue-actions.test.tsx b/packages/views/issues/actions/__tests__/use-issue-actions.test.tsx
index e9e3ec236e..dff0603abe 100644
--- a/packages/views/issues/actions/__tests__/use-issue-actions.test.tsx
+++ b/packages/views/issues/actions/__tests__/use-issue-actions.test.tsx
@@ -1,7 +1,8 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { renderHook, act, waitFor } from "@testing-library/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import type { Issue } from "@multica/core/types";
+import { buildIssueStatusCatalog } from "@multica/core/issue-statuses";
+import type { Issue, IssueStatusEntry } from "@multica/core/types";
vi.mock("@multica/core/hooks", () => ({
useWorkspaceId: () => "ws-1",
@@ -47,6 +48,38 @@ vi.mock("@multica/core/issues/mutations", () => ({
useUpdateIssue: () => ({ mutate: mockUpdateMutate }),
}));
+// The status catalog is server state; this suite only needs it to answer which
+// CATEGORY a key belongs to, so the entries are fed in directly. `later` parks
+// like Backlog and `rework` starts work like Todo — the two cases a raw
+// `status === "backlog"` / `=== "todo"` comparison gets wrong (MUL-6463).
+const catalogEntries: IssueStatusEntry[] = [
+ ...(["backlog", "todo", "in_progress", "in_review", "done", "blocked", "cancelled"] as const).map(
+ (key, i) => statusEntry({ id: key, key, name: key, category: key, is_system: true, position: i }),
+ ),
+ statusEntry({ id: "later", key: "later", name: "Later", category: "backlog", position: 7 }),
+ statusEntry({ id: "rework", key: "rework", name: "Rework", category: "todo", position: 8 }),
+];
+function statusEntry(overrides: Partial<IssueStatusEntry>): IssueStatusEntry {
+ return {
+ id: "id",
+ workspace_id: "ws-1",
+ key: "custom",
+ name: "Custom",
+ description: "",
+ category: "todo",
+ color: "#22c55e",
+ is_system: false,
+ position: 0,
+ archived_at: null,
+ created_at: "",
+ updated_at: "",
+ ...overrides,
+ };
+}
+vi.mock("@multica/core/issue-statuses/hooks", () => ({
+ useIssueStatuses: () => buildIssueStatusCatalog(catalogEntries),
+}));
+
vi.mock("@multica/core/paths", async () => {
const actual = await vi.importActual<typeof import("@multica/core/paths")>(
"@multica/core/paths",
@@ -171,6 +204,46 @@ describe("useIssueActions", () => {
expect(mockOpenModal).not.toHaveBeenCalled();
});
+ // Which writes need confirming is decided by runConfirmIntent, whose matrix
+ // (parked / unresolvable categories, every promotion target) is canonical in
+ // ../run-confirm-gate.test.ts. These two only prove the hook routes on it.
+ it("promoting an agent-owned parked issue routes through the run-confirm modal", () => {
+ const parked = {
+ ...mockIssue,
+ status: "backlog",
+ assignee_type: "agent",
+ assignee_id: "agent-1",
+ } as Issue;
+ const { result } = renderHook(() => useIssueActions(parked), { wrapper });
+
+ act(() => {
+ result.current.updateField({ status: "rework" });
+ });
+
+ expect(mockOpenModal).toHaveBeenCalledWith("issue-run-confirm", {
+ issueIds: ["issue-1"],
+ mode: "promote",
+ status: "rework",
+ assigneeType: "agent",
+ assigneeId: "agent-1",
+ });
+ expect(mockUpdateMutate).not.toHaveBeenCalled();
+ });
+
+ it("a status change that starts no run applies directly", () => {
+ const { result } = renderHook(() => useIssueActions(mockIssue), { wrapper });
+
+ act(() => {
+ result.current.updateField({ status: "in_progress" });
+ });
+
+ expect(mockUpdateMutate).toHaveBeenCalledWith(
+ { id: "issue-1", status: "in_progress" },
+ expect.any(Object),
+ );
+ expect(mockOpenModal).not.toHaveBeenCalled();
+ });
+
it("assigning a member applies directly without the run-confirm modal", () => {
const { result } = renderHook(() => useIssueActions(mockIssue), { wrapper });
diff --git a/packages/views/issues/actions/run-confirm-gate.test.ts b/packages/views/issues/actions/run-confirm-gate.test.ts
new file mode 100644
index 0000000000..7857188386
--- /dev/null
+++ b/packages/views/issues/actions/run-confirm-gate.test.ts
@@ -0,0 +1,139 @@
+// @vitest-environment node
+import { describe, it, expect } from "vitest";
+import { buildIssueStatusCatalog } from "@multica/core/issue-statuses";
+import type { IssueStatusEntry } from "@multica/core/types";
+import { runConfirmIntent, resolveStatusCategory, type GateIssue } from "./run-confirm-gate";
+
+// The canonical matrix for "does this write need confirming" (MUL-6463). The
+// hook and table suites only prove they route on this answer.
+function entry(key: string, category: string): IssueStatusEntry {
+ return {
+ id: key,
+ workspace_id: "ws-1",
+ key,
+ name: key,
+ description: "",
+ category: category as IssueStatusEntry["category"],
+ color: "#ff0000",
+ is_system: false,
+ position: 0,
+ archived_at: null,
+ created_at: "",
+ updated_at: "",
+ };
+}
+
+// `later` parks like Backlog, `rework` starts work like Todo, `qa` sits in
+// in_review — the three custom shapes a raw key comparison gets wrong.
+const CATALOG = buildIssueStatusCatalog([
+ entry("later", "backlog"),
+ entry("rework", "todo"),
+ entry("qa", "in_review"),
+]);
+// A catalog that has not loaded: every custom key is unresolvable.
+const COLD = buildIssueStatusCatalog(undefined);
+
+function issue(overrides: Partial<GateIssue> = {}): GateIssue {
+ return {
+ id: "issue-1",
+ status: "backlog",
+ assignee_type: "agent",
+ assignee_id: "agent-1",
+ ...overrides,
+ };
+}
+
+describe("resolveStatusCategory", () => {
+ it("prefers the category the payload carries", () => {
+ expect(resolveStatusCategory("qa", "in_review", COLD)).toBe("in_review");
+ });
+
+ it("resolves a built-in key without a catalog", () => {
+ expect(resolveStatusCategory("backlog", undefined, COLD)).toBe("backlog");
+ });
+
+ it("resolves a custom key through the catalog", () => {
+ expect(resolveStatusCategory("later", undefined, CATALOG)).toBe("backlog");
+ });
+
+ it("answers null — never a guess — for a custom key nothing can resolve", () => {
+ // catalog.categoryOf would say `todo` here, which is the guess this gate
+ // exists to avoid: it decides whether a write may start an agent.
+ expect(CATALOG.categoryOf("unknown")).toBe("todo");
+ expect(resolveStatusCategory("unknown", undefined, CATALOG)).toBeNull();
+ expect(resolveStatusCategory("later", undefined, COLD)).toBeNull();
+ });
+});
+
+describe("runConfirmIntent — assign", () => {
+ it("confirms when the issue is not parked", () => {
+ expect(
+ runConfirmIntent(issue({ status: "todo" }), { assignee_type: "agent", assignee_id: "a-2" }, CATALOG),
+ ).toEqual({ issueIds: ["issue-1"], mode: "assign", assigneeType: "agent", assigneeId: "a-2" });
+ });
+
+ it.each([
+ ["built-in backlog", "backlog", undefined],
+ ["custom backlog-category status", "later", undefined],
+ ["custom key resolved by the payload", "anything", "backlog" as const],
+ ])("applies directly for a parked issue (%s) — assigning there never starts a run", (_label, status, carried) => {
+ expect(
+ runConfirmIntent(
+ issue({ status, status_category: carried }),
+ { assignee_type: "agent", assignee_id: "a-2" },
+ CATALOG,
+ ),
+ ).toBeNull();
+ });
+
+ it("confirms when the issue's own category is unresolvable", () => {
+ // Fails toward the dialog: a dismissed dialog costs a click, a silent
+ // start costs an agent run.
+ expect(
+ runConfirmIntent(issue({ status: "later" }), { assignee_type: "agent", assignee_id: "a-2" }, COLD),
+ ).not.toBeNull();
+ });
+
+ it("applies directly for a member assignee", () => {
+ expect(
+ runConfirmIntent(issue({ status: "todo" }), { assignee_type: "member", assignee_id: "u-1" }, CATALOG),
+ ).toBeNull();
+ });
+});
+
+describe("runConfirmIntent — promote", () => {
+ it.each([
+ ["built-in todo", "backlog", "todo"],
+ ["custom Todo-category status", "backlog", "rework"],
+ ["custom backlog-category origin", "later", "rework"],
+ ["a non-todo target that still starts a run", "backlog", "in_progress"],
+ ["a custom in_review target", "backlog", "qa"],
+ ])("confirms the promotion (%s)", (_label, from, to) => {
+ expect(runConfirmIntent(issue({ status: from }), { status: to }, CATALOG)).toEqual({
+ issueIds: ["issue-1"],
+ mode: "promote",
+ status: to,
+ assigneeType: "agent",
+ assigneeId: "agent-1",
+ });
+ });
+
+ it.each([
+ ["unresolvable origin", COLD, { status: "later" }, "todo"],
+ ["unresolvable target", CATALOG, { status: "backlog" }, "unknown"],
+ ])("confirms when %s leaves it unknown whether a run starts", (_label, catalog, from, to) => {
+ expect(runConfirmIntent(issue(from), { status: to }, catalog)).not.toBeNull();
+ });
+
+ it.each([
+ ["no owner", { status: "backlog", assignee_type: null, assignee_id: null }, "todo"],
+ ["member owner", { status: "backlog", assignee_type: "member" as const, assignee_id: "u-1" }, "todo"],
+ ["already active", { status: "todo" }, "in_progress"],
+ ["closing the issue", { status: "backlog" }, "done"],
+ ["cancelling the issue", { status: "backlog" }, "cancelled"],
+ ["re-parking inside backlog", { status: "backlog" }, "later"],
+ ["the same status again", { status: "backlog" }, "backlog"],
+ ])("applies directly when no run starts (%s)", (_label, from, to) => {
+ expect(runConfirmIntent(issue(from as Partial<GateIssue>), { status: to }, CATALOG)).toBeNull();
+ });
+});
diff --git a/packages/views/issues/actions/run-confirm-gate.ts b/packages/views/issues/actions/run-confirm-gate.ts
new file mode 100644
index 0000000000..730ff678ad
--- /dev/null
+++ b/packages/views/issues/actions/run-confirm-gate.ts
@@ -0,0 +1,117 @@
+import type { Issue, IssueStatusCategory, UpdateIssueRequest } from "@multica/core/types";
+import { issueStatusCategory } from "@multica/core/issues";
+import { isIssueStatusCategory, type IssueStatusCatalog } from "@multica/core/issue-statuses";
+
+/** The issue fields the gate reads. */
+export type GateIssue = Pick<
+ Issue,
+ "id" | "status" | "status_category" | "assignee_type" | "assignee_id"
+>;
+
+/** Payload for the `issue-run-confirm` modal, or null when nothing to confirm. */
+export type RunConfirmIntent =
+ | {
+ issueIds: [string];
+ mode: "assign";
+ assigneeType: "agent" | "squad";
+ assigneeId: string;
+ }
+ | {
+ issueIds: [string];
+ mode: "promote";
+ status: string;
+ assigneeType: "agent" | "squad";
+ assigneeId: string;
+ };
+
+/**
+ * The category a status KEY belongs to — or `null` when nothing can answer.
+ *
+ * Three states, not two. `catalog.categoryOf` collapses "unknown custom key"
+ * into `todo`, which is indistinguishable from a real `todo` and is exactly
+ * the guess this gate must not make: it decides whether a write may start an
+ * agent, so an unresolvable key has to stay unresolved and let the caller fail
+ * safe. (MUL-6463)
+ *
+ * Resolution order mirrors the server (`issuestatus.Effective`): a category the
+ * payload already carries wins, a BUILT-IN key is its own category, and only a
+ * custom key needs the workspace catalog.
+ */
+export function resolveStatusCategory(
+ statusKey: string,
+ carriedCategory: IssueStatusCategory | undefined,
+ catalog: Pick<IssueStatusCatalog, "entryOf">,
+): IssueStatusCategory | null {
+ const carried = issueStatusCategory({ status: statusKey, status_category: carriedCategory });
+ if (carried) return carried;
+ const category = catalog.entryOf(statusKey)?.category;
+ return category && isIssueStatusCategory(category) ? category : null;
+}
+
+/** Categories a promotion can land in without starting a run. */
+const NEVER_STARTS = ["backlog", "done", "cancelled"];
+
+/**
+ * Which confirmation, if any, an issue write needs before it is applied.
+ *
+ * Both writes that can hand work to an agent confirm; everything else applies
+ * directly. Pure so every entry point — issue detail, context menu, table row —
+ * routes on one answer instead of re-deriving it (MUL-6463).
+ *
+ * - **assign**: giving the issue an agent/squad owner. Skipped only when the
+ * issue is KNOWN to be parked, because assigning into the backlog category
+ * never starts a run (`server/internal/service/issue_trigger.go`) and the
+ * dialog would promise something that cannot happen.
+ * - **promote**: moving an already-owned issue out of the backlog category.
+ * That status change alone starts the run (`RunSourceStatus`), so it earns
+ * the same dialog — for built-in `todo` and every custom Todo-category
+ * status alike.
+ *
+ * Unresolvable categories fail toward confirming: a dialog the user dismisses
+ * costs a click, a silent start costs an unwanted agent run.
+ */
+export function runConfirmIntent(
+ issue: GateIssue,
+ updates: Partial<UpdateIssueRequest>,
+ catalog: Pick<IssueStatusCatalog, "entryOf">,
+): RunConfirmIntent | null {
+ const issueCategory = resolveStatusCategory(issue.status, issue.status_category, catalog);
+ const parked = issueCategory === "backlog";
+
+ if (
+ (updates.assignee_type === "agent" || updates.assignee_type === "squad") &&
+ updates.assignee_id &&
+ !parked
+ ) {
+ return {
+ issueIds: [issue.id],
+ mode: "assign",
+ assigneeType: updates.assignee_type,
+ assigneeId: updates.assignee_id,
+ };
+ }
+
+ const owner = issue.assignee_type;
+ if (
+ updates.status &&
+ updates.status !== issue.status &&
+ // Unknown counts as possibly-parked: the write may promote, so confirm.
+ (parked || issueCategory === null) &&
+ (owner === "agent" || owner === "squad") &&
+ issue.assignee_id
+ ) {
+ const target = resolveStatusCategory(updates.status, undefined, catalog);
+ // An unresolvable TARGET is possibly-active for the same reason.
+ if (target === null || !NEVER_STARTS.includes(target)) {
+ return {
+ issueIds: [issue.id],
+ mode: "promote",
+ status: updates.status,
+ assigneeType: owner,
+ assigneeId: issue.assignee_id,
+ };
+ }
+ }
+
+ return null;
+}
diff --git a/packages/views/issues/actions/use-issue-actions.ts b/packages/views/issues/actions/use-issue-actions.ts
index f6ced57a5e..dbd3df8066 100644
--- a/packages/views/issues/actions/use-issue-actions.ts
+++ b/packages/views/issues/actions/use-issue-actions.ts
@@ -9,11 +9,13 @@ import { useWorkspaceId } from "@multica/core/hooks";
import { useWorkspacePaths } from "@multica/core/paths";
import { useModalStore } from "@multica/core/modals";
import { useUpdateIssue } from "@multica/core/issues/mutations";
+import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
import { errorCode } from "@multica/core/api";
import { pinListOptions, useCreatePin, useDeletePin } from "@multica/core/pins";
import { copyText } from "@multica/ui/lib/clipboard";
import { useNavigation } from "../../navigation";
import { useT } from "../../i18n";
+import { runConfirmIntent } from "./run-confirm-gate";
import { useIssueSurfaceActionsOptional } from "../surface/actions-context";
import type { IssueSurfaceMutationOptions } from "../surface/actions-context";
@@ -68,34 +70,25 @@ export function useIssueActions(issue: Issue | null): UseIssueActionsResult {
const issueProjectId = issue?.project_id ?? null;
const issueAssigneeType = issue?.assignee_type ?? null;
const issueAssigneeId = issue?.assignee_id ?? null;
- const issueStatus = issue?.status ?? null;
+ const { entryOf } = useIssueStatuses(wsId);
const updateField = useCallback(
(
updates: Partial<UpdateIssueRequest>,
options?: IssueSurfaceMutationOptions,
) => {
if (!issueId) return;
- // Assigning to an agent/squad may start a run. Route through the
- // pre-trigger confirm modal (preview + optional handoff note + "暂不开始"),
- // which applies the change itself — the four entry points share this one
- // backend-driven flow instead of guessing (MUL-3375). Every other field
- // change (status, priority, member assign, unassign) applies directly.
+ // The two writes that can hand work to an agent — giving it an owner, and
+ // promoting it out of the parking lot — confirm first, through the shared
+ // gate every single-issue entry point routes on (runConfirmIntent). The
+ // modal applies the change itself; everything else applies directly.
//
- // Backlog is the parking lot: assigning a backlog issue never starts a run
- // (server/internal/service/issue_trigger.go), so the modal would only show
- // an empty "won't start" box with a single Apply button. Apply directly,
- // matching the batch backlog short-circuit in BatchActionToolbar.
- if (
- (updates.assignee_type === "agent" || updates.assignee_type === "squad") &&
- updates.assignee_id &&
- issueStatus !== "backlog"
- ) {
- openModal("issue-run-confirm", {
- issueIds: [issueId],
- mode: "assign",
- assigneeType: updates.assignee_type,
- assigneeId: updates.assignee_id,
- });
+ // Not wired into drag-and-drop or the batch toolbar, which keep applying
+ // directly. That is the existing split, not a new one: a drop is direct
+ // manipulation whose card has already moved, and batch status was made
+ // deliberately dialog-free in MUL-4155.
+ const intent = issue && runConfirmIntent(issue, updates, { entryOf });
+ if (intent) {
+ openModal("issue-run-confirm", intent);
return;
}
if (surfaceActions) {
@@ -123,7 +116,7 @@ export function useIssueActions(issue: Issue | null): UseIssueActionsResult {
);
}
},
- [issueId, issueStatus, surfaceActions, updateIssue, openModal, t],
+ [issue, issueId, entryOf, surfaceActions, updateIssue, openModal, t],
);
// Explicit "open it somewhere else" CTA, so the new tab takes focus
diff --git a/packages/views/issues/components/table-view-editing.test.tsx b/packages/views/issues/components/table-view-editing.test.tsx
index 0d26d09e24..c7a3b2fde4 100644
--- a/packages/views/issues/components/table-view-editing.test.tsx
+++ b/packages/views/issues/components/table-view-editing.test.tsx
@@ -21,6 +21,7 @@ import {
import userEvent from "@testing-library/user-event";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { setApiInstance } from "@multica/core/api";
+import { useModalStore } from "@multica/core/modals";
import type { ApiClient } from "@multica/core/api/client";
import { issueKeys } from "@multica/core/issues/queries";
import { ViewStoreProvider } from "@multica/core/issues/stores/view-store-context";
@@ -68,6 +69,13 @@ vi.mock("@multica/core/workspace/hooks", () => ({
buildActorNameResolver: () => () => "Someone",
}));
+// The assignee cell's avatar only renders for a row that HAS an assignee (the
+// run-confirm case below) and pulls in presence, images and the rest of the
+// workspace-hooks surface. None of that is under test here.
+vi.mock("../../common/actor-avatar", () => ({
+ ActorAvatar: () => <span data-testid="actor-avatar" />,
+}));
+
const mockAuthUser = { id: "user-1", email: "[email protected]", name: "Tester" };
vi.mock("@multica/core/auth", () => ({
useAuthStore: Object.assign(
@@ -226,6 +234,47 @@ function Harness({
}
describe("TableView cell editors under data refresh", () => {
+ // The table's inline pickers are single-issue writes like the issue detail's,
+ // so they route on the same run-confirm gate: promoting an agent-owned issue
+ // out of backlog starts a run and must confirm first (MUL-6463). The gate's
+ // own matrix lives in ../actions/run-confirm-gate.test.ts; this only proves
+ // the table asks it instead of writing straight through.
+ it("confirms a status change that would start an agent run instead of applying it", async () => {
+ const user = userEvent.setup({ delay: null, pointerEventsCheck: 0 });
+ serverIssues = [
+ {
+ ...makeIssue("c", "Parked task", "backlog"),
+ assignee_type: "agent",
+ assignee_id: "agent-1",
+ },
+ ];
+ useModalStore.getState().close();
+
+ renderWithI18n(
+ <QueryClientProvider client={queryClient}>
+ <Harness
+ childProgressMap={new Map<string, ChildProgress>()}
+ surfaceKey={`test-surface-${Math.floor(Math.random() * 1e9)}`}
+ />
+ </QueryClientProvider>,
+ );
+
+ await screen.findByText("MUL-c");
+ const row = screen.getByText("MUL-c").closest("tr")!;
+ await user.click(within(row).getByRole("button", { name: /Backlog/ }));
+ await user.click(screen.getByRole("button", { name: /^Todo$/ }));
+
+ const { modal, data } = useModalStore.getState();
+ expect(modal).toBe("issue-run-confirm");
+ expect(data).toMatchObject({
+ mode: "promote",
+ status: "todo",
+ assigneeType: "agent",
+ assigneeId: "agent-1",
+ });
+ useModalStore.getState().close();
+ });
+
let queryClient: QueryClient;
beforeEach(() => {
@@ -247,6 +296,7 @@ describe("TableView cell editors under data refresh", () => {
listAgents: async () => [],
listSquads: async () => [],
getAssigneeFrequency: async () => [],
+ listIssueStatuses: async () => ({ statuses: [] }),
listIssueTableRows: async () => ({
query_fingerprint: "test",
group_key: null,
diff --git a/packages/views/issues/components/table-view.tsx b/packages/views/issues/components/table-view.tsx
index 037cf22547..91e6b94495 100644
--- a/packages/views/issues/components/table-view.tsx
+++ b/packages/views/issues/components/table-view.tsx
@@ -73,6 +73,8 @@ import { Skeleton } from "@multica/ui/components/ui/skeleton";
import { cn } from "@multica/ui/lib/utils";
import { ApiError } from "@multica/core/api";
import { useWorkspaceId } from "@multica/core/hooks";
+import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
+import { useModalStore } from "@multica/core/modals";
import {
issueKeys,
issueTableGroupsOptions,
@@ -117,6 +119,7 @@ import {
useQueryClient,
type UseQueryResult,
} from "@tanstack/react-query";
+import { runConfirmIntent } from "../actions/run-confirm-gate";
import { ActorAvatar } from "../../common/actor-avatar";
import { LabelChip } from "../../labels/label-chip";
import { resolveClickIntent, useIntentNavigate } from "../../navigation";
@@ -933,7 +936,9 @@ type TableViewMeta = {
* remounts and freezes the table structure while it is up. */
editingCellKey: string | null;
setEditingCellKey: (key: string | null) => void;
- updateIssue: (issueId: string, updates: Partial<UpdateIssueRequest>) => void;
+ /** Takes the ISSUE, not its id: the run-confirm gate reads its status
+ * category and owner to decide whether the write needs confirming first. */
+ updateIssue: (issue: Issue, updates: Partial<UpdateIssueRequest>) => void;
openIssue: (issue: Issue, event?: React.MouseEvent) => void;
createSubIssue: (issue: Issue) => void;
toggleTableParentCollapsed: (issueId: string) => void;
@@ -1108,7 +1113,7 @@ function IssueTableBodyCell({
const setEditorOpen = (open: boolean) =>
meta.setEditingCellKey(open ? cellKey : null);
const onUpdate = (updates: Partial<UpdateIssueRequest>) =>
- meta.updateIssue(issue.id, updates);
+ meta.updateIssue(issue, updates);
const propertyId = propertyIdFromViewKey(key);
if (propertyId) {
@@ -1281,6 +1286,8 @@ export function TableView({
const { t } = useT("issues");
const wsId = useWorkspaceId();
const resolveStatusLabel = useStatusLabel(wsId);
+ const { entryOf } = useIssueStatuses(wsId);
+ const openModal = useModalStore((s) => s.open);
const queryClient = useQueryClient();
const intentNavigate = useIntentNavigate();
const paths = useWorkspacePaths();
@@ -2092,10 +2099,20 @@ export function TableView({
[propertyById, t],
);
+ // Inline row edits are single-issue writes like the picker in the issue
+ // detail or the right-click menu, so they route on the same gate: a status
+ // change that promotes an agent-owned issue out of the backlog category
+ // starts a run, and must confirm rather than fire from one click (MUL-6463).
const updateIssue = useCallback(
- (issueId: string, updates: Partial<UpdateIssueRequest>) =>
- actions?.updateIssue(issueId, updates),
- [actions],
+ (issue: Issue, updates: Partial<UpdateIssueRequest>) => {
+ const intent = runConfirmIntent(issue, updates, { entryOf });
+ if (intent) {
+ openModal("issue-run-confirm", intent);
+ return;
+ }
+ actions?.updateIssue(issue.id, updates);
+ },
+ [actions, entryOf, openModal],
);
const openIssue = useCallback(
diff --git a/packages/views/locales/en/modals.json b/packages/views/locales/en/modals.json
index c12de50452..16ceb38aeb 100644
--- a/packages/views/locales/en/modals.json
+++ b/packages/views/locales/en/modals.json
@@ -54,10 +54,13 @@
"title_assign": "Confirm assignment?",
"assign_single": "Assign this issue to {{name}}. They'll start right away if the run conditions are met.",
"assign_batch": "Assign {{count}} issues to {{name}}. They'll start right away if the run conditions are met.",
+ "title_promote": "Start work now?",
+ "promote_single": "Move this issue to {{status}}. {{name}} will start right away if the run conditions are met.",
"note_label": "Handoff note (optional)",
"note_placeholder": "Tell them what matters — scope, focus, or what to avoid…",
"note_unsupported": "Their runtime is too old to receive this handoff note; it may not be read.",
"confirm_assign": "Confirm assignment",
+ "confirm_promote": "Move and start",
"dont_start": "Don't start yet",
"toast_failed": "Action failed",
"create_will_start": "{{name}} will start working right after creation.",
diff --git a/packages/views/locales/ja/modals.json b/packages/views/locales/ja/modals.json
index 9bb2698deb..85fe577569 100644
--- a/packages/views/locales/ja/modals.json
+++ b/packages/views/locales/ja/modals.json
@@ -54,10 +54,13 @@
"title_assign": "割り当てを確認しますか?",
"assign_single": "このタスクを {{name}} に割り当てます。実行条件を満たす場合はすぐに作業を開始します。",
"assign_batch": "{{count}} 件のタスクを {{name}} に割り当てます。実行条件を満たす場合はすぐに作業を開始します。",
+ "title_promote": "今すぐ作業を開始しますか?",
+ "promote_single": "このタスクを {{status}} に移します。実行条件を満たす場合は {{name}} がすぐに作業を開始します。",
"note_label": "引き継ぎメモ(任意)",
"note_placeholder": "範囲・重点・触れてほしくない点などを一言で…",
"note_unsupported": "相手の実行環境が古いため、この引き継ぎメモは読み取れない可能性があります。",
"confirm_assign": "割り当てを確認",
+ "confirm_promote": "移動して開始",
"dont_start": "まだ開始しない",
"toast_failed": "操作に失敗しました",
"create_will_start": "作成後、{{name}} がすぐに作業を開始します。",
diff --git a/packages/views/locales/ko/modals.json b/packages/views/locales/ko/modals.json
index c69202a2a5..d8e1e40970 100644
--- a/packages/views/locales/ko/modals.json
+++ b/packages/views/locales/ko/modals.json
@@ -54,10 +54,13 @@
"title_assign": "할당을 확인할까요?",
"assign_single": "이 태스크를 {{name}}에게 할당합니다. 실행 조건을 충족하면 바로 시작합니다.",
"assign_batch": "{{count}}개 태스크를 {{name}}에게 할당합니다. 실행 조건을 충족하면 바로 시작합니다.",
+ "title_promote": "지금 작업을 시작할까요?",
+ "promote_single": "이 태스크를 {{status}}(으)로 옮깁니다. 실행 조건을 충족하면 {{name}}이(가) 바로 시작합니다.",
"note_label": "인계 메모 (선택)",
"note_placeholder": "범위·핵심·건드리지 말 것 등을 한마디로…",
"note_unsupported": "상대 런타임이 오래되어 이 인계 메모를 읽지 못할 수 있습니다.",
"confirm_assign": "할당 확인",
+ "confirm_promote": "옮기고 시작",
"dont_start": "아직 시작 안 함",
"toast_failed": "작업에 실패했습니다",
"create_will_start": "생성 후 {{name}}이(가) 바로 작업을 시작합니다.",
diff --git a/packages/views/locales/zh-Hans/modals.json b/packages/views/locales/zh-Hans/modals.json
index 0fbc56bc51..af4cd43ec6 100644
--- a/packages/views/locales/zh-Hans/modals.json
+++ b/packages/views/locales/zh-Hans/modals.json
@@ -54,10 +54,13 @@
"title_assign": "确认指派?",
"assign_single": "将这个任务指派给 {{name}};符合运行条件时会立即开始处理。",
"assign_batch": "将 {{count}} 个任务指派给 {{name}};符合运行条件时会立即开始处理。",
+ "title_promote": "现在开始处理?",
+ "promote_single": "把这个任务移到 {{status}};符合运行条件时 {{name}} 会立即开始处理。",
"note_label": "交接说明(可选)",
"note_placeholder": "交代一句——范围、重点、或别碰什么……",
"note_unsupported": "对方的运行环境版本较旧,这条交接说明可能读不到。",
"confirm_assign": "确认指派",
+ "confirm_promote": "移动并开始",
"dont_start": "暂不开始",
"toast_failed": "操作失败",
"create_will_start": "创建后 {{name}} 会立即开始工作。",
diff --git a/packages/views/modals/run-confirm.test.tsx b/packages/views/modals/run-confirm.test.tsx
index 4682edbe57..1cd6bd1065 100644
--- a/packages/views/modals/run-confirm.test.tsx
+++ b/packages/views/modals/run-confirm.test.tsx
@@ -1,5 +1,6 @@
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
+import { buildIssueStatusCatalog } from "@multica/core/issue-statuses";
import {
configureShortcutPlatform,
createShortcutChord,
@@ -28,6 +29,25 @@ vi.mock("@tanstack/react-query", () => ({
},
}));
vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "ws-test" }));
+vi.mock("@multica/core/issue-statuses/hooks", () => ({
+ useIssueStatuses: () =>
+ buildIssueStatusCatalog([
+ {
+ id: "rework",
+ workspace_id: "ws-test",
+ key: "rework",
+ name: "Rework",
+ description: "",
+ category: "todo",
+ color: "#22c55e",
+ is_system: false,
+ position: 0,
+ archived_at: null,
+ created_at: "",
+ updated_at: "",
+ },
+ ]),
+}));
vi.mock("@multica/core/workspace/queries", () => ({
agentListOptions: (wsId: string) => ({ queryKey: ["workspaces", wsId, "agents"] }),
squadListOptions: (wsId: string) => ({ queryKey: ["workspaces", wsId, "squads"] }),
@@ -80,7 +100,13 @@ vi.mock("../i18n", () => ({
confirm_assign: "Confirm assignment",
dont_start: "Don't start yet",
toast_failed: "failed",
+ title_promote: "Start work now?",
+ promote_single: "move to {{status}}, {{name}} starts",
+ confirm_promote: "Move and start",
},
+ // useStatusLabel resolves BUILT-IN keys through i18n and custom ones
+ // through the catalog, so the promote headline needs both sources.
+ status: { todo: "Todo" },
};
return sel(labels).replace(/\{\{(\w+)\}\}/g, (_m, k) => String(vars?.[k] ?? ""));
},
@@ -145,6 +171,17 @@ const single = {
assigneeId: "agent-1",
};
+// Promoting a parked issue out of backlog starts the run on its own, so it
+// confirms through this same dialog — one behaviour for built-in `todo` and
+// every custom Todo-category status alike (MUL-6463).
+const promote = {
+ issueIds: ["issue-1"],
+ mode: "promote" as const,
+ status: "rework",
+ assigneeType: "agent" as const,
+ assigneeId: "agent-1",
+};
+
describe("RunConfirmModal", () => {
it("is fully operable on the first frame — no preview request, no spinner", () => {
// The MUL-5010 core: opening the dialog fires nothing and blocks nothing.
@@ -199,6 +236,44 @@ describe("RunConfirmModal", () => {
expect(screen.getByText("runtime too old")).toBeInTheDocument();
});
+ it("promote sends the status change with the handoff note and no assignee fields", async () => {
+ // The owner is already on the issue: re-sending it would turn a status
+ // write into an assignee write on the server's side of the predicate.
+ render(<RunConfirmModal onClose={vi.fn()} data={promote} />);
+ fireEvent.change(noteBox(), { target: { value: "redo the migration" } });
+ fireEvent.click(screen.getByRole("button", { name: "Move and start" }));
+ await waitFor(() => expect(mockUpdate).toHaveBeenCalledTimes(1));
+ expect(mockUpdate).toHaveBeenCalledWith({
+ id: "issue-1",
+ status: "rework",
+ handoff_note: "redo the migration",
+ });
+ });
+
+ it("promote's 'don't start yet' still moves the issue, without the run", async () => {
+ // The status change is the point; suppress_run is the only difference. This
+ // is the one way to leave backlog WITHOUT waking the agent.
+ render(<RunConfirmModal onClose={vi.fn()} data={promote} />);
+ fireEvent.click(screen.getByText("Don't start yet"));
+ await waitFor(() => expect(mockUpdate).toHaveBeenCalledTimes(1));
+ expect(mockUpdate).toHaveBeenCalledWith({
+ id: "issue-1",
+ status: "rework",
+ suppress_run: true,
+ });
+ });
+
+ it("promote names the target status the way the workspace named it", () => {
+ // A custom status is only recognisable by its catalog name; built-ins keep
+ // resolving through i18n so a zh workspace never reads "In Progress".
+ const { container, rerender } = render(<RunConfirmModal onClose={vi.fn()} data={promote} />);
+ expect(screen.getByText("Start work now?")).toBeInTheDocument();
+ expect(container.textContent).toContain("move to Rework, Walt starts");
+
+ rerender(<RunConfirmModal onClose={vi.fn()} data={{ ...promote, status: "todo" }} />);
+ expect(container.textContent).toContain("move to Todo, Walt starts");
+ });
+
it("resolves a squad's verdict through its leader's runtime, locally", () => {
// A squad run is executed by its leader, so the leader's runtime decides.
// The squad list gives us leader_id, so this needs no server verdict.
diff --git a/packages/views/modals/run-confirm.tsx b/packages/views/modals/run-confirm.tsx
index cc8a555454..cd75e025a8 100644
--- a/packages/views/modals/run-confirm.tsx
+++ b/packages/views/modals/run-confirm.tsx
@@ -14,7 +14,7 @@ import {
import { Button } from "@multica/ui/components/ui/button";
import { Textarea } from "@multica/ui/components/ui/textarea";
import { Spinner } from "@multica/ui/components/ui/spinner";
-import type { IssueAssigneeType, UpdateIssueRequest } from "@multica/core/types";
+import type { IssueAssigneeType, IssueStatus, UpdateIssueRequest } from "@multica/core/types";
import { useUpdateIssue, useBatchUpdateIssues } from "@multica/core/issues/mutations";
import { errorCode } from "@multica/core/api";
import { useActorName } from "@multica/core/workspace/hooks";
@@ -24,34 +24,51 @@ import { runtimeListOptions, readRuntimeCliVersion, handoffSupported } from "@mu
import { useShortcut, shortcutMatchesEvent, isPlainShortcut } from "@multica/core/shortcuts";
import { isImeComposing } from "@multica/core/utils";
import { ShortcutKeycaps } from "../common/shortcut-keycaps";
+import { useStatusLabel } from "../issues/utils/status-label";
import { useT } from "../i18n";
const MAX_HANDOFF_NOTE = 2000;
-// i18next inlines {{name}} into the sentence, but the actor's position varies by
-// language ("{{name}} 会…" vs "Once assigned, {{name}} will…" vs "{{name}}'s
-// leader…"). Fence the name with a sentinel so we can bold just that span at
-// render time without splitting copy into per-language prefix/suffix keys.
-const NAME_FENCE = "\u0000";
+// i18next inlines {{name}} / {{status}} into the sentence, but their position
+// varies by language ("{{name}} 会…" vs "Once assigned, {{name}} will…" vs
+// "{{name}}'s leader…"). Fence each one with a sentinel so we can bold just
+// those spans at render time without splitting copy into per-language
+// prefix/suffix keys. Bolding is also what marks a custom status name as a
+// status rather than an ordinary word ("Move this issue to Later.").
+const FENCE = "\u0000";
-function boldName(text: string): ReactNode {
- const parts = text.split(NAME_FENCE);
- if (parts.length !== 3) return text;
+const fenced = (value: string) => `${FENCE}${value}${FENCE}`;
+
+function boldFenced(text: string): ReactNode {
+ const parts = text.split(FENCE);
+ // Every fenced span contributes one odd-indexed part; an unfenced string is
+ // a single part and renders as-is.
+ if (parts.length < 3) return text;
return (
<>
- {parts[0]}
- <span className="font-semibold text-foreground">{parts[1]}</span>
- {parts[2]}
+ {parts.map((part, i) =>
+ i % 2 === 1 ? (
+ <span key={i} className="font-semibold text-foreground">
+ {part}
+ </span>
+ ) : (
+ part
+ ),
+ )}
</>
);
}
interface RunConfirmData {
issueIds?: string[];
- // Assign is the only mode: agent/squad assignment is the sole issue write that
- // needs the pre-trigger confirmation. Batch status changes apply directly now
- // (MUL-4155), so there is no "status" mode.
- mode?: "assign";
+ // The two issue writes that hand work to an agent, and the only two that
+ // confirm. `assign` gives the issue an agent/squad owner; `promote` moves an
+ // already-owned issue out of the backlog category, which starts the run on
+ // its own (RunSourceStatus). Batch status changes still apply directly
+ // (MUL-4155) — `promote` is the single-issue picker path only (MUL-6463).
+ mode?: "assign" | "promote";
+ /** promote only: the status KEY the issue is moving to. */
+ status?: IssueStatus;
assigneeType?: IssueAssigneeType;
assigneeId?: string;
assigneeName?: string;
@@ -59,9 +76,9 @@ interface RunConfirmData {
}
/**
- * Assignment confirmation for issues that may start agent runs.
+ * Handoff confirmation for the issue writes that start agent runs.
*
- * The rule is "dialog = you are confirming an assignment", NOT "you are
+ * The rule is "dialog = you are handing this to an agent", NOT "you are
* confirming N runs" (MUL-5010). It therefore does no pre-flight prediction:
* opening it fires no request, so the note box and buttons are usable on the
* first frame. Previously it called POST /api/issues/preview-trigger on open
@@ -69,11 +86,12 @@ interface RunConfirmData {
* keyed per issue id with staleTime 0, every new issue was a guaranteed cache
* miss and the wait was unavoidable.
*
- * Completion is silent: the assignee change and any run it starts surface
- * through the issue's normal assignee / run-status updates, so the confirm adds
- * no result toast. Whether a run starts stays the server's existing decision at
- * write time. Dismissing the dialog (X / Esc / click-outside) cancels without
- * any write. Shared by single assign (1 id) and batch assign (N ids).
+ * Completion is silent: the assignee/status change and any run it starts
+ * surface through the issue's normal updates, so the confirm adds no result
+ * toast. Whether a run starts stays the server's existing decision at write
+ * time. Dismissing the dialog (X / Esc / click-outside) cancels without any
+ * write. Shared by single assign (1 id), batch assign (N ids), and the
+ * single-issue promotion out of backlog.
*/
export function RunConfirmModal({
onClose,
@@ -108,6 +126,9 @@ export function RunConfirmModal({
// yet, or no runtime bound) and leaves the box enabled: the note is a soft
// gate, and a spurious warning is worse than a note an old daemon drops.
const wsId = useWorkspaceId();
+ // Built-ins resolve through i18n, custom statuses through the catalog, so the
+ // promotion headline reads the same way the picker the user just used does.
+ const statusLabel = useStatusLabel(wsId);
const { data: agents = [] } = useQuery({ ...agentListOptions(wsId), enabled: !!wsId });
const { data: runtimes = [] } = useQuery({ ...runtimeListOptions(wsId), enabled: !!wsId });
const { data: squads = [] } = useQuery({ ...squadListOptions(wsId), enabled: !!wsId });
@@ -133,11 +154,18 @@ export function RunConfirmModal({
// the assignment proceed (MUL-3375 §6.3).
const noteDisabled = localHandoff === false;
+ // A promotion carries the status and nothing else: the owner is already on
+ // the issue, and re-sending the same assignee would turn a status write into
+ // an assignee write on the server's side of the trigger predicate.
+ const isPromote = d.mode === "promote" && !!d.status;
+
const applyTo = (extra: Partial<UpdateIssueRequest>) => {
- const base: UpdateIssueRequest = {
- assignee_type: d.assigneeType ?? null,
- assignee_id: d.assigneeId ?? null,
- };
+ const base: UpdateIssueRequest = isPromote
+ ? { status: d.status }
+ : {
+ assignee_type: d.assigneeType ?? null,
+ assignee_id: d.assigneeId ?? null,
+ };
return { ...base, ...extra };
};
@@ -209,24 +237,33 @@ export function RunConfirmModal({
void submit(false);
};
- // States the action, not a prediction: the assignment is certain, the run is
- // conditional, so the copy names no run count.
- const headline: ReactNode = boldName(
- issueIds.length > 1
- ? t(($) => $.run_confirm.assign_batch, {
- name: `${NAME_FENCE}${assigneeName}${NAME_FENCE}`,
- count: issueIds.length,
+ // States the action, not a prediction: the write is certain, the run is
+ // conditional, so the copy names no run count. The promotion names the
+ // status it is moving to by its workspace label — a custom status is only
+ // recognisable by the name its admin gave it.
+ const headline: ReactNode = boldFenced(
+ isPromote
+ ? t(($) => $.run_confirm.promote_single, {
+ name: fenced(assigneeName),
+ status: fenced(statusLabel(d.status ?? "")),
})
- : t(($) => $.run_confirm.assign_single, {
- name: `${NAME_FENCE}${assigneeName}${NAME_FENCE}`,
- }),
+ : issueIds.length > 1
+ ? t(($) => $.run_confirm.assign_batch, {
+ name: fenced(assigneeName),
+ count: issueIds.length,
+ })
+ : t(($) => $.run_confirm.assign_single, { name: fenced(assigneeName) }),
);
return (
<Dialog open onOpenChange={(v) => { if (!v && !submitting) onClose(); }}>
<DialogContent onKeyDown={onDialogKeyDown}>
<DialogHeader>
- <DialogTitle>{t(($) => $.run_confirm.title_assign)}</DialogTitle>
+ <DialogTitle>
+ {isPromote
+ ? t(($) => $.run_confirm.title_promote)
+ : t(($) => $.run_confirm.title_assign)}
+ </DialogTitle>
<DialogDescription>{headline}</DialogDescription>
</DialogHeader>
@@ -261,8 +298,10 @@ export function RunConfirmModal({
<Spinner className="size-4" />
) : (
<>
- {t(($) => $.run_confirm.confirm_assign)}
- {/* Decorative: the accessible name stays "Confirm assignment",
+ {isPromote
+ ? t(($) => $.run_confirm.confirm_promote)
+ : t(($) => $.run_confirm.confirm_assign)}
+ {/* Decorative: the accessible name stays the button's own copy,
not "Confirm assignment Command Enter". Absent when `send`
is unbound. */}
{sendShortcut ? (
diff --git a/server/internal/handler/issue_trigger_backlog_category_test.go b/server/internal/handler/issue_trigger_backlog_category_test.go
new file mode 100644
index 0000000000..ec48e81cec
--- /dev/null
+++ b/server/internal/handler/issue_trigger_backlog_category_test.go
@@ -0,0 +1,81 @@
+package handler
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "testing"
+ "time"
+
+ "github.com/multica-ai/multica/server/internal/testutil"
+)
+
+// A move WITHIN the backlog category must not start a run (MUL-6463).
+//
+// Before custom statuses, leaving the `backlog` key was always leaving the
+// backlog category, so the trigger could key on the key change alone. Once a
+// workspace can define its own parking-lot statuses, `backlog` → `later` is a
+// key change whose category never moves — and starting an agent on it breaks
+// the one promise backlog makes. The UI does not confirm such a move either,
+// so a run here would be a silent start.
+func TestBacklogToCustomBacklogStatusDoesNotTrigger(t *testing.T) {
+ if testHandler == nil {
+ t.Skip("database not available")
+ }
+ ctx := context.Background()
+
+ agentID := createHandlerTestAgent(t, "Backlog Category Move Agent", nil)
+ parkedKey := fmt.Sprintf("later_%d", time.Now().UnixNano())
+ if _, err := testPool.Exec(ctx, `
+ INSERT INTO issue_status (workspace_id, key, name, description, category, color, position)
+ VALUES ($1, $2, 'Later', '', 'backlog', '#ff0000', 1)
+ `, testWorkspaceID, parkedKey); err != nil {
+ t.Fatalf("create custom backlog status: %v", err)
+ }
+ t.Cleanup(func() {
+ testPool.Exec(ctx, `DELETE FROM issue_status WHERE workspace_id = $1 AND key = $2`, testWorkspaceID, parkedKey)
+ })
+
+ req := newRequest("POST", "/api/issues?workspace_id="+testWorkspaceID, map[string]any{
+ "title": "Parked issue",
+ "status": "backlog",
+ "assignee_type": "agent",
+ "assignee_id": agentID,
+ })
+ w := testutil.Call(t, testHandler.CreateIssue, req).Want(http.StatusCreated)
+ var created IssueResponse
+ json.NewDecoder(w.Body).Decode(&created)
+ t.Cleanup(func() {
+ testPool.Exec(ctx, `DELETE FROM agent_task_queue WHERE issue_id = $1`, created.ID)
+ testPool.Exec(ctx, `DELETE FROM issue WHERE id = $1`, created.ID)
+ })
+
+ // backlog → custom backlog-category status: still parked.
+ req = newRequest("PUT", "/api/issues/"+created.ID, map[string]any{"status": parkedKey})
+ req = withURLParam(req, "id", created.ID)
+ testutil.Call(t, testHandler.UpdateIssue, req).Want(http.StatusOK)
+
+ var tasks int
+ dbfx.QueryRow(t,
+ `SELECT count(*) FROM agent_task_queue WHERE issue_id = $1 AND agent_id = $2 AND status = 'queued'`,
+ created.ID, agentID,
+ ).Scan(&tasks)
+ if tasks != 0 {
+ t.Fatalf("moving inside the backlog category must not enqueue a run, got %d queued tasks", tasks)
+ }
+
+ // Leaving the category still does, from the custom parked status too — the
+ // fix must not cost the promotion it exists to allow.
+ req = newRequest("PUT", "/api/issues/"+created.ID, map[string]any{"status": "todo"})
+ req = withURLParam(req, "id", created.ID)
+ testutil.Call(t, testHandler.UpdateIssue, req).Want(http.StatusOK)
+
+ dbfx.QueryRow(t,
+ `SELECT count(*) FROM agent_task_queue WHERE issue_id = $1 AND agent_id = $2 AND status = 'queued'`,
+ created.ID, agentID,
+ ).Scan(&tasks)
+ if tasks != 1 {
+ t.Fatalf("promotion out of the backlog category must enqueue exactly 1 run, got %d", tasks)
+ }
+}
diff --git a/server/internal/service/issue_trigger.go b/server/internal/service/issue_trigger.go
index 09d1abfcb4..954ef0dfc9 100644
--- a/server/internal/service/issue_trigger.go
+++ b/server/internal/service/issue_trigger.go
@@ -104,6 +104,13 @@ func (s *IssueService) WillEnqueueRun(ctx context.Context, in IssueTriggerInput,
canAccess = allowAllAgents
}
+ // The status source also requires LEAVING the backlog category, not merely
+ // changing the status key. Before custom statuses a key change out of
+ // `backlog` was always a category change, so the two were the same
+ // condition; now `backlog` → a custom status in the `backlog` category is a
+ // move within the parking lot, and starting a run on it would break the one
+ // promise backlog makes. (MUL-6463)
+ //
// Both sides of the transition are normalized to the canonical status they
// inherit, so a custom status in the `backlog` category parks exactly like
// Backlog and a custom status in the `todo` category starts a run exactly
@@ -122,6 +129,7 @@ func (s *IssueService) WillEnqueueRun(ctx context.Context, in IssueTriggerInput,
}
source = RunSourceAssign
case in.StatusChanged && prevStatus == "backlog" &&
+ currentStatus != "backlog" &&
currentStatus != "done" && currentStatus != "cancelled":
if probe.IsSelfLoop != nil && probe.IsSelfLoop() {
return IssueRunTrigger{}, false