Skip to content

fix(nix): preserve root dependency peer context - #56889

Merged
rekram1-node merged 2 commits into
anomalyco:devfrom
jerome-benoit:nix-opentui-identity
Oct 19, 2026
Merged

rekram1-node merged 2 commits into
anomalyco:devfrom
jerome-benoit:nix-opentui-identity

Conversation

@jerome-benoit

@jerome-benoit jerome-benoit commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #56856

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Change the Nix install filter from !./ to ./, keeping the CLI/Desktop/App selectors. Excluding root dependencies makes Bun resolve separate OpenTUI instances for theme and TUI, breaking RGBA identity at startup. Including root dependencies restores shared identity without rewriting dependency contexts.

Alternative to #56881: fix the installation context rather than canonicalize OpenTUI afterward. Both normalization scripts and the spinner remain unchanged. The only other change is the verified x86_64-linux dependency hash. Tradeoff: the dependency output also includes root tooling.

How did you verify your code works?

Bun 1.4.2, Linux x86_64, base 501b15af:

  • Reproduced the original crash before either normalization and in the compiled TUI with empty HOME/XDG.
  • Temporary checks against the relocated Nix dependency output verified theme-to-spinner colors, shared OpenTUI identity, preserved Zod/OpenTelemetry peer contexts, and relative/internal links. These investigation checks are not committed.
  • Full Nix CLI build succeeds; its binary reaches the welcome screen with isolated HOME/XDG and --standalone. Architecture verification remains enabled. A separate source-only override supplies root script/ for nix run failure x86 with opencode-2.0.28+5aabb61.drv #55328 / fix(nix): ship the root script/ dir to the CLI build #55494; that prerequisite is not included here.
  • bun run check passes after review cleanup: 34 successful cached typecheck tasks; lint reports warnings but no errors.

ARM Linux/macOS were not built locally. Their hashes remain unchanged; the existing nix-hashes workflow regenerates all three platform hashes when this install change lands on dev.

Screenshots / recordings

Packaging-only change. The built TUI welcome screen was also captured and visually inspected.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Investigation and patch prepared with AI assistance.


Added by the opencode bot (AI-generated).

Related: #55328

Include the root alongside the existing workspace filters instead of merging incompatible Bun store entries.

Refs anomalyco#56856
@github-actions

Copy link
Copy Markdown
Contributor

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

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The fix works. I installed dependencies and built the binary the way the Nix flake does (Bun 1.4.2, x86_64-linux). On the base, packages/theme and packages/tui/packages/cli resolve different @opentui/core store entries, and the binary crashes at launch with e.replace is not a function. With --filter './', all three resolve the same entry (the one a plain install uses), and the binary starts to the home screen with an empty config. One cost to know about: including root dependencies brings in the root package's tooling (sst, @aws-sdk/client-s3, oxlint, turbo, …), so node_modules grows from about 1.7 GB to 2.0 GB (1421 → 1557 store entries). Leaving the arm64 Linux and macOS hashes unchanged is fine, because the nix-hashes workflow regenerates them when nix/node_modules.nix changes on dev.

Public API: unchanged (Nix packaging only).

Two requested changes:

  • Please drop the CHANGELOG.md edit. The changelog is written at release time by script/publish.ts, which inserts each new release above the first ## heading. An ## Unreleased section would end up below the next release and never get filled.
  • Please drop nix/scripts/dependency-identity.test.ts (details inline).

Related: #55328

After

Comment thread CHANGELOG.md Outdated

Release notes for OpenCode V2, newest first.

## Unreleased

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CHANGELOG.md is generated at release time: script/publish.ts inserts the new ## vX.Y.Z entry above the first ## line. With this ## Unreleased section in place, the next release would be inserted above it, leaving this section stranded below. Please drop this hunk.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed in 1c43d4b. Confirmed that script/publish.ts inserts release notes before the first ## heading; changelog generation stays release-owned.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, confirmed: 1c43d4b removes the changelog entry and the standalone test. The pull request now only changes nix/node_modules.nix and the x86_64-linux hash. That fix is unchanged from the version I tested, so the crash result in my review still applies. I have no further requests.

Comment thread nix/scripts/dependency-identity.test.ts Outdated
@@ -0,0 +1,77 @@
import { expect, test } from "bun:test"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This test can be dropped so the change stays minimal. nix/ isn't a workspace package, so bun turbo test never runs it in CI, and it only works after a Nix-style install. Three of the six cases (the Zod and OpenTelemetry peer-context checks and the symlink walk) check things unrelated to the fix. They could start failing after an ordinary dependency bump. If you want a guard, a check in the build that every package resolves a single @opentui/core would catch this where it actually runs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed in 1c43d4b. The PR now changes only the install filter/comment and the verified x86_64-linux hash. Kept the investigation results in the PR description rather than adding a new build guard. bun run check passes after cleanup (34 successful cached typecheck tasks).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, confirmed: 1c43d4b removes nix/scripts/dependency-identity.test.ts, and the pull request now only changes the install filter and comment in nix/node_modules.nix and the x86_64-linux hash. Not adding a build guard is fine. The investigation in the description is enough. My test-file comment is resolved.

Leave changelog generation to the release script and remove the install-specific test outside the CI workspace graph.
@rekram1-node
rekram1-node enabled auto-merge (squash) October 19, 2026 03:50
@rekram1-node
rekram1-node disabled auto-merge October 19, 2026 03:50
@rekram1-node
rekram1-node merged commit ceaef65 into anomalyco:dev Oct 19, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI crash: e.replace is not a function. (In 'e.replace(/^#/,"")', 'e.replace' is undefined)

2 participants