docs(onboarding): fix Claude Code channel setup snippet served by canvas #1661
Reference in New Issue
Block a user
Delete Branch "docs-fix-claude-code-channel-template"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes three real onboarding potholes in the canvas-served Claude Code channel snippet at
workspace-server/internal/handlers/external_connection.go:externalChannelTemplate:claude --dangerously-load-development-channels --channels plugin:molecule@molecule-channelerrors withentries must be tagged: --channels(the--channelsflag does not exist). Fixed to the working single-flag formclaude --dangerously-load-development-channels plugin:molecule@molecule-channel.MOLECULE_PLATFORM_URL + comma-separated IDs/TOKENS(single-tenant). Fixed to the canonicalMOLECULE_WORKSPACES_JSON=[{id,token,platform_url}]shape (multi-tenant, post-PR#15 SSOT in molecule-mcp-claude-channel).Also surfaces the
_as_workspacerequirement for multi-workspace tool calls (the -32603 trap operators hit when calling send_message_to_user without it).Empirical repro
2026-05-21 onboarding session walked through this exact snippet, hit the broken two-flag form, got
entries must be tagged: --channels, lost ~10 minutes diagnosing before noticing the canvas snippet disagreed with the channel plugin’s README. This PR removes the disagreement at the source.Test plan
go test ./internal/handlers/ -run TestExternal— 5 pass (3 existing template tests + 2 new regression tests)TestExternalChannelTemplate_LaunchFlagShapepins the single-flag launch form + bans the broken two-flag formTestExternalChannelTemplate_CanonicalEnvShapepinsMOLECULE_WORKSPACES_JSON+{{WORKSPACE_ID}}+{{PLATFORM_URL}}placeholders/admin/workspaces/:id/external/claude-code-channel) on a deployed build, confirm the rendered snippet has the new launch line and JSON env shapeclaude --dangerously-load-development-channels plugin:molecule@molecule-channelruns cleanly and channel connectsSOP
plugin-devpersona (this is canvas-served docs touching workspace-server, but plugin-dev has push on molecule-core and the diff is doc-only — no Go code semantics change). Open to a reviewer rerouting if a tighter persona match is preferred.feedback_molecule_core_qa_review_team_required.Follow-ups (not in this PR)
🤖 Generated with Claude Code
The canvas-served Claude Code setup snippet had three real flaws that new operators hit on first install: 1. **Wrong launch flag form.** The snippet told users to run claude --dangerously-load-development-channels \ --channels plugin:molecule@molecule-channel but `--channels` is not a real Claude Code flag. On 2.1.143+ this errors with `entries must be tagged: --channels`; on older builds it silently no-ops. The correct form is the channel spec as the VALUE of --dangerously-load-development-channels: claude --dangerously-load-development-channels plugin:molecule@molecule-channel 2. **Legacy .env shape as the primary example.** The snippet used MOLECULE_PLATFORM_URL + comma-separated MOLECULE_WORKSPACE_IDS + MOLECULE_WORKSPACE_TOKENS — the pre-PR#15 single-tenant shape. The canonical SSOT (post-PR#15 in molecule-mcp-claude-channel) is MOLECULE_WORKSPACES_JSON, a JSON array of {id, token, platform_url} objects. Multi-platform onboarding (watch hongming + agents-team from one plugin instance) requires the JSON shape; the legacy form silently fails for that case. 3. **"claude.ai admin settings" misleading.** The allowlist is the on-disk managed-settings.json file (per OS), not a web setting. New operators searched the claude.ai web UI for a toggle that doesn't exist. Replaced with explicit per-OS paths and the `sudo tee` recipe (matches the channel plugin's README §65-118). Promotes multi-workspace from a buried side-note to the canonical example. Adds a "_as_workspace required when watching >1 workspace" callout that operators were hitting as -32603 errors on tool calls. Updates the expected stderr line to the post-PR#15 format ("watching N workspace(s) across M platform(s)") so operators can verify their setup matched the new wire shape. Empirical: hit by a session walking through this snippet 2026-05-21. The two-flag form errored, the user copy-pasted from this exact template, and the only way through was for me to identify the README disagreement after the fact. Adds two regression tests: - TestExternalChannelTemplate_LaunchFlagShape pins the single-flag form + bans the broken two-flag form - TestExternalChannelTemplate_CanonicalEnvShape pins the MOLECULE_WORKSPACES_JSON canonical shape with {{WORKSPACE_ID}} + {{PLATFORM_URL}} placeholders Tests: 5 pass (3 existing + 2 new). The hermes channel template (line 432+) has the same legacy-shape pattern in its export commands but uses a different runtime config mechanism (~/.hermes/config.yaml) — separate PR if we want hermes parity. Not touched here. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>