Repository navigation
Description
Symptom
Running bash test --cpp from inside a worktree created under .claude/worktrees/<branch>/ fails reproducibly with errors like:
[9/677] Compiling C++ object ci/meson/native/libcrash_handler.a.p/C__Users_niteris_dev_fastled10_.claude_worktrees_<branch>_tests_shared_crash_handler_main.cpp.obj
error: unable to open output file 'ci/meson/native/libcrash_handler.a.p/C__Users_niteris_dev_fastled10_.claude_worktrees_<branch>_tests_shared_crash_handler_main.cpp.obj': 'no such file or directory'
The same checkout from the main working tree at C:\Users\niteris\dev\fastled10\ builds clean — 310/310 tests pass.
Root cause hypothesis
Meson encodes the full absolute source path into the object filename (e.g. C__Users_niteris_dev_fastled10_.claude_worktrees_<branch>_tests_shared_crash_handler_main.cpp.obj). When the worktree path lives under .claude/worktrees/<branch>/ the encoded name can exceed Windows long-path limits or hit a meson/ninja parent-dir-creation race, leaving the libcrash_handler.a.p/ subdirectory present but the object file unwritable.
The directory IS created (it can be ls'd after the failure), it's just empty. So meson allocated the path but clang couldn't open the output for write — typical "path too long" or "permission denied due to junction" symptom on Windows.
Reproduction
git fetch origin master
git worktree add -b repro-meson-worktree .claude/worktrees/meson-bug origin/master
cd .claude/worktrees/meson-bug
bash test --cpp
# → fails with the message above
(Tested with worktree branch names of 11-30 chars. The exact failure point depends on which TU clang reaches first.)
Impact
clud-prworkflow is broken inside worktrees:bash test --cppis the canonical gate, and it cannot validate from the disposable worktree the workflow mandates.- Forces agents to copy the entire
.build/tree from the main checkout into the worktree (which is itself stale because meson configure baked-in paths from the original checkout), defeating the worktree isolation point.
Workarounds tried (all fail)
bash test --cpp --clean—.build/meson-quickgets wiped, same error on rebuild.- Force-clearing
.build/via the override hook — same. - Build from main checkout, copy
.build/to worktree — paths inside meson's compile_commands.json point at the main checkout, lint passes but the build is semantically meaningless.
Suggested fix paths (pick one)
- Shorten the object-file encoding — pass
-Db_obj_basename=short(if supported) or set ameson.optionsto use hashed object names instead of path-encoded ones. - Move worktrees to a sibling path — agents create
../<repo>-wt-<branch>/outside the repo. Removes the path-length amplification. Theclud-prskill already allows this as a fallback. - Enable Windows long-path support in the project's
git config core.longpaths true+ aci/hooks/setup_long_paths.pyhelper. Doesn't help non-Windows but it's a one-line setup.
Related
- The
clud-prworkflow that creates the failing worktrees:.claude/skills/clud-pr/SKILL.md agents/docs/binary-size-analysis.md—bash bloatworks from worktrees because it only reads pre-built ELFs (no meson compile), so it's not impacted; only the test-build path is.
🤖 Filed via Claude Code after hitting this during a printf-family-ban PR.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
feat(lint): ban bare printf/vprintf in src/ + replace last 13 WASM of…
perf(gamma): use fl::s16x16::pow for Gamma8 LUT + applyGamma_video; d…
zackees commentedon Jul 27, 2026
Root-cause hypothesis confirmed and quantified — it is the MAX_PATH limit, and the trigger is worktree-path length, which is why it looked intermittent.
Measurement
Computed the encoded object path for every real source (330
.cppfiles undertests/andsrc/, build/artifact dirs excluded) as it would appear under.claude/worktrees/<branch>/:wt(2 chars)meson-bug(9 chars)fix/some-descriptive-branch(26 chars)Longest offender is consistently
tests/platforms/arm/teensy/teensy4_common/drivers/objectfled/channel_engine_objectfled.cpp.That explains every observed symptom: the main worktree at
C:\Users\niteris\dev\fastled\has a short enough prefix to stay under the limit, the.claude/worktrees/<branch>/prefix adds ~30+ chars, and "which TU clang reaches first" varies because only the tail of the length distribution crosses 260. It also matches the report that branch names of 11-30 chars were the ones that broke.Why the paths are that long
Meson encodes the absolute source path into the object filename because the sources are handed to it as absolute strings —
tests/meson.buildbuilds them aspath_norm_root + '/tests/' + test_file(lines 183-185, 202), wherepath_norm_root = meson.project_source_root().So each object name carries the full
C__Users_niteris_dev_fastled_.claude_worktrees_<branch>_prefix on top of the already-deeptests/platforms/arm/teensy/...path.Why the obvious fix needs care
Passing sources as paths relative to
tests/meson.buildwould cut the encoded name down toplatforms_arm_teensy_..._channel_engine_objectfled.cpp.objand fix this outright. But two things in this exact code path have already been root-caused as bugs, so it should not be a drive-by change:The absolute forward-slash convention is itself a fix.
ci/meson/shared/meson.build:37-53documents it at length: meson's/join operator emits a native backslash mid-path on Windows, which produced mixed separators, which defeated#pragma oncededup, which surfaced aserror: redefinition of 'LogLevel'— reproduced and root-caused 2026-06-02 after fix(io): finish fl::print minimal-surface contract for hosts (closes #2668) #2683/chore(lint): clear pre-existing bash-lint baseline failures #2684. The-Iflags must stay absolute regardless of what happens to source paths.__FILE__changes. Test sources'__FILE__currently expands to the absolute path, andFL_TEST_FILE_FILTERmatches against__FILE__infl_unittest.cpp(the.hppquery path insmart_selector.pydepends on this). Making sources relative changes those strings and could silently break.hpp-targeted test selection.So the change is plausible and probably correct, but it needs the include flags kept absolute while only the source arguments go relative, plus explicit coverage that
FL_TEST_FILE_FILTERstill resolves. Filing this analysis rather than a rushed patch, since both prior failures in this area were of the silent-and-confusing variety.Cheap interim workaround: use a short worktree branch name (≤ ~5 chars) — at 2 chars nothing crosses the limit. Enabling Windows long-path support (
LongPathsEnabled) is the other environment-level escape hatch.