Skip to content

build(opencode): shrink single-file executable size#22362

Merged
Hona merged 6 commits intoanomalyco:devfrom
Hona:fix/copilot-compaction-bundle-size
Apr 14, 2026
Merged

build(opencode): shrink single-file executable size#22362
Hona merged 6 commits intoanomalyco:devfrom
Hona:fix/copilot-compaction-bundle-size

Conversation

@Hona
Copy link
Copy Markdown
Member

@Hona Hona commented Apr 14, 2026

Summary

  • enable Bun standalone splitting and minify in the opencode build script
  • keep the executable build on ESM format explicitly
  • reduce the current Windows single-file build from 158.19 MiB to 131.74 MiB (-16.72%) in the --skip-embed-web-ui build we measured

Testing

  • bun script/build.ts --single --skip-install --skip-embed-web-ui
  • dist/opencode-windows-x64/bin/opencode --version

Copilot AI review requested due to automatic review settings April 14, 2026 00:28
@Hona Hona changed the title fix(opencode): support Copilot compaction and shrink single-file builds build(opencode): shrink single-file executable size Apr 14, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a compatibility shim for GitHub Copilot (and similar OpenAI-compatible gateways) so compaction/requests with prior tool-call history don’t fail when no active tools are enabled, plus a targeted regression test and build output-size optimizations for Bun standalone binaries.

Changes:

  • Inject a stub _noop tool when sending requests to LiteLLM proxies or @ai-sdk/github-copilot and the message history contains tool calls but the active tool set is empty.
  • Add a session LLM test that exercises the GitHub Copilot request shape for the above compatibility path.
  • Enable format: "esm", minify: true, and splitting: true in the Bun standalone build to reduce single-file binary size.

Reviewed changes

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

File Description
packages/opencode/src/session/llm.ts Extends existing “dummy tool injection” compatibility behavior to also cover GitHub Copilot’s OpenAI-compatible gateway.
packages/opencode/test/session/llm.test.ts Adds a regression test ensuring _noop is included in the outgoing request tools when history contains tool calls and active tools are empty.
packages/opencode/script/build.ts Turns on ESM output, minification, and splitting for Bun compile builds to reduce binary size.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Hona Hona added the beta label Apr 14, 2026
@Hona Hona merged commit 9b2648d into anomalyco:dev Apr 14, 2026
10 checks passed
mrsimpson pushed a commit to mrsimpson/opencode that referenced this pull request Apr 14, 2026
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
dgokeeffe pushed a commit to dgokeeffe/opencode-databricks that referenced this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants