Skip to content

fix(channels): preserve workspace on connect retry - #1181

Open
baokimho wants to merge 1 commit into
ChatbotXIO:mainfrom
baokimho:fix/connect-retry-workspace-id
Open

baokimho wants to merge 1 commit into
ChatbotXIO:mainfrom
baokimho:fix/connect-retry-workspace-id

Conversation

@baokimho

Copy link
Copy Markdown

Summary

Preserve workspaceId when retrying failed channel connections.

Previously, retry links could drop the current workspace context and incorrectly enter the first-workspace flow, causing errors such as Workspace limit reached.

Changes

  • Preserve workspaceId in retry URLs.
  • Keep workspace-less WhatsApp retries on /channels/create.
  • Avoid empty workspaceId query parameters.
  • Leave workspace creation and OAuth behavior unchanged.

Tests

  • 8 test files passed
  • 143 tests passed
  • git diff --check passed
  • targeted Biome check passed

TypeScript check was inconclusive locally due Node heap exhaustion.

Fixes #1159

Copilot AI lite review requested due to automatic review settings September 14, 2026 12:33
@github-actions github-actions Bot added the bug Something isn't working as expected label Sep 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

馃煛 Changes recommended

A critical TypeScript issue and a moderate WhatsApp workspace-preservation issue remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR preserves workspace context when retrying failed channel connections.

Changes:

  • Adds workspace-aware retry URL generation.
  • Threads workspaceId through connection flows.
  • Adds regression coverage for retry behavior and workspace-less WhatsApp flows.
File summaries
File Reviewed changes / findings
apps/builder/src/features/integration-messenger/components/messenger-pages.tsx Updates Messenger retry links.
apps/builder/src/features/integration-instagram/components/instagram-accounts.tsx Passes workspace context to Instagram errors.
apps/builder/src/features/channel-connect/lib/registry.ts Builds encoded, workspace-aware retry URLs.
apps/builder/src/features/channel-connect/hooks/use-connect-dialog-steps.tsx Threads workspace context into connecting steps. Critical (3 votes): the parameter type lacks the new optional workspaceId, causing a TypeScript error.
apps/builder/src/features/channel-connect/components/connecting-step.tsx Uses workspace-aware retry links.
apps/builder/src/features/channel-connect/components/connect-session-error-alert.tsx Preserves workspace context in session-error links.
apps/builder/src/features/channel-connect/components/connect-picker-screen.tsx Updates picker retry paths.
apps/builder/src/features/channel-connect/components/connect-many-dialog.tsx Forwards workspace context. Moderate (1 vote): WhatsApp retries can lose the existing workspace when the initial connection fails.
apps/builder/__tests__/messenger-pages.test.tsx Tests Messenger retry URLs.
apps/builder/__tests__/instagram-accounts.test.tsx Tests Instagram retry URLs.
apps/builder/__tests__/facebook-pending-auth.cookie-store.test.ts Updates retry route coverage.
apps/builder/__tests__/connect-many-dialog.test-utils.tsx Makes test workspace IDs configurable.
apps/builder/__tests__/connect-many-dialog.footer-steps.test.tsx Tests workspace-aware and workspace-less retries.
apps/builder/__tests__/connect-channel-registry.test.ts Tests URL generation and encoding.
Review details

Suppressed comments (1)

apps/builder/src/features/channel-connect/components/connect-many-dialog.tsx:60

  • This does not preserve the workspace for the WhatsApp retry path: WhatsappCreate passes connectedWorkspaceId, which is initialized to an empty string and is only populated after a successful connect. If the first batch/session attempt fails in an existing workspace, this value is still empty and getConnectRetryHref produces the bare /channels/create URL, sending the user back through the first-workspace flow. Pass the original page workspaceId, falling back to the connected id only for a workspace-less signup.
    workspaceId,
    resolveCoexistWorkspaceId: resolveCoexistWorkspaceId ?? (() => workspaceId),
  • Files reviewed: 14/14 changed files
  • Comments generated: 1
  • Review effort level: Lite

馃挕 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

batch,
channel,
finished,
workspaceId,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected

Projects

None yet

2 participants