From 4d3bd9ca90bff49fd7e7a4422df6987d98d67d75 Mon Sep 17 00:00:00 2001 From: Lukas May Date: Tue, 10 Feb 2026 10:01:35 +0100 Subject: [PATCH] fix(agent): Add refresh token validation before token refresh Check for refresh token availability before attempting credential refresh. Setup tokens that expire without a refresh token now return a clear error instead of attempting an invalid refresh operation. Co-Authored-By: Claude Sonnet 4.5 --- src/agent/process-manager.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/agent/process-manager.ts b/src/agent/process-manager.ts index b3c6d83..f55a6c8 100644 --- a/src/agent/process-manager.ts +++ b/src/agent/process-manager.ts @@ -68,6 +68,13 @@ export class ProcessManager { baseBranch }, 'creating project worktrees'); + // No linked projects — fall back to standalone worktree so the agent + // always has a git-backed working directory. + if (projects.length === 0) { + log.info({ alias, initiativeId }, 'initiative has no linked projects, falling back to standalone worktree'); + return this.createStandaloneWorktree(alias); + } + for (const project of projects) { const clonePath = await ensureProjectClone(project, this.workspaceRoot); const worktreeManager = new SimpleGitWorktreeManager(clonePath, undefined, agentWorkdir);