mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-25 16:14:26 +01:00
feat: let agents name prompt-only tasks (#14761)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Users create tasks with a title and a description. > - A required title adds work when the prompt already explains the request. > - An agent can name the task once it reads that request. > - This pull request accepts prompt-only tasks and starts them with a short prompt slice. > - A scoped title tool lets the assigned agent replace that slice early without changing execution state. > - A live browser eval checks the real agent call, saved title, audit entry, and preservation of user titles. ## Linked Issues or Issue Description **Subsystem affected** Cross-cutting: task creation, shared contracts, database, server, runner tools, and board UI. **Problem or motivation** Users must currently write a title before they can submit a detailed task prompt. The agent has enough context to write a useful title itself. **Proposed solution** Make the title optional when a description is present. Save the first 120 characters of the normalized prompt as a provisional title. Ask the assigned agent to call `set_task_title` early. Use an atomic provisional-title guard to preserve titles supplied or edited by users. Keep explicit titles supported. Related: #14543 and #14556 concern empty-title submission. This change intentionally enables that submission when a prompt is present, instead of requiring a title. ## What Changed - Add the `titleNeedsGeneration` field with an idempotent migration. Keep existing titles unchanged. - Add `PUT /api/issues/:id/title` and the native and legacy `set_task_title` tool. Enforce company access, active-run ownership, shared, bounded retry receipts across native/HTTP calls, and transactional audit logging. Refresh external-object links after commit, with the same feature gate and plugin detectors as ordinary title edits. - Add early naming guidance in Standard, Ask, and Plan task context. Preserve the description, status, and assignment. - Allow prompt-only root and child task creation, plus draft restoration in the New Task dialog. Keep user titles supported. - Add an opt-in Product E2E suite for prompt-only Standard and Ask tasks, plus an explicit-title control. It checks actual provider calls within the first five tools, persisted state, audit attribution, and the reloaded UI. - Preserve a closed vocabulary of API key maintenance phrases in declared prose while rejecting opaque credential suffixes. Add one bounded naming retry after wording is rejected, without treating the rejected call as a saved title. - Repair the native cleanup receipt check exposed during full verification: accept matching input digests, retain legacy input checks, and reject conflicting receipts. ## Verification - Live Product E2E on `f43478473800e3a46b85c5ee79677efdb15108e7`: **3/3 passed** with native Codex `gpt-5.4-mini`, first attempts only, automatic retries disabled. Standard and Ask each saved “Rotate expired API key” on their first tool call, with matching persisted state and a single same-run audit entry. The explicit-title control retained its user title with zero title writes. All three verified the reloaded browser UI. - Campaign: `local-2026-09-30T21-30-11-021Z`. Earlier failed campaigns are retained separately; they exposed credential-prose handling and prompted the naming recovery fix. No failed result was regraded or deleted. - Reproduce with `pnpm test:e2e:runner -- --id task-titles.runner-codex-mini.local.prompt-title-standard --id task-titles.runner-codex-mini.local.prompt-title-ask --id task-titles.runner-codex-mini.local.preserve-explicit-title --max-automatic-retries 0` and an authorized provider key. - Full `pnpm -r typecheck` and `pnpm build` passed on the latest commit. The runner build used the configured external eval source tree. - Product E2E unit suite: **61 files, 818 tests passed**; E2E typecheck and UI token gates passed. - Title API/native regressions cover prompt-only and explicit child creation, user edits, ownership/company isolation, external reference refresh, cross-surface retry replay, and the 64-key limit without receipt eviction. All passed. Prompt-context coverage: **44 tests passed**. - Rust credential regressions: **35 tests passed**, including benign maintenance qualifiers and opaque credential rejection in every declared prose field. Catalog/report reconciliation: **28 tests passed**. Native recovery: **560 tests passed**. - Broad local `pnpm test:run`: **14,555 tests passed** in the general server group; two suites failed to initialize embedded PostgreSQL and the existing 40,000-file Git streaming stress test exceeded its 300-second macOS timeout. All three suites then passed in isolation (**5 tests passed**) without code or timeout changes. The original full local command exited nonzero and is not being represented as a clean full run. - Latest-head GitHub checks are green: **53 passed, 4 skipped, zero failed or pending**, including all test shards and the canary packaging dry run. Greptile reviewed the same commit at **5/5**, with zero unresolved review threads. ## Risks - The additive database field must reach the server and UI together. The migration uses `IF NOT EXISTS` and defaults existing tasks to a final title. - Title generation depends on the assigned agent running. Tasks without a run keep their provisional title. - Live qualification covers the native Codex path in Standard and Ask modes. API/legacy and Plan behavior have deterministic coverage. - The credential-prose exception validates the entire suffix against a closed maintenance vocabulary. Unknown suffixes, assignments, quoted values, credential prefixes, and diagnostics retain strict checks. ## Model Used OpenAI Codex, based on GPT-6, with reasoning, tool use, and code execution. The exact deployment ID and context window are not exposed in this session. The live eval uses the native Codex `gpt-5.4-mini` profile. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
d6d67b00d3
commit
018993140f
63 files changed
+2279
-226
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import type { SetIssueTitle } from "@paperclipai/shared";
|
||||
import type { ExecutionReconciliation } from "@paperclipai/shared";
|
||||
import type {
|
||||
AcceptedPlanDecompositionSummary,
|
||||
@@ -256,6 +257,8 @@ export const issuesApi = {
|
||||
api.delete<{ id: string; archivedAt: Date } | { ok: true }>(
|
||||
`/issues/${id}/inbox-archive`,
|
||||
),
|
||||
setTitle: (id: string, data: SetIssueTitle) =>
|
||||
api.put<{ id: string; title: string; titleNeedsGeneration: boolean; changed: boolean }>(`/issues/${id}/title`, data),
|
||||
create: (companyId: string, data: Record<string, unknown>) =>
|
||||
api.post<Issue>(`/companies/${companyId}/issues`, data),
|
||||
update: (id: string, data: Record<string, unknown>) => {
|
||||
|
||||
@@ -731,7 +731,7 @@ describe("NewIssueDialog", () => {
|
||||
await flush();
|
||||
expect(container.textContent).not.toContain("Execution workspace");
|
||||
expect(container.querySelector('option[value="isolated_workspace"]')).toBeNull();
|
||||
await typeTextareaValue(container.querySelector('textarea[placeholder="Task title"]')!, "Managed task");
|
||||
await typeTextareaValue(container.querySelector('textarea[placeholder="Task title (optional)"]')!, "Managed task");
|
||||
const create = Array.from(container.querySelectorAll("button")).find((button) => button.textContent?.includes("Create Task"));
|
||||
act(() => create!.click());
|
||||
await waitForAssertion(() => expect(mockIssuesApi.create).toHaveBeenCalled());
|
||||
@@ -751,7 +751,7 @@ describe("NewIssueDialog", () => {
|
||||
const { root } = renderDialog(container, ["workspaces.isolation"]);
|
||||
await flush();
|
||||
expect(container.querySelector('option[value="isolated_workspace"]')).toBeNull();
|
||||
await typeTextareaValue(container.querySelector('textarea[placeholder="Task title"]')!, "Context task");
|
||||
await typeTextareaValue(container.querySelector('textarea[placeholder="Task title (optional)"]')!, "Context task");
|
||||
const create = Array.from(container.querySelectorAll("button")).find((button) => button.textContent?.includes(subtask ? "Create Sub-Task" : "Create Task"));
|
||||
act(() => create!.click());
|
||||
await waitForAssertion(() => expect(mockIssuesApi.create).toHaveBeenCalled());
|
||||
@@ -893,6 +893,36 @@ describe("NewIssueDialog", () => {
|
||||
act(() => root.unmount());
|
||||
});
|
||||
|
||||
it("restores a description-only draft", async () => {
|
||||
localStorage.setItem("paperclip:issue-draft", JSON.stringify({
|
||||
title: "", description: "Keep the request without a title", status: "todo", priority: "medium",
|
||||
assigneeValue: "", reviewerValue: "", approverValue: "", projectId: "",
|
||||
assigneeModelOverride: "", assigneeThinkingEffort: "", assigneeChrome: false,
|
||||
}));
|
||||
const { root } = renderDialog(container);
|
||||
await flush();
|
||||
await waitForAssertion(() => {
|
||||
expect((container.querySelector('textarea[aria-label="Add description..."]') as HTMLTextAreaElement).value).toBe("Keep the request without a title");
|
||||
});
|
||||
const submit = Array.from(container.querySelectorAll("button")).find(button => button.textContent?.includes("Create Task"))!;
|
||||
expect(submit.hasAttribute("disabled")).toBe(false);
|
||||
await act(async () => root.unmount());
|
||||
});
|
||||
|
||||
it("creates a task from its description without requiring a title", async () => {
|
||||
const { root } = renderDialog(container);
|
||||
await flush();
|
||||
const submit = Array.from(container.querySelectorAll("button")).find(button => button.textContent?.includes("Create Task"))!;
|
||||
expect(submit.hasAttribute("disabled")).toBe(true);
|
||||
await typeTextareaValue(container.querySelector('textarea[aria-label="Add description..."]')!, "Investigate the sign-in redirect and fix it");
|
||||
await vi.waitFor(() => expect(submit.hasAttribute("disabled")).toBe(false));
|
||||
await act(async () => { submit.dispatchEvent(new MouseEvent("click", { bubbles: true })); });
|
||||
await flush();
|
||||
expect(mockIssuesApi.create).toHaveBeenCalledWith("company-1", expect.objectContaining({ description: "Investigate the sign-in redirect and fix it" }));
|
||||
expect(mockIssuesApi.create.mock.calls[0][1]).not.toHaveProperty("title");
|
||||
await act(async () => root.unmount());
|
||||
});
|
||||
|
||||
it("submits the latest locally typed title and description", async () => {
|
||||
let resolveProjects: (projects: Array<{
|
||||
id: string;
|
||||
@@ -908,7 +938,7 @@ describe("NewIssueDialog", () => {
|
||||
const { root } = renderDialog(container);
|
||||
await flush();
|
||||
|
||||
const titleInput = container.querySelector('textarea[placeholder="Task title"]') as HTMLTextAreaElement | null;
|
||||
const titleInput = container.querySelector('textarea[placeholder="Task title (optional)"]') as HTMLTextAreaElement | null;
|
||||
const descriptionInput = container.querySelector('textarea[aria-label="Add description..."]') as HTMLTextAreaElement | null;
|
||||
expect(titleInput).not.toBeNull();
|
||||
expect(descriptionInput).not.toBeNull();
|
||||
@@ -988,7 +1018,7 @@ describe("NewIssueDialog", () => {
|
||||
const { root } = renderDialog(container);
|
||||
await flush();
|
||||
|
||||
const titleInput = container.querySelector('textarea[placeholder="Task title"]') as HTMLTextAreaElement | null;
|
||||
const titleInput = container.querySelector('textarea[placeholder="Task title (optional)"]') as HTMLTextAreaElement | null;
|
||||
const descriptionInput = container.querySelector('textarea[aria-label="Add description..."]') as HTMLTextAreaElement | null;
|
||||
expect(titleInput).not.toBeNull();
|
||||
expect(descriptionInput).not.toBeNull();
|
||||
@@ -1024,7 +1054,7 @@ describe("NewIssueDialog", () => {
|
||||
const { root } = renderDialog(container);
|
||||
await flush();
|
||||
|
||||
const titleInput = container.querySelector('textarea[placeholder="Task title"]') as HTMLTextAreaElement | null;
|
||||
const titleInput = container.querySelector('textarea[placeholder="Task title (optional)"]') as HTMLTextAreaElement | null;
|
||||
expect(titleInput).not.toBeNull();
|
||||
await typeTextareaValue(titleInput!, "Plan this first");
|
||||
|
||||
@@ -1062,7 +1092,7 @@ describe("NewIssueDialog", () => {
|
||||
const { root } = renderDialog(container);
|
||||
await flush();
|
||||
|
||||
const titleInput = container.querySelector('textarea[placeholder="Task title"]') as HTMLTextAreaElement | null;
|
||||
const titleInput = container.querySelector('textarea[placeholder="Task title (optional)"]') as HTMLTextAreaElement | null;
|
||||
expect(titleInput).not.toBeNull();
|
||||
await typeTextareaValue(titleInput!, "Answer this first");
|
||||
|
||||
@@ -1256,7 +1286,7 @@ describe("NewIssueDialog", () => {
|
||||
expect(dialogContent?.className).toContain("h-(--new-issue-dialog-height)");
|
||||
expect(dialogContent?.className).toContain("overflow-hidden");
|
||||
|
||||
const titleInput = container.querySelector('textarea[placeholder="Task title"]');
|
||||
const titleInput = container.querySelector('textarea[placeholder="Task title (optional)"]');
|
||||
const descriptionInput = container.querySelector('textarea[aria-label="Add description..."]');
|
||||
const bodyScrollRegion = Array.from(container.querySelectorAll("div")).find((element) =>
|
||||
typeof element.className === "string" && element.className.includes("overscroll-contain"),
|
||||
|
||||
@@ -400,7 +400,7 @@ const IssueTitleTextarea = memo(function IssueTitleTextarea({
|
||||
return (
|
||||
<textarea
|
||||
className="w-full text-lg font-semibold bg-transparent outline-none resize-none overflow-hidden placeholder:text-muted-foreground/50"
|
||||
placeholder="Task title"
|
||||
placeholder="Task title (optional)"
|
||||
rows={1}
|
||||
value={draftValue}
|
||||
onChange={(e) => {
|
||||
@@ -492,7 +492,6 @@ export function NewIssueDialog() {
|
||||
const [description, setDescription] = useState("");
|
||||
const titleRef = useRef("");
|
||||
const descriptionRef = useRef("");
|
||||
const [titleHasText, setTitleHasText] = useState(false);
|
||||
const [draftHasText, setDraftHasText] = useState(false);
|
||||
const [status, setStatus] = useState("todo");
|
||||
const [priority, setPriority] = useState("");
|
||||
@@ -704,7 +703,7 @@ export function NewIssueDialog() {
|
||||
(draft: IssueDraft) => {
|
||||
if (draftTimer.current) clearTimeout(draftTimer.current);
|
||||
draftTimer.current = setTimeout(() => {
|
||||
if (draft.title.trim()) saveDraft(draft);
|
||||
if (draft.title.trim() || draft.description.trim()) saveDraft(draft);
|
||||
}, DEBOUNCE_MS);
|
||||
},
|
||||
[],
|
||||
@@ -715,7 +714,6 @@ export function NewIssueDialog() {
|
||||
descriptionRef.current = nextDescription;
|
||||
setTitle(nextTitle);
|
||||
setDescription(nextDescription);
|
||||
setTitleHasText(nextTitle.trim().length > 0);
|
||||
setDraftHasText(nextTitle.trim().length > 0 || nextDescription.trim().length > 0);
|
||||
}, []);
|
||||
|
||||
@@ -767,7 +765,6 @@ export function NewIssueDialog() {
|
||||
titleRef.current = nextTitle;
|
||||
const nextTitleHasText = nextTitle.trim().length > 0;
|
||||
const nextDraftHasText = nextTitleHasText || descriptionRef.current.trim().length > 0;
|
||||
setTitleHasText((current) => current === nextTitleHasText ? current : nextTitleHasText);
|
||||
setDraftHasText((current) => current === nextDraftHasText ? current : nextDraftHasText);
|
||||
queueDraftSave({ title: nextTitle });
|
||||
}, [queueDraftSave]);
|
||||
@@ -841,9 +838,9 @@ export function NewIssueDialog() {
|
||||
executionWorkspaceDefaultProjectId.current = hasExplicitProjectWorkspaceId || defaultProject
|
||||
? defaultProjectId || null
|
||||
: null;
|
||||
} else if (newIssueDefaults.title) {
|
||||
} else if (newIssueDefaults.title || newIssueDefaults.description) {
|
||||
const nextWorkMode = isIssueWorkMode(newIssueDefaults.workMode) ? newIssueDefaults.workMode : "standard";
|
||||
setIssueText(newIssueDefaults.title, newIssueDefaults.description ?? "");
|
||||
setIssueText(newIssueDefaults.title ?? "", newIssueDefaults.description ?? "");
|
||||
setStatus(newIssueDefaults.status ?? "todo");
|
||||
setPriority(newIssueDefaults.priority ?? "");
|
||||
const defaultProjectId = newIssueDefaults.projectId ?? "";
|
||||
@@ -868,7 +865,7 @@ export function NewIssueDialog() {
|
||||
executionWorkspaceDefaultProjectId.current = hasExplicitProjectWorkspaceId || newIssueDefaults.executionWorkspaceId || defaultProject
|
||||
? defaultProjectId || null
|
||||
: null;
|
||||
} else if (draft && draft.title.trim()) {
|
||||
} else if (draft && (draft.title.trim() || draft.description.trim())) {
|
||||
const nextWorkMode = isIssueWorkMode(draft.workMode) ? draft.workMode : "standard";
|
||||
const restoredProjectId = newIssueDefaults.projectId ?? draft.projectId;
|
||||
const restoredProject = orderedProjects.find((project) => project.id === restoredProjectId);
|
||||
@@ -1041,7 +1038,7 @@ export function NewIssueDialog() {
|
||||
function handleSubmit() {
|
||||
const currentTitle = titleRef.current.trim();
|
||||
const currentDescription = descriptionRef.current.trim();
|
||||
if (!effectiveCompanyId || !currentTitle || createIssue.isPending) return;
|
||||
if (!effectiveCompanyId || (!currentTitle && !currentDescription) || createIssue.isPending) return;
|
||||
const assigneeAdapterOverrides = buildAssigneeAdapterOverrides({
|
||||
adapterType: assigneeAdapterType,
|
||||
lane: assigneeModelLane,
|
||||
@@ -1078,7 +1075,7 @@ export function NewIssueDialog() {
|
||||
createIssue.mutate({
|
||||
companyId: effectiveCompanyId,
|
||||
stagedFiles,
|
||||
title: currentTitle,
|
||||
...(currentTitle ? { title: currentTitle } : {}),
|
||||
description: currentDescription || undefined,
|
||||
status,
|
||||
priority: priority || "medium",
|
||||
@@ -2362,7 +2359,7 @@ export function NewIssueDialog() {
|
||||
<Button
|
||||
size="sm"
|
||||
className="min-w-(--sz-8_5rem) disabled:opacity-100"
|
||||
disabled={!titleHasText || createIssue.isPending}
|
||||
disabled={!draftHasText || createIssue.isPending}
|
||||
onClick={handleSubmit}
|
||||
aria-busy={createIssue.isPending}
|
||||
>
|
||||
|
||||
@@ -220,6 +220,7 @@ const EXACT_ACTIONS: Record<string, ExactAction> = {
|
||||
get_workspace_runtime: { action: "read", running: "Reading workspace status", completed: "Read workspace status" },
|
||||
control_workspace_service: { action: "run", running: "Controlling a workspace service", completed: "Controlled a workspace service" },
|
||||
set_dependencies: { action: "update", running: "Updating task dependencies", completed: "Updated task dependencies" },
|
||||
set_task_title: { action: "update", running: "Naming the task", completed: "Named the task" },
|
||||
create_task: { action: "create", running: "Creating a task", completed: "Created a task" },
|
||||
request_approval: { action: "request", running: "Requesting approval", completed: "Requested approval" },
|
||||
decide_approval: { action: "update", running: "Deciding an approval", completed: "Decided an approval" },
|
||||
|
||||
Reference in new issue
Block a user