fix(mux): install @coder/xum instead of the mux compat shim - #1102
Conversation
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).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
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.
|
@codex review |
There was a problem hiding this comment.
💡 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".
| # @coder/xum is the package that ships the mux CLI (bins: mux, xum). | ||
| PKG="@coder/xum" |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
| type = string | ||
| description = "The path for Mux logs." | ||
| default = "/tmp/mux.log" | ||
| default = "$HOME/.coder-modules/coder/mux/logs/mux.log" |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Description
The module installs
mux@<install_version>, but the npmmuxpackage is only a compatibility shim (packages/mux-compatin coder/xum). Its single dependency is an exact-pinned@coder/xumof the same version string, and the two packages are published independently.muxusually lands on the registry several minutes before its own@coder/xumdependency, so any workspace that starts inside that window resolvesmux@nextand then fails with:The
coder_scriptexits 1, the workspace reports a start error, and the Mux app goes unhealthy.This PR installs
@coder/xumdirectly. 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/xumships both themuxandxumbins (node_modules/.bin/mux -> ../@coder/xum/dist/cli/index.js), so the existing binary probe, the$INSTALL_PREFIX/muxsymlink, and everything that callsmux serverare 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'sdist.tarballexactly. Error and progress messages name the package that is being installed.main.tf:install_versionandregistry_urldescriptions name@coder/xum. Defaultinstall_prefixmoves from/tmp/muxto$HOME/.coder-modules/coder/muxand defaultlog_pathfrom/tmp/mux.logto$HOME/.coder-modules/coder/mux/logs/mux.log, the per-module root from AGENTS.md (Module Data Layout), so restarts that clear/tmpno longer discard the install or the diagnostics.run.shalready creates both directories withmkdir -pbefore writing; no other path in it assumed/tmp. The Node.js runtime thatrun.shbootstraps on images withoutnodealso moves from~/.local/share/coder-muxto 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 defaultinstall_versionislatestwhilemain.tfdefaults tonext, and pins a version that exists on@coder/xum; links the renamed upstream repository (coder/mux is now coder/xum).mux.tftest.hcl: newinstalls_coder_xum_packagerun asserting the rendered script installs@coder/xumand uses the scoped metadata/tarball URLs (verified red/green by flippingPKGback tomux); newdefault_paths_under_module_rootandcustom_install_prefix_and_log_pathruns 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-muxfixtures follow the new default paths (/root/.coder-modules/coder/muxinside the test containers). The two install tests now remove their containers inside the test instead of leaving them to the globalafterAllhook insetup.ts: that hook has a 5 second timeout, and deleting a container holding a full@coder/xuminstall (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/xumonly exists on npm from0.28.2-next.24onward (stable:0.28.3,0.28.4); older releases were published undermuxonly. The default (next),latest, and any pin of0.28.3or newer are unaffected. Templates that pininstall_versionto an older version will fail to install and need to move to0.28.3or newer. Private mirrors configured viaregistry_urlmust serve the scoped@coder/xumpackage. The defaultinstall_prefixandlog_pathalso 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 exampleinstall = falsewith a binary pre-installed at/tmp/mux/muxor tooling that reads/tmp/mux.log, must setinstall_prefixandlog_pathexplicitly 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
Module Information
Path:
registry/coder/modules/muxNew version:
v2.0.0(fromv1.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 -verbosein the module: 24 passed, 0 failed.bun test main.test.tsin the module (Docker, bun 1.2.15 and 1.4.1): 8 passed, 0 failed.runs with npm presentperforms a realnpm install @coder/xum@next --ignore-scriptsinnode:20-alpine;runs with defaultexercises the scoped tarball fallback inalpine/curl.scripts/terraform_validate.sh,scripts/shellcheck_validate.sh,scripts/validate_set_u_order.sh,bun fmt:ci, andcmd/readmevalidationall clean.Manual end-to-end check in a scratch directory:
bun add --ignore-scripts @coder/xum@nextresolved0.28.4-next.3.g2a1b5b267;node_modules/.bin/mux --versionprintedv0.28.5-nightly.5-3-g2a1b5b267-dirty (2a1b5b267);mux server --port 4321answeredGET /healthwith 200 within 3 seconds. Skipping@coder/xum'spostinstall(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/nextreturns 200 and itsdist.tarballequals the URL the fallback constructs.Related Issues
None
Generated with Xum using Claude.