lab build fails on nested workspaces — cargo CWD should be the bin's workspace_root, not the outer repo_root #270
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_skills#270
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
lab build --release --platforms linux-musl-x86_64 --workspaceonlhumina_code/hero_rpcfails for two of six discovered targets:The other 4 (
petstore_server,hero_lifecycle,hero_rpc_generator,petstore_client) build cleanly. This blocks hero_rpc's lab-publish.yaml CI (run #211 + #209) from going green — counts against #269 rollout.Root cause
lab discovers
hero_recipes_servercorrectly:find_package_manifests(cargo_discovery.rs:139) walksgit_rootand findsexample/recipe_server/crates/hero_recipes_server/Cargo.toml.workspace_root_for(cargo_discovery.rs:169) walks upward, findsexample/recipe_server/Cargo.toml(which has its own[workspace]), and groups the bin under that workspace root.cargo metadataagainstexample/recipe_server/Cargo.tomlreturns the recipe packages.discover_binaries_in_repo(cargo_discovery.rs:80) emits them asDiscoveredBin.Then
execute(executor.rs:54) launches cargo:repo_rootis the outer hero_rpc workspace, which excludesexample/recipe_server/:So
cargo build -p hero_recipes_serverfromrepo_rootresolves the OUTER workspace and reports the package doesn't exist — even though lab already located its containing workspace via cargo metadata.Fix shape
Two options:
(a) Set
current_dirto the bin's workspace rootMost minimal: each
DiscoveredBinalready carriesmanifest_path. Compute its workspace root (or store it alongside inDiscoveredBin) and pass it ascurrent_dir. TheBuildTargetwould need aworkspace_root: PathBuffield plumbed throughBuildTargetMeta(orchestrator.rs:644).(b) Pass
--manifest-pathexplicitlyAdd
--manifest-path <workspace_root>/Cargo.tomlto the cargo args inbuild_command(executor.rs:106). Same plumbing requirement.Both approaches require carrying the workspace root from discovery → BuildTarget → executor. (a) is more idiomatic; (b) leaves cargo's resolved
CARGO_TARGET_DIRand the rest of the env alone.Blast radius
This bug blocks all repos with nested workspaces under git_root. In the D-07 35-set:
Affected pattern: any repo that uses lab's
--workspacemode and has an excluded sub-workspace containing[[bin]]targets.Verification
Local reproduction:
After fix: same command should build all 6 targets.
See also
mik-tf referenced this issue from lhumina_research/hero_demo2026-05-20 01:14:53 +00:00
Fixed in hero_skills
de34fe0.Implementation took the first option from the issue body (per-bin workspace_root threaded through the builder), not the --manifest-path alternative.
Patch shape (+22/-5 across 3 files)
crates/lab/src/builder/cargo_discovery.rs—DiscoveredBingainspub workspace_root: PathBuf, populated indiscover_binaries_in_repofrom each outercargo metadata'sworkspace_root(one value perMetadatasince every package within shares the workspace).crates/lab/src/builder/orchestrator.rs—build_target_fordrops its outerworkspace_rootparameter and writesbin.workspace_rootintoBuildTarget(the field already existed but was always overwritten with the single outer value).crates/lab/src/builder/executor.rs—cmd.current_dir(repo_root)→cmd.current_dir(&bt.workspace_root);repo_rootparam renamed_repo_rootfor caller compat.Verification
hero_recipes_server+hero_recipes_adminfailed withpackage ID specification did not match)bin.workspace_rootresolves to outer repo_root for single-workspace repos)cargo test -p labforge_api_no_tokenfailure is pre-existing env-pollution whenFORGEJO_TOKENis exported)Follow-up
hero_rpc's next push to
development(or aworkflow_dispatchre-fire) will now publish 6linux-musl-x86_64binaries toreleases/tag/latestinstead of 4.latestrelease created on 3 repos #277latestrelease created on 3 repos #277