diff --git a/doc/workspace-storage.md b/doc/workspace-storage.md index a34af183503..4753a96de7e 100644 --- a/doc/workspace-storage.md +++ b/doc/workspace-storage.md @@ -378,6 +378,17 @@ ends the run `configuration_incomplete` (reason `project_storage_environment_incompatible`). See [project-environment-compatibility.md](project-environment-compatibility.md). +A workspace already saved in remote storage stays there. Only a Paperclip +Runner agent in a sandbox environment, or a supported agent in an SSH +environment, can restore and save it. When the task's agent now runs in another +environment (for example, it moved to a plugin computer), preparation refuses +the run before any workspace or environment work and ends it +`configuration_incomplete` (reason `remote_workspace_environment_incompatible`). +The saved workspace and the task's binding to it are unchanged. The task +notice asks the owner to assign the task to an agent that can use the saved +workspace, or to change the agent's environment. Run-failure reporting skips +this pre-dispatch outcome. + A replacement controller reconstructs an active remote agent-directory cache from the registered sandbox, including unsaved files. The remote directory, lease and save baseline remain unchanged; current canonical files are never diff --git a/server/src/services/__tests__/run-failure-report-remote-workspace-environment.test.ts b/server/src/services/__tests__/run-failure-report-remote-workspace-environment.test.ts new file mode 100644 index 00000000000..af8d2bf2c55 --- /dev/null +++ b/server/src/services/__tests__/run-failure-report-remote-workspace-environment.test.ts @@ -0,0 +1,132 @@ +import { randomUUID } from "node:crypto"; +import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { agents, applyPendingMigrations, closeRegisteredClients, companies, createDb, heartbeatRuns } from "@paperclipai/db"; +import { + getEmbeddedPostgresTestSupport, + startEmbeddedPostgresTestDatabase, +} from "../../__tests__/helpers/embedded-postgres.js"; + +const mockCaptureRunFailure = vi.hoisted(() => vi.fn()); + +vi.mock("../../sentry.js", () => ({ + captureRunFailure: mockCaptureRunFailure, +})); + +import { reportRunFailure } from "../run-failure-report.js"; + +const testDatabaseUrl = process.env.PAPERCLIP_TEST_DATABASE_URL; +const embeddedPostgresSupport = testDatabaseUrl ? { supported: true } : await getEmbeddedPostgresTestSupport(); +const describeEmbeddedPostgres = embeddedPostgresSupport.supported ? describe : describe.skip; + +describeEmbeddedPostgres("reportRunFailure remote workspace environment gaps", () => { + let db!: ReturnType; + let tempDb: Awaited> | null = null; + let companyId!: string; + let agentId!: string; + let inheritedEnv: NodeJS.ProcessEnv; + + beforeAll(async () => { + if (testDatabaseUrl) { + await applyPendingMigrations(testDatabaseUrl); + db = createDb(testDatabaseUrl); + } else { + tempDb = await startEmbeddedPostgresTestDatabase("paperclip-run-failure-remote-workspace-environment-"); + db = createDb(tempDb.connectionString); + } + }, 20_000); + + beforeEach(async () => { + inheritedEnv = process.env; + process.env = Object.fromEntries( + ["PATH", "HOME", "USER", "USERNAME", "LOGNAME", "USERPROFILE", "TMPDIR", "TEMP", "TMP"] + .flatMap((key) => inheritedEnv[key] === undefined ? [] : [[key, inheritedEnv[key]]]), + ); + process.env.PAPERCLIP_SENTRY_RUN_FAILURES = "unexpected"; + companyId = randomUUID(); + agentId = randomUUID(); + await db.insert(companies).values({ + id: companyId, + name: "Paperclip", + issuePrefix: `T${companyId.replace(/-/g, "").slice(0, 6).toUpperCase()}`, + requireBoardApprovalForNewAgents: false, + defaultResponsibleUserId: "responsible-user", + }); + await db.insert(agents).values({ + id: agentId, + companyId, + name: "Runner", + role: "engineer", + status: "active", + adapterType: "paperclip_runner", + adapterConfig: {}, + runtimeConfig: {}, + permissions: {}, + }); + }); + + afterEach(async () => { + vi.clearAllMocks(); + vi.unstubAllEnvs(); + process.env = inheritedEnv; + await db.delete(heartbeatRuns); + await db.delete(agents); + await db.delete(companies); + }); + + afterAll(async () => { + if (testDatabaseUrl) await closeRegisteredClients(testDatabaseUrl); + await tempDb?.cleanup(); + }); + + const configurationIncomplete = () => ({ + reason: "remote_workspace_environment_incompatible", executionWorkspaceId: randomUUID(), environmentId: randomUUID(), + environmentDriver: "plugin", adapterType: "paperclip_runner", + }); + + function remoteWorkspaceEnvironmentRun( + overrides: Partial = {}, + ): typeof heartbeatRuns.$inferSelect { + return { + id: randomUUID(), + companyId, + agentId, + status: "failed", + error: "This task's saved workspace is kept in remote workspace storage, which the environment \"Agent Computer\" cannot use.", + errorCode: "configuration_incomplete", + executionStage: "preparing", + nativeIssueId: randomUUID(), + contextSnapshot: null, + resultJson: { + configurationIncomplete: configurationIncomplete(), + executionRecovery: { kind: "bootstrap", providerWorkStarted: false }, + }, + ...overrides, + } as unknown as typeof heartbeatRuns.$inferSelect; + } + + it("keeps a remote workspace the agent's environment cannot use on the task before dispatch", async () => { + await reportRunFailure(db, remoteWorkspaceEnvironmentRun(), { phase: "setup" }); + expect(mockCaptureRunFailure).not.toHaveBeenCalled(); + }); + + it.each([ + { status: "timed_out" }, { errorCode: "setup_failed" }, { executionStage: "executing" }, { exitCode: 1 }, { signal: "SIGTERM" }, + { resultJson: { configurationIncomplete: configurationIncomplete() } }, + { resultJson: { configurationIncomplete: configurationIncomplete(), executionRecovery: { kind: "bootstrap", providerWorkStarted: true } } }, + { resultJson: { configurationIncomplete: { reason: "something_else" }, executionRecovery: { kind: "bootstrap", providerWorkStarted: false } } }, + ])("reports remote workspace environment markers without an exact pre-dispatch outcome: %j", async (overrides) => { + await reportRunFailure(db, remoteWorkspaceEnvironmentRun(overrides), { phase: "setup" }); + expect(mockCaptureRunFailure).toHaveBeenCalledTimes(1); + }); + + it.each([undefined, "execute"] as const)("reports remote workspace environment markers outside the setup report: %s", async (phase) => { + await reportRunFailure(db, remoteWorkspaceEnvironmentRun(), { phase }); + expect(mockCaptureRunFailure).toHaveBeenCalledTimes(1); + }); + + it("reports the remote workspace environment gap when every run failure is reported", async () => { + vi.stubEnv("PAPERCLIP_SENTRY_RUN_FAILURES", "all"); + await reportRunFailure(db, remoteWorkspaceEnvironmentRun(), { phase: "setup" }); + expect(mockCaptureRunFailure).toHaveBeenCalledTimes(1); + }); +}); diff --git a/server/src/services/heartbeat/workspace-preparation.test.ts b/server/src/services/heartbeat/workspace-preparation.test.ts index c0c234c23a8..9ab2c78591b 100644 --- a/server/src/services/heartbeat/workspace-preparation.test.ts +++ b/server/src/services/heartbeat/workspace-preparation.test.ts @@ -254,6 +254,54 @@ describe.skipIf(!support.supported && !externalDatabaseUrl)("heartbeat workspace expect((await db.select().from(executionWorkspaces))[0]?.metadata?.remoteWorkspace).toBeUndefined(); }); + it("names a remote-storage workspace that the agent's environment cannot use as an owner configuration gap", async () => { + const { input, issue, envOrchestrator } = await fixture(); + const remoteWorkspace = { schema: "paperclip.remote-workspace.v1", epoch: 3, snapshotId: randomUUID(), + source: { kind: "empty" }, location: null, writerRunId: null, dirty: false }; + const [workspace] = await db.insert(executionWorkspaces).values({ companyId: issue.companyId, + sourceIssueId: issue.id, projectId: issue.projectId, projectWorkspaceId: issue.projectWorkspaceId, + name: "Saved sandbox workspace", cwd: null, providerType: "cloud_sandbox", strategyType: "git_worktree", + mode: "isolated_workspace", status: "active", metadata: { remoteWorkspace } }).returning(); + await db.update(issues).set({ executionWorkspaceId: workspace.id }).where(eq(issues.id, issue.id)); + input.reuse.existingExecutionWorkspace = toExecutionWorkspace(workspace); + input.reuse.reusableExistingExecutionWorkspace = toExecutionWorkspace(workspace); + input.reuse.requestedShouldReuseExisting = true; + input.agent.adapterType = "paperclip_runner"; + const computer = { ...input.environment.localEnvironment, id: randomUUID(), name: "Agent Computer", + driver: "plugin" as const, config: { pluginKey: "agent-computers", driverKey: "tasks", driverConfig: {} } }; + input.environment.selectedEnvironmentId = computer.id; + input.environment.selectedEnvironmentForConfig = computer; + const resolve = vi.spyOn(input.services, "resolveWorkspaceForRun"); + const acquire = vi.spyOn(envOrchestrator, "acquireForRun"); + + await expect(prepareHeartbeatWorkspace(db, input)).rejects.toMatchObject({ + name: "ConfigurationIncompleteFailure", + code: "configuration_incomplete", + message: `This task's saved workspace is kept in remote workspace storage, which the environment "Agent Computer" cannot use. ` + + "Only a Paperclip Runner agent in a sandbox environment, or a supported agent in an SSH environment, can continue it.", + resultJson: { + configurationIncomplete: { + reason: "remote_workspace_environment_incompatible", + companyId: issue.companyId, + agentId: input.agent.id, + issueId: issue.id, + executionWorkspaceId: workspace.id, + environmentId: computer.id, + environmentDriver: "plugin", + adapterType: "paperclip_runner", + fingerprint: `remote_workspace_environment:${workspace.id}:${computer.id}`, + actionUrl: `/agents/${input.agent.id}/runtime`, + }, + }, + }); + expect(resolve).not.toHaveBeenCalled(); + expect(acquire).not.toHaveBeenCalled(); + const [unchanged] = await db.select().from(executionWorkspaces).where(eq(executionWorkspaces.id, workspace.id)); + expect(unchanged?.metadata).toEqual(workspace.metadata); + expect(unchanged?.metadata?.remoteWorkspace).toEqual(remoteWorkspace); + expect((await readIssue(issue.id)).executionWorkspaceId).toBe(workspace.id); + }); + it.each([ { kind: "empty", repoUrl: null, branchMode: null, fresh: false, strategyChange: false, ephemeral: true }, { kind: "git", repoUrl: "https://github.com/example/remote.git", branchMode: null, fresh: false, strategyChange: false }, diff --git a/server/src/services/heartbeat/workspace-preparation.ts b/server/src/services/heartbeat/workspace-preparation.ts index fc660ec5d77..37c30c46f07 100644 --- a/server/src/services/heartbeat/workspace-preparation.ts +++ b/server/src/services/heartbeat/workspace-preparation.ts @@ -1,9 +1,10 @@ import { NATIVE_REMOTE_RECOVERY_LEASE_MISMATCH, remoteRecoveryLeaseMismatch } from "../native-runtime/remote-recovery-lease-mismatch.js"; import { readInheritedRunnerRetainedSandbox } from "../native-runtime/native-inherited-runner-retry.js"; import { resolveProviderApiPlacement } from "../native-runtime/provider-api-placement.js"; -import { assertEphemeralWorkspaceExecution, readRemoteWorkspaceAuthority, RemoteWorkspaceWriterActiveError, reserveRemoteWorkspace, shouldUseRemoteWorkspaces } from "../remote-workspaces.js"; +import { assertEphemeralWorkspaceExecution, readRemoteWorkspaceAuthority, RemoteWorkspaceWriterActiveError, reserveRemoteWorkspace, shouldUseRemoteWorkspaces, supportsRemoteWorkspaceExecution } from "../remote-workspaces.js"; import { assertProjectStorageEnvironment, listProjectWorkspaceProviders, projectStorageForEnvironment } from "../project-workspace-provider.js"; import { PROJECT_STORAGE_ENVIRONMENT_INCOMPATIBLE } from "../project-storage-environment-reason.js"; +import { REMOTE_WORKSPACE_ENVIRONMENT_INCOMPATIBLE } from "../remote-workspace-environment-reason.js"; import { ConfigurationIncompleteFailure } from "./run-preparation.js"; import { WorkspaceBusyDeferral } from "./retries.js"; import { remoteWorkspaceHoldRefusesStart } from "../remote-workspace-writer-hold.js"; @@ -280,7 +281,30 @@ async function prepareHeartbeatWorkspaceLocked(db: Db, input: HeartbeatWorkspace { reason: "remote_workspace_migration_in_progress" }); } } - const enrolledRemoteAuthority = readRemoteWorkspaceAuthority((reusableExistingExecutionWorkspace ?? existingExecutionWorkspace)?.metadata) !== null; + const enrolledRemoteWorkspace = reusableExistingExecutionWorkspace ?? existingExecutionWorkspace; + const enrolledRemoteAuthority = readRemoteWorkspaceAuthority(enrolledRemoteWorkspace?.metadata) !== null; + if (!controllerOnly && enrolledRemoteAuthority + && !supportsRemoteWorkspaceExecution(agent.adapterType, selectedEnvironmentForConfig?.driver ?? null)) { + const environmentId = selectedEnvironmentForConfig?.id ?? selectedEnvironmentId ?? null; + throw new ConfigurationIncompleteFailure( + `This task's saved workspace is kept in remote workspace storage, which the environment "${selectedEnvironmentForConfig?.name ?? "unknown"}" cannot use. ` + + "Only a Paperclip Runner agent in a sandbox environment, or a supported agent in an SSH environment, can continue it.", + { + configurationIncomplete: { + reason: REMOTE_WORKSPACE_ENVIRONMENT_INCOMPATIBLE, + companyId: agent.companyId, + agentId: agent.id, + issueId: issueId ?? null, + executionWorkspaceId: enrolledRemoteWorkspace!.id, + environmentId, + environmentDriver: selectedEnvironmentForConfig?.driver ?? null, + adapterType: agent.adapterType, + fingerprint: `remote_workspace_environment:${enrolledRemoteWorkspace!.id}:${environmentId ?? "none"}`, + actionUrl: `/agents/${agent.id}/runtime`, + }, + }, + ); + } let remoteAuthority = !controllerOnly && shouldUseRemoteWorkspaces({ adapterType: agent.adapterType, environmentDriver: selectedEnvironmentForConfig?.driver ?? null, diff --git a/server/src/services/recovery/service.ts b/server/src/services/recovery/service.ts index 21fcd5ff2be..dbd949354c7 100644 --- a/server/src/services/recovery/service.ts +++ b/server/src/services/recovery/service.ts @@ -30,6 +30,7 @@ import { onboardingFirstTaskAwaitingUserSql } from "./onboarding-first-task-wait import { isAiAuthenticationBlocked } from "../ai-auth-failure.js"; import { RESTRICTED_WORKSPACE_SOURCE_REASON } from "../workspace-source-restriction.js"; import { PROJECT_STORAGE_ENVIRONMENT_INCOMPATIBLE } from "../project-storage-environment-reason.js"; +import { REMOTE_WORKSPACE_ENVIRONMENT_INCOMPATIBLE } from "../remote-workspace-environment-reason.js"; import { hasCommittedNativePlanWait } from "../native-runtime/native-plan-wait.js"; import { ensureNativePlanReviewCard } from "../native-runtime/native-plan-review-card.js"; import { hasCommittedNativeConversationTurnWait, hasCommittedNativeResponseWakeWait } from "../native-runtime/native-response-wake-wait.js"; @@ -183,6 +184,7 @@ import { DOT_CONFIGURATION_INCOMPLETE_REASONS, SANDBOX_PROVIDER_PLUGIN_NOT_READY_REASON, PROJECT_STORAGE_ENVIRONMENT_NEXT_ACTION, + REMOTE_WORKSPACE_ENVIRONMENT_NEXT_ACTION, sandboxProviderPluginRemedy, buildConfigurationIncompleteRecoveryNoticeSeed, buildExecutionReviewParticipantRecoveryNoticeSeed, @@ -2877,6 +2879,8 @@ export function recoveryService( ? "Retry the task." : readConfigurationIncompletePayload(input.latestRun)?.reason === PROJECT_STORAGE_ENVIRONMENT_INCOMPATIBLE ? PROJECT_STORAGE_ENVIRONMENT_NEXT_ACTION + : readConfigurationIncompletePayload(input.latestRun)?.reason === REMOTE_WORKSPACE_ENVIRONMENT_INCOMPATIBLE + ? REMOTE_WORKSPACE_ENVIRONMENT_NEXT_ACTION : readConfigurationIncompletePayload(input.latestRun) ?.reason === SANDBOX_PROVIDER_PLUGIN_NOT_READY_REASON ? `The plugin that starts this agent's sandbox is not running. To fix it, ${sandboxProviderPluginRemedy( diff --git a/server/src/services/recovery/stranded-notice-remote-workspace-environment.test.ts b/server/src/services/recovery/stranded-notice-remote-workspace-environment.test.ts new file mode 100644 index 00000000000..95427e149e5 --- /dev/null +++ b/server/src/services/recovery/stranded-notice-remote-workspace-environment.test.ts @@ -0,0 +1,19 @@ +import { describe, expect, it } from "vitest"; +import { buildConfigurationIncompleteRecoveryNoticeSeed } from "./stranded-notice.js"; + +describe("remote workspace environment configuration notice", () => { + it("names the saved remote workspace instead of a missing secret", () => { + const notice = buildConfigurationIncompleteRecoveryNoticeSeed({ + reason: "remote_workspace_environment_incompatible", environmentDriver: "plugin", adapterType: "paperclip_runner", + }); + + expect(notice).toEqual({ + title: "Saved workspace needs a compatible environment", + body: "The agent did not start because this task's saved workspace is kept in remote workspace storage, " + + "and the agent's environment cannot use it. Only a Paperclip Runner agent in a sandbox environment, or a supported agent in an SSH environment, can continue this workspace.", + nextAction: "Assign the task to an agent whose environment can use this saved workspace, or change this agent's environment, then press Retry.", + tone: "danger", + }); + expect(JSON.stringify(notice)).not.toMatch(/secret/i); + }); +}); diff --git a/server/src/services/recovery/stranded-notice.ts b/server/src/services/recovery/stranded-notice.ts index 8642c15a6d8..b2f5d8e558d 100644 --- a/server/src/services/recovery/stranded-notice.ts +++ b/server/src/services/recovery/stranded-notice.ts @@ -2,6 +2,7 @@ import type { IssueCommentMetadata, IssueCommentPresentation } from "@paperclipa import type { PluginWorkspaceOperationFailureReason } from "@paperclipai/plugin-sdk"; import { ENVIRONMENT_PROVIDER_UNAVAILABLE_CODE } from "../environment-provider-unavailable-error.js"; import { PROJECT_STORAGE_ENVIRONMENT_INCOMPATIBLE } from "../project-storage-environment-reason.js"; +import { REMOTE_WORKSPACE_ENVIRONMENT_INCOMPATIBLE } from "../remote-workspace-environment-reason.js"; import { workspaceProviderFailureMessage, type WorkspaceProviderFailureSummary, @@ -145,6 +146,7 @@ export function buildWorkspaceValidationRecoveryNoticeSeed(): StrandedRecoveryNo } export const SANDBOX_PROVIDER_PLUGIN_NOT_READY_REASON = "sandbox_provider_plugin_not_ready"; +export const REMOTE_WORKSPACE_ENVIRONMENT_NEXT_ACTION = "Assign the task to an agent whose environment can use this saved workspace, or change this agent's environment, then press Retry."; export const PROJECT_STORAGE_ENVIRONMENT_NEXT_ACTION = "Assign the task to an agent whose environment can use this project's workspace storage, or choose a workspace from a project for this agent's environment, then press Retry."; function readNonEmptyStringField(payload: Record | null | undefined, key: string): string | null { @@ -259,6 +261,15 @@ export function buildConfigurationIncompleteRecoveryNoticeSeed( tone: "danger", }; } + if (readNonEmptyStringField(configurationIncomplete, "reason") === REMOTE_WORKSPACE_ENVIRONMENT_INCOMPATIBLE) { + return { + title: "Saved workspace needs a compatible environment", + body: "The agent did not start because this task's saved workspace is kept in remote workspace storage, " + + "and the agent's environment cannot use it. Only a Paperclip Runner agent in a sandbox environment, or a supported agent in an SSH environment, can continue this workspace.", + nextAction: REMOTE_WORKSPACE_ENVIRONMENT_NEXT_ACTION, + tone: "danger", + }; + } if (readNonEmptyStringField(configurationIncomplete, "reason") === "dot_subscription_expired") { return { title: "Dot event subscription expired", diff --git a/server/src/services/remote-workspace-environment-reason.ts b/server/src/services/remote-workspace-environment-reason.ts new file mode 100644 index 00000000000..cd536e5aab4 --- /dev/null +++ b/server/src/services/remote-workspace-environment-reason.ts @@ -0,0 +1 @@ +export const REMOTE_WORKSPACE_ENVIRONMENT_INCOMPATIBLE = "remote_workspace_environment_incompatible"; diff --git a/server/src/services/remote-workspaces.ts b/server/src/services/remote-workspaces.ts index 8c1f286adf0..8311367959e 100644 --- a/server/src/services/remote-workspaces.ts +++ b/server/src/services/remote-workspaces.ts @@ -99,12 +99,16 @@ export function supportsSshRemoteWorkspace(adapterType: string, environmentDrive return environmentDriver === "ssh" && adapterSupportsRemoteManagedEnvironments(adapterType); } +export function supportsRemoteWorkspaceExecution(adapterType: string, environmentDriver: string | null | undefined) { + return adapterType === "paperclip_runner" && environmentDriver === "sandbox" + || supportsSshRemoteWorkspace(adapterType, environmentDriver); +} + export function shouldUseRemoteWorkspaces(input: { adapterType: string; environmentDriver: string | null; experimentalEnabled: boolean; existingWorkspace?: { metadata?: Record | null } | null; }) { const enrolled = readRemoteWorkspaceAuthority(input.existingWorkspace?.metadata) !== null; - const supported = input.adapterType === "paperclip_runner" && input.environmentDriver === "sandbox" - || supportsSshRemoteWorkspace(input.adapterType, input.environmentDriver); + const supported = supportsRemoteWorkspaceExecution(input.adapterType, input.environmentDriver); if (enrolled && !supported) { throw conflict("This workspace requires a supported remote execution environment.", { code: "remote_workspace_execution_required" }); } diff --git a/server/src/services/run-failure-report.ts b/server/src/services/run-failure-report.ts index 516daf9715a..67d0d8a4cfb 100644 --- a/server/src/services/run-failure-report.ts +++ b/server/src/services/run-failure-report.ts @@ -19,6 +19,7 @@ import { readRunFailureReportingMode, type RunFailureReportingMode } from "../se import { RESTRICTED_WORKSPACE_SOURCE_REASON } from "./workspace-source-restriction.js"; import { PLUGIN_RUNNER_AI_CONNECTION_REQUIRED } from "./plugin-runner-ai-connection.js"; import { PROJECT_STORAGE_ENVIRONMENT_INCOMPATIBLE } from "./project-storage-environment-reason.js"; +import { REMOTE_WORKSPACE_ENVIRONMENT_INCOMPATIBLE } from "./remote-workspace-environment-reason.js"; import { NATIVE_PROVIDER_OVERLOADED_CODE } from "./native-runtime/native-provider-failure.js"; import { NATIVE_TOOL_RECEIPT_LIMIT_CODE } from "./native-runtime/native-tool-receipt-limit.js"; import { PROJECT_ACCESS_DENIED } from "./project-access-denial.js"; @@ -180,8 +181,12 @@ function isPluginRunnerAiConnectionRequiredBlocker(run: HeartbeatRun, options: R recovery?.kind === "bootstrap" && recovery.providerWorkStarted === false; } +const WORKSPACE_STORAGE_ENVIRONMENT_REASONS: ReadonlySet = new Set([ + PROJECT_STORAGE_ENVIRONMENT_INCOMPATIBLE, REMOTE_WORKSPACE_ENVIRONMENT_INCOMPATIBLE, +]); + /** The source project's storage cannot serve the agent's environment, refused before dispatch; the task notice names the owner action. */ -function isProjectStorageEnvironmentBlocker(run: HeartbeatRun, options: RunFailureReportOptions): boolean { +function isWorkspaceStorageEnvironmentBlocker(run: HeartbeatRun, options: RunFailureReportOptions): boolean { if ( run.status !== "failed" || run.errorCode !== "configuration_incomplete" || run.executionStage !== "preparing" || options.phase !== "setup" || @@ -189,7 +194,7 @@ function isProjectStorageEnvironmentBlocker(run: HeartbeatRun, options: RunFailu ) return false; const configuration = asRecord(run.resultJson?.configurationIncomplete); const recovery = asRecord(run.resultJson?.executionRecovery); - return configuration?.reason === PROJECT_STORAGE_ENVIRONMENT_INCOMPATIBLE && + return WORKSPACE_STORAGE_ENVIRONMENT_REASONS.has(configuration?.reason) && recovery?.kind === "bootstrap" && recovery.providerWorkStarted === false; } @@ -432,7 +437,7 @@ export function reportRunFailure(db: Db, run: HeartbeatRun, options: RunFailureR isLocalPathWorkspaceConfigurationBlocker(run, options) || isRestrictedWorkspaceSourceBlocker(run, options) || isPluginRunnerAiConnectionRequiredBlocker(run, options) || - isProjectStorageEnvironmentBlocker(run, options) || + isWorkspaceStorageEnvironmentBlocker(run, options) || isProjectAccessDenialBlocker(run, options) || isGitConnectionFailure(run, options) || isProviderQuotaFailure(run, options) ||