Skip to content

fix(mux): install @coder/xum instead of the mux compat shim - #1102

Merged
DevelopmentCats merged 5 commits into
mainfrom
mike/mux-module-use-xum
Sep 4, 2026
Merged

fix(mux): install @coder/xum instead of the mux compat shim#1102
DevelopmentCats merged 5 commits into
mainfrom
mike/mux-module-use-xum

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Description

The module installs mux@<install_version>, but the npm mux package is only a compatibility shim (packages/mux-compat in coder/xum). Its single dependency is an exact-pinned @coder/xum of the same version string, and the two packages are published independently. mux usually lands on the registry several minutes before its own @coder/xum dependency, so any workspace that starts inside that window resolves mux@next and then fails with:

No version matching "<ver>" found for specifier "@coder/xum"
❌ Failed to install mux via bun

The coder_script exits 1, the workspace reports a start error, and the Mux app goes unhealthy.

This PR installs @coder/xum directly. It is the package that actually contains Mux, so there is no cross-package version coupling left to race against: whatever version or dist-tag resolves is fully installable on its own. @coder/xum ships both the mux and xum bins (node_modules/.bin/mux -> ../@coder/xum/dist/cli/index.js), so the existing binary probe, the $INSTALL_PREFIX/mux symlink, and everything that calls mux server are unchanged. No CI change on the publishing side is needed.

Changes in registry/coder/modules/mux:

  • run.sh: PKG="@coder/xum" for the npm/pnpm/bun path; the no-package-manager tarball fallback now fetches metadata from <registry>/@coder%2Fxum/<version> (scoped names are URL-encoded in registry metadata paths) and constructs <registry>/@coder/xum/-/xum-<version>.tgz, which matches the registry's dist.tarball exactly. Error and progress messages name the package that is being installed.
  • main.tf: install_version and registry_url descriptions name @coder/xum. Default install_prefix moves from /tmp/mux to $HOME/.coder-modules/coder/mux and default log_path from /tmp/mux.log to $HOME/.coder-modules/coder/mux/logs/mux.log, the per-module root from AGENTS.md (Module Data Layout), so restarts that clear /tmp no longer discard the install or the diagnostics. run.sh already creates both directories with mkdir -p before writing; no other path in it assumed /tmp. The Node.js runtime that run.sh bootstraps on images without node also moves from ~/.local/share/coder-mux to the same root, so all module data shares one directory.
  • README.md: documents the package switch and the new default paths; fixes the "Pin Version" example, which claimed the default install_version is latest while main.tf defaults to next, and pins a version that exists on @coder/xum; links the renamed upstream repository (coder/mux is now coder/xum).
  • mux.tftest.hcl: new installs_coder_xum_package run asserting the rendered script installs @coder/xum and uses the scoped metadata/tarball URLs (verified red/green by flipping PKG back to mux); new default_paths_under_module_root and custom_install_prefix_and_log_path runs assert the default and overridden paths (red/green by reverting the default to /tmp/mux); the trailing-slash registry assertion follows the new metadata URL.
  • main.test.ts: expected lines and the fake-mux fixtures follow the new default paths (/root/.coder-modules/coder/mux inside the test containers). The two install tests now remove their containers inside the test instead of leaving them to the global afterAll hook in setup.ts: that hook has a 5 second timeout, and deleting a container holding a full @coder/xum install (about 800 MB, 48k files) took longer than that on the CI runner under bun 1.4.1, failing the run after every test had passed.

Breaking change

@coder/xum only exists on npm from 0.28.2-next.24 onward (stable: 0.28.3, 0.28.4); older releases were published under mux only. The default (next), latest, and any pin of 0.28.3 or newer are unaffected. Templates that pin install_version to an older version will fail to install and need to move to 0.28.3 or newer. Private mirrors configured via registry_url must serve the scoped @coder/xum package. The default install_prefix and log_path also move out of /tmp (see above), and a bootstrapped Node.js runtime is downloaded once more into the new location: templates that relied on the old defaults, for example install = false with a binary pre-installed at /tmp/mux/mux or tooling that reads /tmp/mux.log, must set install_prefix and log_path explicitly or move to the new locations. Because existing valid configurations can stop working, this is released as a major bump.

Note: this overlaps with #1095, which also reworks the install path of this module. Whichever merges second needs a rebase; the package switch is a small, self-contained change to port.

Type of Change

  • New module
  • New template
  • Bug fix
  • Feature/enhancement
  • Documentation
  • Other

Module Information

Path: registry/coder/modules/mux
New version: v2.0.0 (from v1.5.0, bumped with .github/scripts/version-bump.sh major)
Breaking change: [x] Yes [ ] No

