From 4c02c54c615b4b3168f258b7a429f3ba2bdbfeaf Mon Sep 17 00:00:00 2001 From: "n8n-cat-bot[bot]" <283985454+n8n-cat-bot[bot]@users.noreply.github.com> Date: Thu, 13 Aug 2026 16:10:55 +0000 Subject: [PATCH] chore: Gate codespace agent session launch on the skills plugin install finishing (#36237) Co-authored-by: n8n-cat-bot[bot] Co-authored-by: Claude Opus 4.8 --- scripts/cloud-session.mjs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/cloud-session.mjs b/scripts/cloud-session.mjs index 35447943b0f..40cea440bbe 100644 --- a/scripts/cloud-session.mjs +++ b/scripts/cloud-session.mjs @@ -73,15 +73,26 @@ const SECRETS = '. /usr/local/lib/codespaces-env.sh 2>/dev/null || true'; // Worktrees share the pnpm store but not the turbo cache; a shared TURBO_CACHE_DIR // (seeded from the main checkout) keeps new-worktree builds at cache-hit speed. const CACHE = 'export TURBO_CACHE_DIR=/workspaces/.turbo-cache; [ -d "$TURBO_CACHE_DIR" ] || cp -r /workspaces/n8n/.turbo/cache "$TURBO_CACHE_DIR" 2>/dev/null || mkdir -p "$TURBO_CACHE_DIR"'; +// On a freshly created codespace, post-start.mjs installs the skills plugin via a +// network clone that takes tens of seconds. If `claude` boots first it builds its +// skill registry before the plugin exists on disk, and /reload-plugins can't +// recover it in-process — so the first session silently loses every quality skill. +// Run the idempotent install here to block until the plugin is on disk (a fast +// no-op once cached). Mirrors the env vars post-start.mjs sets for the private +// HTTPS clone; failures are tolerated so a plugin hiccup never blocks the session. +const MARKETPLACE = 'n8n-io/n8n-claude-skills'; +const PLUGIN = 'quality@n8n-claude-skills'; +const ENSURE_PLUGIN = `export CLAUDE_CODE_PLUGIN_PREFER_HTTPS=1 CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE=1; claude plugin marketplace add ${MARKETPLACE} >/dev/null 2>&1 || true; claude plugin install ${PLUGIN} >/dev/null 2>&1 || true`; function remoteCommand(session, extraArgs) { const claude = `claude ${extraArgs}`.trim(); - if (session === 'agent') return `${SECRETS}; ${CACHE}; cd /workspaces/n8n && ${claude}`; + if (session === 'agent') return `${SECRETS}; ${CACHE}; ${ENSURE_PLUGIN}; cd /workspaces/n8n && ${claude}`; const wt = `/workspaces/wt-${session}`; const branch = `session/${session}`; return [ SECRETS, CACHE, + ENSURE_PLUGIN, `if [ ! -d "${wt}" ]; then echo "Setting up worktree ${wt}…"`, `git -C /workspaces/n8n worktree add "${wt}" -b "${branch}" 2>/dev/null || git -C /workspaces/n8n worktree add "${wt}" "${branch}"`, `(cd "${wt}" && pnpm install); fi`,