Fix DAG executor race condition, add cascade logging, and deduplicate layer code
- Fix Os.mkdir EEXIST race when concurrent forked workers create the same
package directory (root cause of ~370 cascade failures in roll-forward)
- Add on_cascade callback to execute_dag for cascade root-cause logging
and skeleton layer creation (layer.json + opam-repository for rerun)
- Extract shared helpers: Util.populate_opam_repository,
Util.write_skeleton_layer, Util.wait_for_layer_json
- Refactor execute_dag internals: deduplicate propagate_failure,
promote_dependents, and complete_node into single definitions
- Use Unix._exit in forked children to avoid flushing parent buffers
- Replace Str with thread-safe pure-string substring matching
- Add Unix.lockf file locking to History.append for concurrent writes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>