Skip to content

fix: skip cross-workspace user collisions during bot sync - #132

Closed
steipete wants to merge 1 commit into
mainfrom
fix/skip-cross-workspace-user-collisions
Closed

fix: skip cross-workspace user collisions during bot sync#132
steipete wants to merge 1 commit into
mainfrom
fix/skip-cross-workspace-user-collisions

Conversation

@steipete

@steipete steipete commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Bot syncs of a multi-workspace archive abort at the trailing users snapshot: Slack's built-in slackbot has the literal ID USLACKBOT in every workspace, so the first workspace to record it owns the row and every later workspace's sync exits with WorkspaceCollisionError. Slack Connect can surface externally owned members the same way. Messages import fine; the run still ends nonzero and the workspace sync-state stamp is never written.

Why This Change Was Made

#130 fixed exactly this failure class for channels (Slack Connect shared channels) by demoting the collision to a skip-with-warning at the API sync boundary. The users snapshot was the missed sibling surface; the desktop import path (upsertDesktopUser) already tolerates user collisions the same way. The first workspace keeps the user row; all other upsert errors stay fatal.

User Impact

Multi-workspace archives sync cleanly again. Live repro: a Foundation-workspace bot sync on a database that also holds a desktop import of another workspace imported all messages but exited nonzero on USLACKBOT every run.

Evidence

  • Regression test TestSyncSkipsUserOwnedByAnotherWorkspace: seeds USLACKBOT under another workspace, proves the sync completes, the original workspace keeps the row, other users still sync, and channel messages persist.
  • GOWORK=off go test ./... green; make lint (vet + govulncheck) clean.

USLACKBOT exists in every Slack workspace and Slack Connect can surface
externally owned members, so the trailing users snapshot aborted any
multi-workspace archive sync once another workspace had recorded the
user. Demote the collision to a skip-with-warning, matching the channel
fix from #130 and the desktop import path; all other upsert errors stay
fatal.
@steipete steipete closed this Aug 6, 2026
@steipete steipete reopened this Aug 6, 2026
@steipete

steipete commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

Closing as a duplicate subset of #131, which fixes the same users-snapshot collision (skipUserCollision in the same loop) and additionally covers the sibling surfaces this PR missed: message collisions in the socket-mode event handler, channel history, and thread sync, plus tail-repair resilience. The regression test here (TestSyncSkipsUserOwnedByAnotherWorkspace, seeding USLACKBOT under a second workspace) is available to cherry-pick if useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants