mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-22 11:54:35 +01:00
fix: make answered Slack conversations idle (#13809)
Settle published, successful Slack turns as Idle; resume the same conversation on an admitted message. Preserve unfinished work, delivery errors, and explicit dispositions. Verified through focused lifecycle/API/UI tests, full CI, and a real staging Slack conversation in the embedded browser. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
e3d8fb0876
commit
8725d6ce09
47 files changed
+777
-51
No files matched your search
@@ -108,6 +108,25 @@ and review run. The server reads these records from saved review state; it does
|
||||
not depend on the parent session remembering a separate review session. These
|
||||
records are evidence and do not grant permission to resolve another review.
|
||||
|
||||
### Answered Slack conversations
|
||||
|
||||
A successful Slack turn with a published final reply and no remaining execution
|
||||
or decision path settles to `chat_conversations.state = waiting` and issue
|
||||
`in_review`. This is a server-owned passive conversation state, displayed as
|
||||
**Idle**, not a request for review. It is excluded from execution counts, work
|
||||
queues, and generic review attention, while remaining accessible through
|
||||
Conversations, search, recent history, and unread activity.
|
||||
|
||||
An admitted Slack or board message clears waiting and returns the issue to
|
||||
`todo` in the message transaction; normal wake admission and checkout resume
|
||||
execution. Settlement rechecks the
|
||||
latest run, message cursor, publication receipt, and outstanding work under the
|
||||
task lock. Failed delivery, a newer message, queued work, monitors, dependencies,
|
||||
and pending decisions prevent settlement. Reconciliation applies the same rule
|
||||
to existing answered threads without another model invocation. Slack identity,
|
||||
permissions, and the ability to execute work in the same thread are unchanged.
|
||||
Other providers keep their existing lifecycle.
|
||||
|
||||
### `done`
|
||||
|
||||
The work is complete and terminal.
|
||||
|
||||
@@ -770,6 +770,8 @@ export type IssueChanges = Record<string, IssueChangeReceiptEntry>;
|
||||
export interface Issue {
|
||||
conversationAgentId?: string | null;
|
||||
conversationUserId?: string | null;
|
||||
/** Server-owned Slack lifecycle projection; not writable through task updates. */
|
||||
externalConversationState?: "active" | "waiting" | null;
|
||||
conversationState?: "active" | "waiting" | null;
|
||||
conversationSessionGeneration?: number;
|
||||
conversationBoundaryCommentId?: string | null;
|
||||
@@ -867,6 +869,7 @@ export interface Issue {
|
||||
|
||||
export type CompactIssue = Pick<
|
||||
Issue,
|
||||
| "externalConversationState"
|
||||
| "id"
|
||||
| "companyId"
|
||||
| "projectId"
|
||||
|
||||
@@ -38,6 +38,7 @@ export interface CompanySearchIssueSummary {
|
||||
identifier: string | null;
|
||||
title: string;
|
||||
status: IssueStatus;
|
||||
externalConversationState?: "active" | "waiting" | null;
|
||||
priority: IssuePriority;
|
||||
assigneeAgentId: string | null;
|
||||
assigneeUserId: string | null;
|
||||
|
||||
@@ -28233,6 +28233,52 @@ describeEmbeddedPostgres("chat channel control-plane integration", () => {
|
||||
await resumed.service.shutdown();
|
||||
});
|
||||
|
||||
it("returns two answered Slack turns to Idle in the same thread", async () => {
|
||||
const fixture = await seedCompany();
|
||||
const { callbacks, endpoint, service } = await configuredSlackEndpoint(fixture);
|
||||
const thread = makeThread({ channelId: "C-IDLE", id: "slack:C-IDLE:4049.1", name: "idle" });
|
||||
let issueId: string | undefined;
|
||||
let conversationId: string | undefined;
|
||||
for (const [index, text] of ["@maya are you there?", "what is your name?"].entries()) {
|
||||
const providerMessageId = `4049.${index + 1}`;
|
||||
await deliverMessage({ callbacks, endpointId: endpoint.id, thread: thread.thread,
|
||||
message: makeMessage({ id: providerMessageId, text, mentioned: index === 0 }),
|
||||
trigger: index === 0 ? "mention" : "subscribed_message" });
|
||||
const conversations = await db.select().from(chatConversations).where(eq(chatConversations.endpointId, endpoint.id));
|
||||
expect(conversations).toHaveLength(1);
|
||||
const conversation = conversations[0]!;
|
||||
expect(conversation.state).toBe("active");
|
||||
expect((await issueService(db).getById(conversation.issueId))?.status).toBe("todo");
|
||||
if (issueId) expect(conversation.issueId).toBe(issueId);
|
||||
if (conversationId) expect(conversation.id).toBe(conversationId);
|
||||
issueId = conversation.issueId;
|
||||
conversationId = conversation.id;
|
||||
const runId = randomUUID();
|
||||
await db.insert(heartbeatRuns).values({ id: runId, companyId: fixture.companyId,
|
||||
agentId: fixture.assignedAgentId, status: "succeeded", runtimeMode: "legacy", finishedAt: new Date(),
|
||||
contextSnapshot: await chatWakeContext({ endpointId: endpoint.id, issueId, provider: "slack", providerMessageId }) });
|
||||
// Model execution consuming the admitted wake and committing its checkout.
|
||||
await db.update(agentWakeupRequests).set({ status: "completed", runId })
|
||||
.where(and(eq(agentWakeupRequests.companyId, fixture.companyId), eq(agentWakeupRequests.status, "queued")));
|
||||
await db.update(issues).set({ status: "in_progress" }).where(eq(issues.id, issueId));
|
||||
await addSelectedChatFinal({ companyId: fixture.companyId, agentId: fixture.assignedAgentId,
|
||||
issueId, runId, body: index === 0 ? "Yes, I'm here." : "I'm Maya." });
|
||||
await service.processPendingPublications();
|
||||
await vi.waitFor(async () => {
|
||||
const issue = await issueService(db).getById(issueId!);
|
||||
expect(issue?.status).toBe("in_review");
|
||||
expect(issue?.externalConversationState).toBe("waiting");
|
||||
expect(issue?.conversationAgentId).toBeNull();
|
||||
expect(issue?.conversationUserId).toBeNull();
|
||||
});
|
||||
// A provider replay must not wake or reactivate the completed turn.
|
||||
await deliverMessage({ callbacks, endpointId: endpoint.id, thread: thread.thread,
|
||||
message: makeMessage({ id: providerMessageId, text, mentioned: index === 0 }),
|
||||
trigger: index === 0 ? "mention" : "subscribed_message" });
|
||||
expect((await issueService(db).getById(issueId))?.externalConversationState).toBe("waiting");
|
||||
}
|
||||
});
|
||||
|
||||
it("coalesces one Slack run's lifecycle and final response despite an interleaved task control", async () => {
|
||||
const fixture = await seedCompany();
|
||||
const { callbacks, endpoint, runtime, service } =
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
import express from "express";
|
||||
import request from "supertest";
|
||||
import { issueRoutes } from "../routes/issues.js";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { and, eq } from "drizzle-orm";
|
||||
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
activityLog, agents, agentWakeupRequests, approvals, chatConversations, chatEndpoints,
|
||||
chatMessageLinks, chatPublications, companies, createDb, heartbeatRuns, issueApprovals,
|
||||
issueComments, issueRelations, issueThreadInteractions, issues, nativeRunFinalizations,
|
||||
toolApplications, toolConnections,
|
||||
} from "@paperclipai/db";
|
||||
import { getEmbeddedPostgresTestSupport, startEmbeddedPostgresTestDatabase } from "./helpers/embedded-postgres.js";
|
||||
import { settleSlackConversation } from "../services/slack-conversation-lifecycle.js";
|
||||
import { externalConversationStateSql } from "../services/slack-conversation-state.js";
|
||||
import { executionIssueCondition } from "../services/issue-visibility.js";
|
||||
import { dashboardService } from "../services/dashboard.js";
|
||||
import { attentionService } from "../services/attention.js";
|
||||
import { companySearchQuerySchema } from "@paperclipai/shared";
|
||||
import { companySearchService } from "../services/company-search.js";
|
||||
import { recoveryService } from "../services/recovery/service.js";
|
||||
import { issueService } from "../services/issues.js";
|
||||
|
||||
const support = await getEmbeddedPostgresTestSupport();
|
||||
(support.supported ? describe : describe.skip)("Slack conversation idle lifecycle", () => {
|
||||
let database: Awaited<ReturnType<typeof startEmbeddedPostgresTestDatabase>>;
|
||||
let db: ReturnType<typeof createDb>;
|
||||
beforeAll(async () => {
|
||||
database = await startEmbeddedPostgresTestDatabase("paperclip-slack-idle-");
|
||||
db = createDb(database.connectionString);
|
||||
}, 90000);
|
||||
afterAll(async () => {
|
||||
await db?.$client.end({ timeout: 0 });
|
||||
await database?.cleanup();
|
||||
});
|
||||
|
||||
async function fixture(native = false) {
|
||||
const companyId = randomUUID();
|
||||
const agentId = randomUUID();
|
||||
const issueId = randomUUID();
|
||||
const endpointId = randomUUID();
|
||||
const conversationId = randomUUID();
|
||||
const runId = randomUUID();
|
||||
const wakeId = randomUUID();
|
||||
const responseId = randomUUID();
|
||||
const publicationId = randomUUID();
|
||||
const applicationId = randomUUID();
|
||||
const connectionId = randomUUID();
|
||||
const start = new Date(Date.now() - 10000);
|
||||
await db.insert(companies).values({ id: companyId, name: "Slack", issuePrefix: companyId.slice(0, 8) });
|
||||
await db.insert(agents).values({ id: agentId, companyId, name: "Carl", role: "general", adapterType: "codex_local" });
|
||||
await db.insert(issues).values({ id: issueId, companyId, title: "you there?", status: "in_progress", assigneeAgentId: agentId, originKind: "chat_channel" });
|
||||
await db.insert(toolApplications).values({ id: applicationId, companyId, name: "Slack", type: "native" });
|
||||
await db.insert(toolConnections).values({ id: connectionId, companyId, applicationId, name: "Slack", uid: connectionId, transport: "chat_sdk", connectionPurpose: "channel" });
|
||||
await db.insert(chatEndpoints).values({ id: endpointId, companyId, connectionId, provider: "slack", publicId: endpointId, assignedAgentId: agentId, status: "active" });
|
||||
await db.insert(chatConversations).values({ id: conversationId, companyId, endpointId, issueId, externalConversationId: "channel", externalThreadId: runId, externalLabel: "#test" });
|
||||
await db.insert(issueComments).values({ id: wakeId, companyId, issueId, authorType: "user", authorUserId: "local-board", body: "you there?", createdAt: start });
|
||||
await db.insert(chatMessageLinks).values({ companyId, endpointId, conversationId, commentId: wakeId, providerMessageId: wakeId, direction: "inbound" });
|
||||
await db.insert(heartbeatRuns).values({ id: runId, companyId, agentId, status: "succeeded", runtimeMode: native ? "native" : "legacy", nativeIssueId: native ? issueId : null,
|
||||
resultJson: native ? { finalizationReasonCode: "external_chat_response_waiting" } : null,
|
||||
createdAt: new Date(start.getTime() + 1), startedAt: start, finishedAt: new Date(),
|
||||
contextSnapshot: { issueId, source: "chat:slack", wakeCommentId: wakeId, wakeCommentIds: [wakeId] } });
|
||||
if (native) await db.insert(nativeRunFinalizations).values({ companyId, issueId, runId, phase: "committed" });
|
||||
await db.insert(issueComments).values({ id: responseId, companyId, issueId, authorType: "agent", authorAgentId: agentId, createdByRunId: runId, body: "Yes, I’m here.",
|
||||
metadata: { version: 1, authorizationReason: "allow_chat_run_presentation", sections: [] } });
|
||||
await db.insert(chatPublications).values({ id: publicationId, companyId, endpointId, conversationId, issueId, commentId: responseId,
|
||||
idempotencyKey: `comment:${responseId}:${endpointId}`, payload: { text: "Yes, I’m here." }, state: "published", providerMessageId: responseId, publishedAt: new Date() });
|
||||
return { companyId, agentId, issueId, endpointId, conversationId, runId, wakeId, responseId, publicationId, start };
|
||||
}
|
||||
async function state(f: Awaited<ReturnType<typeof fixture>>) {
|
||||
return (await db.select({ status: issues.status, externalConversationState: externalConversationStateSql() })
|
||||
.from(issues).where(eq(issues.id, f.issueId)))[0];
|
||||
}
|
||||
const settle = (f: Awaited<ReturnType<typeof fixture>>) => settleSlackConversation(db, f.companyId, f.issueId);
|
||||
|
||||
it.each([false, true])("settles a published answered turn once (native=%s)", async (native) => {
|
||||
const f = await fixture(native);
|
||||
expect(await settle(f)).toBe(true);
|
||||
expect(await state(f)).toEqual({ status: "in_review", externalConversationState: "waiting" });
|
||||
expect(await settle(f)).toBe(false);
|
||||
expect(await db.select().from(activityLog).where(and(eq(activityLog.entityId, f.issueId), eq(activityLog.action, "issue.updated")))).toHaveLength(1);
|
||||
expect(await db.select().from(issues).where(and(eq(issues.id, f.issueId), executionIssueCondition()))).toHaveLength(0);
|
||||
expect((await issueService(db).getById(f.issueId))?.externalConversationState).toBe("waiting");
|
||||
expect(await issueService(db).list(f.companyId)).toHaveLength(0);
|
||||
expect((await dashboardService(db).summary(f.companyId)).tasks.open).toBe(0);
|
||||
expect((await attentionService(db).list(f.companyId)).items.filter((item) => item.issueId === f.issueId)).toHaveLength(0);
|
||||
const results = await companySearchService(db).search(f.companyId, companySearchQuerySchema.parse({ q: "you there" }));
|
||||
expect(results.results.find((result) => result.issue?.id === f.issueId)?.issue?.externalConversationState).toBe("waiting");
|
||||
expect((await issueService(db).list(f.companyId, { q: "you there" }))[0]?.externalConversationState).toBe("waiting");
|
||||
expect((await issueService(db).listReviewAttention(f.companyId, [{ id: f.issueId, companyId: f.companyId, status: "in_review" }])).get(f.issueId)?.state).toBe("none");
|
||||
});
|
||||
|
||||
it("preserves waiting state in compact list responses used by the Inbox", async () => {
|
||||
const f = await fixture();
|
||||
await settle(f);
|
||||
const app = express();
|
||||
app.use((req, _res, next) => {
|
||||
(req as any).actor = { type: "board", userId: "local-board", source: "local_implicit", isInstanceAdmin: true };
|
||||
next();
|
||||
});
|
||||
app.use("/api", issueRoutes(db, {} as any));
|
||||
const response = await request(app).get(`/api/companies/${f.companyId}/issues`)
|
||||
.query({ view: "compact", q: "you there" });
|
||||
expect(response.status, JSON.stringify(response.body)).toBe(200);
|
||||
expect(response.body).toEqual([expect.objectContaining({ id: f.issueId, status: "in_review", externalConversationState: "waiting" })]);
|
||||
});
|
||||
|
||||
it("reconciles an already-answered conversation without another model run", async () => {
|
||||
const f = await fixture();
|
||||
const enqueueWakeup = vi.fn(async () => null);
|
||||
const recovery = recoveryService(db, { enqueueWakeup });
|
||||
// Restrict to this newly created fixture, like the rollout reconciler's candidate scan.
|
||||
const [issue] = await db.select().from(issues).where(eq(issues.id, f.issueId));
|
||||
await recovery.reconcileStrandedAssignedIssues({ issueCreatedAtGte: issue.createdAt });
|
||||
expect((await state(f))?.externalConversationState).toBe("waiting");
|
||||
await recovery.reconcileStrandedAssignedIssues({ issueCreatedAtGte: issue.createdAt });
|
||||
expect(enqueueWakeup).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("waits for both finalization and delivery, regardless of their order", async () => {
|
||||
for (const first of ["run", "publication"]) {
|
||||
const f = await fixture();
|
||||
if (first === "run") await db.update(chatPublications).set({ state: "pending" }).where(eq(chatPublications.id, f.publicationId));
|
||||
else await db.update(heartbeatRuns).set({ status: "running" }).where(eq(heartbeatRuns.id, f.runId));
|
||||
expect(await settle(f)).toBe(false);
|
||||
await db.update(chatPublications).set({ state: "published" }).where(eq(chatPublications.id, f.publicationId));
|
||||
await db.update(heartbeatRuns).set({ status: "succeeded" }).where(eq(heartbeatRuns.id, f.runId));
|
||||
expect(await settle(f)).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it("a new board message reactivates the same conversation and prevents stale settlement", async () => {
|
||||
const f = await fixture();
|
||||
await settle(f);
|
||||
const followup = await issueService(db).addComment(f.issueId, "what's your name?", { userId: "local-board" });
|
||||
expect((await state(f))?.externalConversationState).toBe("active");
|
||||
expect(await settle(f)).toBe(false);
|
||||
expect((await state(f))?.status).toBe("todo");
|
||||
await issueService(db).checkout(f.issueId, f.agentId, ["todo", "backlog", "blocked"], null);
|
||||
expect((await state(f))?.status).toBe("in_progress");
|
||||
const nextRun = randomUUID();
|
||||
await db.insert(chatMessageLinks).values({ companyId: f.companyId, endpointId: f.endpointId, conversationId: f.conversationId, commentId: followup.id, providerMessageId: followup.id, direction: "inbound" });
|
||||
await db.insert(heartbeatRuns).values({ id: nextRun, companyId: f.companyId, agentId: f.agentId, runtimeMode: "legacy", status: "succeeded", finishedAt: new Date(),
|
||||
contextSnapshot: { issueId: f.issueId, source: "chat:slack", wakeCommentId: followup.id } });
|
||||
const [response] = await db.insert(issueComments).values({ companyId: f.companyId, issueId: f.issueId, authorAgentId: f.agentId, createdByRunId: nextRun, body: "Carl", metadata: { version: 1, authorizationReason: "allow_chat_run_presentation", sections: [] } }).returning();
|
||||
await db.insert(chatPublications).values({ companyId: f.companyId, endpointId: f.endpointId, conversationId: f.conversationId, issueId: f.issueId, commentId: response.id,
|
||||
idempotencyKey: nextRun, payload: { text: "Carl" }, state: "published", providerMessageId: nextRun });
|
||||
expect(await settle(f)).toBe(true);
|
||||
expect((await state(f))?.externalConversationState).toBe("waiting");
|
||||
});
|
||||
|
||||
it("serializes simultaneous finalizers and a new message without losing the message", async () => {
|
||||
const f = await fixture();
|
||||
await Promise.all([settle(f), settle(f), issueService(db).addComment(f.issueId, "another request", { userId: "local-board" })]);
|
||||
expect((await state(f))?.externalConversationState).toBe("active");
|
||||
expect(await settle(f)).toBe(false);
|
||||
});
|
||||
|
||||
it("lets an operator explicitly request review instead of keeping Idle", async () => {
|
||||
const f = await fixture();
|
||||
await settle(f);
|
||||
await issueService(db).update(f.issueId, { status: "in_review", actorUserId: "local-board" });
|
||||
expect(await state(f)).toEqual({ status: "in_review", externalConversationState: "active" });
|
||||
expect(await settle(f)).toBe(false);
|
||||
});
|
||||
|
||||
it("duplicate board delivery does not reactivate an answered turn", async () => {
|
||||
const f = await fixture();
|
||||
const clientRequestId = randomUUID();
|
||||
await db.update(issueComments).set({ clientRequestId }).where(eq(issueComments.id, f.wakeId));
|
||||
await settle(f);
|
||||
const duplicate = await issueService(db).addComment(f.issueId, "you there?", { userId: "local-board" }, { clientRequestId });
|
||||
expect(duplicate.id).toBe(f.wakeId);
|
||||
expect((await state(f))?.externalConversationState).toBe("waiting");
|
||||
});
|
||||
|
||||
it("keeps delivery errors visible after a conversation has settled", async () => {
|
||||
const f = await fixture();
|
||||
await settle(f);
|
||||
await db.update(chatPublications).set({ state: "failed" }).where(eq(chatPublications.id, f.publicationId));
|
||||
expect((await state(f))?.externalConversationState).toBe("active");
|
||||
expect(await db.select().from(issues).where(and(eq(issues.id, f.issueId), executionIssueCondition()))).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("does not settle past an unlinked Slack guest's newer message", async () => {
|
||||
const f = await fixture();
|
||||
const [message] = await db.insert(issueComments).values({ companyId: f.companyId, issueId: f.issueId, authorType: "system", body: "one more thing" }).returning();
|
||||
await db.insert(chatMessageLinks).values({ companyId: f.companyId, endpointId: f.endpointId, conversationId: f.conversationId, commentId: message.id, providerMessageId: message.id, direction: "inbound" });
|
||||
expect(await settle(f)).toBe(false);
|
||||
});
|
||||
|
||||
it("requires committed native response-wait evidence", async () => {
|
||||
const f = await fixture(true);
|
||||
await db.update(nativeRunFinalizations).set({ phase: "arbitrating" }).where(eq(nativeRunFinalizations.runId, f.runId));
|
||||
expect(await settle(f)).toBe(false);
|
||||
await db.update(nativeRunFinalizations).set({ phase: "committed" }).where(eq(nativeRunFinalizations.runId, f.runId));
|
||||
await db.update(heartbeatRuns).set({ resultJson: { finalizationReasonCode: "governed_response_waiting" } }).where(eq(heartbeatRuns.id, f.runId));
|
||||
expect(await settle(f)).toBe(false);
|
||||
});
|
||||
|
||||
it("settles an authorized published reply after an interaction continuation", async () => {
|
||||
const f = await fixture(true);
|
||||
const [answer] = await db.insert(issueComments).values({ companyId: f.companyId, issueId: f.issueId,
|
||||
authorType: "user", authorUserId: "local-board", body: "Here is the requested answer", createdAt: new Date(f.start.getTime() + 2) }).returning();
|
||||
await db.update(heartbeatRuns).set({ contextSnapshot: {
|
||||
issueId: f.issueId, source: "issue.interaction.respond", externalChatContinuation: true, wakeCommentId: answer.id,
|
||||
} }).where(eq(heartbeatRuns.id, f.runId));
|
||||
expect(await settle(f)).toBe(true);
|
||||
});
|
||||
|
||||
it("waits for execution release before moving the issue to review", async () => {
|
||||
const f = await fixture();
|
||||
await db.update(issues).set({ executionRunId: f.runId }).where(eq(issues.id, f.issueId));
|
||||
expect(await settle(f)).toBe(false);
|
||||
expect((await state(f))?.status).toBe("in_progress");
|
||||
await db.update(issues).set({ executionRunId: null }).where(eq(issues.id, f.issueId));
|
||||
expect(await settle(f)).toBe(true);
|
||||
});
|
||||
|
||||
it.each([
|
||||
{ status: "pending" },
|
||||
{ status: "changes_requested" },
|
||||
{ status: "idle", monitor: { status: "scheduled" } },
|
||||
{ status: "idle", monitor: { status: "triggered" } },
|
||||
])("preserves governed or monitored unfinished work: %j", async (executionState) => {
|
||||
const f = await fixture();
|
||||
await db.update(issues).set({ executionState }).where(eq(issues.id, f.issueId));
|
||||
expect(await settle(f)).toBe(false);
|
||||
});
|
||||
|
||||
it("preserves pending interactions and removes Idle if a real review is requested later", async () => {
|
||||
const f = await fixture();
|
||||
await settle(f);
|
||||
await db.insert(issueThreadInteractions).values({ companyId: f.companyId, issueId: f.issueId, kind: "request_confirmation", payload: { version: 1, prompt: "Approve?" } });
|
||||
expect((await state(f))?.externalConversationState).toBe("active");
|
||||
await db.update(issues).set({ status: "in_progress" }).where(eq(issues.id, f.issueId));
|
||||
await db.update(chatConversations).set({ state: "active" }).where(eq(chatConversations.id, f.conversationId));
|
||||
expect(await settle(f)).toBe(false);
|
||||
});
|
||||
|
||||
it.each(["failed", "cancelled", "timed_out", "queued", "running", "scheduled_retry"])("does not park a %s run", async (status) => {
|
||||
const f = await fixture();
|
||||
await db.update(heartbeatRuns).set({ status }).where(eq(heartbeatRuns.id, f.runId));
|
||||
expect(await settle(f)).toBe(false);
|
||||
});
|
||||
it.each(["pending", "failed", "delivery_unknown", "retry", "streaming", "awaiting_consent"] as const)("does not park %s delivery", async (state) => {
|
||||
const f = await fixture();
|
||||
await db.update(chatPublications).set({ state }).where(eq(chatPublications.id, f.publicationId));
|
||||
expect(await settle(f)).toBe(false);
|
||||
});
|
||||
it.each(["done", "blocked", "cancelled", "in_review"])("preserves explicit %s disposition", async (status) => {
|
||||
const f = await fixture();
|
||||
await db.update(issues).set({ status }).where(eq(issues.id, f.issueId));
|
||||
expect(await settle(f)).toBe(false);
|
||||
});
|
||||
it.each(["completed", "unavailable", "endpoint_removed"])("does not reactivate a %s conversation", async (state) => {
|
||||
const f = await fixture();
|
||||
await db.update(chatConversations).set({ state }).where(eq(chatConversations.id, f.conversationId));
|
||||
expect(await settle(f)).toBe(false);
|
||||
});
|
||||
it("respects company, provider, and connection boundaries", async () => {
|
||||
const f = await fixture();
|
||||
expect(await settleSlackConversation(db, randomUUID(), f.issueId)).toBe(false);
|
||||
await db.update(chatEndpoints).set({ status: "revoked" }).where(eq(chatEndpoints.id, f.endpointId));
|
||||
expect(await settle(f)).toBe(false);
|
||||
await db.update(chatEndpoints).set({ status: "active", provider: "telegram" }).where(eq(chatEndpoints.id, f.endpointId));
|
||||
expect(await settle(f)).toBe(false);
|
||||
});
|
||||
it("preserves scheduled work, newer runs, queued wakes, monitors, blockers, and approvals", async () => {
|
||||
const monitor = await fixture();
|
||||
await db.update(issues).set({ monitorNextCheckAt: new Date(Date.now() + 60000) }).where(eq(issues.id, monitor.issueId));
|
||||
expect(await settle(monitor)).toBe(false);
|
||||
const queued = await fixture();
|
||||
await db.insert(agentWakeupRequests).values({ companyId: queued.companyId, agentId: queued.agentId, source: "automation", status: "deferred_issue_execution", payload: { issueId: queued.issueId } });
|
||||
expect(await settle(queued)).toBe(false);
|
||||
const newer = await fixture();
|
||||
await db.insert(heartbeatRuns).values({ companyId: newer.companyId, agentId: newer.agentId, status: "scheduled_retry", contextSnapshot: { issueId: newer.issueId } });
|
||||
expect(await settle(newer)).toBe(false);
|
||||
const blocked = await fixture();
|
||||
const [blocker] = await db.insert(issues).values({ companyId: blocked.companyId, title: "dependency", status: "todo" }).returning();
|
||||
await db.insert(issueRelations).values({ companyId: blocked.companyId, issueId: blocker.id, relatedIssueId: blocked.issueId, type: "blocks" });
|
||||
expect(await settle(blocked)).toBe(false);
|
||||
const review = await fixture();
|
||||
const [approval] = await db.insert(approvals).values({ companyId: review.companyId, type: "hire_agent", status: "pending", payload: {} }).returning();
|
||||
await db.insert(issueApprovals).values({ companyId: review.companyId, issueId: review.issueId, approvalId: approval.id });
|
||||
expect(await settle(review)).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -2977,6 +2977,7 @@ class AutoApprovalIssueMissingError extends Error {
|
||||
|
||||
function toCompactIssue(issue: any): CompactIssue {
|
||||
return {
|
||||
externalConversationState: issue.externalConversationState ?? null,
|
||||
id: issue.id,
|
||||
companyId: issue.companyId,
|
||||
projectId: issue.projectId,
|
||||
|
||||
@@ -10,6 +10,8 @@ import { githubChatReviewService } from "./chat-github-reviews.js";
|
||||
import { githubChatRegistrationService } from "./chat-github-registration.js";
|
||||
import { githubChatPrincipalAccess } from "./chat-github-access.js";
|
||||
import { githubAppJwt } from "./chat-github-client.js";
|
||||
import { resumeSlackConversation } from "./slack-conversation-state.js";
|
||||
import { settleSlackConversation } from "./slack-conversation-lifecycle.js";
|
||||
import { runtimeCanonicalOrigin } from "./cloud-runtime-identity.js";
|
||||
import { takePhotonCompanion } from "./photon/attachments.js";
|
||||
import { writePhotonCheckpoint } from "./photon/receiver.js";
|
||||
@@ -16248,6 +16250,9 @@ export function chatChannelService(db: Db, options: ChatChannelServiceOptions) {
|
||||
direction: "inbound",
|
||||
})
|
||||
.onConflictDoNothing();
|
||||
if (taskEndpoint.provider === "slack") {
|
||||
await resumeSlackConversation(taskTx as unknown as Db, endpoint.companyId, conversation.issueId);
|
||||
}
|
||||
await taskTx
|
||||
.update(chatConversations)
|
||||
.set({
|
||||
@@ -37958,7 +37963,12 @@ export function chatChannelService(db: Db, options: ChatChannelServiceOptions) {
|
||||
// this cap. Different conversations for one bot keep the existing
|
||||
// endpoint-exclusive credential fence instead of timing out behind it.
|
||||
const task = Promise.resolve()
|
||||
.then(() => processSelectedPublication(selectedPublication))
|
||||
.then(async () => {
|
||||
await processSelectedPublication(selectedPublication);
|
||||
await settleSlackConversation(db, selectedPublication.companyId, selectedPublication.issueId).catch((err) => {
|
||||
logger.warn({ err, publicationId: selectedPublication.id }, "Slack conversation settlement deferred to reconciliation");
|
||||
});
|
||||
})
|
||||
.catch((error: unknown) => {
|
||||
if (!failed) {
|
||||
failed = true;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { externalConversationStateSql } from "./slack-conversation-state.js";
|
||||
import { and, desc, eq, gte, inArray, isNotNull, isNull, notInArray, or, sql } from "drizzle-orm";
|
||||
import type { SQL } from "drizzle-orm";
|
||||
import type { Db } from "@paperclipai/db";
|
||||
@@ -1108,6 +1109,15 @@ export function companySearchService(db: Db) {
|
||||
: null;
|
||||
|
||||
const paged = results.slice(offset, offset + limit).map(stripInternalSortFields);
|
||||
const issueIds = paged.flatMap((result) => result.issue ? [result.issue.id] : []);
|
||||
if (issueIds.length > 0) {
|
||||
const states = await db.select({ id: issues.id, state: externalConversationStateSql() }).from(issues)
|
||||
.where(and(eq(issues.companyId, companyId), inArray(issues.id, issueIds)));
|
||||
const byId = new Map(states.map((row) => [row.id, row.state]));
|
||||
for (const result of paged) {
|
||||
if (result.issue) result.issue.externalConversationState = byId.get(result.issue.id) ?? null;
|
||||
}
|
||||
}
|
||||
return {
|
||||
query: query.q,
|
||||
normalizedQuery,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { externalConversationStateSql, nonIdleSlackIssueCondition } from "./slack-conversation-state.js";
|
||||
import { settleSlackConversation } from "./slack-conversation-lifecycle.js";
|
||||
import { publicChatTaskUrl } from "./chat-task-url.js";
|
||||
import { toolActionDeliveryService } from "./tool-action-delivery.js";
|
||||
import { githubBotConnectionIdsForRun } from "./chat-github-tools.js";
|
||||
@@ -10598,6 +10600,7 @@ export function heartbeatService(
|
||||
.select({
|
||||
chatCommunicationGuidance: chatConversations.communicationGuidance,
|
||||
chatAssignedAgentId: chatEndpoints.assignedAgentId,
|
||||
externalConversationState: externalConversationStateSql(),
|
||||
conversationAgentId: issues.conversationAgentId,
|
||||
conversationUserId: issues.conversationUserId,
|
||||
conversationState: issues.conversationState,
|
||||
@@ -13058,7 +13061,8 @@ export function heartbeatService(
|
||||
|
||||
const issueId = readNonEmptyString(context.issueId);
|
||||
if (!issueId) return;
|
||||
if (isWaitingConversation(await getIssueExecutionContext(run.companyId, issueId))) return;
|
||||
const waitingContext = await getIssueExecutionContext(run.companyId, issueId);
|
||||
if (isWaitingConversation(waitingContext) || waitingContext?.externalConversationState === "waiting") return;
|
||||
|
||||
const [issue, agent] = await Promise.all([
|
||||
db
|
||||
@@ -13259,7 +13263,8 @@ export function heartbeatService(
|
||||
const issueId =
|
||||
readNonEmptyString(context.issueId) ?? readNonEmptyString(context.taskId);
|
||||
if (!issueId) return;
|
||||
if (isWaitingConversation(await getIssueExecutionContext(run.companyId, issueId))) return;
|
||||
const waitingContext = await getIssueExecutionContext(run.companyId, issueId);
|
||||
if (isWaitingConversation(waitingContext) || waitingContext?.externalConversationState === "waiting") return;
|
||||
if (
|
||||
readNonEmptyString(context.goalControlRequestId) ||
|
||||
context.resumeSessionGoalHeartbeat === true
|
||||
@@ -13577,7 +13582,8 @@ export function heartbeatService(
|
||||
readNonEmptyString(contextSnapshot.issueId) ??
|
||||
readNonEmptyString(contextSnapshot.taskId);
|
||||
if (!issueId) return;
|
||||
if (isWaitingConversation(await getIssueExecutionContext(run.companyId, issueId))) return;
|
||||
const waitingContext = await getIssueExecutionContext(run.companyId, issueId);
|
||||
if (isWaitingConversation(waitingContext) || waitingContext?.externalConversationState === "waiting") return;
|
||||
|
||||
const issue = await db
|
||||
.select({
|
||||
@@ -16734,6 +16740,7 @@ export function heartbeatService(
|
||||
isNull(issues.hiddenAt),
|
||||
inArray(issues.status, [...TIMER_ACTIONABLE_ISSUE_STATUSES]),
|
||||
isNull(issues.conversationAgentId),
|
||||
nonIdleSlackIssueCondition(),
|
||||
),
|
||||
)
|
||||
.limit(1)
|
||||
@@ -26059,6 +26066,14 @@ export function heartbeatService(
|
||||
suppressImmediateRecovery: options.suppressImmediateRecovery,
|
||||
});
|
||||
await applyWakeQueuePostCommitEffects(postCommitEffects);
|
||||
const completed = await getRun(run.id);
|
||||
const issueId = readNonEmptyString(completed?.contextSnapshot?.issueId)
|
||||
?? readNonEmptyString(completed?.contextSnapshot?.taskId) ?? completed?.nativeIssueId;
|
||||
if (completed?.status === "succeeded" && issueId) {
|
||||
await settleSlackConversation(db, run.companyId, issueId).catch((err) => {
|
||||
logger.warn({ err, runId: run.id }, "Slack conversation settlement deferred to reconciliation");
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
if (
|
||||
error instanceof WakeQueueApplicationError &&
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { nonIdleSlackIssueCondition } from "./slack-conversation-state.js";
|
||||
import { and, isNull, type SQL } from "drizzle-orm";
|
||||
import { issues } from "@paperclipai/db";
|
||||
|
||||
@@ -11,5 +12,5 @@ export function visibleIssueSql(alias = "issues") {
|
||||
|
||||
/** Work queues and execution totals omit persistent conversation containers. */
|
||||
export function executionIssueCondition(): SQL {
|
||||
return and(visibleIssueCondition(), isNull(issues.conversationAgentId))!;
|
||||
return and(visibleIssueCondition(), isNull(issues.conversationAgentId), nonIdleSlackIssueCondition())!;
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { externalConversationStateSql, nonIdleSlackIssueCondition, resumeSlackConversation } from "./slack-conversation-state.js";
|
||||
import { documentService } from "./documents.js";
|
||||
import { parseTaskSearch, taskSearchCtes, taskSearchScore } from "./task-search.js";
|
||||
import { createdFromIssueCondition } from "./issue-creation-origin.js";
|
||||
@@ -11,6 +12,7 @@ import {
|
||||
desc,
|
||||
eq,
|
||||
gt,
|
||||
getTableColumns,
|
||||
gte,
|
||||
inArray,
|
||||
isNotNull,
|
||||
@@ -1776,7 +1778,7 @@ export interface IssueFilters {
|
||||
updatedSince?: string;
|
||||
}
|
||||
|
||||
type IssueRow = typeof issues.$inferSelect;
|
||||
type IssueRow = typeof issues.$inferSelect & { externalConversationState?: "active" | "waiting" | null };
|
||||
type IssueLabelRow = typeof labels.$inferSelect;
|
||||
type IssuePlanDecompositionRow = typeof issuePlanDecompositions.$inferSelect;
|
||||
type IssueActiveRunRow = {
|
||||
@@ -4410,7 +4412,7 @@ async function listIssueReviewAttentionMap(
|
||||
.select()
|
||||
.from(issues)
|
||||
.where(
|
||||
and(eq(issues.companyId, companyId), inArray(issues.id, chunk)),
|
||||
and(eq(issues.companyId, companyId), inArray(issues.id, chunk), nonIdleSlackIssueCondition()),
|
||||
)),
|
||||
);
|
||||
}
|
||||
@@ -4777,6 +4779,7 @@ async function listIssueReviewAttentionMap(
|
||||
}
|
||||
|
||||
const issueListSelect = {
|
||||
externalConversationState: externalConversationStateSql(),
|
||||
conversationAgentId: issues.conversationAgentId,
|
||||
conversationUserId: issues.conversationUserId,
|
||||
conversationState: issues.conversationState,
|
||||
@@ -6492,7 +6495,7 @@ export function issueService(db: Db) {
|
||||
|
||||
async function getIssueByUuid(id: string) {
|
||||
const row = await db
|
||||
.select()
|
||||
.select({ ...getTableColumns(issues), externalConversationState: externalConversationStateSql() })
|
||||
.from(issues)
|
||||
.where(eq(issues.id, id))
|
||||
.then((rows) => rows[0] ?? null);
|
||||
@@ -6503,7 +6506,7 @@ export function issueService(db: Db) {
|
||||
|
||||
async function getIssueByIdentifier(identifier: string) {
|
||||
const row = await db
|
||||
.select()
|
||||
.select({ ...getTableColumns(issues), externalConversationState: externalConversationStateSql() })
|
||||
.from(issues)
|
||||
.where(eq(issues.identifier, identifier.toUpperCase()))
|
||||
.then((rows) => rows[0] ?? null);
|
||||
@@ -7784,7 +7787,12 @@ export function issueService(db: Db) {
|
||||
eq(issues.companyId, companyId),
|
||||
visibleIssueCondition(),
|
||||
];
|
||||
if (!filters?.q?.trim()) conditions.push(isNull(issues.conversationAgentId));
|
||||
if (!filters?.q?.trim()) {
|
||||
conditions.push(isNull(issues.conversationAgentId));
|
||||
if (!filters?.touchedByUserId && !filters?.unreadForUserId && !filters?.inboxArchivedByUserId) {
|
||||
conditions.push(nonIdleSlackIssueCondition());
|
||||
}
|
||||
}
|
||||
if (filters?.afterId) conditions.push(gt(issues.id, filters.afterId));
|
||||
const assigneeAgentFilter = parseIssueAssigneeAgentFilter(
|
||||
filters?.assigneeAgentId,
|
||||
@@ -8113,7 +8121,12 @@ export function issueService(db: Db) {
|
||||
}
|
||||
|
||||
const conditions = [eq(issues.companyId, companyId), visibleIssueCondition()];
|
||||
if (!filters?.q?.trim()) conditions.push(isNull(issues.conversationAgentId));
|
||||
if (!filters?.q?.trim()) {
|
||||
conditions.push(isNull(issues.conversationAgentId));
|
||||
if (!filters?.touchedByUserId && !filters?.unreadForUserId && !filters?.inboxArchivedByUserId) {
|
||||
conditions.push(nonIdleSlackIssueCondition());
|
||||
}
|
||||
}
|
||||
const statuses = parseStatusFilter(filters?.status);
|
||||
if (statuses.length === 1)
|
||||
conditions.push(eq(issues.status, statuses[0]!));
|
||||
@@ -10841,6 +10854,14 @@ export function issueService(db: Db) {
|
||||
.returning()
|
||||
.then((rows: Array<typeof issues.$inferSelect>) => rows[0] ?? null);
|
||||
if (!updated) return null;
|
||||
// An operator explicitly choosing a disposition owns that decision,
|
||||
// including choosing In Review while the conversation is Idle.
|
||||
if (actorUserId && issueData.status !== undefined) {
|
||||
await tx.update(chatConversations).set({ state: "active", updatedAt: new Date() })
|
||||
.where(and(eq(chatConversations.companyId, updated.companyId), eq(chatConversations.issueId, updated.id),
|
||||
eq(chatConversations.state, "waiting"), sql`exists (select 1 from chat_endpoints e
|
||||
where e.id = ${chatConversations.endpointId} and e.company_id = ${chatConversations.companyId} and e.provider = 'slack')`));
|
||||
}
|
||||
if (updated.assigneeAgentId !== existing.assigneeAgentId || updated.assigneeUserId !== existing.assigneeUserId) {
|
||||
const { issueThreadInteractionService } = await import("./issue-thread-interactions.js");
|
||||
await issueThreadInteractionService(tx).expireConnectionIntentsForOwnershipChange(updated);
|
||||
@@ -12025,6 +12046,10 @@ export function issueService(db: Db) {
|
||||
? retryNativeChatReviewPresentation(append)
|
||||
: append();
|
||||
}
|
||||
// Callers supplying a transaction still share the settlement fence.
|
||||
if (actor.userId && dbOrTx !== db) {
|
||||
await dbOrTx.select({ id: issues.id }).from(issues).where(eq(issues.id, issueId)).for("update");
|
||||
}
|
||||
const issue = await dbOrTx
|
||||
.select({ companyId: issues.companyId, conversationAgentId: issues.conversationAgentId })
|
||||
.from(issues)
|
||||
@@ -12479,6 +12504,9 @@ export function issueService(db: Db) {
|
||||
if (issue.conversationAgentId && actor.userId) {
|
||||
await dbOrTx.update(issues).set({ conversationState: "active" }).where(eq(issues.id, issueId));
|
||||
}
|
||||
if (authorType === "user" || actor.userId) {
|
||||
await resumeSlackConversation(dbOrTx, issue.companyId, issueId);
|
||||
}
|
||||
// Update issue's updatedAt so comment activity is reflected in recency sorting
|
||||
await dbOrTx
|
||||
.update(issues)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { settleSlackConversation } from "../slack-conversation-lifecycle.js";
|
||||
import { dismissAutomaticCompletionReviews } from "./automatic-completion-reviews.js";
|
||||
import { getNativeReviewAssignment, readNativeReviewAssignmentContext } from "./native-review-participant.js";
|
||||
import { conversationNativeDecision, isConversation } from "../agent-conversations.js";
|
||||
@@ -1039,6 +1040,11 @@ export async function finalizeNativeRun(input: {
|
||||
issueId: coordinator.issueId,
|
||||
runId: run.id,
|
||||
});
|
||||
if (input.projectRunStatus) {
|
||||
await settleSlackConversation(input.db, run.companyId, coordinator.issueId).catch((err) => {
|
||||
logger.warn({ err, runId: run.id }, "Slack conversation settlement deferred to reconciliation");
|
||||
});
|
||||
}
|
||||
return coordinator;
|
||||
}
|
||||
const [resultRow, contractRow] = await Promise.all([
|
||||
@@ -1363,6 +1369,11 @@ export async function finalizeNativeRun(input: {
|
||||
issueId: coordinator.issueId,
|
||||
runId: run.id,
|
||||
});
|
||||
if (input.projectRunStatus && finalizationPhase === "committed") {
|
||||
await settleSlackConversation(input.db, run.companyId, coordinator.issueId).catch((err) => {
|
||||
logger.warn({ err, runId: run.id }, "Slack conversation settlement deferred to reconciliation");
|
||||
});
|
||||
}
|
||||
return {
|
||||
...coordinator,
|
||||
phase: finalizationPhase,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { settleSlackConversation } from "../slack-conversation-lifecycle.js";
|
||||
import { externalConversationStateSql } from "../slack-conversation-state.js";
|
||||
import { hasLiveLegacyController } from "../legacy-controller-lease.js";
|
||||
import { instanceSettingsService } from "../instance-settings.js";
|
||||
import { isWaitingConversation, settleConversationTurn, deliverConversationComments } from "../agent-conversations.js";
|
||||
@@ -4208,6 +4210,12 @@ export function recoveryService(
|
||||
}
|
||||
|
||||
for (const issue of candidates) {
|
||||
if (issue.originKind === "chat_channel") {
|
||||
await settleSlackConversation(db, issue.companyId, issue.id);
|
||||
const [current] = await db.select({ externalConversationState: externalConversationStateSql() })
|
||||
.from(issues).where(and(eq(issues.companyId, issue.companyId), eq(issues.id, issue.id)));
|
||||
if (current?.externalConversationState === "waiting") { result.skipped += 1; continue; }
|
||||
}
|
||||
if (issue.conversationAgentId) {
|
||||
const lastRun = await getLatestIssueRun(issue.companyId, issue.id);
|
||||
if (lastRun?.status === "succeeded") {
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
import { and, desc, eq, inArray, sql } from "drizzle-orm";
|
||||
import { chatConversations, chatEndpoints, heartbeatRuns, issueComments, issues, type Db } from "@paperclipai/db";
|
||||
import { persistActivity, publishActivity, type ActivityPublication } from "./activity-log.js";
|
||||
|
||||
/** Both run finalization and provider publication can arrive first. Re-read
|
||||
* durable evidence under the task lock; never infer completion from prose. */
|
||||
export async function settleSlackConversation(db: Db, companyId: string, issueId: string): Promise<boolean> {
|
||||
let activity: ActivityPublication | null = null;
|
||||
const settled = await db.transaction(async (tx) => {
|
||||
// Match chat admission's endpoint -> task lock order. A closed/revoked
|
||||
// connection must not be resurrected by a late finalizer.
|
||||
const [binding] = await tx.select({ conversation: chatConversations, endpoint: chatEndpoints })
|
||||
.from(chatConversations)
|
||||
.innerJoin(chatEndpoints, and(eq(chatEndpoints.id, chatConversations.endpointId), eq(chatEndpoints.companyId, chatConversations.companyId)))
|
||||
.where(and(eq(chatConversations.companyId, companyId), eq(chatConversations.issueId, issueId),
|
||||
eq(chatEndpoints.provider, "slack"), inArray(chatConversations.state, ["active", "waiting"]),
|
||||
inArray(chatEndpoints.status, ["active", "verifying"])))
|
||||
.orderBy(desc(chatConversations.createdAt)).limit(1)
|
||||
.for("update", { of: chatEndpoints });
|
||||
if (!binding) return false;
|
||||
const [issue] = await tx.select().from(issues)
|
||||
.where(and(eq(issues.companyId, companyId), eq(issues.id, issueId))).for("update");
|
||||
if (!issue || issue.originKind !== "chat_channel" || issue.conversationAgentId || issue.hiddenAt ||
|
||||
issue.assigneeUserId || issue.assigneeAgentId !== binding.endpoint.assignedAgentId ||
|
||||
issue.status !== "in_progress" || issue.executionRunId || issue.monitorNextCheckAt ||
|
||||
["pending", "changes_requested"].includes(String(issue.executionState?.status))) return false;
|
||||
const monitor = issue.executionState?.monitor;
|
||||
if (monitor && typeof monitor === "object" && "status" in monitor &&
|
||||
["scheduled", "triggered"].includes(String(monitor.status))) return false;
|
||||
const [run] = await tx.select().from(heartbeatRuns)
|
||||
.where(and(eq(heartbeatRuns.companyId, companyId),
|
||||
sql`coalesce(${heartbeatRuns.contextSnapshot}->>'issueId', ${heartbeatRuns.contextSnapshot}->>'taskId', ${heartbeatRuns.nativeIssueId}::text) = ${issueId}`))
|
||||
.orderBy(desc(heartbeatRuns.createdAt), desc(heartbeatRuns.id)).limit(1);
|
||||
if (!run || run.status !== "succeeded" || run.agentId !== issue.assigneeAgentId ||
|
||||
!run.finishedAt ||
|
||||
run.scheduledRetryAt || ["plan_only", "empty_response"].includes(run.livenessState ?? "")) return false;
|
||||
if (run.runtimeMode === "native" && run.resultJson?.finalizationReasonCode !== "external_chat_response_waiting") return false;
|
||||
// The published, server-selected response is the binding proof. Resolved
|
||||
// questions can use an interaction continuation source and a board comment
|
||||
// instead of an inbound Slack link; publication already enforced access.
|
||||
const context = run.contextSnapshot ?? {};
|
||||
const commentIds = [...new Set([
|
||||
context.wakeCommentId, context.commentId,
|
||||
...(Array.isArray(context.wakeCommentIds) ? context.wakeCommentIds : []),
|
||||
].filter((id): id is string => typeof id === "string" && /^[a-f0-9-]{36}$/i.test(id)))];
|
||||
if (!commentIds.length) return false;
|
||||
const [wake] = await tx.select().from(issueComments)
|
||||
.where(and(eq(issueComments.companyId, companyId), eq(issueComments.issueId, issueId), inArray(issueComments.id, commentIds)))
|
||||
.orderBy(desc(issueComments.createdAt), desc(issueComments.id)).limit(1);
|
||||
if (!wake) return false;
|
||||
const [evidence] = await tx.execute<{ ready: boolean }>(sql`select
|
||||
exists (select 1 from chat_publications p join issue_comments response
|
||||
on response.id = p.comment_id and response.company_id = p.company_id and response.issue_id = p.issue_id
|
||||
where p.company_id = ${companyId} and p.issue_id = ${issueId} and p.conversation_id = ${binding.conversation.id}
|
||||
and p.state = 'published' and p.provider_message_id is not null
|
||||
and response.created_by_run_id = ${run.id} and response.author_agent_id = ${run.agentId}
|
||||
and response.deleted_at is null
|
||||
and response.created_at >= (select original.created_at from issue_comments original
|
||||
where original.company_id = ${companyId} and original.id = ${wake.id})
|
||||
and response.metadata->>'authorizationReason' = 'allow_chat_run_presentation')
|
||||
and (${run.runtimeMode} <> 'native' or exists (select 1 from native_run_finalizations f
|
||||
where f.company_id = ${companyId} and f.issue_id = ${issueId} and f.run_id = ${run.id} and f.phase = 'committed'))
|
||||
and not exists (select 1 from agent_task_sessions session where session.company_id = ${companyId}
|
||||
and session.task_key = ${issueId} and session.goal_status is not null and session.goal_status <> 'complete')
|
||||
and not exists (select 1 from issue_comments newer where newer.company_id = ${companyId} and newer.issue_id = ${issueId}
|
||||
and newer.deleted_at is null and newer.author_agent_id is null
|
||||
and (coalesce(newer.author_type, 'user') <> 'system' or exists (select 1 from chat_message_links inbound
|
||||
where inbound.company_id = newer.company_id and inbound.comment_id = newer.id
|
||||
and inbound.conversation_id = ${binding.conversation.id} and inbound.direction = 'inbound'))
|
||||
and (newer.created_at, newer.id) > (select original.created_at, original.id from issue_comments original
|
||||
where original.company_id = ${companyId} and original.id = ${wake.id}))
|
||||
and not exists (select 1 from heartbeat_runs r where r.company_id = ${companyId}
|
||||
and coalesce(r.context_snapshot->>'issueId', r.context_snapshot->>'taskId', r.native_issue_id::text) = ${issueId}
|
||||
and r.status in ('queued', 'running', 'scheduled_retry'))
|
||||
and not exists (select 1 from agent_wakeup_requests w where w.company_id = ${companyId}
|
||||
and coalesce(w.payload->>'issueId', w.payload->>'taskId', w.payload->'_paperclipWakeContext'->>'issueId') = ${issueId}
|
||||
and w.status in ('queued', 'claimed', 'deferred_issue_execution') and w.run_id is distinct from ${run.id}::uuid)
|
||||
and not exists (select 1 from issue_thread_interactions i where i.company_id = ${companyId} and i.issue_id = ${issueId} and i.status = 'pending')
|
||||
and not exists (select 1 from issue_approvals ia join approvals a on a.id = ia.approval_id and a.company_id = ia.company_id
|
||||
where ia.company_id = ${companyId} and ia.issue_id = ${issueId} and a.status in ('pending', 'revision_requested'))
|
||||
and not exists (select 1 from issue_relations edge join issues blocker on blocker.id = edge.issue_id and blocker.company_id = edge.company_id
|
||||
where edge.company_id = ${companyId} and edge.related_issue_id = ${issueId} and edge.type = 'blocks' and blocker.status <> 'done')
|
||||
and not exists (select 1 from chat_publications p where p.company_id = ${companyId} and p.conversation_id = ${binding.conversation.id}
|
||||
and p.state in ('pending', 'streaming', 'retry', 'delivery_unknown', 'failed', 'awaiting_consent'))
|
||||
as ready`);
|
||||
if (!evidence?.ready) return false;
|
||||
const changed = await tx.update(chatConversations).set({ state: "waiting", updatedAt: new Date() })
|
||||
.where(and(eq(chatConversations.id, binding.conversation.id), eq(chatConversations.companyId, companyId), eq(chatConversations.state, "active")))
|
||||
.returning({ id: chatConversations.id });
|
||||
if (!changed.length) return false;
|
||||
await tx.update(issues).set({ status: "in_review", updatedAt: new Date() })
|
||||
.where(and(eq(issues.id, issueId), eq(issues.companyId, companyId)));
|
||||
activity = (await persistActivity(tx as unknown as Db, {
|
||||
companyId, actorType: "system", actorId: "slack-conversation", action: "issue.updated",
|
||||
entityType: "issue", entityId: issueId, runId: run.id,
|
||||
details: { status: "in_review", externalConversationState: "waiting", conversationId: binding.conversation.id,
|
||||
issueTitle: issue.title, issueIdentifier: issue.identifier },
|
||||
})).publication;
|
||||
return true;
|
||||
});
|
||||
if (activity) publishActivity(activity);
|
||||
return settled;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import { chatConversations, issues, type Db } from "@paperclipai/db";
|
||||
import { and, eq, sql } from "drizzle-orm";
|
||||
|
||||
/** Read-only projection; Slack threads do not acquire Agent Chat identities. */
|
||||
export function externalConversationStateSql() {
|
||||
return sql<"active" | "waiting" | null>`(
|
||||
select case when c.state = 'waiting' and "issues"."status" = 'in_review'
|
||||
and "issues"."execution_run_id" is null
|
||||
and "issues"."monitor_next_check_at" is null
|
||||
and coalesce("issues"."execution_state"->>'status', '') not in ('pending', 'changes_requested')
|
||||
and coalesce("issues"."execution_state"->'monitor'->>'status', '') not in ('scheduled', 'triggered')
|
||||
and not exists (select 1 from issue_thread_interactions i
|
||||
where i.company_id = c.company_id and i.issue_id = c.issue_id and i.status = 'pending')
|
||||
and not exists (select 1 from issue_approvals ia join approvals a on a.id = ia.approval_id and a.company_id = ia.company_id
|
||||
where ia.company_id = c.company_id and ia.issue_id = c.issue_id and a.status in ('pending', 'revision_requested'))
|
||||
and not exists (select 1 from chat_publications p
|
||||
where p.company_id = c.company_id and p.conversation_id = c.id
|
||||
and p.state in ('pending', 'streaming', 'retry', 'delivery_unknown', 'failed', 'awaiting_consent'))
|
||||
and not exists (select 1 from heartbeat_runs r where r.company_id = c.company_id
|
||||
and coalesce(r.context_snapshot->>'issueId', r.context_snapshot->>'taskId', r.native_issue_id::text) = c.issue_id::text
|
||||
and r.status in ('queued', 'running', 'scheduled_retry'))
|
||||
and not exists (select 1 from agent_wakeup_requests w where w.company_id = c.company_id
|
||||
and coalesce(w.payload->>'issueId', w.payload->>'taskId', w.payload->'_paperclipWakeContext'->>'issueId') = c.issue_id::text
|
||||
and w.status in ('queued', 'claimed', 'deferred_issue_execution')
|
||||
and not exists (select 1 from heartbeat_runs owner where owner.id = w.run_id
|
||||
and owner.company_id = w.company_id and owner.status = 'succeeded'))
|
||||
and not exists (select 1 from agent_task_sessions session where session.company_id = c.company_id
|
||||
and session.task_key = c.issue_id::text and session.goal_status is not null and session.goal_status <> 'complete')
|
||||
and not exists (select 1 from issue_relations edge join issues blocker on blocker.id = edge.issue_id and blocker.company_id = edge.company_id
|
||||
where edge.company_id = c.company_id and edge.related_issue_id = c.issue_id and edge.type = 'blocks' and blocker.status <> 'done')
|
||||
then 'waiting' else 'active' end
|
||||
from chat_conversations c join chat_endpoints e on e.id = c.endpoint_id and e.company_id = c.company_id
|
||||
where c.company_id = "issues"."company_id" and c.issue_id = "issues"."id"
|
||||
and e.provider = 'slack' and e.assigned_agent_id = "issues"."assignee_agent_id"
|
||||
and e.status in ('active', 'verifying') and c.state in ('active', 'waiting')
|
||||
order by c.created_at desc, c.id desc limit 1
|
||||
)`;
|
||||
}
|
||||
|
||||
export function nonIdleSlackIssueCondition() {
|
||||
return sql`${externalConversationStateSql()} is distinct from 'waiting'`;
|
||||
}
|
||||
|
||||
/** Called inside message admission while its transaction owns the issue lock. */
|
||||
export async function resumeSlackConversation(tx: Db, companyId: string, issueId: string) {
|
||||
// Only the verified idle convention may leave In Review automatically.
|
||||
// A real decision or delivery problem keeps the existing review semantics.
|
||||
await tx.update(issues).set({ status: "todo", updatedAt: new Date() })
|
||||
.where(and(eq(issues.companyId, companyId), eq(issues.id, issueId),
|
||||
sql`${externalConversationStateSql()} = 'waiting'`));
|
||||
await tx.update(chatConversations).set({ state: "active", updatedAt: new Date() })
|
||||
.where(and(eq(chatConversations.companyId, companyId), eq(chatConversations.issueId, issueId),
|
||||
eq(chatConversations.state, "waiting"), sql`exists (select 1 from chat_endpoints e
|
||||
where e.id = ${chatConversations.endpointId} and e.company_id = ${chatConversations.companyId} and e.provider = 'slack')`));
|
||||
}
|
||||
@@ -261,6 +261,19 @@ describe("ActiveAgentsPanel", () => {
|
||||
await act(async () => root.unmount());
|
||||
});
|
||||
|
||||
it("shows an answered Slack task as idle without changing the run outcome", async () => {
|
||||
const root = createRoot(container);
|
||||
await act(async () => {
|
||||
root.render(<AgentRunCard companyId="company-1"
|
||||
run={{ ...createIssueRun(0, "issue-1"), status: "succeeded" }}
|
||||
issue={{ title: "Slack conversation", identifier: "PAP-559", status: "in_review", externalConversationState: "waiting" }} />);
|
||||
});
|
||||
expect(container.querySelector('[aria-label="Agent 0 — Succeeded. View run"]')).not.toBeNull();
|
||||
expect(container.querySelector('[aria-label="Task idle"]')).not.toBeNull();
|
||||
expect(container.querySelector('[aria-label="Task in review"]')).toBeNull();
|
||||
await act(async () => root.unmount());
|
||||
});
|
||||
|
||||
it("keeps a failed task lookup navigable and shows a clear error", async () => {
|
||||
const root = createRoot(container);
|
||||
await act(async () => {
|
||||
|
||||
@@ -160,7 +160,7 @@ export const AgentRunCard = memo(function AgentRunCard({
|
||||
}: {
|
||||
companyId: string;
|
||||
run: LiveRunForIssue;
|
||||
issue?: Pick<Issue, "identifier" | "title" | "status">;
|
||||
issue?: Pick<Issue, "identifier" | "title" | "status" | "externalConversationState">;
|
||||
transcript?: TranscriptEntry[];
|
||||
hasOutput?: boolean;
|
||||
showTranscript?: boolean;
|
||||
@@ -172,6 +172,7 @@ export const AgentRunCard = memo(function AgentRunCard({
|
||||
const timestamp = run.finishedAt
|
||||
? `Finished ${relativeTime(run.finishedAt)}`
|
||||
: run.startedAt ? `Started ${relativeTime(run.startedAt)}` : `Queued ${relativeTime(run.createdAt)}`;
|
||||
const taskStatus = issue?.status === "in_review" && issue.externalConversationState === "waiting" ? "idle" : issue?.status ?? "backlog";
|
||||
const taskTitle = issue?.title ?? (issueLoadFailed ? "Task unavailable" : "Loading task…");
|
||||
|
||||
return (
|
||||
@@ -202,10 +203,10 @@ export const AgentRunCard = memo(function AgentRunCard({
|
||||
<span className="flex min-w-0 items-baseline gap-2">
|
||||
<span className="flex min-w-0 flex-1 items-baseline gap-1.5">
|
||||
<StatusGlyph
|
||||
status={issue?.status ?? "backlog"}
|
||||
status={taskStatus}
|
||||
size="md"
|
||||
className="self-center"
|
||||
title={issue ? `Task ${issue.status.replace(/_/g, " ")}` : undefined}
|
||||
title={issue ? `Task ${taskStatus.replace(/_/g, " ")}` : undefined}
|
||||
/>
|
||||
<span className="truncate">{taskTitle}</span>
|
||||
</span>
|
||||
|
||||
@@ -41,7 +41,8 @@ export function ActivityRow({ event, agentMap, userProfileMap, entityNameMap, en
|
||||
? (heartbeatAgentId ? entityNameMap.get(`agent:${heartbeatAgentId}`) : null)
|
||||
: entityNameMap.get(`${event.entityType}:${event.entityId}`);
|
||||
|
||||
const entityTitle = entityTitleMap?.get(`${event.entityType}:${event.entityId}`);
|
||||
const entityTitle = entityTitleMap?.get(`${event.entityType}:${event.entityId}`)
|
||||
?? (event.entityType === "issue" && typeof event.details?.issueTitle === "string" ? event.details.issueTitle : undefined);
|
||||
|
||||
const link = isHeartbeatEvent && heartbeatAgentId
|
||||
? `/agents/${heartbeatAgentId}/runs/${event.entityId}`
|
||||
|
||||
@@ -43,6 +43,13 @@ describe("FeedCard", () => {
|
||||
container.remove();
|
||||
});
|
||||
|
||||
it.each([["waiting", "moved to idle"], [null, "moved to in review"]])("distinguishes waiting from review (%s)", (state, verb) => {
|
||||
const root = createRoot(container);
|
||||
act(() => root.render(<FeedCard event={{ ...event, details: { status: "in_review", externalConversationState: state } }} agentMap={new Map()} entityNameMap={new Map()} entityTitleMap={new Map()} />));
|
||||
expect(container.querySelector('[data-fc="verb"]')?.textContent).toBe(verb);
|
||||
act(() => root.unmount());
|
||||
});
|
||||
|
||||
it("uses the whole visible card as the entity link", () => {
|
||||
const root = createRoot(container);
|
||||
act(() => {
|
||||
|
||||
@@ -46,6 +46,7 @@ function formatVerb(
|
||||
return "opened";
|
||||
case "issue.updated": {
|
||||
const status = details?.status;
|
||||
if (status === "in_review" && details?.externalConversationState === "waiting") return "moved to idle";
|
||||
if (typeof status === "string") return `moved to ${humanize(status)}`;
|
||||
const priority = details?.priority;
|
||||
if (typeof priority === "string") return `set priority to ${humanize(priority)} on`;
|
||||
@@ -141,6 +142,7 @@ function deriveTaskStatus(
|
||||
return "todo";
|
||||
case "issue.updated": {
|
||||
const status = details?.status;
|
||||
if (status === "in_review" && details?.externalConversationState === "waiting") return "idle";
|
||||
return typeof status === "string" ? status : null;
|
||||
}
|
||||
case "issue.document_created":
|
||||
|
||||
@@ -202,7 +202,7 @@ export function InboxIssueMetaLeading({
|
||||
<>
|
||||
{showStatus ? (
|
||||
<span className="hidden shrink-0 items-center sm:inline-flex">
|
||||
{statusSlot ?? <StatusIcon status={issue.status} blockerAttention={issue.blockerAttention} />}
|
||||
{statusSlot ?? <StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} blockerAttention={issue.blockerAttention} />}
|
||||
</span>
|
||||
) : null}
|
||||
{checklistStepNumber !== null ? (
|
||||
|
||||
@@ -285,7 +285,7 @@ export function IssueRow({
|
||||
{leadingControl}
|
||||
{statusSlot ?? (
|
||||
<StatusIcon
|
||||
status={issue.status}
|
||||
status={issue.status} externalConversationState={issue.externalConversationState}
|
||||
blockerAttention={issue.blockerAttention}
|
||||
size="md"
|
||||
className={selectedStatusClass}
|
||||
@@ -385,7 +385,7 @@ export function IssueRow({
|
||||
<span className="sr-only">Open {identifier}: {issue.title}</span>
|
||||
</Link>
|
||||
<span className="flex shrink-0 items-center gap-1 pt-px sm:hidden">
|
||||
{mobileLeading ?? <StatusIcon status={issue.status} blockerAttention={issue.blockerAttention} size="md" className={selectedStatusClass} />}
|
||||
{mobileLeading ?? <StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} blockerAttention={issue.blockerAttention} size="md" className={selectedStatusClass} />}
|
||||
{parkedBlockerIndicator}
|
||||
</span>
|
||||
<span className="flex min-w-0 flex-1 flex-col gap-1 sm:contents">
|
||||
@@ -458,7 +458,7 @@ export function IssueRow({
|
||||
{desktopMetaLeading ?? (
|
||||
<>
|
||||
<span className="hidden shrink-0 items-center gap-1 sm:inline-flex">
|
||||
<StatusIcon status={issue.status} blockerAttention={issue.blockerAttention} size="md" className={selectedStatusClass} />
|
||||
<StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} blockerAttention={issue.blockerAttention} size="md" className={selectedStatusClass} />
|
||||
</span>
|
||||
{checklistStep}
|
||||
<span className="shrink-0 font-mono text-xs text-muted-foreground">
|
||||
|
||||
@@ -79,7 +79,7 @@ function SiblingLink({
|
||||
"flex min-w-0 items-center gap-1.5 text-xs font-mono text-muted-foreground transition-colors group-hover:text-foreground",
|
||||
direction === "next" && "sm:justify-end",
|
||||
)}>
|
||||
<StatusIcon status={issue.status} blockerAttention={issue.blockerAttention} />
|
||||
<StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} blockerAttention={issue.blockerAttention} />
|
||||
<span className="shrink-0">{identifier}</span>
|
||||
</div>
|
||||
<div className="truncate text-sm text-foreground">
|
||||
|
||||
@@ -2232,7 +2232,7 @@ function StreamlinedIssuesList({
|
||||
) : undefined}
|
||||
statusSlot={rowPresentation === "task" ? (
|
||||
<span className="relative inline-flex items-start self-stretch sm:items-center" onClick={(e) => { e.preventDefault(); e.stopPropagation(); }}>
|
||||
<StatusIcon status={issue.status} size="md" blockerAttention={issue.blockerAttention} onChange={(s) => onUpdateIssue(issue.id, { status: s })} />
|
||||
<StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} size="md" blockerAttention={issue.blockerAttention} onChange={(s) => onUpdateIssue(issue.id, { status: s })} />
|
||||
{hasChildren && isExpanded ? (
|
||||
<span aria-hidden="true" className="pointer-events-none absolute top-5 -bottom-2.5 left-1/2 w-px bg-border sm:hidden" />
|
||||
) : null}
|
||||
@@ -2256,7 +2256,7 @@ function StreamlinedIssuesList({
|
||||
</button>
|
||||
) : (
|
||||
<span className="inline-flex items-center" onClick={(e) => { e.preventDefault(); e.stopPropagation(); }}>
|
||||
<StatusIcon status={issue.status} size="md" blockerAttention={issue.blockerAttention} onChange={(s) => onUpdateIssue(issue.id, { status: s })} />
|
||||
<StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} size="md" blockerAttention={issue.blockerAttention} onChange={(s) => onUpdateIssue(issue.id, { status: s })} />
|
||||
</span>
|
||||
)
|
||||
}
|
||||
@@ -2283,7 +2283,7 @@ function StreamlinedIssuesList({
|
||||
checklistStepNumber={checklistStepNumber}
|
||||
statusSlot={(
|
||||
<span className="inline-flex items-center" onClick={(e) => { e.preventDefault(); e.stopPropagation(); }}>
|
||||
<StatusIcon status={issue.status} size="md" blockerAttention={issue.blockerAttention} onChange={(s) => onUpdateIssue(issue.id, { status: s })} />
|
||||
<StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} size="md" blockerAttention={issue.blockerAttention} onChange={(s) => onUpdateIssue(issue.id, { status: s })} />
|
||||
</span>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -2155,7 +2155,7 @@ export function IssuesList({
|
||||
</button>
|
||||
) : (
|
||||
<span className="inline-flex items-center" onClick={(e) => { e.preventDefault(); e.stopPropagation(); }}>
|
||||
<StatusIcon status={issue.status} size="md" blockerAttention={issue.blockerAttention} onChange={(s) => onUpdateIssue(issue.id, { status: s })} />
|
||||
<StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} size="md" blockerAttention={issue.blockerAttention} onChange={(s) => onUpdateIssue(issue.id, { status: s })} />
|
||||
</span>
|
||||
)
|
||||
}
|
||||
@@ -2182,7 +2182,7 @@ export function IssuesList({
|
||||
checklistStepNumber={checklistStepNumber}
|
||||
statusSlot={(
|
||||
<span className="inline-flex items-center" onClick={(e) => { e.preventDefault(); e.stopPropagation(); }}>
|
||||
<StatusIcon status={issue.status} size="md" blockerAttention={issue.blockerAttention} onChange={(s) => onUpdateIssue(issue.id, { status: s })} />
|
||||
<StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} size="md" blockerAttention={issue.blockerAttention} onChange={(s) => onUpdateIssue(issue.id, { status: s })} />
|
||||
</span>
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -262,6 +262,19 @@ describe("SidebarRecentTasks", () => {
|
||||
expect(menu?.textContent).toContain("Pause/Restart");
|
||||
});
|
||||
|
||||
it("keeps an idle Slack conversation in recent history and labels it Idle", async () => {
|
||||
const issue = {
|
||||
id: "issue-1", companyId: "company-1", title: "Slack conversation", identifier: "PAP-1",
|
||||
status: "in_review" as const, externalConversationState: "waiting" as const,
|
||||
updatedAt: new Date(1), hiddenAt: null,
|
||||
};
|
||||
recordRecentTask(issue, "user-1");
|
||||
mockIssuesApi.get.mockResolvedValue(issue);
|
||||
await render();
|
||||
expect(container.textContent).toContain("Slack conversation");
|
||||
expect(container.textContent).toContain("Idle");
|
||||
});
|
||||
|
||||
it("archives a task from the inbox without hiding or removing the recent task", async () => {
|
||||
const issue = {
|
||||
id: "issue-1",
|
||||
|
||||
@@ -255,6 +255,9 @@ function RecentTasksList({
|
||||
<SidebarNavItem
|
||||
to={`/issues/${entry.id}`}
|
||||
label={entry.title}
|
||||
trailing={entry.status === "in_review" && entry.externalConversationState === "waiting"
|
||||
? <span className="text-xs text-muted-foreground">Idle</span> : undefined}
|
||||
trailingLabel={entry.status === "in_review" && entry.externalConversationState === "waiting" ? "Idle" : undefined}
|
||||
className={rail ? undefined : "sidebar-action-link pointer-coarse:pr-8"}
|
||||
liveCount={liveIssueIds.has(entry.id) ? 1 : undefined}
|
||||
/>
|
||||
|
||||
@@ -83,7 +83,8 @@ export function AgentStatusCapsule({ status }: { status: string }) {
|
||||
* Distinct from the generic {@link StatusBadge} so run/goal/approval badges are
|
||||
* unaffected.
|
||||
*/
|
||||
export function IssueStatusBadge({ status }: { status: string }) {
|
||||
export function IssueStatusBadge({ status: taskStatus, externalConversationState }: { status: string; externalConversationState?: "active" | "waiting" | null }) {
|
||||
const status = taskStatus === "in_review" && externalConversationState === "waiting" ? "idle" : taskStatus;
|
||||
const cssVar = taskStatusVar[status] ?? taskStatusVarDefault;
|
||||
return (
|
||||
<span
|
||||
|
||||
@@ -56,6 +56,7 @@ const TaskProgressSpinner = createLucideIcon("TaskProgressSpinner", [
|
||||
|
||||
/** Status → Lucide icon. `in_queue` borrows the blocked icon; its colour var resolves to blue. */
|
||||
const STATUS_ICON: Record<string, LucideIcon> = {
|
||||
idle: Circle,
|
||||
backlog: CircleDashed,
|
||||
todo: Circle,
|
||||
in_progress: TaskProgressSpinner,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { StatusIcon } from "./StatusIcon";
|
||||
import { IssueStatusBadge } from "./StatusBadge";
|
||||
|
||||
/**
|
||||
* StatusIcon renders the unified {@link StatusGlyph} (one shape per status) at
|
||||
@@ -108,3 +109,22 @@ describe("StatusIcon — glyph size (PAP-243a)", () => {
|
||||
expect(html).toContain('height="16"');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("Slack idle status presentation", () => {
|
||||
it("labels verified waiting conversations Idle in icons, labels, badges and picker triggers", () => {
|
||||
const props = { status: "in_review", externalConversationState: "waiting" as const };
|
||||
expect(renderToStaticMarkup(<StatusIcon {...props} showLabel />)).toContain(">Idle<");
|
||||
expect(renderToStaticMarkup(<StatusIcon {...props} onChange={() => {}} />)).toContain('current: Idle');
|
||||
expect(renderToStaticMarkup(<IssueStatusBadge {...props} />)).toContain(">Idle<");
|
||||
});
|
||||
|
||||
it.each(["in_review", "blocked", "done", "cancelled"])("preserves %s without verified waiting", (status) => {
|
||||
const html = renderToStaticMarkup(<StatusIcon status={status} externalConversationState="active" showLabel />);
|
||||
expect(html).not.toContain("Idle");
|
||||
});
|
||||
|
||||
it("preserves an explicit terminal outcome even with stale waiting data", () => {
|
||||
expect(renderToStaticMarkup(<IssueStatusBadge status="done" externalConversationState="waiting" />)).toContain(">Done<");
|
||||
});
|
||||
});
|
||||
@@ -13,6 +13,7 @@ function statusLabel(status: string): string {
|
||||
|
||||
interface StatusIconProps {
|
||||
status: string;
|
||||
externalConversationState?: "active" | "waiting" | null;
|
||||
blockerAttention?: IssueBlockerAttention | null;
|
||||
onChange?: (status: string) => void;
|
||||
className?: string;
|
||||
@@ -75,11 +76,12 @@ function blockedAttentionLabel(blockerAttention: IssueBlockerAttention | null |
|
||||
* glyph — the blocked shape recoloured blue — while the full blocked reason
|
||||
* still rides on the accessible label.
|
||||
*/
|
||||
export function StatusIcon({ status, blockerAttention, onChange, className, showLabel, size = "md" }: StatusIconProps) {
|
||||
export function StatusIcon({ status, externalConversationState, blockerAttention, onChange, className, showLabel, size = "md" }: StatusIconProps) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const displayStatus = status === "in_review" && externalConversationState === "waiting" ? "idle" : status;
|
||||
const isCoveredBlocked = status === "blocked" && blockerAttention?.state === "covered";
|
||||
const ariaLabel = status === "blocked" ? blockedAttentionLabel(blockerAttention) : statusLabel(status);
|
||||
const glyphStatus = isCoveredBlocked ? "in_queue" : status;
|
||||
const ariaLabel = status === "blocked" ? blockedAttentionLabel(blockerAttention) : statusLabel(displayStatus);
|
||||
const glyphStatus = isCoveredBlocked ? "in_queue" : displayStatus;
|
||||
|
||||
const glyph = (
|
||||
<StatusGlyph
|
||||
@@ -94,7 +96,7 @@ export function StatusIcon({ status, blockerAttention, onChange, className, show
|
||||
return showLabel ? (
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
{glyph}
|
||||
<span className="text-sm">{statusLabel(status)}</span>
|
||||
<span className="text-sm">{statusLabel(displayStatus)}</span>
|
||||
</span>
|
||||
) : (
|
||||
glyph
|
||||
@@ -108,7 +110,7 @@ export function StatusIcon({ status, blockerAttention, onChange, className, show
|
||||
className="inline-flex min-h-5 items-center gap-1.5 cursor-pointer hover:bg-accent/50 rounded px-1 -mx-1 py-0.5 transition-colors"
|
||||
>
|
||||
{glyph}
|
||||
<span className="text-sm">{statusLabel(status)}</span>
|
||||
<span className="text-sm">{statusLabel(displayStatus)}</span>
|
||||
</button>
|
||||
) : (
|
||||
<button
|
||||
|
||||
@@ -2332,7 +2332,7 @@ export function IssueProperties({
|
||||
>
|
||||
<PropertyRow label="Status">
|
||||
<StatusIcon
|
||||
status={issue.status}
|
||||
status={issue.status} externalConversationState={issue.externalConversationState}
|
||||
className="size-3"
|
||||
blockerAttention={issue.blockerAttention}
|
||||
onChange={(status) => onUpdate({ status })}
|
||||
|
||||
@@ -178,7 +178,7 @@ function SearchResultRowImpl({
|
||||
data-result-type="issue"
|
||||
>
|
||||
<div className="mt-1 shrink-0">
|
||||
<StatusIcon status={issue.status} />
|
||||
<StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} />
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-1">
|
||||
|
||||
@@ -8,6 +8,13 @@ describe("activity formatting", () => {
|
||||
["agent-approver", { id: "agent-approver", name: "Approver Bot" } as Agent],
|
||||
]);
|
||||
|
||||
it("labels a Slack settlement as idle while retaining actual review wording", () => {
|
||||
const details = { status: "in_review", externalConversationState: "waiting" };
|
||||
expect(formatActivityVerb("issue.updated", details)).toBe("changed status to idle on");
|
||||
expect(formatIssueActivityAction("issue.updated", details)).toBe("changed the status to idle");
|
||||
expect(formatActivityVerb("issue.updated", { status: "in_review" })).toBe("changed status to in review on");
|
||||
});
|
||||
|
||||
it("uses readable verbs for task read-state changes", () => {
|
||||
expect(formatActivityVerb("issue.read_marked")).toBe("read");
|
||||
expect(formatActivityVerb("issue.read_unmarked")).toBe("marked unread");
|
||||
|
||||
@@ -330,9 +330,10 @@ function formatIssueUpdatedVerb(details: ActivityDetails): string | null {
|
||||
const previous = asRecord(details._previous) ?? {};
|
||||
if (details.status !== undefined) {
|
||||
const from = previous.status;
|
||||
const to = humanizeValue(details.status === "in_review" && details.externalConversationState === "waiting" ? "idle" : details.status);
|
||||
return from
|
||||
? `changed status from ${humanizeValue(from)} to ${humanizeValue(details.status)} on`
|
||||
: `changed status to ${humanizeValue(details.status)} on`;
|
||||
? `changed status from ${humanizeValue(from)} to ${to} on`
|
||||
: `changed status to ${to} on`;
|
||||
}
|
||||
if (details.priority !== undefined) {
|
||||
const from = previous.priority;
|
||||
@@ -363,10 +364,11 @@ function formatIssueUpdatedAction(details: ActivityDetails, options: ActivityFor
|
||||
|
||||
if (details.status !== undefined) {
|
||||
const from = previous.status;
|
||||
const to = humanizeValue(details.status === "in_review" && details.externalConversationState === "waiting" ? "idle" : details.status);
|
||||
parts.push(
|
||||
from
|
||||
? `changed the status from ${humanizeValue(from)} to ${humanizeValue(details.status)}`
|
||||
: `changed the status to ${humanizeValue(details.status)}`,
|
||||
? `changed the status from ${humanizeValue(from)} to ${to}`
|
||||
: `changed the status to ${to}`,
|
||||
);
|
||||
}
|
||||
if (details.priority !== undefined) {
|
||||
|
||||
@@ -108,6 +108,7 @@ describe("clearIssueExecutionRun", () => {
|
||||
executionRunId: null,
|
||||
executionAgentNameKey: null,
|
||||
executionLockedAt: null,
|
||||
updatedAt: issue.updatedAt,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ export function clearIssueExecutionRun(
|
||||
executionRunId: null,
|
||||
executionAgentNameKey: null,
|
||||
executionLockedAt: null,
|
||||
updatedAt: new Date(),
|
||||
// Clearing a cached run lock is not a server task edit. Keep its version
|
||||
// so a later authoritative status (including Slack Idle) can replace it.
|
||||
};
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
import { clearIssueExecutionRun } from "./optimistic-issue-runs";
|
||||
import type { Issue } from "@paperclipai/shared";
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
@@ -53,6 +55,34 @@ describe("recent task persistence", () => {
|
||||
expect(entries.filter((entry) => entry.id === "4")).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("refreshes conversation readiness when review or delivery changes without a task edit", () => {
|
||||
const task = { ...issue("1"), status: "in_review" as const, externalConversationState: "waiting" as const };
|
||||
recordRecentTask(task, "user-1");
|
||||
const storageKey = getRecentTasksStorageKey("company-1", "user-1");
|
||||
updateRecentTaskSnapshots(storageKey, "company-1", [{ ...task, externalConversationState: "active" }]);
|
||||
expect(readRecentTasks(storageKey, "company-1")[0]?.externalConversationState).toBe("active");
|
||||
});
|
||||
|
||||
it("accepts server settlement after an optimistic run-lock clear", () => {
|
||||
const running = { ...issue("1"), status: "in_progress" as const, externalConversationState: "active" as const, executionRunId: "run-1", updatedAt: new Date(10) } as Issue;
|
||||
recordRecentTask(running, "user-1");
|
||||
recordRecentTask(clearIssueExecutionRun(running, "run-1")!, "user-1");
|
||||
const storageKey = getRecentTasksStorageKey("company-1", "user-1");
|
||||
updateRecentTaskSnapshots(storageKey, "company-1", [{ ...running, status: "in_review", externalConversationState: "waiting", updatedAt: new Date(20) }]);
|
||||
expect(readRecentTasks(storageKey, "company-1")[0]).toMatchObject({ status: "in_review", externalConversationState: "waiting", snapshotUpdatedAt: 20 });
|
||||
updateRecentTaskSnapshots(storageKey, "company-1", [{ ...running, updatedAt: new Date(30) }]);
|
||||
updateRecentTaskSnapshots(storageKey, "company-1", [{ ...running, status: "in_review", externalConversationState: "waiting", updatedAt: new Date(20) }]);
|
||||
expect(readRecentTasks(storageKey, "company-1")[0]).toMatchObject({ status: "in_progress", externalConversationState: "active", snapshotUpdatedAt: 30 });
|
||||
});
|
||||
|
||||
it("keeps readiness and task status together when a turn settles at the same timestamp", () => {
|
||||
const task = { ...issue("1"), status: "in_progress" as const, externalConversationState: "active" as const };
|
||||
recordRecentTask(task, "user-1");
|
||||
const storageKey = getRecentTasksStorageKey("company-1", "user-1");
|
||||
updateRecentTaskSnapshots(storageKey, "company-1", [{ ...task, status: "in_review", externalConversationState: "waiting" }]);
|
||||
expect(readRecentTasks(storageKey, "company-1")[0]).toMatchObject({ status: "in_review", externalConversationState: "waiting" });
|
||||
});
|
||||
|
||||
it("publishes same-tab updates", () => {
|
||||
const listener = vi.fn();
|
||||
window.addEventListener(RECENT_TASKS_UPDATED_EVENT, listener);
|
||||
|
||||
@@ -11,6 +11,7 @@ export interface RecentTaskEntry {
|
||||
title: string;
|
||||
identifier: string | null;
|
||||
status: IssueStatus;
|
||||
externalConversationState?: Issue["externalConversationState"];
|
||||
recordedAt: number;
|
||||
// Server version of the title/status snapshot, independent of comment activity.
|
||||
// Legacy entries have no version until a detail query refreshes them.
|
||||
@@ -103,26 +104,34 @@ export function writeRecentTasks(storageKey: string, entries: RecentTaskEntry[])
|
||||
publishRecentTasks(storageKey, bounded);
|
||||
}
|
||||
|
||||
type TaskSnapshot = Pick<Issue, "id" | "companyId" | "title" | "identifier" | "status" | "updatedAt">;
|
||||
type TaskSnapshot = Pick<Issue, "id" | "companyId" | "title" | "identifier" | "status" | "externalConversationState" | "updatedAt">;
|
||||
|
||||
export function mergeRecentTaskSnapshot(entry: RecentTaskEntry, issue: TaskSnapshot): RecentTaskEntry {
|
||||
if (entry.id !== issue.id || entry.companyId !== issue.companyId) return entry;
|
||||
const snapshotUpdatedAt = new Date(issue.updatedAt).getTime();
|
||||
if (!Number.isFinite(snapshotUpdatedAt)) return entry;
|
||||
// Equal versions retain the persisted snapshot, so conflicting caches settle.
|
||||
if (entry.snapshotUpdatedAt !== undefined && snapshotUpdatedAt <= entry.snapshotUpdatedAt) return entry;
|
||||
if (entry.snapshotUpdatedAt !== undefined && snapshotUpdatedAt < entry.snapshotUpdatedAt) return entry;
|
||||
// Conversation readiness also depends on deliveries and decisions, which
|
||||
// can change without changing the task's title/status version.
|
||||
if (snapshotUpdatedAt === entry.snapshotUpdatedAt) {
|
||||
return issue.externalConversationState !== undefined
|
||||
&& issue.externalConversationState !== entry.externalConversationState
|
||||
? { ...entry, status: issue.status, externalConversationState: issue.externalConversationState }
|
||||
: entry;
|
||||
}
|
||||
return {
|
||||
...entry,
|
||||
title: issue.title,
|
||||
identifier: issue.identifier,
|
||||
status: issue.status,
|
||||
externalConversationState: issue.externalConversationState,
|
||||
snapshotUpdatedAt,
|
||||
recordedAt: Math.max(entry.recordedAt, snapshotUpdatedAt),
|
||||
};
|
||||
}
|
||||
|
||||
export function recordRecentTask(
|
||||
issue: Pick<Issue, "id" | "companyId" | "title" | "identifier" | "status" | "updatedAt" | "conversationAgentId">,
|
||||
issue: Pick<Issue, "id" | "companyId" | "title" | "identifier" | "status" | "externalConversationState" | "updatedAt" | "conversationAgentId">,
|
||||
userId: string | null | undefined,
|
||||
recordedAt = new Date(issue.updatedAt).getTime(),
|
||||
) {
|
||||
@@ -140,6 +149,7 @@ export function recordRecentTask(
|
||||
title: issue.title,
|
||||
identifier: issue.identifier,
|
||||
status: issue.status,
|
||||
externalConversationState: issue.externalConversationState,
|
||||
recordedAt: activityAt,
|
||||
...(Number.isFinite(snapshotUpdatedAt) ? { snapshotUpdatedAt } : {}),
|
||||
};
|
||||
@@ -153,6 +163,7 @@ export function recordRecentTask(
|
||||
&& existing.title === entry.title
|
||||
&& existing.identifier === entry.identifier
|
||||
&& existing.status === entry.status
|
||||
&& existing.externalConversationState === entry.externalConversationState
|
||||
&& existing.recordedAt === entry.recordedAt
|
||||
&& existing.snapshotUpdatedAt === entry.snapshotUpdatedAt
|
||||
) return;
|
||||
|
||||
@@ -252,6 +252,7 @@ export const agentStatusVarDefault = "--status-agent-idle";
|
||||
|
||||
/** Task/issue status → base-hue CSS var (drives both the chip and the icon). */
|
||||
export const taskStatusVar: Record<string, string> = {
|
||||
idle: "--status-task-backlog",
|
||||
backlog: "--status-task-backlog",
|
||||
todo: "--status-task-todo",
|
||||
in_progress: "--status-task-in_progress",
|
||||
@@ -270,6 +271,7 @@ export const taskStatusVarDefault = "--status-task-backlog";
|
||||
* shape recoloured blue, so it maps to its own var.
|
||||
*/
|
||||
export const taskStatusIconVar: Record<string, string> = {
|
||||
idle: "--status-task-icon-backlog",
|
||||
backlog: "--status-task-icon-backlog",
|
||||
todo: "--status-task-icon-todo",
|
||||
in_progress: "--status-task-icon-in_progress",
|
||||
|
||||
@@ -521,7 +521,7 @@ export function Dashboard() {
|
||||
>
|
||||
<div className="flex items-start gap-2 @xl:grid @xl:grid-cols-(--dashboard-task-list-columns) @xl:items-baseline">
|
||||
<span className="flex size-6 shrink-0 items-center justify-end @xl:self-center">
|
||||
<StatusIcon status={issue.status} blockerAttention={issue.blockerAttention} />
|
||||
<StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} blockerAttention={issue.blockerAttention} />
|
||||
</span>
|
||||
<span className="flex min-w-0 flex-1 flex-col gap-1 @xl:contents">
|
||||
<span className="flex min-w-0 items-baseline gap-2 @xl:contents">
|
||||
|
||||
@@ -754,6 +754,10 @@ export function DesignGuide() {
|
||||
</div>
|
||||
</SubSection>
|
||||
|
||||
<SubSection title="Idle Slack conversation">
|
||||
<StatusIcon status="in_review" externalConversationState="waiting" showLabel />
|
||||
<IssueStatusBadge status="in_review" externalConversationState="waiting" />
|
||||
</SubSection>
|
||||
<SubSection title="StatusIcon (interactive)">
|
||||
<div className="flex items-center gap-3 flex-wrap">
|
||||
{["backlog", "todo", "in_progress", "in_review", "done", "cancelled", "blocked"].map(
|
||||
|
||||
@@ -2787,7 +2787,7 @@ function StreamlinedInbox() {
|
||||
&& blockerAttention?.state === "covered"
|
||||
);
|
||||
const rowStatusIcon = (
|
||||
<StatusIcon status={issue.status} blockerAttention={blockerAttention} size="md" />
|
||||
<StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} blockerAttention={blockerAttention} size="md" />
|
||||
);
|
||||
return (
|
||||
<IssueRow
|
||||
@@ -2886,7 +2886,7 @@ function StreamlinedInbox() {
|
||||
<ChevronRight className={cn("h-3.5 w-3.5 transition-transform", isExpanded && "rotate-90")} />
|
||||
</button>
|
||||
) : (
|
||||
<StatusIcon status={issue.status} blockerAttention={blockerAttention} size="md" />
|
||||
<StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} blockerAttention={blockerAttention} size="md" />
|
||||
)
|
||||
) : undefined}
|
||||
unreadState={isUnread ? "visible" : isFading ? "fading" : "hidden"}
|
||||
|
||||
@@ -3714,13 +3714,14 @@ export function TaskDetailSurface({ conversation, tasksTab }: { tasksTab?: TaskS
|
||||
// from the blocker counts — so the key signs over the full blockerAttention,
|
||||
// not just `state`, to avoid a stale label when counts change.
|
||||
const breadcrumbStatusKey = breadcrumbStatus
|
||||
? `${breadcrumbStatus}|${JSON.stringify(breadcrumbBlockerAttention ?? null)}`
|
||||
? `${breadcrumbStatus}|${issue?.externalConversationState ?? ""}|${JSON.stringify(breadcrumbBlockerAttention ?? null)}`
|
||||
: undefined;
|
||||
const breadcrumbStatusLeading = useMemo(
|
||||
() =>
|
||||
breadcrumbStatus ? (
|
||||
<StatusIcon
|
||||
status={breadcrumbStatus}
|
||||
externalConversationState={issue?.externalConversationState}
|
||||
className="size-3"
|
||||
blockerAttention={breadcrumbBlockerAttention}
|
||||
/>
|
||||
@@ -6843,7 +6844,7 @@ export function TaskDetailSurface({ conversation, tasksTab }: { tasksTab?: TaskS
|
||||
|
||||
const issueStatusControl = (
|
||||
<StatusIcon
|
||||
status={issue.status}
|
||||
status={issue.status} externalConversationState={issue.externalConversationState}
|
||||
size="lg"
|
||||
blockerAttention={issue.blockerAttention}
|
||||
onChange={(status) => updateIssue.mutate({ status })}
|
||||
@@ -7381,6 +7382,10 @@ export function TaskDetailSurface({ conversation, tasksTab }: { tasksTab?: TaskS
|
||||
issueCacheRefs={issueCacheRefs}
|
||||
/>
|
||||
|
||||
{issue.status === "in_review" && issue.externalConversationState === "waiting" && (
|
||||
<p role="status" className="text-sm text-muted-foreground">Reply sent. Send a message to continue.</p>
|
||||
)}
|
||||
|
||||
{issue.hiddenAt && (
|
||||
<div
|
||||
className={cn(
|
||||
|
||||
@@ -2682,7 +2682,7 @@ export function Inbox() {
|
||||
&& blockerAttention?.state === "covered"
|
||||
);
|
||||
const rowStatusIcon = (
|
||||
<StatusIcon status={issue.status} blockerAttention={blockerAttention} size="md" />
|
||||
<StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} blockerAttention={blockerAttention} size="md" />
|
||||
);
|
||||
return (
|
||||
<IssueRow
|
||||
@@ -2752,7 +2752,7 @@ export function Inbox() {
|
||||
<ChevronRight className={cn("h-3.5 w-3.5 transition-transform", isExpanded && "rotate-90")} />
|
||||
</button>
|
||||
) : (
|
||||
<StatusIcon status={issue.status} blockerAttention={blockerAttention} size="md" />
|
||||
<StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} blockerAttention={blockerAttention} size="md" />
|
||||
)
|
||||
}
|
||||
unreadState={isUnread ? "visible" : isFading ? "fading" : "hidden"}
|
||||
|
||||
@@ -65,7 +65,7 @@ export function MyIssues() {
|
||||
title={issue.title}
|
||||
to={`/issues/${issue.identifier ?? issue.id}`}
|
||||
leading={
|
||||
<StatusIcon status={issue.status} blockerAttention={issue.blockerAttention} />
|
||||
<StatusIcon status={issue.status} externalConversationState={issue.externalConversationState} blockerAttention={issue.blockerAttention} />
|
||||
}
|
||||
trailing={
|
||||
<span className="text-xs text-muted-foreground">
|
||||
|
||||
@@ -577,7 +577,7 @@ function WatchedIssueRow({ issue }: { issue: CompanySearchIssueSummary }) {
|
||||
>
|
||||
{issue.identifier ?? issue.id.slice(0, 8)}
|
||||
</Link>
|
||||
<IssueStatusBadge status={issue.status} />
|
||||
<IssueStatusBadge status={issue.status} externalConversationState={issue.externalConversationState} />
|
||||
<span className="min-w-0 flex-1 truncate">{issue.title}</span>
|
||||
<span className="shrink-0 text-muted-foreground">{relativeTime(issue.updatedAt)}</span>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user