Skip to content

fix(plugin): restore private git install fallback#30430

Merged
rekram1-node merged 1 commit into
devfrom
fix/plugin-private-git-fallback
Jun 2, 2026
Merged

fix(plugin): restore private git install fallback#30430
rekram1-node merged 1 commit into
devfrom
fix/plugin-private-git-fallback

Conversation

@rekram1-node
Copy link
Copy Markdown
Collaborator

@rekram1-node rekram1-node commented Jun 2, 2026

Summary

Private Git plugin URLs go through Arborist and pacote. For GitHub repos, pacote resolves the commit SHA and tries a faster codeload.github.com tarball before falling back to git clone.

For private SSH-only repos, the codeload request is anonymous and returns 404. Pacote should recover by cloning over SSH, but pacote@21.5.0 identifies HTTP errors using the error constructor name:

if (er.constructor.name.match(/^Http/)) {
  return this.#clone(handler, false)
}

opencode release binaries are minified, which can rename that constructor. The fallback check then fails and plugin installation stops at the codeload 404.

This backports npm/pacote#481, which checks stable error properties instead:

if ((typeof er.statusCode === "number" && er.statusCode >= 400) ||
    /^TAR_/.test(er.code)) {
  return this.#clone(handler, false)
}

The initial anonymous codeload request still happens. This restores the intended Git clone fallback.

Verification

  • reproduced the codeload 404 with a disposable private GitHub repo and a minified installer harness
  • rebuilt the same harness with this patch and confirmed installation succeeds via SSH fallback
  • ran bun install --frozen-lockfile

@rekram1-node rekram1-node merged commit 882d028 into dev Jun 2, 2026
14 checks passed
@rekram1-node rekram1-node deleted the fix/plugin-private-git-fallback branch June 2, 2026 16:14
ShamirSecret pushed a commit to ShamirSecret/auto-code-machine that referenced this pull request Jun 2, 2026
0xLLLLH pushed a commit to 0xLLLLH/opencode that referenced this pull request Jun 2, 2026
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