Fall back to sole Queue branch when Care branch names differ.
Deploy Ladill Care / deploy (push) Successful in 1m31s

Free single-location Queue orgs often use a default name like
Main Branch while Care stubs send Main; reuse the only branch.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-17 16:09:31 +00:00
co-authored by Cursor
parent cd020512c3
commit 15638d1672
+8 -2
View File
@@ -298,13 +298,19 @@ class QueueClient
try {
$this->ensureBranch($owner, ['name' => $branchName]);
} catch (RequestException $e) {
// Free Queue plans may already be at branch cap — continue if branch already exists.
// Free Queue plans may already be at branch cap — continue if a branch can be resolved.
if ($e->response?->status() !== 422) {
throw $e;
}
$existing = collect($this->branches($owner))->first(
$branches = collect($this->branches($owner));
$existing = $branches->first(
fn ($b) => strcasecmp((string) ($b['name'] ?? ''), $branchName) === 0
);
if (! $existing && $branches->count() === 1) {
// Single-location Queue orgs often use a different default name (e.g. "Main Branch").
$existing = $branches->first();
$branchName = (string) ($existing['name'] ?? $branchName);
}
if (! $existing) {
throw $e;
}