Testing & Validation

  • Tests pass (bun test)

  • Code formatted (bun fmt)

  • Changes tested locally

  • terraform test -verbose in the module: 24 passed, 0 failed.

  • bun test main.test.ts in the module (Docker, bun 1.2.15 and 1.4.1): 8 passed, 0 failed. runs with npm present performs a real npm install @coder/xum@next --ignore-scripts in node:20-alpine; runs with default exercises the scoped tarball fallback in alpine/curl.

  • scripts/terraform_validate.sh, scripts/shellcheck_validate.sh, scripts/validate_set_u_order.sh, bun fmt:ci, and cmd/readmevalidation all clean.

  • Manual end-to-end check in a scratch directory: bun add --ignore-scripts @coder/xum@next resolved 0.28.4-next.3.g2a1b5b267; node_modules/.bin/mux --version printed v0.28.5-nightly.5-3-g2a1b5b267-dirty (2a1b5b267); mux server --port 4321 answered GET /health with 200 within 3 seconds. Skipping @coder/xum's postinstall (sh scripts/postinstall.sh) is safe here: the script only rebuilds node-pty/duckdb for Electron and exits early in server mode or when installed as a dependency.

  • Registry check: GET https://registry.npmjs.org/@coder%2Fxum/next returns 200 and its dist.tarball equals the URL the fallback constructs.

Related Issues

None

Xum acted on behalf of @ibetitsmike for this PR.

Generated with Xum using Claude.

The npm mux package is only a compatibility wrapper whose single
dependency is an exact-pinned @coder/xum of the same version. The two
packages are published independently and mux usually lands before its
own @coder/xum dependency, so a workspace starting inside that window
fails with: No version matching "<ver>" found for specifier "@coder/xum".

Install @coder/xum directly (it ships the mux bin) through the package
manager and tarball paths, and fix the README pin example that claimed
the default install_version is latest (main.tf defaults to next).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T12:15:22.238530Z 2b8055a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ibetitsmike ibetitsmike added the version:major Add to PRs requiring a major version upgrade label Sep 4, 2026 — with Coder

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e6bd2672de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread registry/coder/modules/mux/run.sh
Comment thread registry/coder/modules/mux/README.md Outdated
The two install tests left their containers to the global afterAll hook
in setup.ts, which has a 5 second timeout. A container holding a full
@coder/xum install (about 800 MB, 48k files) takes longer than that to
delete on the CI runner, so the hook timed out under bun 1.4.1 and
failed the run after all tests had passed.
Default install_prefix and log_path now live under
$HOME/.coder-modules/coder/mux (Module Data Layout in AGENTS.md) instead
of /tmp, so restarts that clear /tmp no longer discard the install or
the diagnostics. Tests assert the new defaults; README links the renamed
upstream repo coder/xum.

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea9046a133

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread registry/coder/modules/mux/README.md
Comment on lines +275 to +276
# @coder/xum is the package that ships the mux CLI (bins: mux, xum).
PKG="@coder/xum"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Route the reworked installer through coder-utils

Because this change reworks the existing package-manager and tarball installation flow, retaining the hand-written coder_script/run.sh orchestration violates the repository requirement to use coder-utils when reworking a script-running module. Migrate the install/start flow to rendered .tftpl scripts passed through coder-utils rather than extending this custom installer.

AGENTS.md reference: AGENTS.md:L49-L58

Useful? React with 👍 / 👎.

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.

Not adopted in this PR, on purpose. #1095 (open, by the same author) already migrates this module to coder-utils with rendered .tftpl scripts. This PR is a targeted fix that unblocks workspace starts (the mux/@coder/xum publish race) and keeps the existing orchestration so the conflict surface with #1095 stays small; redoing the migration here would duplicate that work. The package switch and the path defaults port to #1095 in a few lines whichever PR merges second. Leaving the final call to the maintainer.

Xum acted on behalf of @ibetitsmike for this reply.

Comment thread registry/coder/modules/mux/main.tf Outdated
type = string
description = "The path for Mux logs."
default = "/tmp/mux.log"
default = "$HOME/.coder-modules/coder/mux/logs/mux.log"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Name the default log after its producing script

The new module-root default still names the file logs/mux.log, although run.sh writes both the Mux process output and launcher diagnostics there. Repository layout requires module-controlled logs to be named after the script that produces them, so use logs/run.log here and update the README and tests that currently encode mux.log.

AGENTS.md reference: AGENTS.md:L42-L42

Useful? React with 👍 / 👎.

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.

Keeping logs/mux.log. The file is the Mux server's own stdout/stderr (the launcher only appends exit diagnostics to it); run.sh's output goes to the coder_script log like every other module. The AGENTS.md naming rule targets script logs (install.sh -> install.log), and mux.log is also the name the pending coder-utils migration in #1095 uses, so the two PRs stay consistent. Happy to rename if the maintainer prefers.

Xum acted on behalf of @ibetitsmike for this reply.

The bootstrapped Node.js runtime moves from ~/.local/share/coder-mux to
$HOME/.coder-modules/coder/mux so all module data shares one root. Also
document that @coder/xum prereleases exist from 0.28.2-next.24.

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 2b8055a496

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@DevelopmentCats
DevelopmentCats merged commit 952dbee into main Sep 4, 2026
4 of 5 checks passed
@DevelopmentCats
DevelopmentCats deleted the mike/mux-module-use-xum branch September 4, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

version:major Add to PRs requiring a major version upgrade

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants