Skip to content

fix(platform): stable block chat ids, held-listing sync status, session cleanup on account deletion - #7755

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/connector-status-chat-ids-deletion-session
Sep 11, 2026
Merged

fix(platform): stable block chat ids, held-listing sync status, session cleanup on account deletion#7755
waleedlatif1 merged 3 commits into
stagingfrom
fix/connector-status-chat-ids-deletion-session

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Sim block: every Conversation ID is mapped to a UUID v5 of workspaceId:id. Builder strings like customer-456 no longer fail every uuid-keyed read, two workspaces using the same id no longer share a thread in the copilot store, and a block can only continue a chat it derived. The block still exposes the builder's own id so chaining keeps the thread. The fork feature's UUID v5 helper moves to a shared module.
  • Connector sync: checkpoint.unsafe (provider cannot promise a stable listing) is back to gating only deletion reconciliation. Since feat(search): add organization search and private assistant #7477 it also marked the run partial and froze last_sync_at, so stable-but-unsafe providers (Fireflies, Notion search, capped Gmail/Slack) showed stale "last synced" and Partial rows on every run. One isContentPassIncomplete predicate now drives status, watermark, and task outcome. Restores pre-feat(search): add organization search and private assistant #7477 behavior: KB sync history rows go back to Completed and the org Search overview stops flagging these sources as needing attention. Affected connectors self-correct on their next run.
  • Account deletion: the deletion response clears the session cookies itself, since the signed cookie cache otherwise keeps authenticating the browser for its TTL and the page's query-cache reset refetches the workspace list, which auto-creates a workspace for a user who no longer exists. The route builder keeps each cleared cookie on its own header line. A workspaceuser FK violation on create is now WorkspaceOwnerMissingError, answered 401 by both workspace routes instead of a logged 500.

Rollout note

  • Conversation ids are derived from this version on, including UUID-shaped ones. A thread whose id was minted before this deploy and stored for reuse starts fresh once; ids chained from the block's output after this deploy keep their thread. Passing UUIDs through is what let a block continue any chat in the copilot store, so there is no compatibility path to keep.

Type of Change

  • Bug fix

Testing

  • New tests for each change, each confirmed to fail without its fix: resolver derivation/scoping/chaining, UUID v5 RFC vector, handler wire vs. exposed id, isContentPassIncomplete over all flag combinations, held pass completes with advanced watermark, classifier wiring, set-cookie append, deletion finalizer (success and swallowed failure), FK → typed error (plus negative case), GET auto-create → 401
  • vitest over every touched area: 204 files / 2,981 tests passing
  • bun run type-check, bun run lint, check:api-validation, check:audits (46/46), docs-manifest:check all passing

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

The Sim block passed its Conversation ID input straight through as the copilot
chat id. Builders use stable strings such as `customer-456` there, but every
chat column in Sim is a uuid, so each read keyed by the id failed, and the
copilot service keys conversations by id alone, so two workspaces choosing the
same string shared one thread.

Every conversation id is now mapped to a UUID v5 of `workspaceId:id` under a
fixed namespace. The same value keeps the same thread, workspaces never
collide, a block can only reach a chat it derived, and the literal value never
leaves the executor. An omitted id mints a token that the block exposes so a
chained block continues the thread. The fork feature's UUID v5 helper moves
to a shared module.
Since #7477 `completeSuccessfulSync` folded `checkpoint.unsafe` into the same
predicate as an unfinished listing and a failed source read, so every
connector whose provider cannot promise a stable listing (Fireflies and Notion
always, Gmail and Slack at their caps) was recorded as `partial` with a frozen
`last_sync_at` even when every document listed. `unsafe` only ever meant "do
not infer deletions from this listing", and the deletion hold in
`reconcileCompletedListing` still honors it.

One `isContentPassIncomplete` predicate now drives the sync-log status, the
watermark advance, and the task outcome, and it excludes `unsafe`, restoring
the pre-#7477 behavior at all four sites.
…wner

Deleting an account removes the user and session rows, but the signed cookie
cache keeps authenticating that browser for up to five minutes. The settings
page then clears the query cache concurrently with signing out, every mounted
query refetches, and the workspace list finds nothing and tries to create a
default workspace for a user who no longer exists. The insert fails on the
`workspace` -> `user` foreign key and surfaces as an unhandled 500 on roughly
half of all deletions.

The deletion response now clears the session cookies itself, so no later
request from that browser carries them. The route builder keeps each cleared
cookie on its own header line. Workspace creation classifies a user foreign
key violation as `WorkspaceOwnerMissingError`, which both workspace routes
answer with 401 instead of a logged fault.
@vercel

vercel Bot commented Sep 11, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 11, 2026 1:49am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with no outstanding or newly introduced actionable defects identified.

Summary

  • Derives stable, workspace-scoped UUIDv5 chat IDs while preserving builder-facing conversation IDs for chaining.
  • Treats unsafe-but-complete connector listings as completed syncs while continuing to hold deletion reconciliation.
  • Clears authentication cookies after account deletion and maps workspace creation races with deleted users to unauthorized responses.
  • Consolidates UUIDv5 generation into a shared utility and adds focused regression coverage.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Sim block conversation ID] --> B[UUIDv5 of workspace ID and conversation ID]
  B --> C[Workspace-scoped copilot chat ID]
  C --> D[Builder receives original conversation ID for chaining]

  E[Connector content pass] --> F{Listing incomplete or content read failed?}
  F -->|Yes| G[Partial status and retained watermark]
  F -->|No| H[Completed status and advanced watermark]
  H --> I{Listing marked unsafe?}
  I -->|Yes| J[Hold deletion reconciliation]
  I -->|No| K[Perform normal reconciliation]

  L[Account deletion completes] --> M[Clear session cookies on response]
  N[Stale cached session reaches workspace creation] --> O[Owner foreign key violation]
  O --> P[WorkspaceOwnerMissingError]
  P --> Q[HTTP 401 Unauthorized]
Loading

Reviews (2) · Last reviewed commit: "fix(auth): end the session on account de..."

Comment thread apps/sim/executor/handlers/mothership/mothership-handler.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@waleedlatif1
waleedlatif1 merged commit 0bae22b into staging Sep 11, 2026
34 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/connector-status-chat-ids-deletion-session branch September 11, 2026 01:59
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.

1 participant