fix(worker): kept worktree in a company repo opens a PR, unexpected ADO/git errors never fail a task start

This commit is contained in:
mika kuns
2026-10-01 12:25:15 +02:00
parent 93fd6740a1
commit 4917533cb4
7 changed files with 54 additions and 13 deletions
+12 -3
View File
@@ -282,8 +282,17 @@ public sealed class WorktreeManager
.Select(c => c.BaseBranch)
.FirstOrDefaultAsync(ct)).NullIfBlank();
if (isCompany && await FetchCompanyBaseAsync(workingDir, baseBranch, ct) is { } fetched)
return fetched;
if (isCompany)
{
try
{
if (await FetchCompanyBaseAsync(workingDir, baseBranch, ct) is { } fetched) return fetched;
}
catch (Exception ex) when (ex is not OperationCanceledException)
{
_logger.LogWarning(ex, "Fetching the company base in {working_dir} failed, continuing with the local branch", workingDir);
}
}
return baseBranch is null
? await _git.RevParseHeadAsync(workingDir, ct)
@@ -304,7 +313,7 @@ public sealed class WorktreeManager
if (basis is null && _azdo is not null && pat is not null && AzureDevOpsClient.ParseRemote(remote) is { } repo)
{
try { basis = await _azdo.GetDefaultBranchAsync(repo, ct); }
catch (AzureDevOpsException ex) { _logger.LogWarning("Default branch from Azure DevOps unavailable: {reason}", ex.Message); }
catch (Exception ex) when (ex is AzureDevOpsException or InvalidOperationException) { _logger.LogWarning("Default branch from Azure DevOps unavailable: {reason}", ex.Message); }
}
basis ??= await _git.GetRemoteHeadBranchAsync(workingDir, ct);
if (basis is null)