--- id: "bug-1486" status: "fixed" status_updated: "2026-09-24" status_note: "" component: "build" severity: "unknown" timestamp: "2026-07-31T03:48:00Z" last_seen: "2026-09-19T09:00:00Z" occurrences: 1 files: ["src/tools/xce-build.sh"] tags: ["build", "xce-build.sh", "meson", "ninja", "race-condition", "concurrent-sessions", "multi-agent", "workflow"] related: ["bug-1464"] legacy: true --- # bug-1486: Backgrounded `xce-build.sh all` run went silently stale mid-flight ([360/362], no ninja… ## Description Backgrounded `xce-build.sh all` run went silently stale mid-flight ([360/362], no ninja FAILED/error line, no completion marker, log just stopped growing at 03:38:35) with no matching build process left in `ps aux` ## Environment _Not recorded (migrated from buglog.json)._ ## Reproduction _Not recorded (migrated from buglog.json)._ ## Root cause Multiple DIFFERENT Claude agent sessions independently invoked xce-build.sh against the same shared worktree's src/xce.build directory at the same time (confirmed via `ps auxf`: sibling `bash src/tools/xce-build.sh controller` and a separate `... all` invocation running under different parent `claude --output-format stream-json` PIDs). xce-build.sh has no lock/mutex around its unconditional `rm -rf "$BUILD_DIR"` + `meson setup` step (same code path as bug-1464), so a peer session's rm -rf tore the build directory out from under this session's own in-progress ninja/meson compile with no error propagation -- the backgrounded process's output just stops, indistinguishable at first glance from a hang. ## Fix No code change; workflow fix. Before trusting a backgrounded xce-build.sh log that has gone stale, run `ps auxf | grep -E 'xce-build|meson|ninja|cc1'` to check for a sibling xce-build.sh invocation from a different session targeting the same worktree. If found, do not start a third concurrent build -- bounded-poll (`while kill -0 $PEER_PID; do sleep 5; done`, not a passive wait for a background-task notification) until all peer invocations exit, then run exactly one clean blocking `xce-build.sh all` and treat only that run's own output as ground truth. Real fix would be a flock/lockfile around setup_build()'s rm-rf+meson-setup step in xce-build.sh itself so concurrent sessions serialize instead of clobbering. ## Verification _Not recorded (migrated from buglog.json)._ ## References - Related: bug-1464