feat(search): filters, sorting, operators & command-palette parity (#9327)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Company search is the primary way operators find issues, comments,
documents, artifacts, agents, and projects across a busy company
> - Search previously supported only a bare text query: no way to narrow
by status/assignee/project/label/date, no sort control, no typed
operators, and weak relevance/snippets meant hunting through noise
> - As companies accumulate tens of thousands of items, unfiltered
single-sort search stops scaling for day-to-day operator workflows
> - This pull request adds a full filtering model (filter bar, chips,
mobile sheet, URL state), sort modes, typed query operators (`status:`,
`assignee:`, `type:`, …) with command-palette parity,
relevance/snippet/deep-link improvements, zero-results recovery, and the
supporting shared validators, backend service work, and DB indexes
> - The benefit is that operators can go from a vague query to the exact
item in a couple of keystrokes, on desktop and mobile, with shareable
filtered-search URLs

## Linked Issues or Issue Description

No existing public GitHub issue; describing the underlying feature
request inline (per feature_request template):

- **Problem:** Company search accepted only a plain text query. Users
could not filter results by status, assignee, project, label, or
recency; could not change result ordering; and got no guidance when
filters emptied the result set.
- **Desired solution:** Structured search filters (UI controls + typed
query operators + URL parameters), selectable sort modes, better
relevance and snippets with exact deep links, and parity between the
search page and the command palette.
- **Alternatives considered:** Client-side filtering of unfiltered
results (does not scale past the fetch limit); a separate "advanced
search" page (splits the surface and duplicates state handling).

Related (not duplicate) PRs found while searching: #4848 (issue search
query planning), #8235 (search rate limiting).

## What Changed

- **Shared contract:** new search filter/sort/count/zero-results types
and validators in `packages/shared` (`validators/search.ts`, types
index).
- **Backend:** `server/src/services/company-search.ts` supports issue
filters, sort modes, per-filter option counts, snippets, artifact
visibility, and zero-results loosen suggestions; single-statement match
replaces per-scope scans and predicates are trigram-index compatible
(~3.7s → ~350ms on a live 14.8k-hit corpus).
- **DB:** migration `0142_company_search_sort_indexes.sql` adds the
supporting indexes.
- **Search page (`ui/src/pages/Search.tsx`):** filter bar, removable
chips, mobile filter sheet with result-count preview, sort menu, URL
round-tripping, zero-results recovery UI.
- **Query operators (`ui/src/lib/search-query-parser.ts`):** typed
operators parsed into filters, operator autocomplete, filter pills.
- **Command palette:** operator-aware parsing and full-search handoff.
- **Stale-operator fix (latest commit):** typed operator filters are no
longer folded into persistent URL-filter state, so deleting a token
(e.g. removing `status:blocked` from the input) actually removes the
filter from subsequent requests; filter-control edits materialize
control state and strip typed tokens so a removed chip cannot resurrect
from the input.

## Verification

- `cd ui && npx vitest run src/pages/Search.test.tsx` — 19 tests
including two new red→green regressions for the stale-operator paths
(both fail on the previous commit, pass now).
- `cd ui && npx vitest run src/components/CommandPalette.test.tsx` and
`cd server && npx vitest run
src/services/company-search-service.test.ts` — operator parity and
backend filter/sort/count coverage.
- `cd ui && npx tsc --noEmit` — clean.
- Manual: open `/search`, type `auth status:blocked`, confirm the status
filter applies; delete `status:blocked`, confirm results are unfiltered
again; drive the same filters from the filter bar/chips/mobile sheet and
confirm the URL round-trips (reload/back/forward preserves state).
- Full end-to-end QA pass (9/9 acceptance checks) against the wireframes
on desktop (1280px) and mobile (390px) with a live API and browser
automation.

## Risks

- Additive migration (indexes only, no data rewrites) — safe to roll
forward; index creation cost is paid once at migrate time.
- Search request shape gains optional parameters only; old clients keep
working.
- Behavioral shift: filter-control edits now strip typed operator tokens
from the query text (their values persist as filter state) — deliberate,
so removed filters stay removed.
- Ranking changes alter result ordering for existing queries; covered by
service tests and the QA pass.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

