Defer onboarding project setup until task acceptance

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Scott TongandPaperclip committed 2026-11-17 13:56:04 -08:00
1 parent 0b2c6e04ba
commit 94020ae8ad
3 files changed
+5 -3

No files matched your search

@@ -11,7 +11,7 @@ const issue = {
describe("heartbeat task markdown rendering", () => {
it("carries signup context and proposal boundaries into every onboarding chat turn, greeting only on arrival", () => {
const input = { issue: { ...issue, conversationAgentId: "agent", description: '{"initialIdea":"Launch a newsletter"}' },
nativeRunner: true, onboardingChat: true };
nativeRunner: true, coordinatorWorkspace: true, onboardingChat: true };
const greeting = buildPaperclipTaskMarkdown({ ...input, onboardingGreeting: true });
expect(greeting).toContain("Welcome turn:");
expect(greeting).toContain("so it streams to the user");
@@ -22,6 +22,8 @@ describe("heartbeat task markdown rendering", () => {
expect(followup).toContain("begin a structured interview only when they request");
expect(followup).toContain('interactionKind: "suggest_tasks"');
expect(followup).toContain("acceptance creates the task atomically");
expect(followup).toContain("omit projectId from the suggestion");
expect(followup).not.toContain("Coordinator task proposals:");
expect(followup).toContain("An explicit task-creation request authorizes creating it directly");
expect(followup).not.toContain("Welcome turn:");
}
@@ -242,7 +242,7 @@ export function buildPaperclipTaskMarkdown(input: {
if (input.personTimeZone) {
lines.push(`The person's time zone is ${input.personTimeZone} (from their browser). Read times and dates they give, such as "nine in the morning" or "today", in that zone, and save schedules such as routine triggers with that timezone; say the zone when you report a schedule.`);
}
if (input.nativeRunner && (input.coordinatorWorkspace || input.onboardingChat)) {
if (input.nativeRunner && input.coordinatorWorkspace && !input.onboardingChat) {
lines.push("", "Coordinator task proposals:", companyPages(COORDINATOR_CHAT_HANDOFF_DIRECTIVE));
}
if (input.conferenceRoomEnabled) lines.push("", "Conference Room:", companyPages(CONFERENCE_ROOM_CHAT_DIRECTIVE));
@@ -4,7 +4,7 @@ export const ONBOARDING_CHAT_DIRECTIVE = `This conversation is the user's starti
Let the user choose an interview or ordinary conversation. Offer to interview them; begin a structured interview only when they request or choose it. In an interview, ask focused questions about their goal, relevant background, constraints and what done looks like, using a question card when useful. In ordinary conversation, ask only what is needed to understand the outcome and exit criteria. Reuse answers already provided.
Once the goal and exit criteria are clear, suggest a concrete task for the user to accept using a suggest_tasks interaction. Include a self-contained description, relevant context, constraints and acceptance criteria. A suggestion is not an execution task. Do not create a task, project or hire agents just because onboarding finished, the user described an idea or answered questions. Create execution work only after the user accepts a proposal or explicitly asks you to create a task. An explicit task-creation request authorizes creating it directly once material scope questions are answered; do not ask them to approve the same scope again. Use the normal project and task handoff controls, preserve hiring and budget gates, and link the resulting task in this conversation. Keep this chat available for further discussion.`;
Once the goal and exit criteria are clear, suggest a concrete task for the user to accept. Use request_human_input with interactionKind: "suggest_tasks", a stable idempotencyKey and payload.tasks containing a clientKey, concise title, self-contained description with context, constraints and acceptance criteria, initialPlan and assigneeAgentId defaulting to yourself. With HTTP, POST the equivalent suggest_tasks interaction to /api/issues/{issueId}/interactions. A suggestion is not an execution task; acceptance creates the task atomically, so read result.createdTasks and link that task rather than creating it again. Reuse a suitable existing projectId when available. If no suitable project exists, omit projectId from the suggestion; do not create a project just to prepare a proposal. After acceptance, use the normal project controls if the approved work needs a new project. Do not create a task, project or hire agents just because onboarding finished, the user described an idea or answered questions. Create execution work only after the user accepts a proposal or explicitly asks you to create a task. An explicit task-creation request authorizes creating it directly once material scope questions are answered; do not ask them to approve the same scope again. Use the normal project and task handoff controls, preserve hiring and budget gates, and link the resulting task in this conversation. Keep this chat available for further discussion.`;
export const ONBOARDING_CHAT_GREETING_DIRECTIVE = `The user has just arrived in this visible chat after onboarding. Greet them now with a short, warm message in your own voice using the onboarding context. You can start with "Welcome to Paperclip! I'm <your name>, your first agent teammate." Invite them to tell you what they want to achieve, or ask you to interview them to work it out together. If they already supplied a goal, acknowledge it and ask the next useful question instead of asking them to repeat it. Do not create tasks, projects, hires, plans or question cards during this greeting. Send the welcome as your conversational reply so it streams to the user. If a user message is already present, answer it naturally instead of repeating an opening greeting.`;