Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-3244: Bind quick-create attachments to created issues (#4062)
Bohan Jiangc8ab73d38d46
diff --git a/packages/core/api/client.ts b/packages/core/api/client.tsindex 7935b10f99..903ac538b3 100644--- a/packages/core/api/client.ts+++ b/packages/core/api/client.ts@@ -565,6 +565,7 @@ export class ApiClient {prompt: string;project_id?: string | null;parent_issue_id?: string | null;+ attachment_ids?: string[];}): Promise<{ task_id: string }> {return this.fetch("/api/issues/quick-create", {method: "POST",diff --git a/packages/core/runtimes/cli-version.test.ts b/packages/core/runtimes/cli-version.test.tsindex ea05fba86f..08e7eb4678 100644--- a/packages/core/runtimes/cli-version.test.ts+++ b/packages/core/runtimes/cli-version.test.ts@@ -3,11 +3,12 @@ import { checkQuickCreateCliVersion } from "./cli-version";describe("checkQuickCreateCliVersion", () => {it("returns ok for a tagged release at or above the minimum", () => {- expect(checkQuickCreateCliVersion("v0.2.20").state).toBe("ok");+ expect(checkQuickCreateCliVersion("v0.2.21").state).toBe("ok");expect(checkQuickCreateCliVersion("0.3.1").state).toBe("ok");});it("returns too_old for a tagged release below the minimum", () => {+ expect(checkQuickCreateCliVersion("v0.2.20").state).toBe("too_old");expect(checkQuickCreateCliVersion("v0.2.15").state).toBe("too_old");});diff --git a/packages/core/runtimes/cli-version.ts b/packages/core/runtimes/cli-version.tsindex e7c8e0891e..6bce638406 100644--- a/packages/core/runtimes/cli-version.ts+++ b/packages/core/runtimes/cli-version.ts@@ -2,15 +2,15 @@* Frontend mirror of the server's MinQuickCreateCLIVersion gate. The* agent-create flow (Quick Create modal) requires the daemon's bundled* multica CLI to be at least this version — older daemons either- * double-create issues on partial CLI failures or mishandle pasted- * screenshot URLs (see PR #1851 / MUL-1496).+ * double-create issues on partial CLI failures, drop quick-create attachment+ * bindings, or mishandle pasted screenshot URLs (see PR #1851 / MUL-1496).** Both the frontend pre-validation in the modal and the server's* `/api/issues/quick-create` handler enforce this; the server is the* authoritative trust boundary, the frontend just lets us tell the user* "your daemon needs an upgrade" before they hit submit.*/-export const MIN_QUICK_CREATE_CLI_VERSION = "0.2.20";+export const MIN_QUICK_CREATE_CLI_VERSION = "0.2.21";export type CliVersionState = "ok" | "too_old" | "missing";diff --git a/packages/views/modals/quick-create-issue.test.tsx b/packages/views/modals/quick-create-issue.test.tsxindex ba2c70b58c..1ab7e2d770 100644--- a/packages/views/modals/quick-create-issue.test.tsx+++ b/packages/views/modals/quick-create-issue.test.tsx@@ -1,6 +1,6 @@import { forwardRef, useImperativeHandle, useRef, useState, type ReactNode } from "react";import { describe, it, expect, vi, beforeEach } from "vitest";-import { render, screen, waitFor } from "@testing-library/react";+import { fireEvent, render, screen, waitFor } from "@testing-library/react";import userEvent from "@testing-library/user-event";const mockQuickCreateIssue = vi.hoisted(() => vi.fn());@@ -11,6 +11,7 @@ const mockClearPrompt = vi.hoisted(() => vi.fn());const mockSetKeepOpen = vi.hoisted(() => vi.fn());const mockSetLastMode = vi.hoisted(() => vi.fn());const mockToastSuccess = vi.hoisted(() => vi.fn());+const mockUploadWithToast = vi.hoisted(() => vi.fn());const mockQuickCreateStore = {lastActorType: null as "agent" | "squad" | null,@@ -116,7 +117,7 @@ vi.mock("@multica/core/runtimes", () => ({}));vi.mock("@multica/core/hooks/use-file-upload", () => ({- useFileUpload: () => ({ uploadWithToast: vi.fn(), uploading: false }),+ useFileUpload: () => ({ uploadWithToast: mockUploadWithToast, uploading: false }),}));vi.mock("../issues/components/pickers/assignee-picker", () => ({@@ -141,7 +142,7 @@ vi.mock("../common/pill-button", () => ({}));vi.mock("../editor", () => {- const ContentEditor = forwardRef(({ defaultValue, onUpdate, onSubmit, placeholder }: any, ref: any) => {+ const ContentEditor = forwardRef(({ defaultValue, onUpdate, onSubmit, onUploadFile, placeholder }: any, ref: any) => {const valueRef = useRef(defaultValue || "");const [value, setValue] = useState(defaultValue || "");@@ -156,20 +157,28 @@ vi.mock("../editor", () => {}));return (- <textarea- value={value}- placeholder={placeholder}- onChange={(e) => {- valueRef.current = e.target.value;- setValue(e.target.value);- onUpdate?.(e.target.value);- }}- onKeyDown={(e) => {- if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {- onSubmit?.();- }- }}- />+ <>+ <textarea+ value={value}+ placeholder={placeholder}+ onChange={(e) => {+ valueRef.current = e.target.value;+ setValue(e.target.value);+ onUpdate?.(e.target.value);+ }}+ onKeyDown={(e) => {+ if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {+ onSubmit?.();+ }+ }}+ />+ <button+ type="button"+ onClick={() => onUploadFile?.(new File(["image"], "shot.png", { type: "image/png" }))}+ >+ Mock editor upload+ </button>+ </>);});ContentEditor.displayName = "ContentEditor";@@ -287,6 +296,23 @@ describe("AgentCreatePanel", () => {mockProjectsQuery.isSuccess = true;mockSquadsData.list = [];mockQuickCreateIssue.mockResolvedValue(undefined);+ mockUploadWithToast.mockResolvedValue({+ id: "019ec09d-6222-722b-bdfa-427b105d80be",+ workspace_id: "ws-test",+ issue_id: null,+ comment_id: null,+ chat_session_id: null,+ chat_message_id: null,+ uploader_type: "member",+ uploader_id: "user-1",+ filename: "shot.png",+ url: "/uploads/shot.png",+ download_url: "/api/attachments/019ec09d-6222-722b-bdfa-427b105d80be/download",+ markdown_url: "/api/attachments/019ec09d-6222-722b-bdfa-427b105d80be/download",+ content_type: "image/png",+ size_bytes: 5,+ created_at: "2026-06-12T00:00:00Z",+ });mockSetKeepOpen.mockImplementation((value: boolean) => {mockQuickCreateStore.keepOpen = value;});@@ -335,6 +361,38 @@ describe("AgentCreatePanel", () => {expect(onClose).toHaveBeenCalled();});+ it("passes referenced upload attachment ids to quick-create", async () => {+ const user = userEvent.setup();+ const onClose = vi.fn();++ renderPanel({ onClose, isExpanded: false, setIsExpanded: vi.fn() });++ await user.click(screen.getByRole("button", { name: "Mock editor upload" }));+ await waitFor(() => expect(mockUploadWithToast).toHaveBeenCalled());++ const editor = screen.getByPlaceholderText(+ 'Tell the agent what to do, e.g. "let Bohan fix the inbox loading slowness in the Web project"',+ );+ await user.clear(editor);+ fireEvent.change(editor, {+ target: {+ value: "Create issue with ",+ },+ });++ await user.click(screen.getByRole("button", { name: /^Create \(/i }));++ await waitFor(() => {+ expect(mockQuickCreateIssue).toHaveBeenCalledWith({+ agent_id: "agent-1",+ prompt: "Create issue with ",+ project_id: undefined,+ parent_issue_id: undefined,+ attachment_ids: ["019ec09d-6222-722b-bdfa-427b105d80be"],+ });+ });+ });+// Picking a squad routes the submission through `squad_id` (not// `agent_id`) so the backend can resolve the squad's leader agent and// inject the squad-leader briefing on dispatch. The persisted preferencediff --git a/packages/views/modals/quick-create-issue.tsx b/packages/views/modals/quick-create-issue.tsxindex 783fa3a024..feb9496536 100644--- a/packages/views/modals/quick-create-issue.tsx+++ b/packages/views/modals/quick-create-issue.tsx@@ -26,7 +26,7 @@ import {} from "@multica/core/runtimes";import { useFileUpload } from "@multica/core/hooks/use-file-upload";import { formatShortcut, modKey, enterKey } from "@multica/core/platform";-import type { Agent, Squad } from "@multica/core/types";+import { contentReferencesAttachment, type Agent, type Attachment, type Squad } from "@multica/core/types";import { ActorAvatar } from "../common/actor-avatar";import { PillButton } from "../common/pill-button";import { ProjectPicker } from "../projects/components/project-picker";@@ -257,15 +257,21 @@ export function AgentCreatePanel({const [justSent, setJustSent] = useState(false);const [sentCount, setSentCount] = useState(0);const [error, setError] = useState<string | null>(null);+ const [pendingAttachments, setPendingAttachments] = useState<Attachment[]>([]);// Image paste/drop support: route uploads through the same helper Advanced// uses, so users can paste screenshots straight into the prompt and the// agent receives them as embedded markdown image URLs in the prompt.const { uploadWithToast, uploading } = useFileUpload(api);- const handleUploadFile = useCallback(- (file: File) => uploadWithToast(file),- [uploadWithToast],- );+ const handleUploadFile = useCallback(async (file: File) => {+ const result = await uploadWithToast(file);+ if (result) {+ setPendingAttachments((prev) =>+ prev.some((a) => a.id === result.id) ? prev : [...prev, result],+ );+ }+ return result;+ }, [uploadWithToast]);const { isDragOver, dropZoneProps } = useFileDropZone({onDrop: (files) => files.forEach((f) => editorRef.current?.uploadFile(f)),});@@ -281,6 +287,9 @@ export function AgentCreatePanel({const submit = async () => {const md = editorRef.current?.getMarkdown()?.trim() ?? "";if (!md || !actor || submitting || versionBlocked || uploading) return;+ const activeAttachmentIds = pendingAttachments+ .filter((a) => contentReferencesAttachment(md, a))+ .map((a) => a.id);setSubmitting(true);setError(null);try {@@ -291,6 +300,7 @@ export function AgentCreatePanel({prompt: md,project_id: projectId ?? undefined,parent_issue_id: parentIssueId,+ ...(activeAttachmentIds.length > 0 ? { attachment_ids: activeAttachmentIds } : {}),});setLastActor(actor.type, actor.id);setLastProjectId(projectId);@@ -303,6 +313,7 @@ export function AgentCreatePanel({// Stay open for continuous creation — clear the editor so the// user can immediately type the next prompt.editorRef.current?.clearContent();+ setPendingAttachments([]);setHasContent(false);setSentCount((c) => c + 1);setJustSent(true);@@ -469,6 +480,7 @@ export function AgentCreatePanel({setPrompt(md);}}onUploadFile={handleUploadFile}+ attachments={pendingAttachments}onSubmit={submit}debounceMs={150}/>diff --git a/server/cmd/multica/cmd_issue.go b/server/cmd/multica/cmd_issue.goindex 5062e54079..7e6ed1421d 100644--- a/server/cmd/multica/cmd_issue.go+++ b/server/cmd/multica/cmd_issue.go@@ -296,6 +296,7 @@ func init() {issueCreateCmd.Flags().Bool("allow-duplicate", false, "Allow creating an issue even when an active duplicate exists")issueCreateCmd.Flags().String("output", "json", "Output format: table or json")issueCreateCmd.Flags().StringSlice("attachment", nil, "File path(s) to attach (can be specified multiple times)")+ issueCreateCmd.Flags().StringSlice("attachment-id", nil, "Existing attachment UUID(s) to bind to the created issue (can be specified multiple times)")// issue updateissueUpdateCmd.Flags().String("title", "", "New title")@@ -624,6 +625,35 @@ func isHTTPURL(path string) bool {return strings.HasPrefix(p, "http://") || strings.HasPrefix(p, "https://")}+func appendUniqueStrings(dst []string, values ...string) []string {+ seen := make(map[string]struct{}, len(dst)+len(values))+ out := make([]string, 0, len(dst)+len(values))+ for _, v := range append(dst, values...) {+ v = strings.TrimSpace(v)+ if v == "" {+ continue+ }+ if _, ok := seen[v]; ok {+ continue+ }+ seen[v] = struct{}{}+ out = append(out, v)+ }+ return out+}++func quickCreateAttachmentIDsFromEnv() ([]string, error) {+ raw := strings.TrimSpace(os.Getenv("MULTICA_QUICK_CREATE_ATTACHMENT_IDS"))+ if raw == "" {+ return nil, nil+ }+ var ids []string+ if err := json.Unmarshal([]byte(raw), &ids); err != nil {+ return nil, fmt.Errorf("parse MULTICA_QUICK_CREATE_ATTACHMENT_IDS: %w", err)+ }+ return appendUniqueStrings(nil, ids...), nil+}+func runIssueCreate(cmd *cobra.Command, _ []string) error {title, _ := cmd.Flags().GetString("title")if title == "" {@@ -701,6 +731,15 @@ func runIssueCreate(cmd *cobra.Command, _ []string) error {body["origin_type"] = "quick_create"body["origin_id"] = taskID}+ attachmentIDs, _ := cmd.Flags().GetStringSlice("attachment-id")+ envAttachmentIDs, err := quickCreateAttachmentIDsFromEnv()+ if err != nil {+ return err+ }+ attachmentIDs = appendUniqueStrings(attachmentIDs, envAttachmentIDs...)+ if len(attachmentIDs) > 0 {+ body["attachment_ids"] = attachmentIDs+ }// Pre-validate attachments BEFORE creating the issue so a bad path// can never produce a half-created issue (which would otherwisediff --git a/server/cmd/multica/cmd_issue_test.go b/server/cmd/multica/cmd_issue_test.goindex f22fa38be3..a2e200aaa7 100644--- a/server/cmd/multica/cmd_issue_test.go+++ b/server/cmd/multica/cmd_issue_test.go@@ -242,6 +242,7 @@ func newIssueCreateTestCmd() *cobra.Command {cmd.Flags().Bool("allow-duplicate", false, "")cmd.Flags().String("output", "json", "")cmd.Flags().StringSlice("attachment", nil, "")+ cmd.Flags().StringSlice("attachment-id", nil, "")return cmd}@@ -283,6 +284,54 @@ func TestRunIssueCreateSendsAllowDuplicate(t *testing.T) {}}+func TestRunIssueCreateSendsExistingAttachmentIDs(t *testing.T) {+ var body map[string]any+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if r.URL.Path != "/api/issues" {+ http.NotFound(w, r)+ return+ }+ if err := json.NewDecoder(r.Body).Decode(&body); err != nil {+ t.Errorf("decode body: %v", err)+ }+ json.NewEncoder(w).Encode(map[string]any{+ "id": "issue-1",+ "identifier": "MUL-1",+ "title": "With attachments",+ "status": "todo",+ "priority": "none",+ })+ }))+ defer srv.Close()++ t.Setenv("MULTICA_SERVER_URL", srv.URL)+ t.Setenv("MULTICA_WORKSPACE_ID", "ws-1")+ t.Setenv("MULTICA_TOKEN", "test-token")+ t.Setenv("MULTICA_QUICK_CREATE_ATTACHMENT_IDS", `["att-env","att-shared"]`)++ cmd := newIssueCreateTestCmd()+ _ = cmd.Flags().Set("title", "With attachments")+ _ = cmd.Flags().Set("attachment-id", "att-flag")+ _ = cmd.Flags().Set("attachment-id", "att-shared")+ if err := runIssueCreate(cmd, nil); err != nil {+ t.Fatalf("runIssueCreate: %v", err)+ }++ got, ok := body["attachment_ids"].([]any)+ if !ok {+ t.Fatalf("attachment_ids = %#v, want JSON array", body["attachment_ids"])+ }+ want := []string{"att-flag", "att-shared", "att-env"}+ if len(got) != len(want) {+ t.Fatalf("attachment_ids length = %d, want %d (%#v)", len(got), len(want), got)+ }+ for i, w := range want {+ if got[i] != w {+ t.Fatalf("attachment_ids[%d] = %#v, want %q (all=%#v)", i, got[i], w, got)+ }+ }+}+func TestRunIssueCreateShowsDuplicateMessage(t *testing.T) {want := "Active duplicate issue exists: YUA-36 SH-PM-SYNTH-01 Synthesize recommendation-to-shortlist planning outputs (status: in_progress). Set allow_duplicate=true or use --allow-duplicate to create another."srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {diff --git a/server/cmd/server/quick_create_subscriber_test.go b/server/cmd/server/quick_create_subscriber_test.goindex b694cc2591..14e638a1fe 100644--- a/server/cmd/server/quick_create_subscriber_test.go+++ b/server/cmd/server/quick_create_subscriber_test.go@@ -38,6 +38,7 @@ func TestQuickCreateCompletion_SubscribesRequester(t *testing.T) {"please file a bug",pgtype.UUID{},pgtype.UUID{},+ nil,)if err != nil {t.Fatalf("EnqueueQuickCreateTask: %v", err)@@ -112,6 +113,7 @@ func TestQuickCreateFailure_DoesNotSubscribeRequester(t *testing.T) {"another bug",pgtype.UUID{},pgtype.UUID{},+ nil,)if err != nil {t.Fatalf("EnqueueQuickCreateTask: %v", err)diff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.goindex dcef115f53..3c29ed7b2d 100644--- a/server/internal/daemon/daemon.go+++ b/server/internal/daemon/daemon.go@@ -2850,6 +2850,13 @@ func (d *Daemon) runTask(ctx context.Context, task Task, provider string, slot i// deterministically (see GetIssueByOrigin).if task.QuickCreatePrompt != "" {agentEnv["MULTICA_QUICK_CREATE_TASK_ID"] = task.ID+ if len(task.QuickCreateAttachmentIDs) > 0 {+ if raw, err := json.Marshal(task.QuickCreateAttachmentIDs); err == nil {+ agentEnv["MULTICA_QUICK_CREATE_ATTACHMENT_IDS"] = string(raw)+ } else {+ taskLog.Warn("quick-create attachment ids: marshal failed; skipping env injection", "error", err)+ }+ }}// Ensure the multica CLI is on PATH inside the agent's environment.// Some runtimes (e.g. Codex) run in an isolated sandbox that may notdiff --git a/server/internal/daemon/prompt.go b/server/internal/daemon/prompt.goindex 6b7e448087..69a322ddc6 100644--- a/server/internal/daemon/prompt.go+++ b/server/internal/daemon/prompt.go@@ -231,6 +231,7 @@ func buildChatPrompt(task Task) string {}}b.WriteString("Use `multica attachment download <id>` to fetch each file locally before referring to it.\n")+ b.WriteString("When creating an issue that should preserve one of these attachments, pass `--attachment-id <id>` to `multica issue create` in addition to keeping the attachment markdown inline.\n")}return b.String()}diff --git a/server/internal/daemon/prompt_test.go b/server/internal/daemon/prompt_test.goindex 069a51ca65..010d26ced5 100644--- a/server/internal/daemon/prompt_test.go+++ b/server/internal/daemon/prompt_test.go@@ -249,6 +249,27 @@ func TestBuildPromptSquadLeaderNoActionForAgentTrigger(t *testing.T) {}}+func TestBuildChatPromptAttachmentIDsCanBeBoundToCreatedIssues(t *testing.T) {+ task := Task{+ ChatSessionID: "sess-1",+ ChatMessage: "please create an issue with this screenshot",+ ChatMessageAttachments: []ChatAttachmentMeta{+ {ID: "019ec09d-6222-722b-bdfa-427b105d80be", Filename: "shot.png", ContentType: "image/png"},+ },+ }+ out := BuildPrompt(task, "claude")+ for _, want := range []string{+ "Attachments on this message:",+ "id=019ec09d-6222-722b-bdfa-427b105d80be",+ "multica attachment download <id>",+ "--attachment-id <id>",+ } {+ if !strings.Contains(out, want) {+ t.Errorf("chat prompt missing %q\n--- output ---\n%s", want, out)+ }+ }+}+func TestBuildChatPromptSlashSkills(t *testing.T) {t.Run("injects selected skills block", func(t *testing.T) {task := Task{diff --git a/server/internal/daemon/types.go b/server/internal/daemon/types.goindex 16c83e3189..28d4ee74e1 100644--- a/server/internal/daemon/types.go+++ b/server/internal/daemon/types.go@@ -43,36 +43,37 @@ type Task struct {// prompt set in Settings → General). Server populates this on every claim// regardless of task kind so the daemon can inject `## Workspace Context`// into the brief. Empty when the owner hasn't set one.- WorkspaceContext string `json:"workspace_context,omitempty"`- ThreadName string `json:"thread_name,omitempty"` // semantic title for provider-native session/thread history- Agent *AgentData `json:"agent,omitempty"`- Repos []RepoData `json:"repos,omitempty"`- ProjectID string `json:"project_id,omitempty"` // issue's project, when present- ProjectTitle string `json:"project_title,omitempty"` // human-readable project title for context injection- ProjectResources []ProjectResourceData `json:"project_resources,omitempty"` // project-scoped resources to expose to the agent- PriorSessionID string `json:"prior_session_id,omitempty"` // Claude session ID from a previous task on this issue- PriorWorkDir string `json:"prior_work_dir,omitempty"` // work_dir from a previous task on this issue- TriggerCommentID string `json:"trigger_comment_id,omitempty"` // comment that triggered this task- TriggerThreadID string `json:"trigger_thread_id,omitempty"` // root comment ID for the triggering thread; falls back to trigger_comment_id on old servers- TriggerCommentContent string `json:"trigger_comment_content,omitempty"` // content of the triggering comment- TriggerAuthorType string `json:"trigger_author_type,omitempty"` // "agent" or "member" — author kind for the triggering comment- TriggerAuthorName string `json:"trigger_author_name,omitempty"` // display name of the triggering comment author- NewCommentCount int `json:"new_comment_count,omitempty"` // issue-wide comments since this agent's last run (excludes its own and the injected trigger); 0/omitted for old daemons or cold start- NewCommentsSince string `json:"new_comments_since,omitempty"` // RFC3339 anchor (last run's started_at) the count is measured from; empty on cold start- ChatSessionID string `json:"chat_session_id,omitempty"` // non-empty for chat tasks- ChatMessage string `json:"chat_message,omitempty"` // user message content for chat tasks- ChatMessageAttachments []ChatAttachmentMeta `json:"chat_message_attachments,omitempty"` // attachments linked to the chat message; agent uses these to `multica attachment download <id>`- AutopilotRunID string `json:"autopilot_run_id,omitempty"` // non-empty for autopilot run_only tasks- AutopilotID string `json:"autopilot_id,omitempty"` // autopilot that spawned this run- AutopilotTitle string `json:"autopilot_title,omitempty"` // autopilot title used as task context- AutopilotDescription string `json:"autopilot_description,omitempty"` // autopilot description used as task prompt- AutopilotSource string `json:"autopilot_source,omitempty"` // manual, schedule, webhook, or api- AutopilotTriggerPayload json.RawMessage `json:"autopilot_trigger_payload,omitempty"` // optional trigger payload for webhook/api runs- QuickCreatePrompt string `json:"quick_create_prompt,omitempty"` // user's natural-language input for quick-create tasks- SquadID string `json:"squad_id,omitempty"` // when the picker was a squad, the squad's UUID; Agent is still the resolved leader- SquadName string `json:"squad_name,omitempty"` // display name for the picker squad, used in prompt text- ParentIssueID string `json:"parent_issue_id,omitempty"` // for quick-create tasks opened from "Add sub issue" — UUID of the parent issue the new issue should be filed under- ParentIssueIdentifier string `json:"parent_issue_identifier,omitempty"` // human-readable identifier (e.g. MUL-123) of the quick-create parent issue, used in prompt context+ WorkspaceContext string `json:"workspace_context,omitempty"`+ ThreadName string `json:"thread_name,omitempty"` // semantic title for provider-native session/thread history+ Agent *AgentData `json:"agent,omitempty"`+ Repos []RepoData `json:"repos,omitempty"`+ ProjectID string `json:"project_id,omitempty"` // issue's project, when present+ ProjectTitle string `json:"project_title,omitempty"` // human-readable project title for context injection+ ProjectResources []ProjectResourceData `json:"project_resources,omitempty"` // project-scoped resources to expose to the agent+ PriorSessionID string `json:"prior_session_id,omitempty"` // Claude session ID from a previous task on this issue+ PriorWorkDir string `json:"prior_work_dir,omitempty"` // work_dir from a previous task on this issue+ TriggerCommentID string `json:"trigger_comment_id,omitempty"` // comment that triggered this task+ TriggerThreadID string `json:"trigger_thread_id,omitempty"` // root comment ID for the triggering thread; falls back to trigger_comment_id on old servers+ TriggerCommentContent string `json:"trigger_comment_content,omitempty"` // content of the triggering comment+ TriggerAuthorType string `json:"trigger_author_type,omitempty"` // "agent" or "member" — author kind for the triggering comment+ TriggerAuthorName string `json:"trigger_author_name,omitempty"` // display name of the triggering comment author+ NewCommentCount int `json:"new_comment_count,omitempty"` // issue-wide comments since this agent's last run (excludes its own and the injected trigger); 0/omitted for old daemons or cold start+ NewCommentsSince string `json:"new_comments_since,omitempty"` // RFC3339 anchor (last run's started_at) the count is measured from; empty on cold start+ ChatSessionID string `json:"chat_session_id,omitempty"` // non-empty for chat tasks+ ChatMessage string `json:"chat_message,omitempty"` // user message content for chat tasks+ ChatMessageAttachments []ChatAttachmentMeta `json:"chat_message_attachments,omitempty"` // attachments linked to the chat message; agent uses these to `multica attachment download <id>`+ AutopilotRunID string `json:"autopilot_run_id,omitempty"` // non-empty for autopilot run_only tasks+ AutopilotID string `json:"autopilot_id,omitempty"` // autopilot that spawned this run+ AutopilotTitle string `json:"autopilot_title,omitempty"` // autopilot title used as task context+ AutopilotDescription string `json:"autopilot_description,omitempty"` // autopilot description used as task prompt+ AutopilotSource string `json:"autopilot_source,omitempty"` // manual, schedule, webhook, or api+ AutopilotTriggerPayload json.RawMessage `json:"autopilot_trigger_payload,omitempty"` // optional trigger payload for webhook/api runs+ QuickCreatePrompt string `json:"quick_create_prompt,omitempty"` // user's natural-language input for quick-create tasks+ QuickCreateAttachmentIDs []string `json:"quick_create_attachment_ids,omitempty"` // attachments uploaded in the quick-create prompt and bound by issue create+ SquadID string `json:"squad_id,omitempty"` // when the picker was a squad, the squad's UUID; Agent is still the resolved leader+ SquadName string `json:"squad_name,omitempty"` // display name for the picker squad, used in prompt text+ ParentIssueID string `json:"parent_issue_id,omitempty"` // for quick-create tasks opened from "Add sub issue" — UUID of the parent issue the new issue should be filed under+ ParentIssueIdentifier string `json:"parent_issue_identifier,omitempty"` // human-readable identifier (e.g. MUL-123) of the quick-create parent issue, used in prompt context// RequestingUserName + RequestingUserProfileDescription describe the human// the agent is working on behalf of. v1 sources them from the runtime// owner (the user who registered the daemon). Empty when the runtime hasdiff --git a/server/internal/handler/agent.go b/server/internal/handler/agent.goindex 41275771c8..0994592895 100644--- a/server/internal/handler/agent.go+++ b/server/internal/handler/agent.go@@ -199,29 +199,30 @@ type AgentTaskResponse struct {// when WorkDir is empty, or when stripping leaves nothing. See// relativeWorkDir() for the full rules. Older clients can still read// WorkDir directly; newer UIs should prefer RelativeWorkDir.- RelativeWorkDir string `json:"relative_work_dir,omitempty"`- TriggerCommentID *string `json:"trigger_comment_id,omitempty"` // comment that triggered this task- TriggerThreadID string `json:"trigger_thread_id,omitempty"` // root comment ID for the triggering thread- TriggerCommentContent string `json:"trigger_comment_content,omitempty"` // content of the triggering comment- TriggerSummary *string `json:"trigger_summary,omitempty"` // canonical short description snapshot — comment text / autopilot title — taken at task creation; survives source edits/deletes- TriggerAuthorType string `json:"trigger_author_type,omitempty"` // "agent" or "member" — author kind of the triggering comment- TriggerAuthorName string `json:"trigger_author_name,omitempty"` // display name of the triggering comment author- NewCommentCount int `json:"new_comment_count,omitempty"` // trigger-thread comments since last run; excludes injected trigger + own comments; omitempty so old daemons ignore it- NewCommentsSince string `json:"new_comments_since,omitempty"` // RFC3339 anchor (last run's started_at) the count is measured from; omitempty so old daemons ignore it- ChatSessionID string `json:"chat_session_id,omitempty"` // non-empty for chat tasks- ChatMessage string `json:"chat_message,omitempty"` // user message for chat tasks- ChatMessageAttachments []ChatAttachmentMeta `json:"chat_message_attachments,omitempty"` // attachments on the user message — agent calls `multica attachment download <id>` per entry- AutopilotRunID string `json:"autopilot_run_id,omitempty"` // non-empty for autopilot-spawned tasks- AutopilotID string `json:"autopilot_id,omitempty"` // autopilot that spawned this task- AutopilotTitle string `json:"autopilot_title,omitempty"` // autopilot title used as task context- AutopilotDescription string `json:"autopilot_description,omitempty"` // autopilot description used as task prompt- AutopilotSource string `json:"autopilot_source,omitempty"` // manual, schedule, webhook, or api- AutopilotTriggerPayload json.RawMessage `json:"autopilot_trigger_payload,omitempty"` // optional trigger payload for webhook/api runs- QuickCreatePrompt string `json:"quick_create_prompt,omitempty"` // user's natural-language input for quick-create tasks- SquadID string `json:"squad_id,omitempty"` // for quick-create tasks where the picker was a squad; Agent is still the resolved leader- SquadName string `json:"squad_name,omitempty"` // display name for the picker squad- ParentIssueID string `json:"parent_issue_id,omitempty"` // for quick-create tasks opened from "Add sub issue" — UUID of the parent issue the new issue should be filed under- ParentIssueIdentifier string `json:"parent_issue_identifier,omitempty"` // human-readable identifier (e.g. MUL-123) of the quick-create parent issue, resolved on claim for prompt context+ RelativeWorkDir string `json:"relative_work_dir,omitempty"`+ TriggerCommentID *string `json:"trigger_comment_id,omitempty"` // comment that triggered this task+ TriggerThreadID string `json:"trigger_thread_id,omitempty"` // root comment ID for the triggering thread+ TriggerCommentContent string `json:"trigger_comment_content,omitempty"` // content of the triggering comment+ TriggerSummary *string `json:"trigger_summary,omitempty"` // canonical short description snapshot — comment text / autopilot title — taken at task creation; survives source edits/deletes+ TriggerAuthorType string `json:"trigger_author_type,omitempty"` // "agent" or "member" — author kind of the triggering comment+ TriggerAuthorName string `json:"trigger_author_name,omitempty"` // display name of the triggering comment author+ NewCommentCount int `json:"new_comment_count,omitempty"` // trigger-thread comments since last run; excludes injected trigger + own comments; omitempty so old daemons ignore it+ NewCommentsSince string `json:"new_comments_since,omitempty"` // RFC3339 anchor (last run's started_at) the count is measured from; omitempty so old daemons ignore it+ ChatSessionID string `json:"chat_session_id,omitempty"` // non-empty for chat tasks+ ChatMessage string `json:"chat_message,omitempty"` // user message for chat tasks+ ChatMessageAttachments []ChatAttachmentMeta `json:"chat_message_attachments,omitempty"` // attachments on the user message — agent calls `multica attachment download <id>` per entry+ AutopilotRunID string `json:"autopilot_run_id,omitempty"` // non-empty for autopilot-spawned tasks+ AutopilotID string `json:"autopilot_id,omitempty"` // autopilot that spawned this task+ AutopilotTitle string `json:"autopilot_title,omitempty"` // autopilot title used as task context+ AutopilotDescription string `json:"autopilot_description,omitempty"` // autopilot description used as task prompt+ AutopilotSource string `json:"autopilot_source,omitempty"` // manual, schedule, webhook, or api+ AutopilotTriggerPayload json.RawMessage `json:"autopilot_trigger_payload,omitempty"` // optional trigger payload for webhook/api runs+ QuickCreatePrompt string `json:"quick_create_prompt,omitempty"` // user's natural-language input for quick-create tasks+ QuickCreateAttachmentIDs []string `json:"quick_create_attachment_ids,omitempty"` // attachment ids uploaded in the quick-create prompt and bound on issue create+ SquadID string `json:"squad_id,omitempty"` // for quick-create tasks where the picker was a squad; Agent is still the resolved leader+ SquadName string `json:"squad_name,omitempty"` // display name for the picker squad+ ParentIssueID string `json:"parent_issue_id,omitempty"` // for quick-create tasks opened from "Add sub issue" — UUID of the parent issue the new issue should be filed under+ ParentIssueIdentifier string `json:"parent_issue_identifier,omitempty"` // human-readable identifier (e.g. MUL-123) of the quick-create parent issue, resolved on claim for prompt context// RequestingUserName + RequestingUserProfileDescription mirror the user// the agent is acting on behalf of (see daemon/types.go). v1 sources them// from the runtime owner so they're populated for daemon runtimes anddiff --git a/server/internal/handler/daemon.go b/server/internal/handler/daemon.goindex ef254fde6b..ac049ffa2c 100644--- a/server/internal/handler/daemon.go+++ b/server/internal/handler/daemon.go@@ -1481,6 +1481,7 @@ func (h *Handler) ClaimTaskByRuntime(w http.ResponseWriter, r *http.Request) {if json.Unmarshal(task.Context, &qc) == nil && qc.Type == service.QuickCreateContextType {hasQuickCreate = trueresp.QuickCreatePrompt = qc.Prompt+ resp.QuickCreateAttachmentIDs = append([]string(nil), qc.AttachmentIDs...)resp.ThreadName = qc.Promptresp.WorkspaceID = qc.WorkspaceIDdiff --git a/server/internal/handler/daemon_test.go b/server/internal/handler/daemon_test.goindex c741b69c63..eb08cf7787 100644--- a/server/internal/handler/daemon_test.go+++ b/server/internal/handler/daemon_test.go@@ -2388,10 +2388,11 @@ func TestCompleteTask_AssignmentTriggered_DoesNotSuppressTrivialDoneOutput(t *te}type claimRuntimeGuardTask struct {- PriorSessionID string `json:"prior_session_id"`- PriorWorkDir string `json:"prior_work_dir"`- ChatMessage string `json:"chat_message"`- ThreadName string `json:"thread_name"`+ PriorSessionID string `json:"prior_session_id"`+ PriorWorkDir string `json:"prior_work_dir"`+ ChatMessage string `json:"chat_message"`+ ThreadName string `json:"thread_name"`+ QuickCreateAttachmentIDs []string `json:"quick_create_attachment_ids"`}func claimTaskForRuntimeGuard(t *testing.T, runtimeID, daemonID string) *claimRuntimeGuardTask {@@ -3036,11 +3037,13 @@ func TestClaimTask_QuickCreatePopulatesThreadName(t *testing.T) {agentID, runtimeID, daemonID := createRuntimeGuardAgent(t, ctx)quickPrompt := "create a follow-up issue for Codex session titles"+ attachmentID := "019ec09d-6222-722b-bdfa-427b105d80be"quickContext, _ := json.Marshal(map[string]any{- "type": "quick_create",- "prompt": quickPrompt,- "requester_id": testUserID,- "workspace_id": testWorkspaceID,+ "type": "quick_create",+ "prompt": quickPrompt,+ "requester_id": testUserID,+ "workspace_id": testWorkspaceID,+ "attachment_ids": []string{attachmentID},})if _, err := testPool.Exec(ctx, `@@ -3054,6 +3057,9 @@ func TestClaimTask_QuickCreatePopulatesThreadName(t *testing.T) {if task.ThreadName != quickPrompt {t.Fatalf("quick-create task thread_name = %q, want prompt", task.ThreadName)}+ if len(task.QuickCreateAttachmentIDs) != 1 || task.QuickCreateAttachmentIDs[0] != attachmentID {+ t.Fatalf("quick-create attachment ids = %#v, want [%q]", task.QuickCreateAttachmentIDs, attachmentID)+ }}func TestClaimTask_ChatForceFreshSessionSkipsPriorSession(t *testing.T) {diff --git a/server/internal/handler/issue.go b/server/internal/handler/issue.goindex 3e7830cfc2..aee2a12560 100644--- a/server/internal/handler/issue.go+++ b/server/internal/handler/issue.go@@ -1671,11 +1671,12 @@ func (h *Handler) ChildIssueProgress(w http.ResponseWriter, r *http.Request) {// keeping the sub-issue intent of the entry point regardless of whether// the user submits via manual or agent mode.type QuickCreateIssueRequest struct {- AgentID string `json:"agent_id,omitempty"`- SquadID string `json:"squad_id,omitempty"`- Prompt string `json:"prompt"`- ProjectID string `json:"project_id,omitempty"`- ParentIssueID string `json:"parent_issue_id,omitempty"`+ AgentID string `json:"agent_id,omitempty"`+ SquadID string `json:"squad_id,omitempty"`+ Prompt string `json:"prompt"`+ ProjectID string `json:"project_id,omitempty"`+ ParentIssueID string `json:"parent_issue_id,omitempty"`+ AttachmentIDs []string `json:"attachment_ids,omitempty"`}// QuickCreateIssueResponse echoes the queued task id so the frontend can@@ -1791,10 +1792,11 @@ func (h *Handler) QuickCreateIssue(w http.ResponseWriter, r *http.Request) {// Daemon CLI version gate. The agent-side prompt + create-flow rely on// behaviors introduced in MinQuickCreateCLIVersion (URL attachment- // handling, no-retry on partial failure). Older daemons either- // double-create issues on partial CLI failures or mishandle pasted- // screenshot URLs; fail closed before enqueuing rather than surface- // the breakage as an inbox failure twenty seconds later. Dev-built+ // handling, quick-create attachment binding, no-retry on partial failure).+ // Older daemons either double-create issues on partial CLI failures, drop+ // attachment bindings, or mishandle pasted screenshot URLs; fail closed+ // before enqueuing rather than surface the breakage as an inbox failure+ // twenty seconds later. Dev-built// daemons (git-describe shape) are exempted inside CheckMinCLIVersion// so `make daemon` works without weakening staging or production.if status, payload := h.checkQuickCreateDaemonVersion(r.Context(), agent.RuntimeID); status != 0 {@@ -1802,6 +1804,11 @@ func (h *Handler) QuickCreateIssue(w http.ResponseWriter, r *http.Request) {return}+ attachmentIDs, ok := parseUUIDSliceOrBadRequest(w, req.AttachmentIDs, "attachment_ids")+ if !ok {+ return+ }+// Optional project_id — validate it belongs to the same workspace before// pinning the task to it. The handler is the trust boundary; the frontend// already only shows projects from the active workspace, but we re-check@@ -1843,7 +1850,7 @@ func (h *Handler) QuickCreateIssue(w http.ResponseWriter, r *http.Request) {parentIssueUUID = pid}- task, err := h.TaskService.EnqueueQuickCreateTask(r.Context(), wsUUID, requesterUUID, agentUUID, squadUUID, prompt, projectUUID, parentIssueUUID)+ task, err := h.TaskService.EnqueueQuickCreateTask(r.Context(), wsUUID, requesterUUID, agentUUID, squadUUID, prompt, projectUUID, parentIssueUUID, attachmentIDs)if err != nil {slog.Warn("quick-create enqueue failed", append(logger.RequestAttrs(r), "error", err)...)writeError(w, http.StatusInternalServerError, "failed to enqueue quick-create task")@@ -1887,7 +1894,7 @@ func (h *Handler) isRuntimeOnline(ctx context.Context, runtimeID pgtype.UUID) bo// 422 {// "code": "daemon_version_unsupported",// "current_version": "0.2.18" | "",-// "min_version": "0.2.20",+// "min_version": "0.2.21",// "runtime_id": "<uuid>"// }func (h *Handler) checkQuickCreateDaemonVersion(ctx context.Context, runtimeID pgtype.UUID) (int, map[string]any) {diff --git a/server/internal/handler/quick_create_parent_test.go b/server/internal/handler/quick_create_parent_test.goindex 41a09ac74a..07a3fe6af8 100644--- a/server/internal/handler/quick_create_parent_test.go+++ b/server/internal/handler/quick_create_parent_test.go@@ -125,11 +125,13 @@ func TestQuickCreateIssueParentTrustBoundary(t *testing.T) {}t.Run("same workspace parent enqueues with context", func(t *testing.T) {+ attachmentID := "019ec09d-6222-722b-bdfa-427b105d80be"w := httptest.NewRecorder()req := newRequest("POST", "/api/issues/quick-create", map[string]any{"agent_id": agentID,"prompt": "Create a follow-up issue for the local parent","parent_issue_id": localParentID,+ "attachment_ids": []string{attachmentID},})testHandler.QuickCreateIssue(w, req)if w.Code != http.StatusAccepted {@@ -162,6 +164,9 @@ func TestQuickCreateIssueParentTrustBoundary(t *testing.T) {if qc.ParentIssueID != localParentID {t.Fatalf("expected parent_issue_id=%q in context, got %q", localParentID, qc.ParentIssueID)}+ if len(qc.AttachmentIDs) != 1 || qc.AttachmentIDs[0] != attachmentID {+ t.Fatalf("expected attachment_ids=[%q] in context, got %#v", attachmentID, qc.AttachmentIDs)+ }})t.Run("foreign workspace parent is rejected", func(t *testing.T) {@@ -199,4 +204,21 @@ func TestQuickCreateIssueParentTrustBoundary(t *testing.T) {t.Fatalf("bogus parent must not enqueue a task: expected %d quick-create tasks, got %d", before, got)}})++ t.Run("bogus uuid attachment id is rejected", func(t *testing.T) {+ before := countQuickCreateTasks(t)+ w := httptest.NewRecorder()+ req := newRequest("POST", "/api/issues/quick-create", map[string]any{+ "agent_id": agentID,+ "prompt": "Try a malformed attachment UUID",+ "attachment_ids": []string{"not-a-uuid"},+ })+ testHandler.QuickCreateIssue(w, req)+ if w.Code != http.StatusBadRequest {+ t.Fatalf("expected 400 for bogus attachment id, got %d: %s", w.Code, w.Body.String())+ }+ if got := countQuickCreateTasks(t); got != before {+ t.Fatalf("bogus attachment id must not enqueue a task: expected %d quick-create tasks, got %d", before, got)+ }+ })}diff --git a/server/internal/service/task.go b/server/internal/service/task.goindex 8032071f29..58471129f4 100644--- a/server/internal/service/task.go+++ b/server/internal/service/task.go@@ -565,12 +565,13 @@ func (s *TaskService) enqueueMentionTask(ctx context.Context, issue db.Issue, ag// onto the agent's Instructions, matching the behavior of issue-bound// tasks assigned to the squad.type QuickCreateContext struct {- Type string `json:"type"`- Prompt string `json:"prompt"`- RequesterID string `json:"requester_id"`- WorkspaceID string `json:"workspace_id"`- ProjectID string `json:"project_id,omitempty"`- SquadID string `json:"squad_id,omitempty"`+ Type string `json:"type"`+ Prompt string `json:"prompt"`+ RequesterID string `json:"requester_id"`+ WorkspaceID string `json:"workspace_id"`+ ProjectID string `json:"project_id,omitempty"`+ SquadID string `json:"squad_id,omitempty"`+ AttachmentIDs []string `json:"attachment_ids,omitempty"`// ParentIssueID is the optional UUID of the parent issue the new issue// should be filed under. Set when the user opens the modal from "Add// sub issue" on an existing issue; the daemon claim handler resolves the@@ -602,7 +603,7 @@ const QuickCreateContextType = "quick_create"// parentIssueID is optional (zero-valued pgtype.UUID when the user didn't// open the modal from "Add sub issue"). The handler is responsible for// validating it belongs to the same workspace before passing it in.-func (s *TaskService) EnqueueQuickCreateTask(ctx context.Context, workspaceID, requesterID pgtype.UUID, agentID, squadID pgtype.UUID, prompt string, projectID, parentIssueID pgtype.UUID) (db.AgentTaskQueue, error) {+func (s *TaskService) EnqueueQuickCreateTask(ctx context.Context, workspaceID, requesterID pgtype.UUID, agentID, squadID pgtype.UUID, prompt string, projectID, parentIssueID pgtype.UUID, attachmentIDs []pgtype.UUID) (db.AgentTaskQueue, error) {agent, err := s.Queries.GetAgent(ctx, agentID)if err != nil {return db.AgentTaskQueue{}, fmt.Errorf("load agent: %w", err)@@ -629,6 +630,14 @@ func (s *TaskService) EnqueueQuickCreateTask(ctx context.Context, workspaceID, rif parentIssueID.Valid {payload.ParentIssueID = util.UUIDToString(parentIssueID)}+ if len(attachmentIDs) > 0 {+ payload.AttachmentIDs = make([]string, 0, len(attachmentIDs))+ for _, id := range attachmentIDs {+ if id.Valid {+ payload.AttachmentIDs = append(payload.AttachmentIDs, util.UUIDToString(id))+ }+ }+ }contextJSON, err := json.Marshal(payload)if err != nil {return db.AgentTaskQueue{}, fmt.Errorf("marshal quick-create context: %w", err)diff --git a/server/pkg/agent/version.go b/server/pkg/agent/version.goindex 82e82e59f7..df0a40de16 100644--- a/server/pkg/agent/version.go+++ b/server/pkg/agent/version.go@@ -19,11 +19,12 @@ var MinVersions = map[string]string{// MinQuickCreateCLIVersion gates the agent-create (quick-create) flow against// the multica CLI version reported by the daemon at registration time. The// quick-create prompt that the agent runs depends on CLI behavior introduced-// after this version (attachment URL handling, no-retry semantics on-// `multica issue create` failure — see PR #1851); older daemons would either-// double-create issues or mishandle pasted screenshot URLs. Treated as a hard-// requirement: missing / unparsable / below this threshold all fail closed.-const MinQuickCreateCLIVersion = "0.2.20"+// after this version (attachment URL handling, quick-create attachment+// binding, no-retry semantics on `multica issue create` failure — see PR+// #1851); older daemons would either double-create issues or mishandle pasted+// screenshot URLs. Treated as a hard requirement: missing / unparsable / below+// this threshold all fail closed.+const MinQuickCreateCLIVersion = "0.2.21"// Errors returned by CheckMinCLIVersion. Callers branch on these to surface// "needs upgrade" vs "version not reported" with the right user message.diff --git a/server/pkg/agent/version_test.go b/server/pkg/agent/version_test.goindex da65ce14e3..66d5ed66e8 100644--- a/server/pkg/agent/version_test.go+++ b/server/pkg/agent/version_test.go@@ -58,14 +58,15 @@ func TestCheckMinCLIVersion(t *testing.T) {input stringwantErr error}{- {"tagged release at minimum", "v0.2.20", nil},+ {"tagged release at minimum", "v0.2.21", nil},{"tagged release above minimum", "0.3.1", nil},+ {"previous tagged release below minimum", "v0.2.20", ErrCLIVersionTooOld},{"tagged release below minimum", "v0.2.15", ErrCLIVersionTooOld},{"empty string", "", ErrCLIVersionMissing},{"unparsable", "not-a-version", ErrCLIVersionMissing},{"git-describe dev build past old tag", "v0.2.15-235-gdaf0e935", nil},{"git-describe dirty dev build", "v0.2.15-235-gdaf0e935-dirty", nil},- {"git-describe dev build past current tag", "v0.2.20-3-gabc1234", nil},+ {"git-describe dev build past current tag", "v0.2.21-3-gabc1234", nil},}for _, tt := range tests {err := CheckMinCLIVersion(tt.input)