Skip to content

fix(opencode): confine Bun temp library copies; Hermes and OpenCode pins already latest - #6652

Merged
Lightheartdevs merged 1 commit into
mainfrom
claude/latest-hermes-opencode
Sep 25, 2026
Merged

Lightheartdevs merged 1 commit into
mainfrom
claude/latest-hermes-opencode

Conversation

@Lightheartdevs

Copy link
Copy Markdown
Collaborator

Summary

This PR does not change any versions. ODS already ships the latest upstream releases of both agents:

Agent Pin on main (2d3162b8) Latest upstream release Result
Hermes Agent nousresearch/hermes-agent:v2026.9.24@sha256:fca358f1…52b7 (0.21.5) v2026.9.24, 2026-09-24 (landed in #6625) already current
OpenCode 1.18.32 + installers/lib/opencode-release.tsv v1.18.32, 2026-09-21 (landed in #6624) already current

I re-checked both pins against the official artifacts:

  • Hermes: the Docker Hub index digest for v2026.9.24 is fca358f1…52b7. The platform manifests are amd64 2fd023ef…a283 and arm64 93b4e287…b5a. Both have OCI revision f97608f1…e5f, which is the release tag commit. All of this matches config/hermes-release.json. Docker :latest (d4da4a40…) is built from main at 749220ef, 442 commits after the release, so it is not a release.
  • OpenCode: all 8 SHA-256 values in opencode-release.tsv match the GitHub release asset digest fields for v1.18.32. The tag resolves to 545f51d2…. Tags v2.0.0–v2.0.16 exist without GitHub releases. They are the separate @opencode/cli preview line. The official installer and the npm package opencode-ai@latest both 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 (packageManager at 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/.node file 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, /tmp collected about 100 GB of these files. That came from fleet-harness OpenCode invocations, not from ODS itself.

ODS-managed OpenCode now starts with BUN_TMPDIR pointing to a directory that ODS owns and empties on every start. TMPDIR for OpenCode's tools is unchanged. Tested locally: BUN_TMPDIR alone moves the extraction.

  • Linux (opencode/opencode-web.service): Environment="BUN_TMPDIR=~/.cache/ods/opencode-bun-tmp". ExecStartPre empties it and recreates it with mode 0700; ExecStopPost removes it. This covers installer restarts, host-agent model-switch restarts and Restart=on-failure. PrivateTmp=true is kept.
  • macOS (LaunchAgent in install-macos.sh): ProgramArguments now runs a /bin/sh -c wrapper. It empties ~/Library/Caches/ODS/opencode-bun-tmp, exports BUN_TMPDIR, then execs the unchanged opencode web --port 3003 --hostname 127.0.0.1. This covers launchctl kickstart -k and KeepAlive restarts.
  • Windows (start-opencode.ps1 generated by 07-devtools.ps1): empties %LOCALAPPDATA%\ODS\opencode-bun-tmp and sets BUN_TMPDIR before starting. This covers the scheduled task and ods CLI starts.
  • New tests/test-opencode-bun-tmpdir.sh, wired into make test and Test Linux CI:
    • Linux: renders the unit the way the installer does and runs its ExecStartPre/ExecStopPost commands.
    • macOS: renders the plist heredoc, parses it with plistlib (which checks the XML escaping), and runs the wrapper twice with a fake binary.
    • Windows: checks the launcher order statically.

Not covered / not verified

  • Windows host-agent restart: after a model switch, _run_windows_opencode_control("restart") in bin/ods-host-agent.py calls Start-Process opencode.exe directly and does not go through the launcher. That path still writes to %TEMP%. It also already drops OPENCODE_ENABLE_EXA=1 today. This is a follow-up.
  • macOS: I have not run the new LaunchAgent under launchd on a Mac. It is tested only by rendering and parsing the plist and running the wrapper with /bin/sh on Linux.
  • Windows with 1.18.32: not run. The launcher was rendered and run twice under Windows PowerShell 5.1 with a fake executable. The leak and BUN_TMPDIR behaviour on Windows were confirmed with a local OpenCode 1.2.18 (Bun 1.3.10): 2 files per serve process.
  • Direct use: OpenCode that users run themselves (TUI, opencode run) is not covered.
  • Old ODS directory after uninstall: after a macOS or Windows uninstall, the (small) ODS-owned directory is left behind.
  • Existing installs: they pick up the change the next time the installer rewrites the unit, plist or launcher.

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) and shellcheck -x on it
  • test-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 error on install-macos.sh, systemd-analyze verify --user on the rendered unit
  • Live systemd user unit (rendered from this branch, port changed to avoid a clash) with a local OpenCode 1.18.23 binary, which uses the same Bun 1.3.14:
    • a stale copy planted in the directory was removed at start
    • after API activity there was exactly one copy, mapped from BUN_TMPDIR
    • restart emptied the directory and stop removed it
    • the host /tmp count did not change
  • Windows launcher rendered from this branch and run twice under PS 5.1 with a fake exe: BUN_TMPDIR exported, directory empty at each start, OPENCODE_ENABLE_EXA=1 kept
  • test-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

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>
@github-actions

Copy link
Copy Markdown

Sensitive Files Detected

Trigger: Security-sensitive files detected: ods/installers/

Files flagged:

ods/installers/macos/install-macos.sh
ods/installers/macos/lib/constants.sh
ods/installers/windows/phases/07-devtools.ps1

Extra human review is recommended for this PR.


Claude Code Review | Sensitive File Detection | ~$1.50

@Lightheartdevs
Lightheartdevs merged commit ba3d892 into main Sep 25, 2026
53 checks passed
@Lightheartdevs
Lightheartdevs deleted the claude/latest-hermes-opencode branch October 4, 2026 14:09
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