Skip to content

v0.6.10: tour fix, connectors reliability improvements, tooltip gif fixes #3757

Merged
waleedlatif1 merged 7 commits intomainfrom
staging
Mar 25, 2026
Merged

v0.6.10: tour fix, connectors reliability improvements, tooltip gif fixes #3757
waleedlatif1 merged 7 commits intomainfrom
staging

Conversation

@waleedlatif1
Copy link
Collaborator

TheodoreSpeaks and others added 7 commits March 24, 2026 20:19
* improvement(ui): Merge ui definitions for mothership chat

* Fix lint

* Restore copilot layout

* Fix subagent text not animating collapses

---------

Co-authored-by: Theodore Li <theo@sim.ai>
#3751)

* improvement(tour): fix tour auto-start logic and standardize selectors

* fix(tour): address PR review comments

- Move autoStartAttempted.add() inside timer callback to prevent
  blocking auto-start when tour first mounts while disabled
- Memoize setJoyrideRef with useCallback to prevent ref churn
- Remove unused joyrideRef
- Add max-w-[260px] to Tooltip.Content so video previews don't blow out the tooltip size
- Replace cursor-help with cursor-default on info icons in settings
* fix(auth): remove captcha from login, fix signup captcha flow

* fix(auth): show Turnstile widget at normal size for Managed mode challenges
…of fire-and-forget (#3754)

* fix(knowledge): route connector doc processing through queue instead of fire-and-forget

* fix(knowledge): rename jobIds to batchIds in processDocumentsWithTrigger return type

* improvement(knowledge): add Trigger.dev tags for connector sync and document processing tasks

* fix(knowledge): move completeSyncLog after doc enqueue, handle NULL processingStartedAt in stuck doc query
@cursor
Copy link

cursor bot commented Mar 25, 2026

PR Summary

Medium Risk
Touches authentication (captcha enforcement) and knowledge connector processing/queuing logic; errors here can impact signups or document sync reliability. Also refactors shared chat/tour UI which could cause UX regressions if edge cases differ between views.

Overview
Improves onboarding tours and chat UI reuse while tightening background processing reliability.

Product tours now use standardized data-tour selectors (sidebar + workflow tabs), safer Joyride ref forwarding, and more robust auto-start/transition handling (session-scoped auto-start guard + cancelable rAF/timers).

Chat rendering for both Home and Workflow Copilot is consolidated into a new reusable MothershipChat component, alongside minor UX tweaks (agent group auto-expand/collapse behavior and “Stopped by user” labeling).

Auth updates remove Turnstile captcha from login and harden signup captcha execution via explicit success/error/expire callbacks + timeout handling; server captcha enforcement is limited to the signup endpoint. Knowledge connector sync now batches/enqueues document processing through the queue (including retries for stale/failed docs), tags Trigger.dev runs, and records lastSyncDocCount from actual DB counts. Tooltip previews are constrained/styled better with optional non-looping video previews, and user_stats token counters are migrated to bigint.

Written by Cursor Bugbot for commit b497033. Configure here.

@vercel
Copy link

vercel bot commented Mar 25, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 25, 2026 8:41pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 25, 2026

Greptile Summary

This PR bundles several targeted fixes and one larger refactor across auth, product tour, tooltips, UI component extraction, knowledge connector reliability, and a database schema correction.

  • Auth: Captcha (Cloudflare Turnstile) removed from the login flow on both client and server; signup captcha rewritten to use onSuccess/onError/onExpire callbacks with a Promise.race timeout instead of getResponsePromise.
  • Tour: Selectors standardised to data-tour="nav-*" / data-tour="tab-*" attributes; use-tour.ts gets a module-level autoStartAttempted Set to prevent duplicate auto-starts across component remounts, a disabledRef to avoid stale-closure races, and consolidated cancelPendingTransitions cleanup.
  • Tooltip: Width capped at max-w-[260px]; Preview gains a loop prop and bleeds to the Content edges with negative margins; question-mark cursor removed by moving the tooltip trigger from the label to an inline Info icon.
  • MothershipChat extraction: Chat rendering logic duplicated across home.tsx and panel.tsx is unified into a new MothershipChat component parameterised by a LAYOUT_STYLES record; two factory functions (getMothershipUseChatOptions / getWorkflowCopilotUseChatOptions) centralise useChat configuration.
  • Connector reliability: addDocument/updateDocument now return DocumentData instead of firing processing asynchronously; executeSync collects returned data and enqueues all new/updated docs in a single processDocumentsWithQueue call; stale-processing retry logic adds time cutoffs (STALE_PROCESSING_MINUTES, RETRY_WINDOW_DAYS); lastSyncDocCount now reflects the actual DB document count. processDocumentsWithTrigger switches from individual triggers to batchTrigger with idempotency keys.
  • DB: totalTokensUsed and totalCopilotTokens columns promoted from integer to bigint (mode 'number') with a corresponding migration to prevent overflow for high-volume users.
  • Revert: "show continue options on abort" feature removed from use-chat.ts.

Confidence Score: 4/5

  • PR is safe to merge; one test file has stale mocks that should be fixed to keep CI green.
  • All functional changes are well-reasoned and consistent (auth, tour, tooltip, DB migration, connector reliability). The single concrete issue is that sync-engine.test.ts still mocks processDocumentAsync and is missing gt/or in its drizzle-orm mock, which could break CI if those test paths are exercised. Everything else is clean refactoring with no logic regressions.
  • apps/sim/lib/knowledge/connectors/sync-engine.test.ts — mocks need updating to match the new imports.

Important Files Changed

Filename Overview
apps/sim/lib/knowledge/connectors/sync-engine.ts Significant reliability improvement: replaces fire-and-forget processDocumentAsync calls with batched queue-based processing, adds stale-processing retry logic with time cutoffs, and updates lastSyncDocCount with the actual DB count rather than the raw page count.
apps/sim/lib/knowledge/documents/service.ts ProcessingOptions fields made optional (safe, callers pass {}); processDocumentsWithTrigger switches from individual triggers to batchTrigger with idempotency keys; retryDocumentProcessing upgraded to queue-based flow.
apps/sim/lib/knowledge/connectors/sync-engine.test.ts Mocks not updated to reflect new imports: service mock still exports processDocumentAsync (removed) instead of processDocumentsWithQueue, and drizzle-orm mock is missing gt and or operators that are now imported.
packages/db/schema.ts totalTokensUsed and totalCopilotTokens promoted from integer to bigint(mode:'number') to prevent overflow; migration 0181 correctly alters the columns.
apps/sim/app/workspace/[workspaceId]/components/product-tour/use-tour.ts Module-level autoStartAttempted Set prevents duplicate auto-starts across remounts; disabledRef avoids stale-closure race; scheduleReveal/cancelPendingTransitions consolidate rAF/timer cleanup.
apps/sim/app/(auth)/signup/signup-form.tsx Captcha flow rewritten to use onSuccess/onError/onExpire callbacks with Promise.race timeout instead of getResponsePromise; cleanup in finally block is correct.
apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/mothership-chat.tsx New shared MothershipChat component extracted from home.tsx, parameterised by LAYOUT_STYLES record for mothership-view and copilot-view variants; used in both home.tsx and panel.tsx.
apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts Factory functions getMothershipUseChatOptions / getWorkflowCopilotUseChatOptions added; resolveInterruptedToolCalls/CONTINUE_OPTIONS_CONTENT removed (revert of prior feature); stopGeneration simplified.

Sequence Diagram

sequenceDiagram
    participant SE as sync-engine.ts
    participant DB as Database
    participant Q as processDocumentsWithQueue
    participant T as Trigger.dev (batchTrigger)

    SE->>DB: Fetch external docs
    loop For each doc batch
        SE->>DB: addDocument / updateDocument
        DB-->>SE: DocumentData (filename, fileUrl…)
        SE->>SE: pendingProcessing.push(data)
    end

    SE->>DB: Query stuck docs (pending/failed/stale-processing)
    DB-->>SE: stuckDocs[]

    alt stuckDocs.length > 0
        SE->>Q: processDocumentsWithQueue(stuckDocs, kbId, {}, requestId)
        Q->>T: batchTrigger (with idempotency keys)
    end

    alt pendingProcessing.length > 0
        SE->>Q: processDocumentsWithQueue(pendingProcessing, kbId, {}, requestId)
        Q->>T: batchTrigger (with idempotency keys)
    end

    SE->>DB: SELECT count(*) actual doc count
    SE->>DB: UPDATE connector (lastSyncDocCount = actualDocCount)
Loading

Comments Outside Diff (1)

  1. apps/sim/lib/knowledge/connectors/sync-engine.test.ts, line 15-27 (link)

    P2 Stale mocks after refactoring

    The service mock still exports processDocumentAsync instead of processDocumentsWithQueue, and the drizzle-orm mock is missing the newly imported gt and or operators. Any test that exercises the updated code paths in executeSync will see undefined instead of mock functions, likely causing test failures.

    vi.mock('@/lib/knowledge/documents/service', () => ({
      hardDeleteDocuments: vi.fn(),
      isTriggerAvailable: vi.fn(),
    -  processDocumentAsync: vi.fn(),
    +  processDocumentsWithQueue: vi.fn().mockResolvedValue(undefined),
    }))
    
    vi.mock('drizzle-orm', () => ({
      and: vi.fn(),
      eq: vi.fn(),
    +  gt: vi.fn(),
      inArray: vi.fn(),
      isNull: vi.fn(),
      lt: vi.fn(),
      ne: vi.fn(),
    +  or: vi.fn(),
      sql: vi.fn(),
    }))

Reviews (1): Last reviewed commit: "Revert "improvement(mothership): show co..." | Re-trigger Greptile

Copy link

@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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

}
},
[invalidateChatQueries, resolveInterruptedToolCalls]
[invalidateChatQueries]
Copy link

Choose a reason for hiding this comment

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

Executing tool calls never resolve on stream error

Medium Severity

The old resolveInterruptedToolCalls was called from both stopGeneration (user-initiated) and finalize (stream completion/error). The refactor moved the tool-call resolution logic inline into stopGeneration only, and removed it from finalize. When finalize({ error: true }) is called (e.g., network failure, reconnection failure, or stream error), any tool calls stuck in executing status will never be resolved to cancelled, leaving a perpetual spinner in the UI.

Additional Locations (1)
Fix in Cursor Fix in Web

@waleedlatif1 waleedlatif1 merged commit 7b572f1 into main Mar 25, 2026
26 of 27 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.

3 participants