Skip to content

Conversation

@MBanucu
Copy link
Contributor

@MBanucu MBanucu commented Jan 20, 2026

Fixes #9583

Updates OpenCode to use Bun 1.3.6, including packageManager, dependencies, and Nix hashes.

Problem:
OpenCode build fails because packageManager specifies bun@1.3.5, but Nix provides 1.3.6.

Solution:

  • Update packageManager to bun@1.3.6.
  • Update @types/bun to 1.3.6.
  • Regenerate bun.lock.
  • Update nix/hashes.json with new node_modules hash.

Compatibility:
Bun 1.3.6 is backward compatible; this matches the version in Nixpkgs.

Testing:
Verified with local NixOS rebuild; build succeeds with Bun 1.3.6.

Note: This PR is similar to #8865 but includes the nix/hashes.json update that #8865 lacks, ensuring it works in Nix builds. Alternative to PR #9597, which uses semver ranges instead of exact pinning.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate PRs Found:

  1. PR fix(opencode): Allow compatible Bun versions in packageManager field #9597: fix(opencode): Allow compatible Bun versions in packageManager field

    • This appears to be directly related - it addresses the Bun version compatibility issue in the packageManager field. This may be an alternative approach to solving the same problem.
  2. PR chore: bump bun to v1.3.6 #8865: chore: bump bun to v1.3.6

    • This relates to updating Bun to v1.3.6 across the project, which is the version your PR is targeting.

Recommendation: Review PR #9597 in particular, as it appears to be handling the same packageManager Bun version issue that your PR (9618) is addressing.

@gigamonster256
Copy link
Contributor

@MBanucu if you're going to update 1 node_modules hash... why not all 4?

@MBanucu
Copy link
Contributor Author

MBanucu commented Jan 20, 2026

@MBanucu if you're going to update 1 node_modules hash... why not all 4?

@gigamonster256
Short answer: because I was doing this locally just for my machine. Long answer:

Detailed Investigation Report: PR #8865 and Nix Hash Updates

Issue Summary

PR #8865 updates OpenCode to use Bun 1.3.6 by modifying package.json (setting "packageManager": "bun@1.3.6" and "@types/bun": "1.3.6") and regenerating bun.lock. However, it does not update nix/hashes.json, which contains the fixed-output SHA256 hashes for node_modules.

Testing Results

  • Branch Testing: We tested the branch (chore/bump-bun-1.3.6) on a NixOS system. The build failed with a hash mismatch in the opencode-node_modules derivation, confirming that the Nix hashes must be updated alongside the package changes.
  • Hash Resolution: Manually updating nix/hashes.json with the correct hash resolved the issue, allowing successful builds.

Key Finding

The update-nix-hashes.yml workflow includes a job update-node-modules-hashes that automatically computes and commits the correct hashes when package.json or bun.lock change. This job:

  • Runs on push to dev or PRs affecting the relevant paths.
  • Skips on PRs from forks to avoid push conflicts (condition: github.event.pull_request.head.repo.full_name == github.repository).
  • Would trigger upon merge to dev, automatically updating nix/hashes.json and ensuring successful Nix builds.

Recommendation

Merge PR #8865 to dev to trigger the automated hash update workflow. This will complete the Bun 1.3.6 upgrade without manual intervention. Alternatively, manually update the hashes before merging.

Related PRs/Issues

This ensures the PR fully resolves the issue once integrated into the main branch.

@MBanucu
Copy link
Contributor Author

MBanucu commented Jan 20, 2026

@MBanucu
Copy link
Contributor Author

MBanucu commented Jan 20, 2026

#9597 (comment)

@gigamonster256 do I understand correctly that it is desired to downgrade the rev of nixpkgs in flake.lock instead of upgrading bun to version 1.3.6?

@MBanucu
Copy link
Contributor Author

MBanucu commented Jan 20, 2026

Let me open a new issue then.

@gigamonster256
Copy link
Contributor

#9682

putting ^ in the package.json broke the CI and was removed, however the semver check was then ineffectual

@qverkk
Copy link

qverkk commented Jan 20, 2026

@gigamonster256 i've also made a PR to relax the version #9684 . But i guess your one is more appealing

@gigamonster256
Copy link
Contributor

#9597 (comment)

@gigamonster256 do I understand correctly that it is desired to downgrade the rev of nixpkgs in flake.lock instead of upgrading bun to version 1.3.6?

IMO nix users/committers should aim to provide a nix dev experience as close to CI as possible - which means keeping deps provided by the nixpkgs rev in flake.lock in sync with what is declared in the rest of the project

however a maintainer said its ok to relax the bun version requirement, but we should still aim to diverge as little as possible from non-nix environments

@gigamonster256
Copy link
Contributor

gigamonster256 commented Jan 20, 2026

@gigamonster256 i've also made a PR to relax the version #9684 . But i guess your one is more appealing

your pr only fixes the package build, when doing local nix environment based dev with a bun version mismatch it will still error

@MBanucu
Copy link
Contributor Author

MBanucu commented Jan 20, 2026

#9618 (comment)

IMO nix users/committers should aim to provide a nix dev experience as close to CI as possible - which means keeping deps provided by the nixpkgs rev in flake.lock in sync with what is declared in the rest of the project

@gigamonster256 I think so, too. But I still don't get it, why not just upgrade to bun version 1.3.6. If it is failing on some systems because of bun should branch dev of opencode stay behind? There will always be systems where some bugs appear and some get fixed. If dev wants to be a somehow stable branch then why not use the most stable bun 1.2.X version or even earlier 1.0.X? What is the philosophy behind the dev branch? Is there some documentation about this?

I think a good philosophy would be to join forces with bun for a while and drive stability development on bun 1.3 until everyone in opencode is satisfied with the stability of bun and then return to development of opencode because a stable base is important.

@gigamonster256
Copy link
Contributor

the upgrade to bun 1.3.6 was applied but then reverted in 5a8a0f6

nixpkgs rev with bun 1.3.6 only made it into dev bevause of bad CI which updated nixpkgs without checking the package still built

@MBanucu
Copy link
Contributor Author

MBanucu commented Jan 20, 2026

#9618 (comment)

nixpkgs rev with bun 1.3.6 only made it into dev bevause of bad CI which updated nixpkgs without checking the package still built

@gigamonster256 so let me file a new issue with the downgraded flake.lock? Would this help?

@MBanucu
Copy link
Contributor Author

MBanucu commented Jan 20, 2026

You can easily revert it. Why not?

7621c5c

@MBanucu
Copy link
Contributor Author

MBanucu commented Jan 20, 2026

I personally like it more if nixos-unstable of opencode is in sync with nixos-unstable of nixpkgs because then I do not need an extra nixpkgs version on my NixOS extra for opencode. But some decisions have to made, I guess.

@MBanucu
Copy link
Contributor Author

MBanucu commented Jan 20, 2026

Some people benefit, other get sacrificed. This is life.

@MBanucu
Copy link
Contributor Author

MBanucu commented Jan 20, 2026

How about an impact analysis of changes and base the decisions on data? But then opencode would have to collect data from users. Oh, no! We can't do that, because people are not open, they are more closed. Why use opencode then? Open people should use opencode. Closed people should use closedcode.

I should stop thinking. This is maybe going too far.

@MBanucu
Copy link
Contributor Author

MBanucu commented Jan 21, 2026

(Temporarily) fixed by #9725

@MBanucu MBanucu closed this Jan 21, 2026
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.

Build failure: Bun version mismatch (expects 1.3.5, system has 1.3.6)

4 participants