Repository navigation
fix(build): read CARGO_MANIFEST_DIR at run time in build scripts - #33741
Conversation
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
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
Shipped in:
|
teamleaderleo
left a comment
There was a problem hiding this comment.
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.
|
Found 1 test failure on Blacksmith runners: Failure
|
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
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.rspanics reading ajs/manifest.jsonthat 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.jsonwhile the source was in another slot.cmux-tailnet/build.rsreadspatches/withunwrap_or_default, so it silently builds with no patches.Both now read
CARGO_MANIFEST_DIRat run time; Cargo sets it for every build script run. No otherbuild.rsusesenv!("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
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Fixes build script caching failures by reading
CARGO_MANIFEST_DIRat 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-hostthen panics on a missingjs/manifest.json, andcmux-tailnetsilently builds without its patches.Written for commit b1b9f45. Summary will update on new commits.