- Claude Fable 5 (`claude-fable-5`, Anthropic, extended thinking + tool
use) — stale-operator-filter fix, regression tests, PR preparation.
- GPT-5 Codex (`codex_local` adapter) and Claude Opus 4.6
(`claude-opus-4-6`) — earlier implementation phases (backend contract,
filter UI, operators, ranking) under agent orchestration.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [ ] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
— pre-existing branch name retained to avoid closing/reopening the PR
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes (no
user-facing docs affected)
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green (pending re-run on latest commit)
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
(pending re-review of the stale-filter fix)
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-07-09 19:32:58 -05:00
1 parent cec0fc249a
commit 606aa4f266
28 files changed
+4423 -401

No files matched your search

@@ -13,7 +13,18 @@ function createSearchResponse(query: CompanySearchQuery): CompanySearchResponse
limit: query.limit,
offset: query.offset,
results: [],
countsByType: { issue: 0, artifact: 0, agent: 0, project: 0 },
sort: query.sort,
countsByType: { issue: 0, comment: 0, document: 0, artifact: 0, agent: 0, project: 0 },
filterOptionCounts: {
status: {},
priority: {},
assigneeAgentId: {},
assigneeUserId: {},
projectId: {},
labelId: {},
updatedWithin: {},
},
zeroResults: null,
hasMore: false,
};
}
@@ -51,4 +62,60 @@ describe("company search route rate limiting", () => {
});
expect(limited.headers["retry-after"]).toBe("60");
});
it("resolves assigneeUserId=me for board actors before invoking search", async () => {
const search = vi.fn(async (_companyId: string, query: CompanySearchQuery) => createSearchResponse(query));
const app = express();
app.use((req, _res, next) => {
req.actor = {
type: "board",
userId: "user-1",
companyIds: ["company-1"],
source: "local_implicit",
isInstanceAdmin: true,
};
next();
});
app.use("/api", issueRoutes({} as never, {} as never, {
searchService: { search },
searchRateLimiter: createCompanySearchRateLimiter({
maxRequests: 10,
windowMs: 60_000,
now: () => 1_000,
}),
}));
await request(app).get("/api/companies/company-1/search?q=wizard&assigneeUserId=me").expect(200);
expect(search).toHaveBeenCalledTimes(1);
expect(search.mock.calls[0]?.[1].assigneeUserId).toBe("user-1");
});
it("rejects invalid filter and sort params before invoking search", async () => {
const search = vi.fn(async (_companyId: string, query: CompanySearchQuery) => createSearchResponse(query));
const app = express();
app.use((req, _res, next) => {
req.actor = {
type: "board",
userId: "user-1",
companyIds: ["company-1"],
source: "local_implicit",
isInstanceAdmin: true,
};
next();
});
app.use("/api", issueRoutes({} as never, {} as never, {
searchService: { search },
searchRateLimiter: createCompanySearchRateLimiter({
maxRequests: 10,
windowMs: 60_000,
now: () => 1_000,
}),
}));
await request(app).get("/api/companies/company-1/search?q=wizard&sort=nope").expect(400);
await request(app).get("/api/companies/company-1/search?q=wizard&assigneeAgentId=nope").expect(400);
expect(search).not.toHaveBeenCalled();
});
});
@@ -8,7 +8,9 @@ import {
documents,
issueComments,
issueDocuments,
issueLabels,
issues,
labels,
projects,
} from "@paperclipai/db";
import { companySearchQuerySchema, COMPANY_SEARCH_MAX_QUERY_LENGTH } from "@paperclipai/shared";
@@ -32,23 +34,36 @@ if (!embeddedPostgresSupport.supported) {
}
describe("company search query validation", () => {
it("clamps query length, limit, and offset without rejecting the request", () => {
it("truncates long text queries but rejects invalid filters, sort, and pagination", () => {
const parsed = companySearchQuerySchema.parse({
q: "x".repeat(COMPANY_SEARCH_MAX_QUERY_LENGTH + 50),
limit: "500",
offset: "9000",
scope: "not-a-scope",
limit: "50",
offset: "200",
scope: "all",
status: "todo,blocked",
priority: ["critical", "low"],
sort: "priority",
updatedWithin: "7d",
});
expect(parsed.q).toHaveLength(COMPANY_SEARCH_MAX_QUERY_LENGTH);
expect(parsed.limit).toBe(50);
expect(parsed.offset).toBe(200);
expect(parsed.scope).toBe("all");
expect(parsed.status).toEqual(["todo", "blocked"]);
expect(parsed.priority).toEqual(["critical", "low"]);
expect(parsed.sort).toBe("priority");
expect(parsed.updatedWithin).toBe("7d");
expect(() => companySearchQuerySchema.parse({ q: "needle", limit: "500" })).toThrow();
expect(() => companySearchQuerySchema.parse({ q: "needle", offset: "9000" })).toThrow();
expect(() => companySearchQuerySchema.parse({ q: "needle", scope: "not-a-scope" })).toThrow();
expect(() => companySearchQuerySchema.parse({ q: "needle", status: "not-a-status" })).toThrow();
expect(() => companySearchQuerySchema.parse({ q: "needle", priority: "urgent" })).toThrow();
expect(() => companySearchQuerySchema.parse({ q: "needle", sort: "oldest" })).toThrow();
expect(() => companySearchQuerySchema.parse({ q: "needle", updatedWithin: "forever" })).toThrow();
expect(() => companySearchQuerySchema.parse({ q: "needle", projectId: "not-a-uuid" })).toThrow();
});
it("includes offset in the internal per-branch fetch window", () => {
const lowOffset = companySearchQuerySchema.parse({ q: "needle", limit: "50", offset: "0" });
const highOffset = companySearchQuerySchema.parse({ q: "needle", limit: "50", offset: "9000" });
const highOffset = companySearchQuerySchema.parse({ q: "needle", limit: "50", offset: "200" });
expect(companySearchBranchFetchLimit(lowOffset.limit, lowOffset.offset)).toBe(51);
expect(companySearchBranchFetchLimit(highOffset.limit, highOffset.offset)).toBe(COMPANY_SEARCH_BRANCH_FETCH_LIMIT);
@@ -71,7 +86,9 @@ describeEmbeddedPostgres("companySearchService", () => {
await db.delete(issueDocuments);
await db.delete(documents);
await db.delete(issueComments);
await db.delete(issueLabels);
await db.delete(issues);
await db.delete(labels);
await db.delete(projects);
await db.delete(agents);
await db.delete(companies);
@@ -134,6 +151,18 @@ describeEmbeddedPostgres("companySearchService", () => {
return id;
}
async function createLabel(companyId: string, values: Partial<typeof labels.$inferInsert> = {}) {
const id = values.id ?? randomUUID();
await db.insert(labels).values({
id,
companyId,
name: values.name ?? "Search label",
color: values.color ?? "blue",
...values,
});
return id;
}
it("ranks exact issue identifiers before weaker title matches", async () => {
const companyId = await createCompany();
const exactId = await createIssue(companyId, {
@@ -151,6 +180,30 @@ describeEmbeddedPostgres("companySearchService", () => {
expect(result.results[0]?.matchedFields).toContain("identifier");
});
it("ranks phrase and all-token issue matches before partial scattered-token matches", async () => {
const companyId = await createCompany();
const base = new Date("2026-01-01T00:00:00.000Z").getTime();
const partialTokenId = await createIssue(companyId, {
identifier: "TST-50",
title: "Alpha-only deployment",
updatedAt: new Date(base + 3_000),
});
const allTokenId = await createIssue(companyId, {
identifier: "TST-51",
title: "Alpha rollout beta",
updatedAt: new Date(base + 2_000),
});
const phraseId = await createIssue(companyId, {
identifier: "TST-52",
title: "Alpha beta deployment",
updatedAt: new Date(base + 1_000),
});
const result = await svc.search(companyId, companySearchQuerySchema.parse({ q: "alpha beta", scope: "issues" }));
expect(result.results.map((row) => row.id)).toEqual([phraseId, allTokenId, partialTokenId]);
});
it("matches multiple tokens across the same issue thread and returns comment snippets", async () => {
const companyId = await createCompany();
const issueId = await createIssue(companyId, {
@@ -158,7 +211,9 @@ describeEmbeddedPostgres("companySearchService", () => {
title: "Checkout semantics",
description: "Atomic ownership is enforced here.",
});
const commentId = randomUUID();
await db.insert(issueComments).values({
id: commentId,
companyId,
issueId,
body: "The ranking snippet should explain why this thread matched.",
@@ -169,7 +224,10 @@ describeEmbeddedPostgres("companySearchService", () => {
expect(match).toBeTruthy();
expect(match?.matchedFields).toEqual(expect.arrayContaining(["title", "comment"]));
expect(match?.snippets.some((snippet) => /snippet/i.test(snippet.text))).toBe(true);
expect(match?.href).toContain(`#comment-${commentId}`);
expect(match?.snippets.some((snippet) => snippet.field === "comment" && /snippet/i.test(snippet.text))).toBe(true);
expect(match?.snippets.find((snippet) => snippet.field === "comment")?.highlights.length).toBeGreaterThan(0);
expect(result.countsByType.comment).toBe(1);
});
it("searches issue documents and returns document metadata for snippets", async () => {
@@ -200,6 +258,9 @@ describeEmbeddedPostgres("companySearchService", () => {
expect(result.results[0]?.matchedFields).toContain("document");
expect(result.results[0]?.href).toContain("#document-plan");
expect(result.results[0]?.snippet).toMatch(/parser/i);
expect(result.results[0]?.snippets[0]).toMatchObject({ field: "document", label: "Hermes Parser Plan" });
expect(result.results[0]?.snippets[0]?.highlights.length).toBeGreaterThan(0);
expect(result.countsByType.document).toBe(1);
});
it("searches artifact projections through the artifacts scope", async () => {
@@ -238,7 +299,7 @@ describeEmbeddedPostgres("companySearchService", () => {
}),
});
expect(result.results[0]?.snippet).toMatch(/comet tail/i);
expect(result.countsByType).toEqual({ issue: 0, artifact: 1, agent: 0, project: 0 });
expect(result.countsByType).toEqual({ issue: 0, comment: 0, document: 0, artifact: 1, agent: 0, project: 0 });
});
it("does not pass high-offset search fetch windows through to artifact query validation", async () => {
@@ -255,6 +316,159 @@ describeEmbeddedPostgres("companySearchService", () => {
expect(result.countsByType.artifact).toBe(0);
});
it("applies issue filters before sorting and pagination", async () => {
const companyId = await createCompany();
const agentId = await createAgent(companyId, { name: "Needle engineer" });
const projectId = await createProject(companyId, { name: "Needle project" });
const labelId = await createLabel(companyId, { name: "Needle label" });
const base = new Date("2026-01-01T00:00:00.000Z").getTime();
const newestMatch = await createIssue(companyId, {
identifier: "TST-30",
title: "Needle newest",
status: "todo",
priority: "high",
assigneeAgentId: agentId,
projectId,
updatedAt: new Date(base + 3_000),
});
const olderMatch = await createIssue(companyId, {
identifier: "TST-31",
title: "Needle older",
status: "todo",
priority: "high",
assigneeAgentId: agentId,
projectId,
updatedAt: new Date(base + 2_000),
});
const statusDecoy = await createIssue(companyId, {
identifier: "TST-32",
title: "Needle done",
status: "done",
priority: "high",
assigneeAgentId: agentId,
projectId,
updatedAt: new Date(base + 4_000),
});
await db.insert(issueLabels).values([
{ companyId, issueId: newestMatch, labelId },
{ companyId, issueId: olderMatch, labelId },
{ companyId, issueId: statusDecoy, labelId },
]);
const result = await svc.search(companyId, companySearchQuerySchema.parse({
q: "needle",
status: "todo",
priority: "high",
assigneeAgentId: agentId,
projectId,
labelId,
updatedAfter: new Date(base + 1_000).toISOString(),
sort: "updated",
limit: "1",
offset: "1",
}));
expect(result.results.map((row) => row.id)).toEqual([olderMatch]);
expect(result.countsByType.issue).toBe(2);
expect(result.countsByType.agent).toBe(0);
expect(result.countsByType.project).toBe(0);
expect(result.filterOptionCounts.status.todo).toBe(2);
expect(result.filterOptionCounts.status.done).toBe(1);
expect(result.hasMore).toBe(false);
});
it("returns issue rows for filter-only searches", async () => {
const companyId = await createCompany();
const agentId = await createAgent(companyId, { name: "Filter owner" });
const matchingIssue = await createIssue(companyId, {
identifier: "TST-34",
title: "Filtered task",
status: "todo",
assigneeAgentId: agentId,
});
await createIssue(companyId, {
identifier: "TST-35",
title: "Filtered decoy",
status: "done",
assigneeAgentId: agentId,
});
await createAgent(companyId, { name: "Todo" });
await createProject(companyId, { name: "Todo" });
const result = await svc.search(companyId, companySearchQuerySchema.parse({
q: "",
status: "todo",
assigneeAgentId: agentId,
}));
expect(result.results.map((row) => row.id)).toEqual([matchingIssue]);
expect(result.countsByType.issue).toBe(1);
expect(result.countsByType.agent).toBe(0);
expect(result.countsByType.project).toBe(0);
expect(result.results[0]?.snippets).toEqual([]);
});
it("returns zero-result loosen data and suppresses agent/project rows while issue filters are active", async () => {
const companyId = await createCompany();
await createAgent(companyId, { name: "Needle agent", capabilities: "Needle capabilities" });
await createProject(companyId, { name: "Needle project", description: "Needle roadmap" });
const result = await svc.search(companyId, companySearchQuerySchema.parse({ q: "needle", status: "todo" }));
expect(result.results).toEqual([]);
expect(result.countsByType.agent).toBe(0);
expect(result.countsByType.project).toBe(0);
expect(result.zeroResults).toMatchObject({
unfilteredTotal: 2,
loosenSuggestions: [
{ filter: "status", values: ["todo"], resultCount: 2, additionalCount: 2 },
],
});
});
it("does not leak hidden issue-backed artifacts", async () => {
const companyId = await createCompany();
const agentId = await createAgent(companyId, { name: "Artifact Writer" });
const visibleIssueId = await createIssue(companyId, {
identifier: "TST-33",
title: "Visible artifact holder",
});
const hiddenIssueId = await createIssue(companyId, {
identifier: "TST-34",
title: "Hidden artifact holder",
hiddenAt: new Date(),
});
const visibleDocumentId = randomUUID();
const hiddenDocumentId = randomUUID();
await db.insert(documents).values([
{
id: visibleDocumentId,
companyId,
title: "Visible Artifact",
latestBody: "Searchable artifact body",
format: "markdown",
createdByAgentId: agentId,
},
{
id: hiddenDocumentId,
companyId,
title: "Hidden Artifact",
latestBody: "Searchable artifact body",
format: "markdown",
createdByAgentId: agentId,
},
]);
await db.insert(issueDocuments).values([
{ companyId, issueId: visibleIssueId, documentId: visibleDocumentId, key: "visible" },
{ companyId, issueId: hiddenIssueId, documentId: hiddenDocumentId, key: "hidden" },
]);
const result = await svc.search(companyId, companySearchQuerySchema.parse({ q: "artifact", scope: "artifacts" }));
expect(result.results.map((row) => row.artifact?.issueId)).toEqual([visibleIssueId]);
expect(result.countsByType.artifact).toBe(1);
});
it("excludes hidden issues and other companies' data", async () => {
const companyId = await createCompany("Visible Co");
const otherCompanyId = await createCompany("Other Co");
@@ -445,7 +659,7 @@ describeEmbeddedPostgres("companySearchService", () => {
const result = await svc.search(companyId, companySearchQuerySchema.parse({ q: "needle", limit: "2", offset: "2" }));
expect(result.results.map((row) => row.id)).toEqual([agentIds[2], projectIds[0]]);
expect(result.countsByType).toEqual({ issue: 0, artifact: 0, agent: 3, project: 3 });
expect(result.countsByType).toEqual({ issue: 0, comment: 0, document: 0, artifact: 0, agent: 3, project: 3 });
expect(result.hasMore).toBe(true);
});
+15 -1
View File
@@ -4432,7 +4432,21 @@ export function issueRoutes(
res.status(403).json({ error: "Company search is outside this actor's authorization boundary" });
return;
}
const query = companySearchQuerySchema.parse(req.query);
const parsedQuery = companySearchQuerySchema.safeParse(req.query);
if (!parsedQuery.success) {
res.status(400).json({
error: parsedQuery.error.issues[0]?.message ?? "Invalid search query",
});
return;
}
let query = parsedQuery.data;
if (query.assigneeUserId === "me") {
if (req.actor.type !== "board" || !req.actor.userId) {
res.status(403).json({ error: "assigneeUserId=me requires board authentication" });
return;
}
query = { ...query, assigneeUserId: req.actor.userId };
}
const rateLimit = searchRateLimiter.consume(companySearchRateLimitActor(req, companyId));
res.setHeader("X-RateLimit-Limit", String(rateLimit.limit));
res.setHeader("X-RateLimit-Remaining", String(rateLimit.remaining));
+13 -1
View File
@@ -315,7 +315,11 @@ function buildArtifactGroups(input: {
export function companyArtifactsService(db: Db, storage?: StorageService) {
return {
list: async (companyId: string, rawQuery: Partial<CompanyArtifactsQuery> = {}): Promise<CompanyArtifactsResponse> => {
list: async (
companyId: string,
rawQuery: Partial<CompanyArtifactsQuery> = {},
options: { issueConditions?: SQL[] } = {},
): Promise<CompanyArtifactsResponse> => {
const query = companyArtifactsQuerySchema.parse(rawQuery);
const cursor = decodeCursor(query.cursor);
const groupBy = query.groupBy === "none" ? null : query.groupBy;
@@ -329,6 +333,11 @@ export function companyArtifactsService(db: Db, storage?: StorageService) {
const fetchLimit = Math.min(query.limit + 1, COMPANY_ARTIFACTS_MAX_LIMIT + 1);
const sourceFetchLimit = groupBy ? GROUPED_ARTIFACT_FETCH_LIMIT : fetchLimit;
const q = query.q ? `%${escapeLikePattern(query.q)}%` : null;
const issueConditions: SQL[] = [
isNull(issues.hiddenAt),
isNull(issues.harnessKind),
...(options.issueConditions ?? []),
];
const artifacts: CompanyArtifact[] = [];
const workProductAttachmentIds = new Set<string>();
@@ -341,6 +350,7 @@ export function companyArtifactsService(db: Db, storage?: StorageService) {
eq(documents.companyId, companyId),
or(isNotNull(documents.createdByAgentId), isNotNull(documents.updatedByAgentId))!,
notInArray(issueDocuments.key, [...SYSTEM_ISSUE_DOCUMENT_KEYS]),
...issueConditions,
];
const documentCursor = groupBy ? undefined : cursorCondition(sql<Date>`${documents.updatedAt}`, documentArtifactId, cursor);
if (documentCursor) documentConditions.push(documentCursor);
@@ -442,6 +452,7 @@ export function companyArtifactsService(db: Db, storage?: StorageService) {
eq(issueWorkProducts.companyId, companyId),
eq(issueWorkProducts.type, "artifact"),
eq(issueWorkProducts.provider, "paperclip"),
...issueConditions,
];
const workProductConditions: SQL[] = [...workProductBaseConditions];
const workProductCursor = groupBy
@@ -578,6 +589,7 @@ export function companyArtifactsService(db: Db, storage?: StorageService) {
eq(issueAttachments.companyId, companyId),
isNull(issueAttachments.issueCommentId),
isNotNull(assets.createdByAgentId),
...issueConditions,
];
const attachmentCursor = groupBy
? undefined
File diff suppressed because it is too large. Load diff