Skip to content

v0.6.85: mothership stream, resource column spacing, prospeo, findymail integrations, markdown google docs creation#4659

Merged
waleedlatif1 merged 10 commits into
mainfrom
staging
May 19, 2026
Merged

v0.6.85: mothership stream, resource column spacing, prospeo, findymail integrations, markdown google docs creation#4659
waleedlatif1 merged 10 commits into
mainfrom
staging

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

icecrasher321 and others added 10 commits May 17, 2026 15:05
…he cleanup (#4646)

* improvement(redis-cleanup): schedule, async workflow, hitl bae64 cache cleanup

* address comments
* improvement(mothership): abort path race preventing persistence

* address comments

* address bugbot comment
…hunk viewer (#4643)

* fix(knowledge): preserve scroll position when toggling tokenizer in chunk viewer

* fix(knowledge): skip scroll restore on initial mount of chunk editor

* chore(dev): add dev:clean script to purge Turbopack cache
…o fix heap growth (#4652)

* fix(memory): prune toolSchemaCache and semaphores to prevent heap growth

toolSchemaCache (lib/copilot/chat/payload.ts): module-level Map keyed by
userId:workspaceId never deleted expired entries, only checked TTL on read.
With 100K+ unique user/workspace pairs each holding 50-200KB of tool schemas,
this was the primary driver of the 24MB -> 25GB heap growth observed in
CloudWatch. Add a setInterval sweep every 30s (matching the TTL) with .unref()
so it does not prevent graceful shutdown.

semaphores (lib/core/async-jobs/backends/database.ts): acquireSlot created
Semaphore entries that releaseSlot never deleted. With per-execution UUID keys
(e.g. scheduleJobId), each scheduled workflow run would add a permanent entry.
Store the concurrency limit on the Semaphore struct and delete the entry from
the Map when all slots are free and no waiters remain.

validatorCache (lib/copilot/tools/server/generated-schema.ts): validated as
bounded (93 tools x 2 schema kinds = 186 max entries, ~2-9MB). No fix needed.

isolated-vm nativeContexts: validated as deferred GC, self-healed by worker
rotation at MAX_EXECUTIONS_PER_WORKER=200. externalMB spikes trace to
concurrent isolate heaps at peak load (128MB limit x active isolates), not a
reference leak. No fix needed.

* fix(memory): prune effectiveEnvCache and instrument cache sizes in telemetry

effectiveEnvCache (lib/environment/utils.ts): same unbounded accumulation
pattern as toolSchemaCache — module-level Map keyed by userId:workspaceId
with a 15s TTL that is only checked on read, never proactively evicted.
Adds a periodic sweep matching the TTL interval with .unref().

cache-registry (lib/monitoring/cache-registry.ts): lightweight registry
so modules can expose their cache sizes to telemetry without coupling.
toolSchemaCache and effectiveEnvCache both register on module load.

memory-telemetry: emits cacheSizes in every Memory snapshot log so
CloudWatch can confirm the caches stay bounded post-deploy.

* improvement(memory): replace manual TTL Maps with lru-cache for toolSchemaCache and effectiveEnvCache

Replaces the homegrown Map + setInterval sweep pattern with LRUCache from
the lru-cache npm package, which is the standard Node.js solution for
bounded in-process caching with TTL.

Changes per cache:
- Removes manual ToolSchemaCacheEntry / EffectiveEnvCacheEntry types
- Removes setInterval sweep timers (and the .unref() boilerplate)
- Removes the two-phase promise->value entry update inside the IIFE
- Stores Promise<T> directly — in-flight and resolved states share one type
- max: 200 (toolSchemaCache) / max: 500 (effectiveEnvCache) as hard ceilings
- TTL behaviour and concurrent-request deduplication are preserved exactly
- cache-registry .size reporting works unchanged via lru-cache's .size prop

* fix(memory): remove redundant waiters guard in releaseSlot
… search (#4653)

* feat(prospeo): add Prospeo integration for B2B contact enrichment and search

Adds 8 operations: enrich person/company, bulk enrich person/company,
search person/company, search suggestions, and account information.
Uses X-KEY header auth.

* refactor(prospeo): extract shared parse helpers into utils.ts
* feat(findymail): add Findymail B2B contact data integration

Adds 11 tools covering verified email lookup (by name, LinkedIn, domain
roles), email verification, reverse email lookup with profile enrichment,
company info, employee discovery, phone lookup, technology stack
detection, and credit checks. Single API-key block with operation
dropdown, gradient-rendered icon, and generated docs.

* fix(findymail): handle HTTP errors and surface last_detected_at

- All 11 tools now check response.ok and return success:false with the API error message on non-2xx responses
- search_technologies now maps last_detected_at to match lookup_technologies and the shared output schema
- Restore file_v3 in docs icon-mapping (translated docs still reference it)

* improvement(findymail): exclude operation from params transform

Match the convention used by enrich/apify/box/calendly — destructure out
operation before forwarding the rest to the tool call, so the operation
key doesn't leak into the tool payload.
…st stacking (#4655)

* improvement(workspace): fix resource table column proportions and toast stacking

* fix(resource): restore scrollbar-gutter stable on table scroll container

* fix(resource): remove scrollbar-gutter stable — single-table layout doesn't need it

* fixed files cols

* fix(findymail): add required enabled field to wandConfig entries

* fix(findymail): remove optional from block outputs — not valid on BlockConfig output type

* fixes

* fix(files): use folderSizeMap for sort value so size sort matches display

* files ref
…4657)

* fix(tables): type-aware SQL casts for range filters on date columns

* improvement(table): tighten filter-cast types & workspace guards

- Drop redundant tableId/workspaceId from BulkUpdateData and BulkDeleteData; service uses table.id / table.workspaceId so column metadata and DB scope can't drift apart.
- Add missing workspace-id guards to copilot user-table cases (insert_row, batch_insert_rows, update_row, batch_update_rows, rename); collapse duplicated rename check.
- Add service-level integration tests that buildFilterClause/buildSortClause receive table.schema.columns from queryRows, updateRowsByFilter, deleteRowsByFilter.

* improvement(table): cast jsonb date filters/sorts to timestamptz

::timestamp strips timezone offsets from ISO strings, making comparisons
depend on the server TimeZone setting. ::timestamptz preserves the offset
so chronological comparisons are correct regardless of server config.

* improvement(table): correct JSDoc examples for required columns arg

* improvement(table): validate range operator value types at SQL builder
…4656)

* feat(google_docs): opt-in Markdown formatting for create operation

* fix(google_docs): harden multipart boundary handoff and align postProcess guard
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 19, 2026 2:42am

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 19, 2026

PR Summary

Medium Risk
Touches copilot chat finalization/persistence and table filtering logic, which can affect data consistency and UX if edge cases are missed. Also adds new third-party integrations and caching changes that may surface runtime/config issues.

Overview
Adds two new sales data integrations: Prospeo and Findymail are introduced end-to-end (new block configs, icons, docs pages, and entries in integrations metadata/mappings) so they show up in both Docs and the Sim landing/integration registry.

Improves copilot stream stop/finalization reliability by routing both /chat/stop and server lifecycle cancellation through finalizeAssistantTurn, adding transactional row locking, an active-or-cleared stream marker policy, and a helper (withStoppedContentBlock) to ensure cancelled partial assistant content is persisted and completion status is republished when needed.

Documentation + tooling updates: File docs are updated to file_v4 and expanded to include read/fetch/write/append semantics; CloudWatch docs and integrations metadata add mute/unmute alarm operations.

Workspace UX refinements: resource tables switch to sticky headers with improved column width handling and a shared EMPTY_CELL_PLACEHOLDER; files now display aggregated folder sizes; toasts are capped and visually stacked; knowledge chunk tokenizer toggle preserves scroll position.

Infra/behavior tweaks: tool schema caching is switched to an LRUCache with metrics registration; workflow and schedule executions now always clean up the per-execution base64 cache; table row filtering now passes schema columns into buildFilterClause, and export/row update/delete helpers are refactored to take the table object directly.

Reviewed by Cursor Bugbot for commit 6827be7. Configure here.

Comment thread apps/sim/app/workspace/[workspaceId]/files/files.tsx
Comment thread apps/sim/components/emcn/components/toast/toast.tsx
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 19, 2026

Greptile Summary

This release bundles ten improvements: a Prospeo and Findymail B2B contact-enrichment integration, an opt-in Markdown formatting path for Google Docs create, type-aware SQL casts for range filters and sort on date/number columns, a row-locked finalizeAssistantTurn to eliminate the mothership stream abort-path race, LRU-bounded server caches to fix heap growth, finally-block base64 cache cleanup for schedule/HITL/async executions, resource table column-proportion tweaks, and a knowledge chunk-viewer scroll-position fix.

  • Type-aware SQL casts (sql.ts / service.ts): buildFilterClause and buildSortClause now accept column definitions and emit ::numeric / ::timestamptz casts; the updateRowsByFilter and deleteRowsByFilter signatures were unified so the table definition (and thus the column schema) flows through all call sites.
  • Copilot cancellation race fix (terminal-state.ts / run.ts / post.ts): finalizeAssistantTurn now runs inside a SELECT … FOR UPDATE transaction, and the cancelled onComplete path (in post.ts) is now the primary DB writer for partial content instead of /chat/stop; both paths share streamMarkerPolicy: 'active-or-cleared' so whichever wins the lock appends the message and the other is a no-op.
  • LRU caches (environment/utils.ts, copilot/*): unbounded Map-backed caches replaced with lru-cache (max + TTL), with a registerCache / getCacheSizes telemetry hook wired into the existing memory-telemetry interval.

Confidence Score: 5/5

Safe to merge — all changed paths have been updated consistently and the key concurrency fix is well-guarded by a row-level lock.

The mothership stream abort-path race is eliminated by wrapping finalizeAssistantTurn in a SELECT … FOR UPDATE transaction, and both competing writers (/chat/stop and the cancelled onComplete path) share an idempotent active-or-cleared policy that makes whichever arrives second a no-op. The SQL type-cast changes are covered by end-to-end SQL rendering tests. The new Prospeo and Findymail integrations follow the established tool pattern with correct API key visibility. No call sites were missed in the queryRows / updateRowsByFilter / deleteRowsByFilter signature refactor.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/lib/table/sql.ts Added jsonbCastForType as a single source of truth for numeric/timestamptz casts in both filter range operators and sort; validation added at the builder layer before values reach Postgres.
apps/sim/lib/table/service.ts queryRows, updateRowsByFilter, deleteRowsByFilter signatures unified to accept TableDefinition so column schema flows through for type-aware casts; all call sites updated.
apps/sim/lib/copilot/chat/terminal-state.ts Wrapped the read-modify-write in a SELECT … FOR UPDATE transaction; introduced streamMarkerPolicy and a structured FinalizeAssistantTurnResult return type to eliminate the abort-path race.
apps/sim/lib/copilot/request/lifecycle/run.ts Cancel path now accumulates partial content and calls onComplete(cancelled) instead of being handled exclusively by /chat/stop; onCompleteStarted flag prevents double-invocation.
apps/sim/lib/environment/utils.ts Replaced unbounded Map-backed cache with LRUCache (max 500, 15 s TTL); promise-deduplication behavior preserved; registered with cache-registry for telemetry.
apps/sim/app/api/copilot/chat/stop/route.ts Delegated DB writes to shared finalizeAssistantTurn; uses active-or-cleared policy and interprets AssistantAlreadyPersisted outcome correctly for the publishStatusChanged decision.
apps/sim/tools/google_docs/create.ts Added opt-in markdown param that routes through Drive's uploadType=multipart endpoint; boundary stashed on params with a loud throw guard if order is violated.
apps/sim/tools/prospeo/enrich_person.ts New Prospeo Enrich Person tool; uses visibility: 'user-only' for the API key. Response mapped cleanly with null-fallbacks.
apps/sim/tools/findymail/index.ts New Findymail integration barrel; all 11 tools consistently use visibility: 'user-only' for the API key.
apps/sim/lib/core/async-jobs/backends/database.ts Semaphore now stores limit alongside available; releaseSlot deletes the map entry when available returns to the limit, preventing unbounded semaphore accumulation.
apps/sim/background/schedule-execution.ts Added finally { cleanupExecutionBase64Cache(executionId) } so cached base64 data is always released regardless of execution outcome.
apps/sim/lib/copilot/tools/server/table/user-table.ts Updated all queryRows/updateRowsByFilter/deleteRowsByFilter call sites to new signatures; previously missing workspace-ownership checks added to query_rows and delete_rows operations.

Reviews (2): Last reviewed commit: "feat(google_docs): opt-in Markdown forma..." | Re-trigger Greptile

Comment thread apps/sim/app/_styles/globals.css
Comment thread apps/sim/tools/google_docs/create.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 6827be7. Configure here.

@waleedlatif1 waleedlatif1 merged commit d14af04 into main May 19, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants