Particle cli cloud compile is mixing target build trees

Couldn’t find another community post on this so just submitted a ticket - posting here in case anyone bumps into the same problem:

If I do one build with the particle CLI, e.g.

particle compile --target 1.4.2 --saveTo target/MyProject.bin photon

and then later to another build of a different project with the same name (for example, working on a branch/patch in the same repository):

particle compile --target 1.4.2 --saveTo target/MyProject.bin photon

I get compile errors, for example indicating that some symbols are not defined, includes are missing, etc. Here is the tail of the error message:

.
.
.
make[2]: Leaving directory ‘/firmware/user’
…/…/…/build/recurse.mk:11: recipe for target ‘user’ failed
make[1]: Leaving directory ‘/firmware/modules/photon/user-part’
make[1]: *** [user] Error 2
…/build/recurse.mk:11: recipe for target ‘modules/photon/user-part’ failed
make: *** [modules/photon/user-part] Error 2
Compile failed: Compiler encountered an error

I expect this when doing offline builds but not when doing a build in the cloud - the environment should be clean every time with no mixing of symbols, sources, etc.

The pre-compiling seems to be having a problem for me - definitely an issue.