Repository navigation
feat(opencode): install OpenCode v2 from GitHub releases - #288
Merged
Merged
Conversation
npm opencode-ai only carries v1. The new lib/update-opencode.sh adapter picks the newest plain v2.x.y release, verifies the archive against the release SHA256SUMS, safely extracts the single binary, probes its version and activates it like Cursor. Fresh installs use the same adapter instead of the v1 install script, and the blueprint owns "autoupdate": false so OpenCode never updates itself inside an immutable release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex review (gpt-6.2-sol) on 83e508a. The v2 binary now sits at the v1 launcher path so an active npm v1 release can hand over; transcript redaction recognises and scrubs the v2 store; the config probe no longer touches the shared background server; the launcher disables the v2 updater and routes update/upgrade to aicoding; release lookup follows pagination; failed downloads keep curl's error; checksum parsing works on mawk; asset tests no longer depend on the host arch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex review (gpt-6.2-sol) on 8347cf2. Redaction covers every user-content TEXT column of the 2.3.2 store (job.recovery, automation.state and others); the config probe points OPENCODE_DB and the PTY socket dir into its scratch dir; the launcher sends only a bare update/upgrade to aicoding, passes --help through, refuses versions and flags, and always disables the v2 updater, with Claude's launcher left as on main; the image seeds v2 from the checksum-verified archive instead of the v1 installer, and env.sh moves a leftover ~/.opencode/bin behind ~/.local/bin; reason texts name the real log locations; the extractor accepts only a real root directory marker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
opencode-ai, which only carries v1 (latest1.19.6). v2 is published as GitHub release archives ofanomalyco/opencode, on npm as@opencode/cli, and in a Homebrew tap. Owner decision: switch to v2; the blueprint chose the GitHub archives (one self-contained binary plusSHA256SUMS).lib/update-opencode.sh, modeled on the Cursor adapter:v2.x.ytag from the GitHub releases API, following the Link header for up to 5 pages, skipping drafts, prereleases, v1 and the repo's other tools (its "Latest" flag points at v1.19.6, so it is not used).opencode-linux-{x64,arm64}, with-baselineon x64 CPUs without AVX2 and-muslon musl hosts.SHA256SUMS, refuses a checksum mismatch (new reasonarchive_checksum_mismatch), refuses any archive that is not exactly one regularopencodefile, probes--version, then the usual integrity marker and immutable activation.node_modules/.bin/opencode, the path npm v1 releases used, so an active managed v1 release hands over to v2 (activation only accepts a changed launcher whose executable exists in the old release).~/.local/state/aicoding/diagnostics/opencode-download.log; thearchive_download_failedreason text points there.lib/runtime.sh) always exportsOPENCODE_DISABLE_AUTOUPDATE=1. A bareopencode update/upgraderunsaicoding-auto-update --once,--help/-hpasses through, and a version or other flag is refused without changes. The Claude launcher is byte-identical tomain. The blueprint also owns"autoupdate": falseinopencode.jsonas a fallback for launches that bypass the launcher (v1 accepts that key too).opencode.ai/install(which installs v1 and prepends~/.opencode/binin.bashrc). The smoke test asserts a v2 seed and no~/.opencode/bin. On containers from older images, the managedenv.shmoves~/.opencode/binto the end of PATH.ensure_opencode(fresh installs) calls the same adapter instead of theopencode.ai/installscript, which put v1 in~/.opencode/bin. Gated behindAICODINGSETUP_SKIP_NETWORK.opencode debug config --standaloneon v2 (the plain command starts or reuses the shared background server) with throwaway state, cache and data dirs,OPENCODE_DBandOPENCODE_PTY_SOCKET_DIRin its scratch dir andOPENCODE_TEST_HOMEdropped; plaindebug configon v1; nothing offline.lib/redact-sqlite.py) recognises the v2 store (session_part+session_v2) next to v1 (message+part) and scrubs both in a migrated database. Every TEXT column of the fresh 2.3.2 schema was audited and the user-content ones are scrubbed. Before this, a fresh v2 store exited 5 (unrecognised) and was never scrubbed.blob(binary, content-addressed) and OpenCode's own credentials are not rewritten.docs/agent-release-audits.mdentry.opencode-v2ahead of~/.local/binon PATH. It keeps shadowing the managed copy until it is uninstalled.Independent review
Codex
gpt-6.2-sol, efforthigh, review-only, on83e508a. Both P1s were confirmed against the code by the coordinator; all findings fixed in8347cf2:lib/runtime.shonly publishes a changed launcher whose executable exists in the old release, and v1 keeps it atnode_modules/.bin/opencode): fixed. The v2 binary is staged at that same path. New test starts from an active npm-layout v1 release and ends with v2 active.session_part.dataand friends, and a fresh v2 store exits 5): fixed. Schemas read from a fresh 2.3.2 store and this desktop's migrated store (schema only). Tests for fresh v2, migrated (both generations), and v1. On a real fresh 2.3.2 store,mainexits 5 and this branch exits 0.--standalone, isolated dirs, skipped offline; v1 rejects--standalone, so it keeps the plain command). No opencode process left behind by the probe or the suite.{64}in awk unsupported by older mawk: fixed (length($1) == 64plus a non-hex check).unamestubbed to x86_64 in setup)."update": "auto"beatsautoupdate: fixed. Verified in the 2.3.2 binary thatOPENCODE_DISABLE_AUTOUPDATEis checked before the update policy; the launcher exports it. README claim scoped to what is enforced.@opencode/cli: fixed in docs and theensure_opencodecomment (verified@opencode/cli2.3.2 on npm).api.github.comURLs). Test with the only v2 tag on page 2.Round 2
Codex
gpt-6.2-sol, efforthigh, review-only, on8347cf2. The redaction, launcher and Dockerfile findings were confirmed by the coordinator; all fixed in0e539c2:job.recoveryandautomation.statenot scrubbed: fixed. Re-audited every TEXT column of a fresh 2.3.2 store (schema only) and also addedsession_v2.permission/idle_outcome,automation.name/last_outcome,kv.value,permission.resource,project.commands. Test: a secret injob.title,job.recovery.commandandautomation.stateis removed and the JSON still decodes.OPENCODE_DB(absolute path wins) andOPENCODE_PTY_SOCKET_DIRnow point into the scratch dir andOPENCODE_TEST_HOMEis dropped. Test with an inherited absoluteOPENCODE_DB.opencode update/upgrade ...ran the updater: fixed. Only a bareupdate/upgraderunsaicoding-auto-update --once;--help/-hpasses through (verified on 2.3.2: prints usage, binary unchanged); a version or other flag exits 2 with a message. Claude's launcher is byte-identical tomain. Tests for both launchers.opencode.ai/install: fixed. v2 seeded from the archive withSHA256SUMS(checked locally underdash: checksum OK,opencode v2.3.2); smoke test and image test updated.env.shmoves a leftover~/.opencode/binto the end of PATH on older containers, with a test.OPENCODE_DISABLE_AUTOUPDATEcould be overridden: fixed (always1).worker.log: fixed (--onceprints to the terminal, scheduled runs go tojournalctl --user -u aicoding-auto-update,worker.logis only the fallback worker; same for the download reason).././entry: fixed (only a root marker that is a real directory; test covers file, link, duplicate and subdirectory cases).Test plan
tests/bats/update-opencode.bats(12 tests, curl and uname stubbed): target selection, pagination, verified reuse and tamper refusal, checksum mismatch, unsafe archive, version mismatch, no v2 release, network guard, asset selection, download diagnostic, v1 to v2 migration, launcher routingupgradetests/bats/redact-sqlite.bats: 23/23 including fresh v2, migrated and v1 stores0e539c2; no leaked opencode process83e508a): the adapter downloaded, verified and activated the real v2.3.2 in a throwaway HOME--standaloneand isolated dirs passes on 2.3.2 and the v1 branch passes on 1.19.6, with no new process🤖 Generated with Claude Code