Skip to content

fix(build): read CARGO_MANIFEST_DIR at run time in build scripts - #33741

Merged
teamleaderleo merged 1 commit into
feat-cmux-nextfrom
lane/build-rs-runtime-manifest-dir
Nov 3, 2026
Merged

teamleaderleo merged 1 commit into
feat-cmux-nextfrom
lane/build-rs-runtime-manifest-dir

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Two build scripts read their own crate folder with the compile-time env!("CARGO_MANIFEST_DIR"). When a build cache reuses a build script binary compiled in another checkout, that path points into the old checkout:

  • cmux-browser-host/build.rs panics reading a js/manifest.json that no longer exists. This broke a chat-open benchmark build on a fleet worker: the step read …/steps/<old step>/src/cmux-tui/crates/cmux-browser-host/js/manifest.json while the source was in another slot.
  • cmux-tailnet/build.rs reads patches/ with unwrap_or_default, so it silently builds with no patches.

Both now read CARGO_MANIFEST_DIR at run time; Cargo sets it for every build script run. No other build.rs uses env!("CARGO_MANIFEST_DIR").

Small change: two lines of logic in two build scripts. Risk: none beyond the build itself; the variable is always set when Cargo runs a build script.

Agent session: agent session

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes build script caching failures by reading CARGO_MANIFEST_DIR at run time instead of compile time in two build scripts. When a cached build script binary is reused from a different checkout, env! keeps the old checkout's path; cmux-browser-host then panics on a missing js/manifest.json, and cmux-tailnet silently builds without its patches.

Written for commit b1b9f45. Summary will update on new commits.

View guided diff Turn on auto-fix

A build script binary reused from another checkout keeps the compile-time
env! path. cmux-browser-host then fails on a deleted manifest.json, and
cmux-tailnet silently finds no patches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-342ae944382c55b76f4c
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review b1b9f45: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr33741 -f ref=lane/build-rs-runtime-manifest-dir -f platform=macos -f backend_mode=local

Shipped in:

@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Nov 3, 2026

@teamleaderleo teamleaderleo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review (claude-sonnet-5-5): SHIP at b1b9f45

Review (subagent claude-sonnet-5-5): SHIP at b1b9f45

Cargo always sets CARGO_MANIFEST_DIR in a build script's run-time environment. Both edits compile by inspection, and the joined paths and rerun-if-changed output are the same as before. No other build.rs uses env!("CARGO_MANIFEST_DIR"); grep confirms it.

Follow-ups: none.

@teamleaderleo
teamleaderleo merged commit 2a48ef7 into feat-cmux-next Nov 3, 2026
151 of 165 checks passed
@teamleaderleo
teamleaderleo deleted the lane/build-rs-runtime-manifest-dir branch November 3, 2026 11:57
@blacksmith-sh

blacksmith-sh Bot commented Nov 3, 2026

Copy link
Copy Markdown

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
test_every_compile_job_names_its_warm_sources (main.ThisTree.test_every_compile_job
_names_its_warm_sources)/
test_every_compile_job_names_its_warm_sources (main.ThisTree.test_every_compile_job
_names_its_warm_sources)
View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

This branch was previously deployed

3 inactive deployments
artifacts — b1b9f45e Deployed Nov 3, 2026 by teamleaderleo via publish tree-addressed cmux-tui #105859
sentry-dsyms — b1b9f45e Deployed Nov 3, 2026 by teamleaderleo via upload cmux-tui dSYMs to Sentry #105859
ci-routing-agent — b1b9f45e Deployed Nov 3, 2026 by teamleaderleo via cmux-tui tree preflight #105859
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant