Skip to content

fix(connectors): close sign-in on deep link and enable slack mcp - #204

Merged
nixuuu merged 1 commit into
devfrom
fix/oauth-paste-code
Nov 5, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/oauth-paste-code

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 5, 2026

Copy link
Copy Markdown
Member

Signing in to a connector no longer ends in a misleading "This code did not work" error, and new Slack apps have MCP access turned on.

What happened

  • The dialog stayed open. The sign-in page opened Canopy through canopy://, and the deep link completed the sign-in. The Connect dialog did not notice and kept asking for a code. Pasting that code (already used) showed the generic "It works once and expires after 10 minutes. Start sign-in again."
  • Slack MCP access was off. Test then failed with HTTP 400, -32600 "App is not enabled for Slack MCP server access", because the generated Slack app manifest did not set settings.is_mcp_enabled, so Slack created the app with MCP access off.

Fix

  • Deep link: when the deep link completes the sign-in, the open Connect dialog closes and the account refreshes.
  • Pasting a code: gives a specific result instead of one generic error:
    • "Already connected." when the code was used and the account is now connected;
    • separate messages for a code that was already used, an expired code, a code from another window, and text that is not a sign-in code;
    • provider rejections, with the redacted reason under Show details.
  • Security: state stays single-use, owner-bound and valid for 10 minutes. A desktop BFF restart still needs a fresh sign-in.
  • Slack manifest: gains settings.is_mcp_enabled: true (checked against Slack's app manifest reference). The error from an app with MCP access off has its own message: "Slack MCP access is off for this app. Turn it on in the app's settings, then test again."
  • Setup docs: the setup steps and docs/connectors.md explain how to turn MCP access on for an existing app.

Tests
Gateway and BFF integration with a fake OAuth provider:

  • a paste after the deep link completed;
  • a valid code;
  • an expired code;
  • a code from another window;
  • a malformed code;
  • a provider error that shows its reason;
  • the Slack MCP-off classification.

check:tmp: 1353 passed, 0 failed.

Checked in a browser with the real BFF and gateway, a fake provider and the built bounce page, including a second completion of the same sign-in. Light and dark, desktop, narrow and phone.

Copy audit (§8): each message gives the reason and the next action; technical details stay collapsed.

Fixes: #162

Close the active Connect dialog and refresh its account when desktop OAuth
finishes. Recognize completed returns without exchanging the code twice.
Completion receipts remain owner-bound, binding-bound and short-lived;
failed exchanges cannot borrow an earlier connection's success.

Preserve classified sign-in failures and redacted provider details. Enable
MCP in generated Slack manifests, explain disabled MCP access, and document
the setting for existing apps.

Validation: generation, typecheck, lint, formatting, web build, OAuth and
Slack gateway integration, full check:tmp, and a real browser walkthrough
through an isolated gateway, BFF, fake provider and built Pages callback.
Checked light/dark, desktop/narrow/phone, and short/typical/long names.

Copy audit (docs/copy.md section 8): the generic invalid/expired error now
states the actual reason and next action; a successful duplicate says
"Already connected." Disabled Slack MCP now explains which setting to
change. Instructions use active voice and short sentences. Provider
diagnostics stay behind Show details. Existing action labels start with
verbs. No new empty states, repeated facts, glossary terms or humour.
Success and errors have text and status/alert semantics, not colour alone.

Fixes: #162
@nixuuu
nixuuu merged commit 9816ece into dev Nov 5, 2026
15 of 17 checks passed
@nixuuu
nixuuu deleted the fix/oauth-paste-code branch November 5, 2026 17:06
nixuuu added a commit that referenced this pull request Nov 5, 2026
Settings → Linked computers no longer shows amber route failures for a
computer that is connected, and the configuration sharing note says
which computer needs an update.

**Why routes showed "Failed" while connected**
- A gateway dials a partner only when it has no link to it. When the
partner dialled first, failures from an earlier dial pass (for example
while the partner slept or restarted) stayed stored, and the UI showed
them in amber whatever the link status.
- The listener port is stable, but two gaps around announced addresses
also existed:
  - announced addresses were never retired;
  - addresses that changed during a handshake were not re-announced.

**What the card shows now**
- **Status:** "Connected · incoming" when only the partner dialled.
- **Routes:**
  - the route the outgoing link runs over: "In use · 4 ms";
- a failed route while the link is up, in neutral tone: "Not needed
while connected · failed 14 minutes ago";
  - amber only while the link is down.
- **Old addresses:** an address the partner no longer announces gets an
"Old address" badge. It is tried last, and it is removed once a current
route works or after 7 days. An empty announcement (listener off) marks
nothing as old. Changed addresses are announced right after the
handshake.

**Configuration sharing**
- The capability check was right: `config_sync` first shipped in
nightly.67, so a nightly.65 partner cannot share yet. The note now names
the computer:
- "{name} runs 0.2.0-nightly.65 and needs an update to share
configuration."
  - "This computer needs an update to share configuration."
- The switch shows this computer's saved choice and stays usable. A line
that is always there says "Sharing starts after the update." or "Sharing
stays off after the update.", so nothing moves. Turning it off while
waiting needs no confirmation.

**Contracts**
- Proto (additive): `LinkedComputer.connection_direction` (26),
`config_update_node_id` (27), `ComputerRoute.in_use` (7) and
`withdrawn_at_ms` (8).
- Migration `0082_computer_route_withdrawn`, renumbered after #204's
0081.

**Tests**
`tests/integration/linked-routes-status.test.ts`:
- an incoming-only link with failed outgoing routes;
- the dialling side marks its route "In use";
- a reconnect clears a route's failure;
- a partner on a new port, where the old address is marked, tried last,
then removed;
- a re-announced address that loses the "Old address" badge.

`config-sync.test.ts` checks that both sides name the older computer.
The `lan-routes` and `linked-computers` tests pass. `check:tmp`: 1348
passed, 0 failed.

**Checked** in a browser with two gateways and fixture names and
addresses: light and dark, desktop and phone, with long names and
addresses.

**Copy audit (§8)**
- "Connected · incoming", "In use · 4 ms" and "Not needed while
connected · failed …".
- "Old address".
- The update notes and "Sharing starts / stays off after the update."
- One idea per sentence, active voice, and failures always say "Failed",
not colour alone.

Related: #35, #157
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