From ab8ee06cbfce42f94e07a0a694701a4df9201815 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:40 +0100 Subject: feat(nvim): pin copilot to Node 24 to dodge LSP/Node 26 incompat copilot-language-server emits 'HTTP 200 response does not appear to originate from GitHub' under Node 26 (the current Arch nodejs). Upstream tracking: https://github.com/zbirenbaum/copilot.lua/issues/695 https://github.com/github/copilot.vim/issues/282 https://github.com/github/copilot-language-server-release/issues/45 Workaround universally confirmed in those threads is to run the language-server under Node 24. Rather than downgrade system nodejs (used by lots of other tooling) install a private Node 24 under ~/.local/share/copilot-node/ via a chezmoi run_onchange script that verifies the official sha256, and point copilot.lua at it via copilot_node_command. Drop in once, bump NODE_VERSION when the upstream incompatibility is resolved. --- dot_config/nvim/lua/plugins/ai.lua | 3 ++ run_onchange_after_install-copilot-node.sh | 44 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 run_onchange_after_install-copilot-node.sh diff --git a/dot_config/nvim/lua/plugins/ai.lua b/dot_config/nvim/lua/plugins/ai.lua index 8c213b5..995f6a0 100644 --- a/dot_config/nvim/lua/plugins/ai.lua +++ b/dot_config/nvim/lua/plugins/ai.lua @@ -1,6 +1,9 @@ require("copilot").setup({ suggestion = { enabled = false }, panel = { enabled = false }, + -- Pinned Node 24 runtime; system nodejs (26.x) is incompatible with + -- copilot-language-server. See ~/.local/share/chezmoi/run_onchange_after_install-copilot-node.sh + copilot_node_command = vim.fs.joinpath(vim.env.XDG_DATA_HOME or (vim.env.HOME .. "/.local/share"), "copilot-node/bin/node"), server_opts_overrides = { settings = { telemetry = { diff --git a/run_onchange_after_install-copilot-node.sh b/run_onchange_after_install-copilot-node.sh new file mode 100755 index 0000000..82c0254 --- /dev/null +++ b/run_onchange_after_install-copilot-node.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# Install a Node.js 24 (LTS) runtime under ~/.local/share/copilot-node/ for the +# exclusive use of copilot.lua / copilot-lsp inside neovim. System-wide nodejs +# (currently 26.x in Arch) is unaffected. +# +# Background: copilot-language-server is incompatible with Node 26's default +# fetch implementation. Multiple upstream issues, no fix yet: +# https://github.com/zbirenbaum/copilot.lua/issues/695 +# https://github.com/github/copilot.vim/issues/282 +# https://github.com/github/copilot-language-server-release/issues/45 +# Symptom: "HTTP 200 response does not appear to originate from GitHub". +# Workaround universally confirmed in those threads: use Node 24. +# +# chezmoi re-runs this only when the script content (and thus NODE_VERSION) +# changes. Bump NODE_VERSION + NODE_SHA256 below to upgrade. + +set -eu + +NODE_VERSION=24.15.0 +# linux-x64 sha256 from https://nodejs.org/download/release/latest-v24.x/SHASUMS256.txt +NODE_SHA256=472655581fb851559730c48763e0c9d3bc25975c59d518003fc0849d3e4ba0f6 +TARBALL="node-v${NODE_VERSION}-linux-x64.tar.xz" + +DEST="${XDG_DATA_HOME:-$HOME/.local/share}/copilot-node" +STAMP="$DEST/.installed-${NODE_VERSION}" + +if [ -x "$DEST/bin/node" ] && [ -f "$STAMP" ]; then + exit 0 +fi + +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT + +curl --fail --silent --show-error --location \ + --output "$tmp/$TARBALL" \ + "https://nodejs.org/download/release/v${NODE_VERSION}/${TARBALL}" + +printf '%s %s\n' "$NODE_SHA256" "$tmp/$TARBALL" | sha256sum -c - + +tar -xJf "$tmp/$TARBALL" -C "$tmp" +rm -rf "$DEST" +mkdir -p "$(dirname "$DEST")" +mv "$tmp/node-v${NODE_VERSION}-linux-x64" "$DEST" +touch "$STAMP" -- cgit v1.3.1