You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Headless opencode serve still extracts libopentui.so into /tmp on every start, causing temp artifact buildup #20043
opencode serve is documented as a headless server, but on Linux it still extracts a bundled native OpenTUI shared library (libopentui.so) into /tmp during startup.
In long-running environments where opencode serve is restarted periodically, this causes repeated creation of hidden temp artifacts such as:
/tmp/.58afeffabbf7dede-00000000.so
/tmp/.58afffdf9b3fffef-00000000.so
Observed properties:
each file is about 4.2 MB
filenames are randomized
file content is identical across runs
ELF SONAME is libopentui.so
the file is mapped directly by the opencode serve process itself
the artifact is created at startup time, before pyright-langserver starts
This means the issue is not primarily about language-server activity. It appears to come from the standalone opencode binary extracting a bundled native library even for serve.
Why this is a problem
For headless server deployments, this behavior is surprising and operationally expensive:
/tmp accumulates many hidden .so files over time
repeated restarts create new copies with different names
cleanup is hard to automate safely in shared /tmp
the behavior is especially awkward for long-running service environments, where serve is used without any terminal UI
What I verified
On Linux, I verified that:
opencode serve starts first
the temp .so appears immediately after startup
pyright-langserver starts much later
lsof and /proc/<pid>/maps show the .so is mapped by the opencode serve process
the extracted file reports SONAME: libopentui.so
Expected behavior
At least one of the following would be preferable:
opencode serve should avoid loading or extracting OpenTUI native libraries entirely when running in headless mode
the extracted native library should be cleaned up automatically on normal shutdown
extracted files should be reused from a stable cache path instead of creating a new randomized temp file on each start
documentation for serve should explicitly call out the BUN_TMPDIR requirement/workaround for service deployments
Suggested improvements
Preferred
split headless/server builds from TUI-capable builds, so opencode serve does not carry OpenTUI runtime baggage at all
Acceptable
reuse a deterministic cache location for bundled native libs
unlink temp artifacts after successful load when possible
provide an explicit server/runtime flag or documented environment variable strategy for temp extraction
Workaround
BUN_TMPDIR helps redirect the extraction location, but it does not solve the underlying accumulation behavior.
Update: the unbounded native-library temp-file growth described here is fixed in OpenCode V2.
As of V2 build 0.0.0-dev-17643, the compiled CLI uses Bun 1.4.0-canary.1 (681a49bee). That runtime includes oven-sh/bun#29587, which replaces the unique temporary .so/.dylib/.node extraction on every load with a deterministic, content-hashed path reused across calls, Workers, processes, and restarts. The V2 build provenance is workflow run 32216069554.
This bounds extraction to one reusable file per embedded native module and user instead of allowing unbounded disk growth. It does not mean the temp directory will contain zero native files, and upgrading does not remove files leaked by older builds; those stale randomly named files can be cleaned up after all older OpenCode processes have stopped.
Activity
fix: prevent libopentui.so extraction to /tmp on serve/headless mode
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
thdxr commentedon Aug 19, 2026
Update: the unbounded native-library temp-file growth described here is fixed in OpenCode V2.
As of V2 build
0.0.0-dev-17643, the compiled CLI uses Bun 1.4.0-canary.1 (681a49bee). That runtime includes oven-sh/bun#29587, which replaces the unique temporary.so/.dylib/.nodeextraction on every load with a deterministic, content-hashed path reused across calls, Workers, processes, and restarts. The V2 build provenance is workflow run 32216069554.This bounds extraction to one reusable file per embedded native module and user instead of allowing unbounded disk growth. It does not mean the temp directory will contain zero native files, and upgrading does not remove files leaked by older builds; those stale randomly named files can be cleaned up after all older OpenCode processes have stopped.