mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-10 12:37:55 +01:00
fix(issues): do not wake the assignee for an issue created already closed
Creating an issue with status done or cancelled and an agent assignee queued an issue_assigned wake, so the agent got a run for finished work (and it queued behind any run the agent already had). The update path already treats restoring an assignee on closed work as not a reopen request, and create-time fast responses already skip done and cancelled. Apply the same guard to the create-time assignment wake. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fd29465e1a
commit
ff9ee74c46
2 files changed
+23
-2
No files matched your search
@@ -342,6 +342,25 @@ describeEmbeddedPostgres("issue create onboarding first-task routes", () => {
|
||||
expect(mockAdapterExecute).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it.each(["done", "cancelled"])("does not queue an assignment wake for an issue created already %s", async (status) => {
|
||||
const companyId = await seedCompany();
|
||||
const agentId = await seedAgent(companyId);
|
||||
const app = createApp();
|
||||
|
||||
await request(app)
|
||||
.post(`/api/companies/${companyId}/issues`)
|
||||
.send({ title: "Historical record", status, assigneeAgentId: agentId })
|
||||
.expect(201);
|
||||
|
||||
await drainHeartbeatRunsToQuiescence(db, heartbeatService(db));
|
||||
const wakeups = await db
|
||||
.select()
|
||||
.from(agentWakeupRequests)
|
||||
.where(eq(agentWakeupRequests.companyId, companyId));
|
||||
expect(wakeups).toHaveLength(0);
|
||||
expect(mockAdapterExecute).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("still queues an assignment wake for an ordinary assigned issue", async () => {
|
||||
const companyId = await seedCompany();
|
||||
const agentId = await seedAgent(companyId);
|
||||
|
||||
@@ -13242,9 +13242,11 @@ export function issueRoutes(
|
||||
// Do not auto-wake the onboarding first task. Nothing should run and no
|
||||
// token should be spent until the user types: the greeting is posted above
|
||||
// (deterministic, no LLM) and the user's first comment wakes the assignee
|
||||
// through the normal comment path. Every other create path keeps its wake.
|
||||
// through the normal comment path. A task created already done or
|
||||
// cancelled is a record, not work: like restoring an assignee on closed
|
||||
// work, it must not wake the assignee. Every other create keeps its wake.
|
||||
|
||||
if (!isOnboardingFirstTask) {
|
||||
if (!isOnboardingFirstTask && !isClosedIssueStatus(issue.status)) {
|
||||
void queueIssueAssignmentWakeup({
|
||||
heartbeat,
|
||||
issue,
|
||||
|
||||
Reference in new issue
Block a user