diff --git a/apps/sim/background/workspace-file-search-index.test.ts b/apps/sim/background/workspace-file-search-index.test.ts index 84b71627813..b261a0e3b7f 100644 --- a/apps/sim/background/workspace-file-search-index.test.ts +++ b/apps/sim/background/workspace-file-search-index.test.ts @@ -35,7 +35,7 @@ describe('workspace file search index task', () => { it('uses isolated medium workers with a hard global concurrency and duration cap', () => { expect(workspaceFileSearchIndexTask).toMatchObject({ id: 'workspace-file-search-index', - machine: 'medium-1x', + machine: 'medium-2x', maxDuration: FILE_SEARCH_INDEX_MAX_DURATION_SECONDS, retry: { maxAttempts: 3 }, queue: { diff --git a/apps/sim/background/workspace-file-search-index.ts b/apps/sim/background/workspace-file-search-index.ts index fbba50476ca..c44bd47acf3 100644 --- a/apps/sim/background/workspace-file-search-index.ts +++ b/apps/sim/background/workspace-file-search-index.ts @@ -15,7 +15,7 @@ import { */ export const workspaceFileSearchIndexTask = task({ id: 'workspace-file-search-index', - machine: 'medium-1x', + machine: 'medium-2x', maxDuration: FILE_SEARCH_INDEX_MAX_DURATION_SECONDS, retry: { maxAttempts: 3 }, queue: { diff --git a/apps/sim/lib/workspace-files/search/README.md b/apps/sim/lib/workspace-files/search/README.md index 27892fc76d0..2d51795a2cf 100644 --- a/apps/sim/lib/workspace-files/search/README.md +++ b/apps/sim/lib/workspace-files/search/README.md @@ -12,6 +12,8 @@ PostgreSQL stores complete extracted text in bounded chunks. Object storage rema Workers download and extract outside database transactions, then insert batches of at most 250 rows / 1 MiB. Each batch checks the build token and lease. Publication locks the canonical file, build, and revision in that order, verifies the stored chunk count, and changes the visible pointer only after every batch succeeds. Old dispatch failure callbacks cannot overwrite newer dispatches or successful builds. +The indexing task uses an isolated `medium-2x` Trigger worker (4 GB RAM). Document parsers can materialize expanded content before chunking, so source and extracted-text byte limits do not bound parser memory. Parser complexity guards and the worker's memory budget remain separate protections. + File edits, context changes, and deletion invalidate metadata and expire builds. Chunks have no cascading foreign key to files or workspaces. Cleanup locks at most 100 expired builds with `SKIP LOCKED`, deletes at most 1,000 chunks per transaction, retires empty builds in the same batch, and stops after 10 batches or five seconds. Dispatch pauses while at least 10,000 expired chunks await cleanup, so sustained revisions cannot keep admitting new builds faster than retirement can drain them. Existing ready files remain searchable. Stale workers cannot revive a reclaimed build. ## Search