Repository navigation
fix(opencode): confine Bun temp library copies; Hermes and OpenCode pins already latest - #6652
Merged
Merged
Conversation
OpenCode 1.18.32, the latest stable release, is built with Bun 1.3.14. That runtime copies each bundled native library to a new randomly named file in the temp directory on every load and never deletes the copy (anomalyco/opencode#42700, #49283). The Bun fix (oven-sh/bun#29587) needs Bun 1.4 or later. The 1.18.x upgrade (anomalyco/opencode#44946) is still open. ODS now starts its managed OpenCode with BUN_TMPDIR set to an ODS-owned directory that is emptied on every start: - Linux systemd user unit: ExecStartPre empties it, ExecStopPost removes it - macOS LaunchAgent: a /bin/sh wrapper empties it, then execs OpenCode - Windows scheduled-task launcher: empties it before starting OpenCode TMPDIR for OpenCode's tools is unchanged. New test tests/test-opencode-bun-tmpdir.sh runs in make test and in Test Linux CI. The Hermes Agent (v2026.9.24, 0.21.5) and OpenCode (1.18.32) pins are already the latest upstream releases, so no version changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sensitive Files DetectedTrigger: Security-sensitive files detected: ods/installers/ Files flagged: Extra human review is recommended for this PR. Claude Code Review | Sensitive File Detection | ~$1.50 |
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
This PR does not change any versions. ODS already ships the latest upstream releases of both agents:
2d3162b8)nousresearch/hermes-agent:v2026.9.24@sha256:fca358f1…52b7(0.21.5)1.18.32+installers/lib/opencode-release.tsvI re-checked both pins against the official artifacts:
v2026.9.24isfca358f1…52b7. The platform manifests are amd642fd023ef…a283and arm6493b4e287…b5a. Both have OCI revisionf97608f1…e5f, which is the release tag commit. All of this matchesconfig/hermes-release.json. Docker:latest(d4da4a40…) is built from main at749220ef, 442 commits after the release, so it is not a release.opencode-release.tsvmatch the GitHub release assetdigestfields for v1.18.32. The tag resolves to545f51d2…. Tagsv2.0.0–v2.0.16exist without GitHub releases. They are the separate@opencode/clipreview line. The official installer and the npm packageopencode-ai@latestboth install 1.18.32.Change: keep OpenCode's Bun temp library copies out of the shared temp directory
OpenCode 1.18.32 is built with Bun 1.3.14 (
packageManagerat the tag). Each time that runtime loads a bundled native library, it copies it to a new randomly named.<16 hex>-0000000N.so/.dylib/.dll/.nodefile in the temp directory and never deletes it (#42700, #49283, #28089). The Bun fix, oven-sh/bun#29587, needs Bun ≥ 1.4. The 1.18.x upgrade, #44946, is still open. On one fleet host,/tmpcollected about 100 GB of these files. That came from fleet-harness OpenCode invocations, not from ODS itself.ODS-managed OpenCode now starts with
BUN_TMPDIRpointing to a directory that ODS owns and empties on every start.TMPDIRfor OpenCode's tools is unchanged. Tested locally:BUN_TMPDIRalone moves the extraction.opencode/opencode-web.service):Environment="BUN_TMPDIR=~/.cache/ods/opencode-bun-tmp".ExecStartPreempties it and recreates it with mode 0700;ExecStopPostremoves it. This covers installer restarts, host-agent model-switch restarts andRestart=on-failure.PrivateTmp=trueis kept.install-macos.sh):ProgramArgumentsnow runs a/bin/sh -cwrapper. It empties~/Library/Caches/ODS/opencode-bun-tmp, exportsBUN_TMPDIR, thenexecs the unchangedopencode web --port 3003 --hostname 127.0.0.1. This coverslaunchctl kickstart -kand KeepAlive restarts.start-opencode.ps1generated by07-devtools.ps1): empties%LOCALAPPDATA%\ODS\opencode-bun-tmpand setsBUN_TMPDIRbefore starting. This covers the scheduled task andodsCLI starts.tests/test-opencode-bun-tmpdir.sh, wired intomake testand Test Linux CI:ExecStartPre/ExecStopPostcommands.plistlib(which checks the XML escaping), and runs the wrapper twice with a fake binary.Not covered / not verified
_run_windows_opencode_control("restart")inbin/ods-host-agent.pycallsStart-Process opencode.exedirectly and does not go through the launcher. That path still writes to%TEMP%. It also already dropsOPENCODE_ENABLE_EXA=1today. This is a follow-up./bin/shon Linux.BUN_TMPDIRbehaviour on Windows were confirmed with a local OpenCode 1.2.18 (Bun 1.3.10): 2 files perserveprocess.opencode run) is not covered.Test plan
Ran on a clean LF copy in WSL Ubuntu-24.04 (systemd 255), plus local Windows PowerShell 5.1:
tests/test-opencode-bun-tmpdir.sh(new) andshellcheck -xon ittest-plist-log-paths.sh,test-local-app-auth-defaults.sh,test-linux-opencode-path.sh,test-linux-opencode-opt-in.sh,test-opencode-runtime.sh,test-opencode-release.py,test-macos-installer-transitions.sh,test-windows-opencode-config.sh,test-dependency-pins.py,test-hermes-dashboard-session-token.py,test-doc-links.sh,bash -n/shellcheck -S erroroninstall-macos.sh,systemd-analyze verify --useron the rendered unitBUN_TMPDIRrestartemptied the directory andstopremoved it/tmpcount did not changeBUN_TMPDIRexported, directory empty at each start,OPENCODE_ENABLE_EXA=1kepttest-macos-uninstall-launchagents.sh: "Linux uninstall must still succeed" fails in this WSL environment on unmodified main too. The failure is environmental and unrelated to this change.🤖 Generated with Claude Code