I am experimenting the cloud agent by working with API approach. For single repo agent session creation, it worked great. I am struggling to get multi-repos agent session working. I did pass repos[] and autoCreatePR as true. In some cases, i was able to get this through on some project.
But, recently, i couldn’t get this env setup step passed and keep getting me this error.
Hey @SkylineDev2, thanks for the report and for including the agent ID that made this easy to trace!
When you pass repos[], the API reuses an existing environment that contains the same set of repos. The environment being matched here lists those repos in a different order than your request does, and when the two orders disagree, the checkout fails with the Couldn't check out the repository error you’re seeing. I’ll flag this for the team!
In the meantime, either of these should get you unstuck:
Send the repos in the same order the environment lists them, and start a new agent. Retrying the existing agent keeps its original settings, so it will keep failing.
Or name the environment under Cloud Agents > Environments and start agents with env: { type: "cloud", name: "<that name>" } instead of repos[]. The repos and their order then come from the environment itself, which is the most predictable setup for API use.
On your other question: environments being created automatically is expected. The API creates one the first time it encounters a new set of repos and reuses it thereafter, so there’s no need to create one by hand unless you want to target it by name.
Based on your direction, i was trying to enforce alphabet asc order first, didn’t work, then, switched to desc order, now it worked.
But, the weird thing… i couldn’t find this env name (auto-created) with suffix “+1” for my project.
Environment list remains the same. I am wondering… whether there is a hidden or archived one I can’t see, but somehow it was either matched or created in a state i can’t see yet.
Here is the new agent id it showed the expected behavior, but based on my guess to sort desc order for repos. When i clicked on “manage” or “enviornment” under the top menu, it didn’t re-direct to a environment detail page like others. Thus, i am guessing… stale env or hidden env, maybe?
new agent id - bc-2aab0bf7-5c3e-451a-84d9-d663b88bfbf9
Hey @SkylineDev2, glad the reordered request is working now.
You guessed right, there is an environment you can’t see. After you deleted your earlier environment, new API runs for those two repos started attaching to an environment left over from an earlier setup session that was never finished. Unfinished environments don’t appear in the Environments list and don’t have a details page, which is why “Manage” doesn’t go anywhere. The “+1” name you’re seeing is that environment, which is why the descending order worked.
If you’d like an environment you can see and manage, create one under Cloud Agents > Environments, add both repos (bubblyagent-frontend first), give it a name, and save it. Then start agents with env: { type: "cloud", name: "<that name>" }. A saved, named environment with those repos is picked ahead of the hidden one.
Love to reduce one decision from the user side, but have to trust your and my harness right.
Overall, thanks for your quick resolution. I have debugged this for 3 days, now my app integrates with cloud agent like a charm. I can go back to my 10x mode now.